Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dagger/modules/engine-e2e/dagger-module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ engineVersion = "v1.0.0-0"

[[dependencies]]
name = "engine-dev"
source = "github.com/dagger/dagger/.dagger/modules/engine-dev@0d031c08ef3e379c6f4eb7f8f5cad4638a168863"
source = "github.com/dagger/dagger/.dagger/modules/engine-dev@6bf59d50654ce9244ebeee1cc090b7dce3fe3083"
4 changes: 2 additions & 2 deletions .dagger/modules/engine-e2e/main.dang
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
Checks the Python SDK against a pinned main engine.
Checks the Python SDK against the v1.0.0-beta.13 engine, pinned by commit.
Keep engineCommit and the engine-dev dependency in dagger-module.toml aligned.
"""
type EngineE2e {
let engineCommit: String! = "0d031c08ef3e379c6f4eb7f8f5cad4638a168863"
let engineCommit: String! = "6bf59d50654ce9244ebeee1cc090b7dce3fe3083"
let modulePath: String! = ".dagger/modules/sdk-smoke"

let assert(condition: Boolean!, message: String!): Void {
Expand Down
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It uses the engine's native `Workspace` and `ModuleSource` APIs. It uses
| --- | --- |
| `python-sdk.dang`, `mod.dang`, `templates/` | authoring: `findClientRoot`, `generateScope`, `mod` (generate, config), templates |
| `sdk/` | the `dagger-io` client library and code generator |
| `runtime/` | the module runtime the engine calls to run a module |
| `runtime/` | the module runtime the engine calls to run a module, and the container build the static entrypoint shares |

Code generation happens at `dagger generate`, which calls `generateScope` for
every recorded scope. It runs the code generator in `sdk/` and vendors the
Expand Down Expand Up @@ -73,6 +73,51 @@ runtime runs the module — so switching back is just editing the line again.
Within this repository, a path relative to the module works too, which is how
the end-to-end fixture exercises the runtime before the ref exists.

## Static entrypoint

Not available yet. A module's types are discovered by running it: the engine
builds the module's container and starts Python once per session to register
the types, then again for every call. The SDK can instead compute the types
once, at `dagger generate`, and write them into a generated entrypoint the
engine loads without running Python. The setting that turns this on is not
exposed until the engine loads manifest version 2 (dagger/dagger#14038), so
`dagger module init python` has no `--static-entrypoint` flag yet and every
new module is generated on the default path.

Once enabled, generating a module writes a manifest version 2 instead of a
runtime manifest, and `sdk/entrypoint/` next to the vendored library:

| File | What it is |
| --- | --- |
| `types.dang` | the module's types, as a literal list of `TypeDef` values |
| `main.dang` | the `ModuleEntrypoint`: returns the types and runs calls in the module's container |
| `build.dang` | the container build, copied from `runtime/build.dang` |

The types come from importing the module in its own container and reading
what its decorators registered, so they are the ones the runtime would
register. `main.dang` bakes a content digest of every source file that can
change them; a call after an edit is refused with a message to run
`dagger generate`. A lock file added afterwards is refused the same way, and
only file contents count, not permissions.

What the static path cannot do yet, and refuses at `dagger generate`:
module clients (manifest version 2 has no dependencies), any `cache=` value
on a function (the entrypoint's exec is content-cached and receives no
per-call signal), the `legacy` template, and a manifest with `include`,
`disableDefaultFunctionCaching`, a runtime other than `python`, a `source`
other than `.`, or `codegen`, `clients` or `dependencies` tables. Such
modules keep the default path. There is no `debug` terminal on the static
path, and a function error reaches the caller as the exec failure with the
process's stderr.

A module that already has a manifest version 2 keeps its static entrypoint
when generated directly, with `dagger call python-sdk mod --path <module>
generate`. `dagger generate` moves it back to the default path: it removes
`sdk/entrypoint/` and rewrites a runtime manifest with the generating engine's
version. See
[`future/done/static-module-entrypoint.md`](./future/done/static-module-entrypoint.md)
for the design and the plan to make it the default.

## Install

From your workspace root:
Expand Down Expand Up @@ -174,6 +219,6 @@ one to a Python scope is refused and the workspace is left unchanged.
dagger check
```

`engine-e-2-e:dev-sdk-check` builds the pinned dagger/dagger#13992 engine. It
`engine-e-2-e:dev-sdk-check` builds the dagger/dagger `v1.0.0-beta.13` engine. It
runs the SDK interface checks, initializes Python modules with default and
explicit settings, and calls a generated module.
6 changes: 5 additions & 1 deletion dagger-module.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name = "python-sdk"
engineVersion = "v1.0.0-beta.11"
include = ["!runtime", "!.dagger", "!future", "!docs"]
include = ["!.dagger", "!future", "!docs"]

[runtime]
source = "dang"

[[dependencies]]
name = "sdk-helpers"
source = "dagger.io/sdk/helpers@v1"

[[dependencies]]
name = "python-sdk-runtime"
source = "runtime"
5 changes: 4 additions & 1 deletion dagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"source": "dang"
},
"include": [
"!runtime",
"!.dagger",
"!future",
"!docs"
Expand All @@ -14,6 +13,10 @@
{
"name": "sdk-helpers",
"source": "dagger.io/sdk/helpers@v1"
},
{
"name": "python-sdk-runtime",
"source": "runtime"
}
]
}
23 changes: 9 additions & 14 deletions dagger.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# Generated by Dagger. Pins the images and git refs this workspace uses.
# Any Dagger command may update this file; always commit it with your changes.
# Run `dagger workspace update` to refresh the pinned versions.
[["version","2"]]
["","git-latest",["github.com/dagger/sdk-helpers"],"refs/tags/v1.0.2",[["version","v1"]]]
["","git-latest",["https://github.com/dagger/sdk-sdk"],"refs/heads/main"]
["","git-sha",["github.com/dagger/sdk-helpers","refs/tags/v1.0.2"],"e5e38a5f0778c5a804931d95e5d0d9953668049a"]
["","git-sha",["https://github.com/containernetworking/plugins","refs/tags/v1.9.0"],"9b3772e1a7abf93cbb7c6526a28bc0d27b830e02"]
["","git-sha",["https://github.com/dagger/sdk-helpers","main"],"64645f1967d3dba6fce951dd61ae4acd8d9b0861"]
["","git-sha",["https://github.com/dagger/sdk-sdk","refs/heads/main"],"334448911a8292fba0d677e5f31926c79ad80ad3"]
["","git-sha",["https://github.com/libfuse/sshfs.git","refs/tags/sshfs-3.7.6"],"7a2d988775446ebe7af9b01c99b3b8e86bddb05a"]
["","git-sha",["https://github.com/opencontainers/runc","refs/tags/v1.4.2"],"c241c0bb5e60a8e8c1b2e53d4eca8d0068d8d57e"]
["","oci-latest",["docker.io/library/busybox"],"1.38.0"]
["","oci-sha",["docker.io/library/alpine:3.22"],"sha256:14358309a308569c32bdc37e2e0e9694be33a9d99e68afb0f5ff33cc1f695dce"]
["","oci-sha",["docker.io/library/busybox:1.38.0"],"sha256:dc2d74b28e4cf8984fa52af1f39bc7c3d9c73760b41a74d629f5d11b1ab28616"]
["","oci-sha",["docker.io/library/golang:1.25-alpine"],"sha256:1ae0735f00daffa3aaf1363a5184c0d2dc55c78e3db4ec70241cdac97bf84b59"]
["","git-latest",["github.com/dagger/sdk-helpers",["version","v1"]],"refs/tags/v1.0.4"]
["","git-sha",["github.com/containernetworking/plugins","refs/tags/v1.9.0"],"9b3772e1a7abf93cbb7c6526a28bc0d27b830e02"]
["","git-sha",["github.com/dagger/sdk-helpers","refs/tags/v1.0.4"],"6c883f657933ecb06ae86d56d9cd1f8785346bb1"]
["","git-sha",["github.com/libfuse/sshfs","refs/tags/sshfs-3.7.6"],"7a2d988775446ebe7af9b01c99b3b8e86bddb05a"]
["","git-sha",["github.com/opencontainers/runc","refs/tags/v1.4.2"],"c241c0bb5e60a8e8c1b2e53d4eca8d0068d8d57e"]
["","oci-sha",["docker.io/library/golang:1.26-alpine"],"sha256:ce864e7223ac17b1775e6fd0b4c0db580c2eb50e7953a427916379e4b92a1628"]
["","oci-sha",["docker.io/tonistiigi/xx:1.2.1"],"sha256:8879a398dedf0aadaacfbd332b29ff2f84bc39ae6d4e9c0a1109db27ac5ba012"]
["","oci-sha",["ghcr.io/astral-sh/uv:python3.14-alpine"],"sha256:706cd9faf6d3fa7476fc470463bfca625d4b3ea5e46d6dc166ec1fb8ad3976e6"]
["","vanity-url",["https://dagger.io/sdk/helpers"],"https://github.com/dagger/sdk-helpers"]
["","vanity-url",["https://dagger.io/sdk/helpers"],"https://github.com/dagger/sdk-helpers"]
Loading