Repository navigation
Adopt the module-max SDK interface from dagger/dagger#13992 - #25
Merged
eunomie merged 3 commits intoSep 4, 2026
Merged
Conversation
This was referenced Sep 4, 2026
eunomie
force-pushed
the
python-sdk-pr-13992-fast-adopt-lead-d4e003f3
branch
4 times, most recently
from
September 4, 2026 10:23
d90d42d to
ef02a1d
Compare
dagger/dagger#13992 replaces the beta SDK-module interface with no compatibility adapter: an SDK is an installed module that implements detectScope(ws) and generateScope(ws, isModule, name, clients), recorded under [sdks.<name>] in dagger.toml. The engine persists a scope, sets Workspace.cwd to it, and asks the SDK for the complete scope; the SDK writes the module manifest itself. The same change removes currentModule.asSDK and ModuleSource.generateLocalDependencies, which the beta entry points selected, and it ignores an SDK's own @generate functions. detectScope answers with the directory of the nearest pyproject.toml, lifted to the owning Python module when that is the vendored sdk/ library. generateScope scaffolds a module that has no config file from the configured template and a dagger-module.toml from the engine's manifest builder, naming the python runtime and writing no dagger.json, then generates the module in place; a module that already has a config is only generated, and a new module is generated even under a skip marker. In a module scope the client set becomes the module's dependency set: the manifest builder loads the manifest file the module has, replaces the dependencies with one entry per client, and writes that file back, so the vendored bindings include the clients' types; a module with neither clients nor dependencies keeps its manifest untouched. Standalone clients, in a scope without a module, are refused rather than silently skipped, so a client add fails atomically. The template, Python version, uv, and base image choices are constructor settings, which the CLI exposes as `dagger module init python --template=... --python-version=...` flags and persists on the scope. initModule, targetRuntime, modules, and the generateAll @generate hook go away with the interface they served, as in dagger/dang-sdk#13 and dagger/go-sdk#37. mod stays for the config helpers and reads the registered modules through Workspace.sdk(name).modules; the cwd policy moves into Dang. Mod gains a public `generated` workspace, which generateScope returns directly. A changeset computed at a scope cwd cannot be re-applied with withChanges: Workspace.changes compares both sides at their cwd, so the round trip copied the scope subtree onto the workspace root. skipGenerate anchors its findUp start at the root for the same reason: Workspace.findUp resolves a relative start against the cwd. Signed-off-by: Yves Brissaud <[email protected]>
…mmand tree dagger/dagger#13992 records an SDK under [sdks.<name>] with one scope per managed module, and ignores [modules.<name>.as-sdk]. dagger.toml moves to that form, as in dagger/dang-sdk#13 and dagger/go-sdk#37: the checks that read the registered modules pass on an engine with #13992, and `dagger generate` drives the same fixtures generateAll drove before. The sdk-sdk contract checks covered the beta interface and go with it. .dagger/lock and .dagger/config.toml predate the workspace layout: nothing reads the config, and an engine with #13992 refuses the version 1 lock file before it can initialize a module in this checkout. The README follows the CLI: module operations live under `dagger module`, install records the SDK, init generates the whole module in one step, and `module deps` / `module engine` are gone. Module dependencies are replaced by generated clients, which this SDK does not produce yet. Signed-off-by: Yves Brissaud <[email protected]>
The released engine cannot drive the new SDK interface, so the check that proves the whole flow builds its own engine: engine-dev from dagger/dagger's sdk-ux-module-max branch, pinned in dagger.lock, gives a playground with the CLI and engine from that branch. The check mounts this checkout as the python SDK, lists it, initializes a Python module, and calls a function of the generated module. dagger/dang-sdk#13 and dagger/go-sdk#37 use the same check. Signed-off-by: Yves Brissaud <[email protected]>
eunomie
force-pushed
the
python-sdk-pr-13992-fast-adopt-lead-d4e003f3
branch
from
September 4, 2026 16:07
ef02a1d to
c05426e
Compare
eunomie
marked this pull request as ready for review
September 4, 2026 17:11
This was referenced Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
dagger/dagger#13992 (branch
sdk-ux-module-max, head 055def6f7794b9d0dfdcc4252f0695ea92257536) changes how the engine drives an SDK module, with no compatibility adapter:CurrentModule.asSDKandModuleSource.generateLocalDependencies. Every public function of this module selected one of them, and Dang infers the whole program on each call, so on that engine every call of this module failed.initModule,targetRuntime,@generate) withdetectScope(ws)andgenerateScope(ws, isModule, name, clients). The SDK is recorded under[sdks.python]indagger.toml, the engine setsWorkspace.cwdto a persisted scope, and the SDK writes the module manifest itself through the engine's manifest builder.dagger module;dagger module depsanddagger module engineare gone; module dependencies are replaced by generated module clients.This follows dagger/dang-sdk#13 and dagger/go-sdk#37, which adopt the same interface the same way.
Change
detectScopeanswers with the directory of the nearestpyproject.toml(lifted to the owning Python module when that is the vendoredsdk/library).generateScopescaffolds a module that has no config file from the configured template andmoduleManifest.withName(name).withLegacyPythonRuntime.tomlFile, which writesdagger-module.tomlonly (nodagger.json), then generates it; a module that already has adagger-module.tomlordagger.jsonis only generated. A new module is generated even under a skip marker.dagger-module.toml(or thedagger.jsonof a pre-1.0 module that has nothing else), replaces the dependencies with one entry per client (a git ref as is, a local module by its path relative to the module), and writes that file back, so the vendored bindings include the clients' types; a removed client is dropped again, and a module with neither clients nor dependencies keeps its manifest untouched. Standalone clients, in a scope without a module, are refused with an error, so that client add fails atomically.dagger module init python --template=... --python-version=...flags.initModule,targetRuntime,modules, and thegenerateAllgenerate hook are removed with the interface they served.modstays for the config helpers and reads the registered modules throughWorkspace.sdk(name).modules.Modgains ageneratedworkspace thatgenerateScopereturns directly:Workspace.changescompares both sides at their cwd, so a changeset computed at a scope cwd cannot be re-applied withwithChanges.dagger.tomlmoves to the[sdks.python]form with one scope per fixture; theas-sdkform and the sdk-sdk contract checks go away.engine-e2emodule builds an engine fromsdk-ux-module-maxat commit 055def6f (theengine-devdependency and the engine source are pinned to that commit, so CI does not float with the branch; bump both to follow it), installs this checkout as thepythonSDK, initializes a Python module, and calls it.The module needs an engine built from
sdk-ux-module-maxat 2af60773 or later: it selectsmoduleManifest(loadTOML:, loadJSON:),withName,withDependency, andwithoutDependency, which that commit introduced.Manifest v2 and entrypoint generation (dagger/dagger#14038) are out of scope.
Verification
engine-e-2-e:dev-sdk-checkpasses with the released CLI. It builds the engine fromsdk-ux-module-maxat 055def6f inside Dagger; there,dagger sdk listprintspython python-sdk,dagger module init python --name sdk-smoke --path .dagger/modules/sdk-smokewritesdagger-module.toml(and nodagger.json),pyproject.toml,src/sdk_smoke/__init__.py, andsdk/src/dagger/client/gen.py, anddagger -m .dagger/modules/sdk-smoke call container file --path /etc/alpine-release contentsruns the module.e-2-e:*checks that call this module (detect-scope, the threegenerate-scope-*, the three lookup checks,generate,toml-generate,skip-generate,generate-skips-existing-files,config,skip-generate-filename) pass whendagger checkruns inside that branch-engine playground;generate-scope-clients-checkadds a Dang fixture module as a client of a Python module, asserts the dependency in the manifest and its type in the generated bindings, then removes it again.Workspace.withClienton a freshly initialized Python module does return a workspace whose overlay modifiesdagger.toml, the module'sdagger-module.toml, and the vendored bindings, which is the SDK's part of the job.e-2-e:runtime-call-check,e-2-e:runtime-naming-check,e-2-e:runtime-requires-generated-files-check, ande-2-e:sdk-test-checkpass on the released engine v1.0.0-beta.11.Known limitations and engine gaps
e-2-e:*checks that call this module fail on the released engine (v1.0.0-beta.11), which lacksmoduleManifest;engine-e-2-e:dev-sdk-check, the runtime checks, and the SDK unit tests pass there.[modules.python-sdk.settings]were not delivered to the provider constructor in the SDK-module path on an engine built from the branch at 7ebd6da5 (--template=emptyis persisted, the default template is scaffolded), whiledagger call python-sdk templatesees them. Reproduced again on 055def6f inside the engine-e2e playground:dagger module init python --name bare --path mods/bare --template=empty --python-version=3.13records both settings under the scope and scaffolds the default template withrequires-python = ">=3.14".dagger module init python --path <dir>into an existing Python project without a module config overlays the template, which replaces a same-namedpyproject.toml; the CLI shows the diff before applying.dagger module client add <target>prints "no changes to apply" and writes nothing, although thewithClientresult carries the changes in its overlay; the CLI'schanges(from: currentWorkspace)comes back empty. Reproduced with a path target and with an installed-module alias, from inside a subdirectory module scope and at a workspace-root scope, and with the engine's owncore/integration/testdata/sdks/module-max-lifecyclefixture SDK, all inside the engine-e2e playground.dagger generatewith a client recorded on a module scope (clients = [".dagger/modules/e2e/fixtures/clients/dep"]) fails before calling the SDK:GeneratorGroup.moduleSource(path: "/.dagger/modules/e2e/fixtures/clients/dep"): "attach module source workspace: attach dependency result: attach dependency results: reconstruct attached self: cannot instantiate dagql.Class[*core.GeneratorGroup] with dag".ResolveDepToSource(core/modulesource.go) joins a module's local dependency source onto the module's workspace-relative root and passes the result toWorkspace.moduleSource(path)without a leading slash, so the workspace resolves it againstWorkspace.cwd. With the cwd at a scope, as duringgenerateScope, a dependency../../clients/depof.dagger/modules/e2e/fixtures/toml-generate/appis looked up at.dagger/modules/e2e/fixtures/toml-generate/app/.dagger/modules/e2e/fixtures/clients/dep.generateScopeworks around it by generating with the cwd at the workspace root and restoring the scope cwd on the result.