Repository navigation
Conversation
Client codegen reads the names the engine formatted from the `codegen introspect --names-out` sidecar (`generate -n names.json`, SNAKE:UPPERCASE), and python-client-dev mounts engine-dev's IntrospectionNames for it. Schemas without Query.formatIdentifiers, and names missing from the map, keep the legacy converter, so older schemas generate the same code. With engine-formatted names: - A method whose legacy-converted name differs (experimental_with_all_gp_us, prerequisite_sh_as) keeps that name as a deprecated alias. - Core enum members are named SCREAMING_SNAKE (ImageMediaTypes.OCI, FunctionCachePolicy.PER_SESSION) and hold the schema value. The schema's other spellings (OCIMediaTypes, PerSession) stay as deprecated aliases, and enum argument defaults use the canonical member. - Such enums extend the new ValueEnum, which the converter sends by value rather than by member name. - A dependency module's enum whose @enumValue holds the module's own values is generated as before (plain Enum, members named by schema value, holding the module's value), so str(DepStatus.ACTIVE) keeps its value. Signed-off-by: Alex Suraci <[email protected]>
Core enums become ValueEnum with SCREAMING_SNAKE members and deprecated aliases for their legacy spellings; renamed methods keep deprecated aliases (experimental_with_all_gp_us, prerequisite_sh_as). Signed-off-by: Alex Suraci <[email protected]>
Calls through a module's own interfaces are built by the runtime, which predicted the schema names of the interface type, its functions, their arguments and the module's enum members with a plain case conversion. From engine version v1.0.0 the engine names module declarations with its naming rules (get_url is getURL, Ready is READY), so those calls failed. Before invoking a function of a module that declares interfaces, ask the engine to format those names (Query.formatIdentifiers, in batches) and use them for the interface bindings. The API's presence is the gate: the runtime's session is served at the module's engine version, so older modules keep the conversion they had. Interface arguments are now also bound by their Python name, so one renamed for registration (from_ registers as from) no longer fails. Signed-off-by: Alex Suraci <[email protected]>
The runtime module moves from engineVersion v0.21.9 to v1.0.0. Its session gets the v1 view, so module codegen can format the module schema's names: when that schema has Query.formatIdentifiers, the runtime formats its names (casing SNAKE, version: the schema's __schemaVersion) and passes them to codegen as a names file (`-n /names.json`). Older schemas get no names file and keep the legacy conversion. WithSDK now takes a context and can fail; its GraphQL signature is unchanged. Under v1 the module itself is named by engine/naming (PythonSDK, pythonSDK, withSDK, extraIndexURL, introspectionJSON) and Go codegen returns nullable objects as (ctx) (*T, error), so Load resolves ModuleSource.SDK before reading Debug. The bindings are hand-edited to match. The ext-python-sdk fixture refers to the dependency's class as dagger.PythonSDK. Signed-off-by: Alex Suraci <[email protected]>
This was referenced Oct 14, 2026
Contributor
Author
|
🤖 Closing: the in-repo SDKs are now legacy. This work will be redone as a PR against github.com/dagger/python-sdk ( |
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.
Part 5c/N of the stack splitting #14501 (identifier casing). Plan: #14501 (comment)
Refs #13668
Stacked on #14673.
What it does
The Python SDK now uses the engine's names (
Query.formatIdentifiers) instead of guessing word boundaries locally, in three places:gen.py)codegen introspect --names-outsidecar from #14673 (generate -n names.json,SNAKE:UPPERCASE), mounted by python-client-dev from engine-dev'sIntrospectionNamesQuery.formatIdentifiersformatIdentifiers(version:the schema's__schemaVersion) and passes them to codegen as the same names fileQuery.formatIdentifiersmod/_naming.pyasksformatIdentifiers, in batches, before invoking a function of a module that declares interfacesformatIdentifiers, i.e. the module is on v1On schemas without
formatIdentifiers, and for names missing from the map, codegen falls back to the old converter. Older schemas therefore generate the same code as before.What changes in generated code
experimental_with_all_gpus,prerequisite_shas. When the old converter gave a different name (experimental_with_all_gp_us,prerequisite_sh_as), that name stays as a deprecated method that warns and forwards. Most names don't change.ValueEnums withSCREAMING_SNAKEmembers:ImageMediaTypes.OCIMediaTypesis an alias ofOCI, andFunctionCachePolicy.PerSessionis an alias ofPER_SESSION.media_types=ImageMediaTypes.OCI.f28c41ein the final tree, deferred here from core: name modules with engine/naming from v1.0.0-beta.21 #14669):@enumValueholds the module's own values ("ACTIVE value") is generated as before: a plainEnumwith members named by schema value, holding the module's value, sent by name.str(DepStatus.ACTIVE)doesn't change, andTypeSuite/TestCustomEnumTypecovers it.@enumValueonly ever names another schema value) becomeValueEnum.The runtime moves to v1
sdk/python/runtimemoves fromengineVersionv0.21.9 to v1.0.0. This gives its session the v1 view, which hasformatIdentifiers.formatIdentifierswith theCasing/AcronymStyleenums;(ctx) (*T, error), soLoadresolvesModuleSource.SDKbefore readingDebug;WithSDK: it now takes a context and can fail. Its GraphQL signature is unchanged.Breaking changes (for Python SDK users)
These are for the maintainers to decide on:
.namechanges. A member looked up through a deprecated alias resolves to the canonical member, soImageMediaTypes.OCIMediaTypes.name == "OCI"andFunctionCachePolicy.PerSession.name == "PER_SESSION". Code that compares or serializes.namesees the new spelling..valueand what goes over the wire don't change.ValueEnum(a subclass indagger.client.base) instead ofEnum. This only matters to code that inspects the class hierarchy.experimental_with_all_gp_us,prerequisite_sh_as) and enum member spellings (OCIMediaTypes,Gzip,PerSession, ...) emitDeprecationWarning. The plan proposes keeping them through 1.0.PythonSdk→PythonSDK,pythonSdk→pythonSDK,withSdk→withSDK,extraIndexUrl→extraIndexURL,introspectionJson→introspectionJSON. These only affect modules that extend the Python SDK (like theext-python-sdkfixture, updated here todagger.PythonSDK). Old spellings still resolve through core: name modules with engine/naming from v1.0.0-beta.21 #14669's module aliases. A Python module that annotates with the old class name (dagger.PythonSdk) has to rename it.Not in it
callID,shortSHA,FunctionCachePolicyDEFAULT/...) and Python's "old schema names" table (codegen/renamed.py,07a07f7in the final tree). The client here still selectsshortSha,callId, etc.FunctionCachePolicy's wire values stayDefault/PerSession/Never, with newDEFAULT/PER_SESSION/NEVERmembers next to them.__formatIdentifiers.Testing
python-client/format,lint,python-310/unit,python-313/unit(309 tests, including the newtests/codegenandtests/mod/test_naming.py);python-client/client-library/stale(the regeneratedgen.pymatches the engine built from this branch).go vetand thenames_test.gotests.TestPackageNameNormalizationfails, but it testspython.go, which this PR doesn't touch, so it looks like it was already failing.TestPython/(TestAltRuntime|TestEnumDefaultValue|TestWithOtherModuleTypes|TestNameOverrides)TestModuleNaming/TestPythonAcronymsTestType/(TestEnumType|TestCustomEnumType)TestInterface/(TestIfaceBasic|TestIfaceCall)/pythonTestPythonsuite.