Skip to main content

IDE Integration

To get your IDE to recognize the dagger Python module and any added Dagger module dependencies in the generated client, install the Python SDK in a virtual environment from the generated ./sdk directory, as shown below:

python -m venv .venv
source .venv/bin/activate
pip install -e ./sdk
tip

If you place the virtual environment (.venv) inside the module, don't forget to add it to .gitignore and to "exclude" in dagger.json to avoid uploading those files to the runtime container unnecessarily.

When using Poetry, instead of the above, add ./sdk as a development dependency:

poetry add -e --group=dev ./sdk

When using Hatch, update pyproject.toml to allow direct references, and add a local dependency:

[project]
name = "main"
version = "0.0.0"

[tool.hatch.envs.dev]
dependencies = [
"dagger-io @ {root:uri}/sdk",
]

[tool.hatch.metadata]
allow-direct-references = true

Confirm it was installed:

hatch run dev:pip list

For other package managers, look for their documentation on how to accomplish the same.

note

It's important to install the SDK in editable mode (the -e in the pip install and poetry add commands) so you don't have to reinstall it after a dagger develop. However, it's always recommended to reinstall the SDK after upgrading Dagger to cover possible dependency changes.