github dagger/dagger sdk/python/v0.3.0

11 months ago

This SDK is compatible with CLI+Runner version v0.3.9.


Notable changes

Runtime type checking

Python has a static typing system, not meant to be run at runtime. We depend on the IDE to complain or running a static type checker manually like mypy, but some users reported no issues from their environment only to later fail with an obscure AST conversion or API error, which is hard to debug especially if the problem is in a nested query.

Now you get a fail fast error, as soon as a type mismatch is encountered, which enables the SDK to pinpoint exactly which method and parameter has an unexpected type.

This is a breaking change if you relied on implicit conversion from a compatible type. For example, passing a DirectoryID when a Directory is required no longer works (it used to work by accident of implementation detail). Or passing an int when a str is required. Previously this was converted implicitly but now it’s validated.

Fixed inconsistencies in passing IDs to fields

  • sdk: python: Fix inconsistencies in passing IDs to fields by @helderco in #4195

In version 0.2.0 we removed the need to pass ID instances to steps in the pipeline, but there were some inconsistencies left. Now you should only need to pass around objects. The only fields that accept an ID are there in case you do have one and need it’s corresponding object (e.g., def file(id: FileID) -> File).

In general, you shouldn’t need to worry about IDs.

Breaking changes:

  • Container.with_rootfs(id) no longer accepts a DirectoryID. Only a Directory object.
  • Top level Client fields that have an id argument, no longer accept an object, only an ID.

Provisioning changes

There were quite a few changes in the way the engine is provisioned. It should mostly be hidden unless you’re customizing it to some extent.

This is part of a larger effort to Simplify and clarify how to open a GraphQL session.


  • Dagger CLI and engine binary were merged into one;
  • CLI downloaded from S3 instead of a docker image;
  • It’s no longer possible to connect to an engine via URL as it was misleading that you could connect to a remote engine directly. Now you need a port and a session token for authenticating into a locally running engine;
  • You can run your pipeline with a specific CLI binary instead of the SDK provisioning one (experimental), which is especially useful for maintainers during development, to run changes against latest engine version instead of last released.

Breaking changes:

  • dagger.Config no longer has host and secret_token. Those can only be configured via DAGGER_SESSION_PORT and DAGGER_SESSION_TOKEN environment variables. Usually managed by the SDK for you unless you’ve done some customizations.
  • The catch-all dagger.Error was renamed dagger.DaggerError. dagger.ProvisionError was also added in order to target provision specific failures.
  • All exceptions were moved to dagger.exceptions, although if it’s not importable from dagger directly it should be considered subject to change.

No execution timeout

The default timeout for executing a query was 5 min. That was too short for most workloads and there was no good default other than just remove it.

If you had to set a bigger timeout in dagger.Config(execution_timeout: int), then you can remove that setting unless you want to specifically enforce a limit.

API changes

  • Directory+File: add withTimestamps for normalizing file/dir timestamps by @vito in #4106
  • Add file/folder permissions to Directory and Container APIs by @jlongtine in #4157
  • Add build args to Dockerfile build by @jlongtine in #4207

Other changes

Don't miss a new dagger release

NewReleases is sending notifications on new releases.