Metadata-Version: 2.1
Name: dagger-io
Version: 0.2.1
Summary: A client package for running Dagger pipelines in Python.
Home-page: https://dagger.io
License: Apache-2.0
Author: Dagger
Author-email: hello@dagger.io
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AnyIO
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Typing :: Typed
Provides-Extra: server
Requires-Dist: anyio (>=3.6.2)
Requires-Dist: attrs (>=22.1.0)
Requires-Dist: cattrs (>=22.2.0)
Requires-Dist: gql (>=3.4.0)
Requires-Dist: httpx (>=0.23.1)
Requires-Dist: strawberry-graphql (>=0.133.5); extra == "server"
Requires-Dist: typer[all] (>=0.6.1)
Project-URL: Community, https://discord.gg/ufnyBtc8uY
Project-URL: Documentation, https://docs.dagger.io/sdk/python
Project-URL: Repository, https://github.com/dagger/dagger/tree/main/sdk/python
Project-URL: Release Notes, https://github.com/dagger/dagger/releases?q=tag%3Asdk%2Fpython%2Fv0
Project-URL: Tracker, https://github.com/dagger/dagger/issues
Project-URL: Twitter, https://twitter.com/dagger_io
Description-Content-Type: text/markdown

# Dagger Python SDK

[![PyPI](https://img.shields.io/pypi/v/dagger-io)](https://pypi.org/project/pytest/) [![Supported Python Versions](https://img.shields.io/pypi/pyversions/dagger-io.svg)](https://pypi.org/project/pytest/) [![Code style](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/psf/black)

A client package for running [Dagger](https://dagger.io/) 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.

## Example

```python
# say.py
import sys

import anyio
import dagger


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

        # run cowsay with requested message
        result = await ctr.with_exec(args).stdout()

        print(result)


if __name__ == "__main__":
    anyio.run(main, sys.argv[1:])
```

Run with:

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

## Learn more

- [Documentation](https://docs.dagger.io/sdk/python)
- [API Reference](https://dagger-io.readthedocs.org)
- [Source code](https://github.com/dagger/dagger/tree/main/sdk/python)

## Development

Requirements:

- Python 3.10+
- [Poetry](https://python-poetry.org/docs/)
- [Docker](https://docs.docker.com/engine/install/)

Start environment with `poetry install`.

Run tests with `poetry run poe test`.

Reformat code with `poetry run poe fmt` or just check with `poetry run poe lint`.

Re-regenerate client with `poetry run poe generate`.

Build reference docs with `poetry run poe docs`.

Tip: You don't need to prefix the previous commands with `poetry run` if you activate the virtualenv with `poetry shell`.

