Skip to content

feat(python): add a Workflow resource factory - #87

Closed
moetemp wants to merge 1 commit into
moe/up/field-flattenfrom
moe/up/resource-factory
Closed

moetemp wants to merge 1 commit into
moe/up/field-flattenfrom
moe/up/resource-factory

Conversation

@moetemp

@moetemp moetemp commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds a Workflow factory for each Python resource.

  • The client extension's get_<resource> factory of Add independent Python client generation and explicit API targets temporalio/nexgen#344 takes the flattened fields and the runtime types, as in client.get_stream(id="s1", body_type=Turn). The Workflow package exports a factory with the same name, as in stream_service.get_stream(id="s1", body_type=Turn). When an operation get_<resource> already returns the resource, as get-sender of the defaults sample does, the resource gets no factory. nexgen refuses any other operation with the factory's name. A factory makes no call.
  • @nexus.flatten-in-api param="ref" fields="id backend" keep=true on a resource lets the factory take fields of one constructor parameter, or the whole value. So id="s1" and ref=ref both work.

TypeScript and .NET get the resource flatten on their factories in a follow-up PR.

Why?

The proposal builds a Stream with no call, like get_workflow_handle, from an id and a backend or from a whole ref. The ref is data, and code turns it into a Stream explicitly, so no converter turns a payload into a resource.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

Python tests build Streams with both factories, from the fields of the flattened parameter and from the whole value.

@moetemp
moetemp force-pushed the moe/up/field-flatten branch from 427d8be to e185234 Compare October 29, 2026 04:00
@moetemp
moetemp force-pushed the moe/up/resource-factory branch 2 times, most recently from 3e97846 to ff120ff Compare October 31, 2026 13:08
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from e185234 to f4435b6 Compare October 31, 2026 13:08
@moetemp moetemp changed the title feat(python): add a resource factory, and pass a resource as data feat(python): add a Workflow resource factory, and pass a resource as data Oct 31, 2026
@moetemp
moetemp force-pushed the moe/up/resource-factory branch from ff120ff to c0e998f Compare November 3, 2026 15:22
@moetemp moetemp changed the title feat(python): add a Workflow resource factory, and pass a resource as data feat(python): add a Workflow resource factory Nov 3, 2026
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from 3bbac1d to 7731e40 Compare November 4, 2026 09:34
@moetemp
moetemp force-pushed the moe/up/resource-factory branch from c0e998f to 242c137 Compare November 4, 2026 09:34
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from 7731e40 to 751ad5b Compare November 5, 2026 05:19
@moetemp
moetemp force-pushed the moe/up/resource-factory branch 2 times, most recently from 801829b to de23557 Compare November 5, 2026 07:27
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from 751ad5b to b5dafd5 Compare November 5, 2026 07:27
Workflow code builds a handle on an existing Stream with the factory, from an id and a backend.
@moetemp
moetemp force-pushed the moe/up/field-flatten branch from b5dafd5 to 6c9b2f1 Compare November 5, 2026 22:22
@moetemp
moetemp force-pushed the moe/up/resource-factory branch from de23557 to 097799a Compare November 5, 2026 22:22
@moetemp

moetemp commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Replaced by temporalio#373.

@moetemp moetemp closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant