Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Dagger Python SDK

PyPI Version Conda Version Supported Python Versions License Code style Ruff

A client package for running Dagger pipelines.

What is the Dagger Python SDK?

The Dagger Python SDK contains everything you need to develop CI/CD pipelines in Python, and run them on any OCI-compatible container runtime.

Requirements

  • Python 3.10 or later
  • Docker, or another OCI-compatible container runtime

A compatible version of the Dagger CLI is automatically downloaded and run by the SDK for you, although it’s possible to manage it manually.

Installation

From PyPI, using pip:

pip install dagger-io

You can also install via Conda, from the conda-forge channel:

conda install dagger-io

Example

Create a main.py file:

import sys

import anyio
import dagger
from dagger import dag


async def main(args: list[str]):
    async with dagger.connection():
        # build container with cowsay entrypoint
        ctr = (
            dag.container()
            .from_("python:alpine")
            .with_exec(["pip", "install", "cowsay"])
        )

        # run cowsay with requested message
        result = await ctr.with_exec(["cowsay", *args]).stdout()

    print(result)


anyio.run(main, sys.argv[1:])

Run with:

$ python main.py "Simple is better than complex"
  _____________________________
| Simple is better than complex |
  =============================
                             \
                              \
                                ^__^
                                (oo)\_______
                                (__)\       )\/\
                                    ||----w |
                                    ||     ||

Note It may take a while for it to finish, especially on first run with cold cache.

If you need to debug, you can stream the logs from the engine with the log_output config:

config = dagger.Config(log_output=sys.stderr)
async with dagger.connection(config):
    ...

Learn more

Development

The SDK is managed with a Dagger module in ./dev. To see which tasks are available run:

dagger call -m dev

Common tasks

Run pytest in supported Python versions:

dagger call -m dev test default

Check for linting violations:

dagger call -m dev lint

Re-format code following common styling conventions:

dagger call -m dev format export --path=.

Update pinned development dependencies (run from this directory, ./sdk/python, or adjust export path accordingly):

dagger call -m ../../.dagger/modules/python-client-dev dev-container with-exec --args uv,lock,-U directory --path . export --path .

Update a single pinned development dependency (run from this directory, ./sdk/python, or adjust export path accordingly):

dagger call -m ../../.dagger/modules/python-client-dev dev-container with-exec --args uv,lock,-P,<DEPNAME> directory --path . export --path .

Build and preview the reference documentation:

dagger call -m dev docs preview up

Add --help to any command to check all the available options.

Metadata

Release files for dagger-io 1.0.0b24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dagger-io 1.0.0b24
File Size Uploaded Provenance Actions
dagger_io-1.0.0b24.tar.gz 166.0 kB Without provenance Details for dagger_io-1.0.0b24.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dagger-io 1.0.0b24
File Interpreter ABI Platform Actions
dagger_io-1.0.0b24-py3-none-any.whl Python 3 none any Details for dagger_io-1.0.0b24-py3-none-any.whl

Total release size: 316.8 kB

Release files / dagger_io-1.0.0b24.tar.gz

Download URL dagger_io-1.0.0b24.tar.gz
Size 166.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dcc49f225149f82100e4ea20ec5665a23851a0d403dc6ea0e328080fb00259a8
BLAKE2b-256 checksum
How to use checksums
df52d6e458436738d1b3ff81966a3b8222e72de53994c417687e8254a34e8ec5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Wolfi","version":"20230201","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dagger_io-1.0.0b24-py3-none-any.whl

Download URL dagger_io-1.0.0b24-py3-none-any.whl
Size 150.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64e6778dc923fa95cf1a5572d52fab1027fe18eb97b062e2b8eba1c2dc3ef8bf
BLAKE2b-256 checksum
How to use checksums
669d5c5c5c950a13841abf44c86ca641c27733f15a85022f07b571645b92c36e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Wolfi","version":"20230201","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for dagger-io 1.0.0b24

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page