This SDK is compatible with CLI+Runner version v0.3.9.
🐍 https://pypi.org/project/dagger-io/0.3.0/
📖 https://dagger-io.readthedocs.io/en/sdk-python-v0.3.0/
Notable changes
Runtime type checking
- sdk: python: Check input types at runtime by @helderco in #4034
- Python: Improve runtime type checking error message by @helderco in #4333
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.
Warning
This is a breaking change if you relied on implicit conversion from a compatible type. For example, passing aDirectoryID
when aDirectory
is required no longer works (it used to work by accident of implementation detail). Or passing anint
when astr
is required. Previously this was converted implicitly but now it’s validated.
Fixed inconsistencies in passing IDs to fields
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 ID
s.
Warning
Breaking changes:
Container.with_rootfs(id)
no longer accepts aDirectoryID
. Only aDirectory
object.- Top level
Client
fields that have anid
argument, no longer accept an object, only anID
.
Provisioning changes
- Update SDKs to pull CLI from S3 URL. by @sipsma in #4194
- Switch session url to port by @sipsma in #4285
- Python: Use platform dependent cache dirs by @helderco in #4281
- sdk: python: Refactor provisioning by @helderco in #4255
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.
Summary
- 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.
Warning
Breaking changes:
dagger.Config
no longer hashost
andsecret_token
. Those can only be configured viaDAGGER_SESSION_PORT
andDAGGER_SESSION_TOKEN
environment variables. Usually managed by the SDK for you unless you’ve done some customizations.- The catch-all
dagger.Error
was renameddagger.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 fromdagger
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
- docs(python): Fix reference docs by @helderco in #4109
- docs(python): Hide internal member from reference by @helderco in #4295
- build(deps): bump attrs from 22.1.0 to 22.2.0 in /sdk/python by @dependabot in #4238
- build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /sdk/python by @dependabot in #4148
- Python: Update locked packages by @helderco in #4280
- Python: Update Poetry in CI by @helderco in #4292
- Update default python version by @helderco in #4298
- deps(python): Package updates by @helderco in #4334