From 5b4ffaf2090f598ed0255bbd01bfe8de8dd71e6d Mon Sep 17 00:00:00 2001 From: Guillaume de Rouville Date: Thu, 18 Jun 2026 15:05:57 -0700 Subject: [PATCH 1/2] python-sdk: add CLI 1.0 client init CLI 1.0 calls initClient when a workspace adds a managed client. The Python SDK init-contract work lives in the stacked prepare-cli-1.0-init-contract branch, but that branch does not add the client hook. Add initClient with the CLI 1.0 signature, including the dev flag. It returns an empty Changeset on purpose: the engine records the client and owns generated client files through GeneratedContextChangeset. Add an e2e check that calls initClient and verifies the SDK returns no file changes. This keeps the PR narrowly scoped on top of #2. It only adds the client init hook and does not duplicate the targetRuntime or initModule changes from the stacked base. Signed-off-by: Guillaume de Rouville --- .dagger/modules/e2e/main.dang | 12 ++++++++++++ python-sdk.dang | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/.dagger/modules/e2e/main.dang b/.dagger/modules/e2e/main.dang index f3befa1..255a236 100644 --- a/.dagger/modules/e2e/main.dang +++ b/.dagger/modules/e2e/main.dang @@ -156,6 +156,18 @@ type E2e { null } + """ + initClient should not materialize files itself. The engine records the client + and owns the generated context changeset. + """ + pub initClientCheck(ws: Workspace!): Void @check { + let changes = pythonSdk.initClient(ws, path: outputRoot + "/client", module: generateModulePath, dev: true) + + assert(changes.isEmpty, "initClient should return an empty SDK changeset") + + null + } + """ config.get should reflect pyproject.toml and report unset values as null rather than guessing, and config.set should edit only pyproject.toml. diff --git a/python-sdk.dang b/python-sdk.dang index 6bf7e19..2c53cc2 100644 --- a/python-sdk.dang +++ b/python-sdk.dang @@ -145,6 +145,16 @@ type PythonSdk { } } + """ + Generate a typed Python client for `module` at `path`. + + The engine records the managed client in workspace config before calling + this function. The engine owns materializing the generated client files. + """ + pub initClient(ws: Workspace!, path: String!, module: String!, dev: Boolean! = false): Changeset! { + polyfill.workspace(ws).fork.changes + } + """ Render a Python template with the requested module name. """ From db199cae1932337301bd7955448ebe8e0aa76960 Mon Sep 17 00:00:00 2001 From: Guillaume de Rouville Date: Thu, 18 Jun 2026 16:00:13 -0700 Subject: [PATCH 2/2] python-sdk: load e2e checks as a workspace module Dogfood load checks run through workspace modules. The Python SDK repo did not have a dagger.toml, so CI was not loading its in-repo e2e module through the same workspace path as the Go and TypeScript SDK repos. Add a minimal dagger.toml that includes only .dagger/modules/e2e. The Python SDK root module is intentionally not listed as a workspace module; it remains the root module that the e2e module depends on through a local source. The workspace e2e checks call sdk-sdk/polyfill helper binaries such as workspace-module-generate and workspace-snapshot. The old Python SDK pin built those helpers against dagger.io/dagger v0.20.6, which still queried loadWorkspaceFromID and fails against the CLI 1.0 dev engine schema. Bump the polyfill pin and lock to the same commit used by the TypeScript SDK, where those helpers are compatible with the current workspace API. Also bump the e2e module engine pin to v0.21.4 so the workspace-loaded test module runs with the same schema generation baseline as the TypeScript SDK e2e module. Signed-off-by: Guillaume de Rouville --- .dagger/lock | 2 +- .dagger/modules/e2e/dagger.json | 2 +- dagger.json | 2 +- dagger.toml | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 dagger.toml diff --git a/.dagger/lock b/.dagger/lock index 5d3ee5d..d0e75b6 100644 --- a/.dagger/lock +++ b/.dagger/lock @@ -1,3 +1,3 @@ [["version","1"]] ["","container.from",["docker.io/library/golang:1.25-alpine","linux/arm64"],"sha256:8d22e29d960bc50cd025d93d5b7c7d220b1ee9aa7a239b3c8f55a57e987e8d45","pin"] -["","git.head",["https://github.com/dagger/sdk-sdk"],"09da9576688ec4b495ae4a9443a4719da86ed25e","float"] \ No newline at end of file +["","git.head",["https://github.com/dagger/sdk-sdk"],"d1532df4f7d322a7bdab02487accde9d21bbb464","float"] diff --git a/.dagger/modules/e2e/dagger.json b/.dagger/modules/e2e/dagger.json index 8bbc10f..0466464 100644 --- a/.dagger/modules/e2e/dagger.json +++ b/.dagger/modules/e2e/dagger.json @@ -1,6 +1,6 @@ { "name": "e2e", - "engineVersion": "v0.20.8", + "engineVersion": "v0.21.4", "sdk": { "source": "dang" }, diff --git a/dagger.json b/dagger.json index ee88bef..0cae831 100644 --- a/dagger.json +++ b/dagger.json @@ -8,7 +8,7 @@ { "name": "polyfill", "source": "https://github.com/dagger/sdk-sdk/polyfill@main", - "pin": "09da9576688ec4b495ae4a9443a4719da86ed25e" + "pin": "d1532df4f7d322a7bdab02487accde9d21bbb464" } ] } diff --git a/dagger.toml b/dagger.toml new file mode 100644 index 0000000..eac285e --- /dev/null +++ b/dagger.toml @@ -0,0 +1,10 @@ +# Dagger workspace configuration +# Install modules with: dagger install +# Example: +# dagger install github.com/dagger/dagger/modules/wolfi + +# Marker filename that skips generate when found at or above a Python SDK module root. +# settings.skipGenerateFilename = "" + +[modules.e2e] +source = ".dagger/modules/e2e"