PythonSdk đź”— Functions for building the runtime module for the Python SDK.
The server interacts directly with the ModuleRuntime and Codegen functions.
The others were built to be composable and chainable to facilitate the
creation of extension modules (custom SDKs that depend on this one).
sdkSourceDir() đź”— Directory with the Python SDK source code
Return Type Directory !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
sdk- source- dir
content_copy Copied! func (m *myModule) example () *Directory {
return dag.
PythonSdk ().
SdkSourceDir ()
}
content_copy Copied! @function
def example () -> dagger.Directory :
return (
dag.python_sdk ()
.sdk_source_dir ()
)
content_copy Copied! @func()
example(): Directory {
return dag
.pythonSdk()
.sdkSourceDir()
}
content_copy Copied! container() đź”— Resulting container after each composing step
Return Type Container !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
container
content_copy Copied! func (m *myModule) example () *Container {
return dag.
PythonSdk ().
Container ()
}
content_copy Copied! @function
def example () -> dagger.Container :
return (
dag.python_sdk ()
.container ()
)
content_copy Copied! @func()
example(): Container {
return dag
.pythonSdk()
.container()
}
content_copy Copied! modName() 🔗 The original module’s name
Return Type String !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
mod- name
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
ModName (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.mod_name()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.modName()
}
content_copy Copied! projectName() đź”— The normalized python distribution package name (in pyproject.toml)
Return Type String !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
project- name
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
ProjectName (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.project_name()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.projectName()
}
content_copy Copied! packageName() đź”— The normalized python import package name (in the filesystem)
Return Type String !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@ 6c5e7b42b9e819f1ef114694149e10f362236479 call \
package -name
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
PackageName (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.package_name()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.packageName()
}
content_copy Copied! mainObjectName() đź”— The normalized main object name in Python
Return Type String !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@ 6c5e7b42b9e819f1ef114694149e10f362236479 call \
main-object -name
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
MainObjectName (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.main_object_name()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.mainObjectName()
}
content_copy Copied! modSource() đź”— The source needed to load and run a module
Return Type ModuleSource !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
mod- source
content_copy Copied! func (m *myModule) example () *ModuleSource {
return dag.
PythonSdk ().
ModSource ()
}
content_copy Copied! @function
def example () -> dag.ModuleSource :
return (
dag.python_sdk ()
.mod_source ()
)
content_copy Copied! @func()
example(): ModuleSource {
return dag
.pythonSdk()
.modSource()
}
content_copy Copied! contextDir() đź”— ContextDir is a copy of the context directory from the module source
We add files to this directory, always joining paths with the source’s
subpath. We could use modSource.Directory(“”) for that if it was read-only,
but since we have to mount the context directory in the end, rather than
mounting the context dir and then mounting the forked source dir on top,
we fork the context dir instead so there’s only one mount in the end.
Return Type Directory !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
context- dir
content_copy Copied! func (m *myModule) example () *Directory {
return dag.
PythonSdk ().
ContextDir ()
}
content_copy Copied! @function
def example () -> dagger.Directory :
return (
dag.python_sdk ()
.context_dir ()
)
content_copy Copied! @func()
example(): Directory {
return dag
.pythonSdk()
.contextDir()
}
content_copy Copied! contextDirPath() đź”— ContextDirPath is a unique host path for the module being loaded
HACK: this property is computed as a unique value for a ModuleSource to
provide a unique path on the filesystem. This is because the uv cache
uses hashes of source paths - so we need to have something unique, or we
can get very real conflicts in the uv cache.
Return Type String !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
context- dir- path
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
ContextDirPath (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.context_dir_path()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.contextDirPath()
}
content_copy Copied! subPath() đź”— Relative path from the context directory to the source directory
Return Type String !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6 c5e7b42b9e819f1ef114694149e10f362236479 call \
sub -path
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
SubPath (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.sub_path()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.subPath()
}
content_copy Copied! isInit() đź”— True if the module is new and we need to create files from the template
It’s assumed that this is the case if there’s no pyproject.toml file.
Return Type Boolean !
Example dagger - m github.com/crjm/ dagger/sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
is - init
content_copy Copied! func (m *myModule) example (ctx context.Context) bool {
return dag.
PythonSdk ().
IsInit (ctx)
}
content_copy Copied! @function
async def example () -> bool :
return await (
dag.python_sdk()
.is_init()
)
content_copy Copied! @func()
async example () : Promise<boolean > {
return dag
.pythonSdk()
.isInit()
}
content_copy Copied! withoutUserConfig() đź”— Disable the discovery of custom configuration
If it’s not necessary, it’s faster without it.
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
without - user - config
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithoutUserConfig ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.without_user_config ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withoutUserConfig()
}
content_copy Copied! withContainer() đź”— Replace the underlying container
Since all steps change this container, it’s possible to extract it in one
step, change it, and then set it with this function. Can be useful, for
example, to add system packages between the WithBase() and WithSource()
steps.
Return Type PythonSdk !
Arguments Name Type Default Value Description ctr Container ! - The container to use
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - container
content_copy Copied! func (m *myModule) example (ctr *Container) *PythonSdk {
return dag.
PythonSdk ().
WithContainer (ctr)
}
content_copy Copied! @function
def example (ctr : dagger.Container) -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_container (ctr)
)
content_copy Copied! @func ()
example(ctr : Container): PythonSdk {
return dag
.pythonSdk ()
.withContainer (ctr)
}
content_copy Copied! baseImage() đź”— Image reference for the base container
Return Type String !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
base- image
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
BaseImage (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.base_image()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.baseImage()
}
content_copy Copied! uvImage() đź”— Image reference where uv is fetched from
Return Type String !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
uv- image
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
UvImage (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.uv_image()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.uvImage()
}
content_copy Copied! withBaseImage() 🔗 Override the base container’s image
Needs to be called before Load.
Return Type PythonSdk !
Arguments Name Type Default Value Description ref String ! - The image reference
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6 c5e7b42b9e819f1ef114694149e10f362236479 call \
with -base -image --ref string
content_copy Copied! func (m *myModule) example (ref string) *PythonSdk {
return dag.
PythonSdk ().
WithBaseImage (ref)
}
content_copy Copied! @function
def example (ref : str) -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_base_image (ref)
)
content_copy Copied! @func ()
example(ref : string): PythonSdk {
return dag
.pythonSdk ()
.withBaseImage (ref)
}
content_copy Copied! Check whether to use uv or not
Return Type Boolean !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
use -uv
content_copy Copied! func (m *myModule) example (ctx context.Context) bool {
return dag.
PythonSdk ().
UseUv (ctx)
}
content_copy Copied! @function
async def example () -> bool :
return await (
dag.python_sdk()
.use_uv()
)
content_copy Copied! @func()
async example () : Promise<boolean > {
return dag
.pythonSdk()
.useUv()
}
content_copy Copied! withUv() đź”— Enable the use of uv
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - uv
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithUv ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_uv ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withUv()
}
content_copy Copied! withoutUv() đź”— Disable the use of uv
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
without - uv
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithoutUv ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.without_uv ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withoutUv()
}
content_copy Copied! uvVersion() đź”— Version to use for uv
Return Type String !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
uv- version
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
UvVersion (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.uv_version()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.uvVersion()
}
content_copy Copied! indexUrl() 🔗 Uv’s default index URL setting
Return Type String !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
index -url
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
IndexUrl (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.index_url()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.indexUrl()
}
content_copy Copied! Uv’s “extra-index-url” setting
Return Type String !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
extra-index -url
content_copy Copied! func (m *myModule) example (ctx context.Context) string {
return dag.
PythonSdk ().
ExtraIndexUrl (ctx)
}
content_copy Copied! @function
async def example () -> str :
return await (
dag.python_sdk()
.extra_index_url()
)
content_copy Copied! @func()
async example (): Promise<string > {
return dag
.pythonSdk()
.extraIndexUrl()
}
content_copy Copied! withUvVersion() đź”— Override the uv version
Needs to be called before Load. Enables uv if not already enabled.
Return Type PythonSdk !
Arguments Name Type Default Value Description version String ! - The uv version
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - uv- version
content_copy Copied! func (m *myModule) example (version string) *PythonSdk {
return dag.
PythonSdk ().
WithUvVersion (version)
}
content_copy Copied! @function
def example (version : str) -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_uv_version (version)
)
content_copy Copied! @func ()
example(version : string): PythonSdk {
return dag
.pythonSdk ()
.withUvVersion (version)
}
content_copy Copied! codegen() đź”— Generated code for the Python module
Return Type GeneratedCode !
Arguments Name Type Default Value Description modSource ModuleSource ! - No description provided introspectionJson File ! - No description provided
Example echo 'Custom types are not supported in shell examples'
content_copy Copied! func (m *myModule) example (modSource *ModuleSource, introspectionJson *File) *GeneratedCode {
return dag.
PythonSdk ().
Codegen (modSource, introspectionJson)
}
content_copy Copied! @function
def example (mod_source : dag.ModuleSource, introspection_json : dagger.File) -> dag.GeneratedCode :
return (
dag.python_sdk ()
.codegen (mod_source, introspection_json)
)
content_copy Copied! @func ()
example(modSource : ModuleSource, introspectionJson : File): GeneratedCode {
return dag
.pythonSdk ()
.codegen (modSource, introspectionJson)
}
content_copy Copied! moduleRuntime() đź”— Container for executing the Python module runtime
Return Type Container !
Arguments Name Type Default Value Description modSource ModuleSource ! - No description provided introspectionJson File ! - No description provided
Example echo 'Custom types are not supported in shell examples'
content_copy Copied! func (m *myModule) example (modSource *ModuleSource, introspectionJson *File) *Container {
return dag.
PythonSdk ().
ModuleRuntime (modSource, introspectionJson)
}
content_copy Copied! @function
def example (mod_source : dag.ModuleSource, introspection_json : dagger.File) -> dagger.Container :
return (
dag.python_sdk ()
.module_runtime (mod_source, introspection_json)
)
content_copy Copied! @func ()
example(modSource : ModuleSource, introspectionJson : File): Container {
return dag
.pythonSdk ()
.moduleRuntime (modSource, introspectionJson)
}
content_copy Copied! common() đź”— Common steps for the ModuleRuntime and Codegen functions
Return Type PythonSdk !
Arguments Name Type Default Value Description modSource ModuleSource ! - No description provided introspectionJson File ! - No description provided
Example echo 'Custom types are not supported in shell examples'
content_copy Copied! func (m *myModule) example (modSource *ModuleSource, introspectionJson *File) *PythonSdk {
return dag.
PythonSdk ().
Common (modSource, introspectionJson)
}
content_copy Copied! @function
def example (mod_source : dag.ModuleSource, introspection_json : dagger.File) -> dag.PythonSdk :
return (
dag.python_sdk ()
.common (mod_source, introspection_json)
)
content_copy Copied! @func ()
example(modSource : ModuleSource, introspectionJson : File): PythonSdk {
return dag
.pythonSdk ()
.common (modSource, introspectionJson)
}
content_copy Copied! Get all the needed information from the module’s metadata and source files
Return Type PythonSdk !
Arguments Name Type Default Value Description modSource ModuleSource ! - No description provided
Example echo 'Custom types are not supported in shell examples'
content_copy Copied! func (m *myModule) example (modSource *ModuleSource) *PythonSdk {
return dag.
PythonSdk ().
Load (modSource)
}
content_copy Copied! @function
def example (mod_source : dag.ModuleSource) -> dag.PythonSdk :
return (
dag.python_sdk ()
.load (mod_source)
)
content_copy Copied! @func ()
example(modSource : ModuleSource): PythonSdk {
return dag
.pythonSdk ()
.load (modSource)
}
content_copy Copied! withBase() đź”— Initialize the base Python container
Workdir is set to the module’s source directory.
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - base
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithBase ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_base ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withBase()
}
content_copy Copied! withTemplate() đź”— Add the template files to skaffold a new module
The following files are added:
- /runtime
- /pyproject.toml
- /src//init .py
- /src//main.py
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - template
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithTemplate ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_template ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withTemplate()
}
content_copy Copied! withSdk() đź”— Add the SDK package to the source directory
This includes regenerating the client bindings for the current API schema
(codegen).
Return Type PythonSdk !
Arguments Name Type Default Value Description introspectionJson File ! - No description provided
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - sdk
content_copy Copied! func (m *myModule) example (introspectionJson *File) *PythonSdk {
return dag.
PythonSdk ().
WithSdk (introspectionJson)
}
content_copy Copied! @function
def example (introspection_json : dagger.File) -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_sdk (introspection_json)
)
content_copy Copied! @func ()
example(introspectionJson : File): PythonSdk {
return dag
.pythonSdk ()
.withSdk (introspectionJson)
}
content_copy Copied! withSource() 🔗 Add the module’s source code
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - source
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithSource ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_source ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withSource()
}
content_copy Copied! withUpdates() đź”— Make any updates to current source
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - updates
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithUpdates ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_updates ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withUpdates()
}
content_copy Copied! withInstall() 🔗 Install the module’s package and dependencies
Return Type PythonSdk !
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
with - install
content_copy Copied! func (m *myModule) example () *PythonSdk {
return dag.
PythonSdk ().
WithInstall ()
}
content_copy Copied! @function
def example () -> dag.PythonSdk :
return (
dag.python_sdk ()
.with_install ()
)
content_copy Copied! @func()
example(): PythonSdk {
return dag
.pythonSdk()
.withInstall()
}
content_copy Copied! addNewFile() 🔗 AddNewFile adds a new file, with contents, to the module’s source.
Return Type Void !
Arguments Name Type Default Value Description name String ! - No description provided contents String ! - No description provided
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
add - new - file
content_copy Copied! func (m *myModule) example (ctx context.Context, name string, contents string) {
return dag.
PythonSdk ().
AddNewFile (ctx, name, contents)
}
content_copy Copied! @function
async def example (name: str , contents: str ) -> None :
return await (
dag.python_sdk()
.add_new_file(name, contents)
)
content_copy Copied! @func ()
async example (name : string , contents : string ): Promise <void > {
return dag
.pythonSdk ()
.addNewFile (name, contents)
}
content_copy Copied! addFile() 🔗 AddFile adds a file to the module’s source.
Return Type Void !
Arguments Name Type Default Value Description name String ! - No description provided file File ! - No description provided
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
add - file
content_copy Copied! func (m *myModule) example (ctx context.Context, name string, file *File) {
return dag.
PythonSdk ().
AddFile (ctx, name, file)
}
content_copy Copied! @function
async def example (name: str , file: dagger.File ) -> None :
return await (
dag.python_sdk()
.add_file(name, file)
)
content_copy Copied! @func ()
async example(name : string, file : File): Promise<void> {
return dag
.pythonSdk ()
.addFile (name, file)
}
content_copy Copied! getFile() 🔗 GetFile returns a file from the module’s source.
Return Type File !
Arguments Name Type Default Value Description name String ! - No description provided
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
get - file
content_copy Copied! func (m *myModule) example (name string) *File {
return dag.
PythonSdk ().
GetFile (name)
}
content_copy Copied! @function
def example (name : str) -> dagger.File :
return (
dag.python_sdk ()
.get_file (name)
)
content_copy Copied! @func ()
example(name : string): File {
return dag
.pythonSdk ()
.getFile (name)
}
content_copy Copied! useUvLock() đź”— UseUvLock returns true if the runtime should expect a uv.lock file.
Return Type Boolean !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
use -uv-lock
content_copy Copied! func (m *myModule) example (ctx context.Context) bool {
return dag.
PythonSdk ().
UseUvLock (ctx)
}
content_copy Copied! @function
async def example () -> bool :
return await (
dag.python_sdk()
.use_uv_lock()
)
content_copy Copied! @func()
async example () : Promise<boolean > {
return dag
.pythonSdk()
.useUvLock()
}
content_copy Copied! addDirectory() 🔗 AddDirectory adds a directory to the module’s source.
Return Type Void !
Arguments Name Type Default Value Description name String ! - No description provided dir Directory ! - No description provided
Example dagger - m github.com/ crjm/ dagger/ sdk/ python/ runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
add - directory
content_copy Copied! func (m *myModule) example (ctx context.Context, name string, dir *Directory) {
return dag.
PythonSdk ().
AddDirectory (ctx, name, dir)
}
content_copy Copied! @function
async def example (name: str , dir : dagger.Directory ) -> None :
return await (
dag.python_sdk()
.add_directory(name, dir )
)
content_copy Copied! @func ()
async example (name : string , dir : Directory ): Promise<void > {
return dag
.pythonSdk ()
.addDirectory (name, dir)
}
content_copy Copied! source() 🔗 We could use modSource.Directory(“”) but we’ll need to use the
context directory in GeneratedCode later, so rather than trying
to replace the source directory in the context directory, we’ll
just use the context directory with subpath everywhere.
Return Type Directory !
Example dagger -m github.com/crjm/dagger/sdk/python/runtime@6c5e7b42b9e819f1ef114694149e10f362236479 call \
source
content_copy Copied! func (m *myModule) example () *Directory {
return dag.
PythonSdk ().
Source ()
}
content_copy Copied! @function
def example () -> dagger.Directory :
return (
dag.python_sdk ()
.source ()
)
content_copy Copied! @func()
example(): Directory {
return dag
.pythonSdk()
.source()
}
content_copy Copied!