Skip to content

Conversation

VegetarianOrc
Copy link

What was changed

This PR adds code generation of the RPC call wrapper in the bridge client to ensure ease the maintenance of manually updating the methods when core has a proto update. This generation has been added to the end of the gen_protos_docker script.

Some changes were included to make the generation possible:

  1. To eliminate a code generation path, the rpc_call and rpc_call_on_trait macros have been refactored to only include an exported macro named rpc_call that uses the fully qualified call syntax that was previously in the body of rpc_call_on_trait.
  2. The multiple-pymethods feature of PyO3 was enabled to allow the ClientRef impl to be split into two modules.
  3. The visibility of some elements of client module was elevated to pub(crate) for referencing from the client_rpc_generated module.

Why?

This allows us to easily keep the bridge client up to date with the RPC methods exposed via core.

Checklist

  1. Closes [Bug] Batch operation feature in the Temporal Python SDK doesn't work #927

  2. How was this tested:

The generated client was tested against the existing test suite and used to ensure the repro described in #927 correctly functions against a Temporal dev server.

  1. Any docs updates needed?

@VegetarianOrc VegetarianOrc requested a review from a team as a code owner September 25, 2025 21:27
@CLAassistant
Copy link

CLAassistant commented Sep 25, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might also want to generate all of that mess in temporalio/service.py. Off the top of my head, what I would suggest is to generate some file at temporalio/bridge/client_generated.py.

Could do the simple way of just having an init_workflow_service_client_calls(client: ServiceClient) that just does what it does today which is makes a _new_call for each known service name. Alternatively, a cleaner approach may be to just move the WorkflowService (and operator and cloud equivalents) to this generated file and have explicit methods created for each call that do as expected and then alias the service class publicly (or have the public WorkflowService class extend the internal/bridge form).

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.

[Bug] Batch operation feature in the Temporal Python SDK doesn't work
3 participants