Client

Automatically generated client from Dagger API.

dagger.api.gen.CacheID

A global cache volume identifier

alias of str

class dagger.api.gen.CacheVolume(ctx: Context)[source]

A directory whose contents persist across runs

async id() CacheID[source]

Note

This is lazyly evaluated, no operation is actually run.

Returns

A global cache volume identifier

Return type

CacheID

class dagger.api.gen.Client(ctx: Context)[source]
cache_volume(key: str) CacheVolume[source]

Construct a cache volume for a given cache key

container(id: Optional[Union[ContainerID, Container]] = None, platform: Optional[Platform] = None) Container[source]

Load a container from ID.

Null ID returns an empty container (scratch).

Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder’s host.

async default_platform() Platform[source]

The default platform of the builder.

directory(id: Optional[Union[DirectoryID, Directory]] = None) Directory[source]

Load a directory by ID. No argument produces an empty directory.

file(id: Union[FileID, File]) File[source]

Load a file by ID

git(url: str, keep_git_dir: Optional[bool] = None) GitRepository[source]

Query a git repository

host() Host[source]

Query the host environment

http(url: str) File[source]

An http remote

project(name: str) Project[source]

Look up a project by name

secret(id: Union[SecretID, Secret]) Secret[source]

Load a secret from its ID

class dagger.api.gen.Container(ctx: Context)[source]

An OCI-compatible container, also known as a docker container

build(context: Directory, dockerfile: Optional[str] = None) Container[source]

Initialize this container from a Dockerfile build

async default_args() list[str] | None[source]

Default arguments for future commands

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

list[str] | None

directory(path: str) Directory[source]

Retrieve a directory at the given path. Mounts are included.

async entrypoint() list[str] | None[source]

Entrypoint to be prepended to the arguments of all commands

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

list[str] | None

async env_variable(name: str) str | None[source]

The value of the specified environment variable

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

env_variables() EnvVariable[source]

A list of environment variables passed to commands

exec(args: Optional[list[str]] = None, stdin: Optional[str] = None, redirect_stdout: Optional[str] = None, redirect_stderr: Optional[str] = None, experimental_privileged_nesting: Optional[bool] = None) Container[source]

This container after executing the specified command inside it

Deprecated

Replaced by with_exec().

Parameters
  • args – Command to run instead of the container’s default command

  • stdin – Content to write to the command’s standard input before closing

  • redirect_stdout – Redirect the command’s standard output to a file in the container

  • redirect_stderr – Redirect the command’s standard error to a file in the container

  • experimental_privileged_nesting – Provide dagger access to the executed command Do not use this option unless you trust the command being executed The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM

async exit_code() int | None[source]

Exit code of the last executed command. Zero means success.

Null if no command has been executed.

Returns

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Return type

int | None

async export(path: str, platform_variants: Optional[list[dagger.api.gen.Container]] = None) bool[source]

Write the container as an OCI tarball to the destination file path on the host

Returns

The Boolean scalar type represents true or false.

Return type

bool

file(path: str) File[source]

Retrieve a file at the given path. Mounts are included.

from_(address: str) Container[source]

Initialize this container from the base image published at the given address

fs() Directory[source]

This container’s root filesystem. Mounts are not included.

Deprecated

Replaced by rootfs().

async id() ContainerID[source]

A unique identifier for this container

Note

This is lazyly evaluated, no operation is actually run.

Returns

A unique container identifier. Null designates an empty container (scratch).

Return type

ContainerID

async mounts() list[str][source]

List of paths where a directory is mounted

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

list[str]

async platform() Platform[source]

The platform this container executes and publishes as

async publish(address: str, platform_variants: Optional[list[dagger.api.gen.Container]] = None) str[source]

Publish this container as a new image, returning a fully qualified ref

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

rootfs() Directory[source]

This container’s root filesystem. Mounts are not included.

async stderr() str | None[source]

The error stream of the last executed command.

Null if no command has been executed.

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

async stdout() str | None[source]

The output stream of the last executed command.

Null if no command has been executed.

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

async user() str | None[source]

The user to be set for all commands

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

with_default_args(args: Optional[list[str]] = None) Container[source]

Configures default arguments for future commands

with_entrypoint(args: list[str]) Container[source]

This container but with a different command entrypoint

with_env_variable(name: str, value: str) Container[source]

This container plus the given environment variable

with_exec(args: list[str], stdin: Optional[str] = None, redirect_stdout: Optional[str] = None, redirect_stderr: Optional[str] = None, experimental_privileged_nesting: Optional[bool] = None) Container[source]

This container after executing the specified command inside it

Parameters
  • args – Command to run instead of the container’s default command

  • stdin – Content to write to the command’s standard input before closing

  • redirect_stdout – Redirect the command’s standard output to a file in the container

  • redirect_stderr – Redirect the command’s standard error to a file in the container

  • experimental_privileged_nesting – Provide dagger access to the executed command Do not use this option unless you trust the command being executed The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM

with_fs(id: Union[DirectoryID, Directory]) Container[source]

Initialize this container from this DirectoryID

Deprecated

Replaced by with_rootfs().

with_mounted_cache(path: str, cache: CacheVolume, source: Optional[Directory] = None) Container[source]

This container plus a cache volume mounted at the given path

with_mounted_directory(path: str, source: Directory) Container[source]

This container plus a directory mounted at the given path

with_mounted_file(path: str, source: File) Container[source]

This container plus a file mounted at the given path

with_mounted_secret(path: str, source: Secret) Container[source]

This container plus a secret mounted into a file at the given path

with_mounted_temp(path: str) Container[source]

This container plus a temporary directory mounted at the given path

with_rootfs(id: Union[DirectoryID, Directory]) Container[source]

Initialize this container from this DirectoryID

with_secret_variable(name: str, secret: Secret) Container[source]

This container plus an env variable containing the given secret

with_user(name: str) Container[source]

This container but with a different command user

with_workdir(path: str) Container[source]

This container but with a different working directory

without_env_variable(name: str) Container[source]

This container minus the given environment variable

without_mount(path: str) Container[source]

This container after unmounting everything at the given path.

async workdir() str | None[source]

The working directory for all commands

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

dagger.api.gen.ContainerID

A unique container identifier. Null designates an empty container (scratch).

alias of str

class dagger.api.gen.Directory(ctx: Context)[source]

A directory

diff(other: Directory) Directory[source]

The difference between this directory and an another directory

directory(path: str) Directory[source]

Retrieve a directory at the given path

async entries(path: Optional[str] = None) list[str][source]

Return a list of files and directories at the given path

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

list[str]

async export(path: str) bool[source]

Write the contents of the directory to a path on the host

Returns

The Boolean scalar type represents true or false.

Return type

bool

file(path: str) File[source]

Retrieve a file at the given path

async id() DirectoryID[source]

The content-addressed identifier of the directory

Note

This is lazyly evaluated, no operation is actually run.

Returns

A content-addressed directory identifier

Return type

DirectoryID

load_project(config_path: str) Project[source]

load a project’s metadata

with_directory(path: str, directory: Directory, exclude: Optional[list[str]] = None, include: Optional[list[str]] = None) Directory[source]

This directory plus a directory written at the given path

with_file(path: str, source: File) Directory[source]

This directory plus the contents of the given file copied to the given path

with_new_directory(path: str) Directory[source]

This directory plus a new directory created at the given path

with_new_file(path: str, contents: str) Directory[source]

This directory plus a new file written at the given path

without_directory(path: str) Directory[source]

This directory with the directory at the given path removed

without_file(path: str) Directory[source]

This directory with the file at the given path removed

dagger.api.gen.DirectoryID

A content-addressed directory identifier

alias of str

class dagger.api.gen.EnvVariable(ctx: Context)[source]

EnvVariable is a simple key value object that represents an environment variable.

async name() str[source]

name is the environment variable name.

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

async value() str[source]

value is the environment variable value

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

class dagger.api.gen.File(ctx: Context)[source]

A file

async contents() str[source]

The contents of the file

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

async export(path: str) bool[source]

Write the file to a file path on the host

Returns

The Boolean scalar type represents true or false.

Return type

bool

async id() FileID[source]

The content-addressed identifier of the file

Note

This is lazyly evaluated, no operation is actually run.

secret() Secret[source]
async size() int[source]

The size of the file, in bytes

Returns

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Return type

int

class dagger.api.gen.GitRef(ctx: Context)[source]

A git ref (tag or branch)

async digest() str[source]

The digest of the current value of this ref

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

tree() Directory[source]

The filesystem tree at this ref

class dagger.api.gen.GitRepository(ctx: Context)[source]

A git repository

branch(name: str) GitRef[source]

Details on one branch

async branches() list[str][source]

List of branches on the repository

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

list[str]

commit(id: str) GitRef[source]

Details on one commit

tag(name: str) GitRef[source]

Details on one tag

async tags() list[str][source]

List of tags on the repository

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

list[str]

class dagger.api.gen.Host(ctx: Context)[source]

Information about the host execution environment

directory(path: str, exclude: Optional[list[str]] = None, include: Optional[list[str]] = None) Directory[source]

Access a directory on the host

env_variable(name: str) HostVariable[source]

Lookup the value of an environment variable. Null if the variable is not available.

workdir(exclude: Optional[list[str]] = None, include: Optional[list[str]] = None) Directory[source]

The current working directory on the host

Deprecated

Use directory() with path set to ‘.’ instead.

class dagger.api.gen.HostVariable(ctx: Context)[source]

An environment variable on the host environment

secret() Secret[source]

A secret referencing the value of this variable

async value() str[source]

The value of this variable

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

class dagger.api.gen.Project(ctx: Context)[source]

A set of scripts and/or extensions

extensions() Project[source]

extensions in this project

generated_code() Directory[source]

Code files generated by the SDKs in the project

async install() bool[source]

install the project’s schema

Returns

The Boolean scalar type represents true or false.

Return type

bool

async name() str[source]

name of the project

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

async schema() str | None[source]

schema provided by the project

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

async sdk() str | None[source]

sdk used to generate code for and/or execute this project

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str | None

class dagger.api.gen.Secret(ctx: Context)[source]

A reference to a secret value, which can be handled more safely than the value itself

async id() SecretID[source]

The identifier for this secret

Note

This is lazyly evaluated, no operation is actually run.

Returns

A unique identifier for a secret

Return type

SecretID

async plaintext() str[source]

The value of this secret

Returns

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Return type

str

dagger.api.gen.SecretID

A unique identifier for a secret

alias of str