Skip to content

Conversation

@zchee
Copy link
Member

@zchee zchee commented Jul 7, 2025

This pull request introduces significant enhancements to the Python code generation for the Connect RPC framework, focusing on supporting bidirectional streaming, improving code structure, and handling method options like idempotency. Below is a summary of the most important changes:

Enhancements to RPC Method Support:

  • Added support for BidirectionalStreaming RPC type in the generate function, including updates to the Method struct and handling in generated client and handler classes. [1] [2] [3] [4]

Improvements to Generated Code Structure:

  • Updated import statements in generated Python files to use grouped imports for better readability and maintainability. [1] [2]
  • Modified the handler class to use abc.ABCMeta as a metaclass and added context parameters to handler methods for better extensibility. [1] [2]

Handling of Method Options:

  • Incorporated logic to process MethodOptions in the generate function, including idempotency level checks, and merged them into client options in the generated code. [1] [2] [3]

Formatting and Code Generation:

  • Improved formatting of generated Python imports and method definitions to follow Python conventions, such as aligning multi-line imports and method calls. [1] [2] [3]

Version Update:

  • Updated the version of the protoc-gen-connect-python plugin in the generated files to reflect the latest changes.

These changes collectively enhance the usability, performance, and maintainability of the generated code for Connect RPC services.

@zchee zchee force-pushed the protc-gne-connect-idempotency_level branch 8 times, most recently from c5159ce to ce7302a Compare July 7, 2025 22:58
@zchee zchee force-pushed the protc-gne-connect-idempotency_level branch from ce7302a to 02ac7c4 Compare July 8, 2025 09:11
@zchee zchee force-pushed the protc-gne-connect-idempotency_level branch from 02ac7c4 to e6fd76c Compare July 8, 2025 09:12
@zchee zchee changed the title WIP cmd/protoc-gen-connect-python: follow connect-python APIs: 2025-07-08 Jul 8, 2025
@zchee zchee self-assigned this Jul 8, 2025
@zchee zchee marked this pull request as ready for review July 8, 2025 09:13
@zchee zchee requested a review from tsubakiky as a code owner July 8, 2025 09:13
@zchee zchee merged commit aa867cb into main Jul 9, 2025
4 checks passed
@zchee zchee deleted the protc-gne-connect-idempotency_level branch July 9, 2025 02:28
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.

2 participants