python-sdk
No long description provided.
Installation
dagger install github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594Entrypoint
Return Type
PythonSdk !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| skipGenerateFilename | String | - | Marker filename that skips generate when found at or above a Python SDK module root. |
Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
func (m *MyModule) Example() *dagger.PythonSdk {
return dag.
PythonSdk()
}@function
def example() -> dagger.PythonSdk:
return (
dag.python_sdk()
)@func()
example(): PythonSdk {
return dag
.pythonSdk()
}Entrypoint
Return Type
PythonSdkMod !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| path | String ! | - | Workspace-relative path of this module root. |
| ws | Workspace | - | The workspace this module belongs to. |
| skipGenerateFilename | String ! | - | Marker filename that skips generate when found at or above this module root. |
Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
--path string --skip-generate-filename stringfunc (m *MyModule) Example(path string, skipGenerateFilename string) *dagger.PythonSdkMod {
return dag.
PythonSdk(path, skipGenerateFilename)
}@function
def example(path: str, skip_generate_filename: str) -> dagger.PythonSdkMod:
return (
dag.python_sdk(path, skip_generate_filename)
)@func()
example(path: string, skipGenerateFilename: string): PythonSdkMod {
return dag
.pythonSdk(path, skipGenerateFilename)
}Entrypoint
Return Type
PythonSdkModConfigValues !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| pythonVersion | String | - | No description provided |
| useUv | Boolean | - | No description provided |
| baseImage | String | - | No description provided |
Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
func (m *MyModule) Example() *dagger.PythonSdkModConfigValues {
return dag.
PythonSdk()
}@function
def example() -> dagger.PythonSdkModConfigValues:
return (
dag.python_sdk()
)@func()
example(): PythonSdkModConfigValues {
return dag
.pythonSdk()
}Entrypoint
Return Type
PythonSdkTemplate !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | Template name passed to init. |
| source | Directory ! | - | Template source files materialized into the new module before generation. |
Example
Function PythonSdkTemplate.Constructor is not accessible from the python-sdk moduleFunction PythonSdkTemplate.Constructor is not accessible from the python-sdk moduleFunction PythonSdkTemplate.Constructor is not accessible from the python-sdk moduleFunction PythonSdkTemplate.Constructor is not accessible from the python-sdk moduleEntrypoint
Return Type
PythonSdkModConfig !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| path | String ! | - | Workspace-relative path of the module root. |
| ws | Workspace | - | The workspace this module belongs to. |
Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
--path stringfunc (m *MyModule) Example(path string) *dagger.PythonSdkModConfig {
return dag.
PythonSdk(path)
}@function
def example(path: str, ) -> dagger.PythonSdkModConfig:
return (
dag.python_sdk(path)
)@func()
example(path: string, ): PythonSdkModConfig {
return dag
.pythonSdk(path)
}Types
PythonSdk 🔗
Manage Dagger modules that use the Python SDK.
skipGenerateFilename() 🔗
Marker filename that skips generate when found at or above a Python SDK module root.
Return Type
String ! Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
skip-generate-filenamefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
PythonSdk().
SkipGenerateFilename(ctx)
}@function
async def example() -> str:
return await (
dag.python_sdk()
.skip_generate_filename()
)@func()
async example(): Promise<string> {
return dag
.pythonSdk()
.skipGenerateFilename()
}targetRuntime() 🔗
Runtime source to write into modules created by this SDK.
Return Type
String ! Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
target-runtimefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
PythonSdk().
TargetRuntime(ctx)
}@function
async def example() -> str:
return await (
dag.python_sdk()
.target_runtime()
)@func()
async example(): Promise<string> {
return dag
.pythonSdk()
.targetRuntime()
}modules() 🔗
Return every legacy dagger.json Dagger module whose sdk.source is “python”.
This discovery path is obsolete for workspace-managed modules; the engine owns the modules..as-sdk.modules source of truth.
Return Type
[PythonSdkMod ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() []*dagger.PythonSdkMod {
return dag.
PythonSdk().
Modules()
}@function
def example() -> List[dagger.PythonSdkMod]:
return (
dag.python_sdk()
.modules()
)@func()
example(): PythonSdkMod[] {
return dag
.pythonSdk()
.modules()
}templates() 🔗
Return init templates tracked by this module.
Templates live under templates/ and are materialized into the new module before generation. Passing an empty template to init uses the module default.
Return Type
[PythonSdkTemplate ! ] ! Example
dagger -m github.com/dagger/python-sdk@2b3a70629f31e15111aa3a2aa69934c6b85ed594 call \
templatesfunc (m *MyModule) Example() []*dagger.PythonSdkTemplate {
return dag.
PythonSdk().
Templates()
}@function
def example() -> List[dagger.PythonSdkTemplate]:
return (
dag.python_sdk()
.templates()
)@func()
example(): PythonSdkTemplate[] {
return dag
.pythonSdk()
.templates()
}mod() 🔗
Return the Python SDK module at or above a workspace path.
When findUp is true, path may point inside the module.
Return Type
PythonSdkMod !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| path | String | - | No description provided |
| findUp | Boolean | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.PythonSdkMod {
return dag.
PythonSdk().
Mod()
}@function
def example() -> dagger.PythonSdkMod:
return (
dag.python_sdk()
.mod()
)@func()
example(): PythonSdkMod {
return dag
.pythonSdk()
.mod()
}initModule() 🔗
Initialize Python-owned files for a new Dagger module.
Returns a Changeset with only the SDK-owned template files layered onto the
new module’s path. Engine-owned files (dagger-module.toml, workspace config
updates) are produced by the engine and merged with this changeset.
Pass template to materialize files from templates/. The empty
default uses this module’s minimal template.
Pass pythonVersion, useUv, or baseImage to customize the generated
pyproject.toml. Defaults leave the template untouched: the template’s Python
version is used, uv is enabled, and no base image override is written.
Return Type
Changeset !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| name | String ! | - | No description provided |
| path | String ! | - | No description provided |
| template | String | - | No description provided |
| pythonVersion | String | - | No description provided |
| useUv | Boolean | - | No description provided |
| baseImage | String | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(name string, path string) *dagger.Changeset {
return dag.
PythonSdk().
InitModule(name, path)
}@function
def example(name: str, path: str) -> dagger.Changeset:
return (
dag.python_sdk()
.init_module(name, path)
)@func()
example(name: string, path: string): Changeset {
return dag
.pythonSdk()
.initModule(name, path)
}generateAll() 🔗
Generate all discovered legacy dagger.json Python SDK modules.
This discovery path is obsolete for workspace-managed modules; the engine owns the modules..as-sdk.modules source of truth.
Modules with the generate skip marker are skipped.
Return Type
Changeset !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.Changeset {
return dag.
PythonSdk().
GenerateAll()
}@function
def example() -> dagger.Changeset:
return (
dag.python_sdk()
.generate_all()
)@func()
example(): Changeset {
return dag
.pythonSdk()
.generateAll()
}PythonSdkMod 🔗
A Dagger module that uses the Python SDK.
path() 🔗
Workspace-relative path of this module root.
Return Type
String ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context) string {
return dag.
PythonSdk().
Mod().
Path(ctx)
}@function
async def example() -> str:
return await (
dag.python_sdk()
.mod()
.path()
)@func()
async example(): Promise<string> {
return dag
.pythonSdk()
.mod()
.path()
}skipGenerate() 🔗
Whether this module or an ancestor contains the configured generate skip marker.
Return Type
Boolean ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context) bool {
return dag.
PythonSdk().
Mod().
SkipGenerate(ctx)
}@function
async def example() -> bool:
return await (
dag.python_sdk()
.mod()
.skip_generate()
)@func()
async example(): Promise<boolean> {
return dag
.pythonSdk()
.mod()
.skipGenerate()
}config() 🔗
Manage this module’s Python build configuration (pyproject.toml).
Return Type
PythonSdkModConfig ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.PythonSdkModConfig {
return dag.
PythonSdk().
Mod().
Config()
}@function
def example() -> dagger.PythonSdkModConfig:
return (
dag.python_sdk()
.mod()
.config()
)@func()
example(): PythonSdkModConfig {
return dag
.pythonSdk()
.mod()
.config()
}generate() 🔗
Generate this module. If the generate skip marker is present, the changeset is empty.
Return Type
Changeset ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.Changeset {
return dag.
PythonSdk().
Mod().
Generate()
}@function
def example() -> dagger.Changeset:
return (
dag.python_sdk()
.mod()
.generate()
)@func()
example(): Changeset {
return dag
.pythonSdk()
.mod()
.generate()
}PythonSdkModConfigValues 🔗
A module’s resolved Python SDK configuration.
Each field is null when the corresponding setting is not explicitly written to pyproject.toml, so unset values are reported rather than guessed.
pythonVersion() 🔗
The required Python version (e.g. “3.14”), or null when requires-python is unset.
Return Type
String Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context) string {
return dag.
PythonSdk().
Mod().
Config().
Get().
PythonVersion(ctx)
}@function
async def example() -> str:
return await (
dag.python_sdk()
.mod()
.config()
.get()
.python_version()
)@func()
async example(): Promise<string> {
return dag
.pythonSdk()
.mod()
.config()
.get()
.pythonVersion()
}useUv() 🔗
Whether the module builds with uv (true) instead of pip, or null when unset. When null, the SDK default (uv) applies.
Return Type
Boolean Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context) bool {
return dag.
PythonSdk().
Mod().
Config().
Get().
UseUv(ctx)
}@function
async def example() -> bool:
return await (
dag.python_sdk()
.mod()
.config()
.get()
.use_uv()
)@func()
async example(): Promise<boolean> {
return dag
.pythonSdk()
.mod()
.config()
.get()
.useUv()
}baseImage() 🔗
The base container image override, or null when the SDK default is used.
Return Type
String Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context) string {
return dag.
PythonSdk().
Mod().
Config().
Get().
BaseImage(ctx)
}@function
async def example() -> str:
return await (
dag.python_sdk()
.mod()
.config()
.get()
.base_image()
)@func()
async example(): Promise<string> {
return dag
.pythonSdk()
.mod()
.config()
.get()
.baseImage()
}PythonSdkTemplate 🔗
An init template tracked by this module.
name() 🔗
Template name passed to init.
Return Type
String ! Example
Function PythonSdkTemplate.name is not accessible from the python-sdk moduleFunction PythonSdkTemplate.name is not accessible from the python-sdk moduleFunction PythonSdkTemplate.name is not accessible from the python-sdk moduleFunction PythonSdkTemplate.name is not accessible from the python-sdk modulesource() 🔗
Template source files materialized into the new module before generation.
Return Type
Directory ! Example
Function PythonSdkTemplate.source is not accessible from the python-sdk moduleFunction PythonSdkTemplate.source is not accessible from the python-sdk moduleFunction PythonSdkTemplate.source is not accessible from the python-sdk moduleFunction PythonSdkTemplate.source is not accessible from the python-sdk modulePythonSdkModConfig 🔗
Python SDK build configuration stored in a module’s pyproject.toml.
get() 🔗
Read the module’s current Python SDK configuration.
Settings that are not explicitly written to pyproject.toml are reported as null rather than guessed.
Return Type
PythonSdkModConfigValues ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.PythonSdkModConfigValues {
return dag.
PythonSdk().
Mod().
Config().
Get()
}@function
def example() -> dagger.PythonSdkModConfigValues:
return (
dag.python_sdk()
.mod()
.config()
.get()
)@func()
example(): PythonSdkModConfigValues {
return dag
.pythonSdk()
.mod()
.config()
.get()
}set() 🔗
Set one or more configuration values in pyproject.toml at once.
Each flag is optional; omitting it leaves that setting untouched. Setting useUv to true (the SDK default) writes nothing, keeping the file minimal.
Return Type
Changeset !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| pythonVersion | String | - | No description provided |
| useUv | Boolean | - | No description provided |
| baseImage | String | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.Changeset {
return dag.
PythonSdk().
Mod().
Config().
Set()
}@function
def example() -> dagger.Changeset:
return (
dag.python_sdk()
.mod()
.config()
.set()
)@func()
example(): Changeset {
return dag
.pythonSdk()
.mod()
.config()
.set()
}