Repository navigation
Add independent Python client generation and explicit API targets - #344
Merged
Merged
Conversation
1 of 3 tasks
moetemp
reviewed
Oct 30, 2026
This was referenced Oct 30, 2026
tconley1428
force-pushed
the
refactor/api-generation-targets
branch
from
October 30, 2026 18:17
798a802 to
f746287
Compare
This was referenced Oct 31, 2026
tconley1428
force-pushed
the
refactor/api-generation-targets
branch
from
November 2, 2026 17:06
cafb166 to
70ac708
Compare
tconley1428
marked this pull request as ready for review
November 2, 2026 19:03
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
tconley1428
commented
Nov 2, 2026
dplyukhin
reviewed
Nov 2, 2026
1 of 3 tasks
moetemp
reviewed
Nov 3, 2026
VegetarianOrc
approved these changes
Nov 3, 2026
VegetarianOrc
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me! Thanks for the offline walkthrough!
`--targets workflow,client` also writes a `client` package, with its own resource classes and a client extension for each service. Its methods start each operation through `_create_nexus_client` and return the result. The models are shared, and the Workflow package doesn't change. The operation renderers take a target and start each line at its indent, so both targets share them. The stream sample gets the client target.
…346) * Scoped the Workflow-only sample defaults to the Workflow target. A default without a target list applies to every target, and these helpers need a Workflow context. * Used `GenerationTarget` in Python and ran each target check once. `PythonTarget` copied `GenerationTarget`, and two checks ran twice per run. A private client method named `_create_nexus_client` replaced the extension hook. * Rendered each resource method request argument on its own line. One long line has no trailing comma, so `ruff format` joined the requests in the samples, and unformatted output got lines of about 200 characters. * Accepted an empty sourced string again in Python proto decode. Without a source default in the shared model, decode refused an empty sourced value. A handler then rejected requests that it accepted before. * Rendered fields-only resources when the Workflow target is off. The root classes had stub methods that always raised, and the client package kept private copies of them. The client now decodes results into the root classes. * Generated definitions for resources and sources with no API target. A handler that implements a service generates definitions only, from the WIT that its callers share. That WIT can have resources and sources, and the default build has no `--targets`, so it couldn't generate such WIT at all. * Gave a returned client handle the Nexus client of its own service. When another interface returned a resource, the handle kept the client of the returning service, so its methods started operations on the wrong endpoint. * Matched the client Nexus protocol to `temporalio.client.NexusClient`. `Client.create_nexus_client` didn't fit the generated hook, so a real client failed to type-check and to run. The SDK needs an operation ID, so each call passes a new random one. * Added a public factory for each resource on the client extensions. To rebuild a client handle from stored identity fields, a caller needed the private `_create_nexus_client` hook and the wire names of the service. * Rejected unknown settings in examples.toml by name. A misspelled key was read as a child configuration and the parent then stopped generating. The error now names the key and its section. * Rejected examples.toml sections that match no input. A misspelled section name gave definitions-only output with no error, or an error that did not point at examples.toml. * Rejected child names that share a directory or cannot name a package. Children whose names map to one directory in any language would merge their files. Names with a leading digit or a Python keyword are not importable packages. * Built the target-sources sample in TypeScript, Go and .NET. The target-sources sample now builds for the workflow target in all three languages. Go filled sourced fields only on proto-backed inputs, so operations without a proto input now fill them too. * Pruned Go imports that the rendered code does not use. Go output with no Workflow API kept the imports of that API and did not compile. The renderer pruned only aliased imports, and now prunes plain ones too. * Updated the changelog for the targets change. The client constructor line describes a new feature, so it moves to added. The breaking entry lists the flag and library changes, and a new fixed entry covers Go output with no Workflow API. * Renamed the leftover native-api wording to Workflow API. The flag is gone, so READMEs, specs and comments now name the Workflow API. * Explained why target-sources borrows Temporal protos. A reader could copy the sample, but its fields do not match the meaning of the borrowed messages. * Updated the core-fix changelog and reworded a native API comment. The sources line still said that resources need a target. The `kw_only` flips had no entry yet. * Generated and tested the Python client of the stream sample. The stream sample is the one System Nexus service with a client, and no sample built or type-checked it. Only Python has the client target, so Python builds both APIs in its own variant, and TypeScript and .NET keep the Workflow API. * Moved the cross-interface resource sample to its own WIT. The `orders` interface in `target-sources.wit` broke the .NET build of that sample, which now runs in every language. Two services there declare two `Operations` classes in one namespace. * Used a resource field before its source in every language. Go, TypeScript and .NET replaced a resource field with the source of the same request field, and Python kept the resource field. Each now sends the resource's value and fills only the other sources.
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.
Reworks #324 as a standalone change against
main, without the other stack changes.--targetsinstead of--native-api, apply sources per target, and reject resources or sources without an API target.Draft: field-origin unification and target-scoped defaults remain pending.
Validation gap: full local validation is blocked by five Python integration setups whose Temporal dev server fails to start within five seconds.