Prepare Python SDK for CLI 1.0 workspace settings#3
Draft
eunomie wants to merge 1 commit into
Draft
Conversation
Declare a PythonSdk constructor with defaultPythonVersion, defaultUseUv and defaultBaseImage. The engine's settings discovery introspects the main object's constructor arguments, so these become the typed, described settings surfaced by `dagger settings python-sdk` (camelCase maps to kebab-case: default-python-version, default-use-uv, default-base-image) and stored under [modules.python-sdk.settings]. initModule now falls back to these workspace defaults when the matching per-init flag is omitted; an explicit flag still wins. useUv becomes nullable so an omitted flag is distinguishable from an explicit --use-uv=false, mirroring the existing nullable-boolean pattern in mod-config.dang. The defaulting is the only new logic: configuredTemplate still consumes the resolved values. Add an e2e check (initSettingsDefaultCheck) covering both inheritance of the constructor defaults and per-init override, and document the settings in the README. Discoverability and the `dagger call python-sdk …` path land with this change. End-to-end inheritance through the privileged `dagger module init python` dispatch additionally requires an engine change that threads [modules.python-sdk.settings] into the SDK constructor at init time. Signed-off-by: Yves Brissaud <yves@dagger.io>
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.
Follow-up to #2 (CLI 1.0 init contract). Makes the Python SDK participate in
CLI 1.0 workspace-scoped SDK settings (
dagger settings python-sdk …).Targets
prepare-cli-1.0-init-contract(#2) so the diff is just this change;rebase onto
mainonce #2 lands.What this does
Settings have no dedicated SDK capability function — the engine derives the
typed, discoverable settings of an SDK module from its main object's
constructor arguments (
constructorHintsFromModule).PythonSdkpreviouslydeclared no constructor, so
dagger settings python-sdksurfaced nothing.This PR:
PythonSdkconstructor declaring the workspace knobsdefaultPythonVersion/defaultUseUv/defaultBaseImage. They become thesettings
dagger settings python-sdklists (camelCase → kebab on the CLI:default-python-version,default-use-uv,default-base-image) and arestored under
[modules.python-sdk.settings].initModulefall back to those defaults when the matching per-init flagis omitted; an explicit flag still wins.
useUvbecomes nullable(
Boolean = null) so an omitted flag is distinguishable from an explicit--use-uv=false— mirroring the nullable-boolean pattern already inmod-config.dang. The only new logic is the defaulting;configuredTemplatestill consumes the resolved values.
initSettingsDefaultCheck) covering both inheritance ofthe constructor defaults and per-init override, and documents the settings in
the README.
skipGenerateFilename/targetRuntimekeep their inline defaults and areintentionally not constructor args, so they don't leak in as settings.
dagger settings python-sdk default-python-version 3.13 dagger settings python-sdk default-use-uv false dagger settings python-sdk default-base-image python:3.13-slimScope / what lands now
dagger settings python-sdk default-*is discoverable, typed and stored.dagger call python-sdk …path the engine populates the constructorfrom the stored settings, so
initModulehonors them there.dagger module init pythondispatch does not yet thread[modules.python-sdk.settings]into the SDK constructor, so "new modulesinherit the workspace default" through the real init command needs an
engine-side follow-up (thread settings into
core/sdk/module.go:instantiate/core/schema/workspace_module_init.goondesign/cli-1.0). This SDK change is correct and harmless ahead of it. Thee2e harness instantiates
pythonSdkdirectly, so it can already cover theconstructor-default path.
Out of scope (needs a design decision, not guessing)
dagger module sdkper-module alignment: the wrapper dispatchesdagger call <sdk> <subcommand>without injecting the current module's path,which doesn't match this SDK's path-based
mod configsurface. The contract isunderspecified — left for the
design/cli-1.0owner to resolve before aligningthe per-module surface.
Notes
@checksuite is the validator.v0.21.3→ Dang v1 semantics.