This release is a pre-release and may not be stable for production use.
Dagger Python SDK
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.
Release files for dagger-io 1.0.0b13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dagger_io-1.0.0b13.tar.gz | 136.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dagger_io-1.0.0b13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:260.2 kB
Release files / dagger_io-1.0.0b13.tar.gz
| Download URL | dagger_io-1.0.0b13.tar.gz |
|---|---|
| Size | 136.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd03191550643da30f9e0b0fe19c1faba4442a7958ead1acc4d39d2fb13491f4
|
|
BLAKE2b-256 checksum How to use checksums |
4c09bab295cb1a265de950fffa2cd9904f676a62d78006e96d4acee3c96a8838
|
| 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.0b13-py3-none-any.whl
| Download URL | dagger_io-1.0.0b13-py3-none-any.whl |
|---|---|
| Size | 123.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3764829f931f7020e6f3e4e9e29d581b262e1a8ac89fefd3764e725b1eda8437
|
|
BLAKE2b-256 checksum How to use checksums |
ec61e127b850e3ce0519c3473f3de63afb9291e924847f01ddf005c7a3e47cf1
|
| 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}
|