Skip to content

Conversation

@b-long
Copy link
Owner

@b-long b-long commented Dec 14, 2025

This pull request updates the Connect Python plugin integration and refines the way generated protobuf modules are imported and exposed in the package. The changes ensure compatibility with the latest connect-python naming conventions, improve dependency instructions, and add the generated Connect client code for the authorization service.

Connect Python plugin integration and naming updates:

  • Updated all references from protoc-gen-connect_python to the correct protoc-gen-connect-python naming in buf.gen.yaml and related scripts, ensuring consistency with the latest plugin naming conventions. [1] [2] [3] [4]
  • Improved dependency installation instructions to include both connect-python and protoc-gen-connect-python for generating Connect clients.

Generated Connect client code and import structure:

  • Added the generated authorization_connect.py file, providing both async and sync Connect client classes for the AuthorizationService (including service protocols and ASGI/WSGI application classes).
  • Updated the authorization module to expose the new Connect client classes via its __init__.py.
  • Changed the main __init__.py to import submodules like authorization, entityresolution, wellknownconfiguration, and policy lazily, avoiding import errors from missing generated protobuf files and only directly exposing stable modules in __all__.

BREAKING CHANGE: Upgrade from connect-python 0.4.2 to 0.6.0

The connect-python library underwent a major API change between versions
0.4.x and 0.6.0, requiring updates throughout the codebase.

Changes:
- Update dependencies: split connect-python[compiler] into separate packages
  - connect-python>=0.6.0,<0.7
  - protoc-gen-connect-python>=0.6.0,<0.7

- Fix binary name: protoc-gen-connect_python → protoc-gen-connect-python
  The new version uses hyphens instead of underscores in the binary name

- Regenerate proto files with new API
  - Deleted 15 old *_pb2_connect.py files
  - Generated 15 new *_connect.py files
  - Fixed imports to use relative paths

- Update SDK implementation (kas_connect_rpc_client.py)
  - Replace urllib3.PoolManager with httpx.Client
  - Use AccessServiceClientSync instead of AccessServiceClient
  - Update client instantiation: base_url and session parameters
  - Change extra_headers parameter to headers
  - Add proper context manager usage for HTTP clients

- Update test mocks (test_kas_client.py)
  - Patch httpx.Client instead of urllib3.PoolManager
  - Update mock setup for context managers
  - Fix import paths for new module structure

- Update proto module exports (kas/__init__.py)
  - Export AccessServiceClientSync instead of AsyncAccessServiceClient
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @b-long, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily updates the otdf-python-proto submodule to align with the latest connect-python library. This involves a significant refactoring of the generated RPC client code, moving to a new naming convention for service clients and updating related build scripts and dependencies. Additionally, the KAS client's underlying HTTP request mechanism has been modernized by switching from urllib3 to httpx, enhancing network communication capabilities and maintainability.

Highlights

  • Connect RPC Client Migration: The generated Connect RPC client files have been migrated from the older *_pb2_connect.py naming convention to the new *_connect.py format, reflecting updates in the connect-python library.
  • Dependency Updates: The connect-python dependency has been upgraded to 0.6.0 and protoc-gen-connect-python has been added to pyproject.toml to support the updated client generation.
  • HTTP Client Library Switch: The internal KAS client implementation now utilizes httpx instead of urllib3 for making HTTP requests, including changes to SSL verification handling, for a more modern and robust approach to network communication.
  • OTDF Python Proto Submodule Update: The otdf-python-proto submodule has been updated to its latest version, incorporating the aforementioned changes and ensuring compatibility with the latest protobuf and Connect RPC ecosystem.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@b-long
Copy link
Owner Author

b-long commented Dec 14, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully updates the otdf-python-proto submodule, primarily focusing on upgrading the connect-python dependency and its related tooling. The changes are comprehensive, including updates to the protobuf generation scripts, regeneration of client code, and necessary adaptations in the KAS client and its tests. The migration from urllib3 to httpx is a positive change, improving the HTTP client handling. The code modifications are consistent with the dependency upgrade and appear to be correct. I have no further suggestions.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the otdf-python-proto submodule, which involves upgrading connect-python and regenerating the protobuf client code. The changes correctly adapt the SDK to the new library version, including switching from urllib3 to httpx and updating client instantiation. The tests have also been updated accordingly. My main concern is that while the KAS service's __init__.py is updated to export the new client classes, other services' __init__.py files are not included in this PR. If they exist, they are likely broken by this change, preventing other services from being used. Additionally, there's an opportunity to improve performance by reusing httpx.Client instances across multiple requests.

@b-long
Copy link
Owner Author

b-long commented Dec 14, 2025

/gemini review

@b-long b-long requested a review from Copilot December 14, 2025 17:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the otdf-python-proto submodule to use the newer connect-python version 0.6.x, migrating from version 0.4.x. The update involves regenerating protobuf client code to use the new Connect RPC library API, which changes HTTP client handling from urllib3 to httpx, updates client class names, and modifies the parameter naming convention.

Key Changes:

  • Upgraded connect-python from 0.4.x to 0.6.x and added separate protoc-gen-connect-python dependency
  • Migrated HTTP client from urllib3.PoolManager to httpx.Client with lazy initialization and resource management
  • Updated Connect RPC client class names (e.g., AccessServiceClientAccessServiceClientSync)

Reviewed changes

Copilot reviewed 50 out of 52 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updated connect-python dependency versions and added protoc-gen-connect-python
src/otdf_python/kas_connect_rpc_client.py Migrated from urllib3 to httpx, added context manager support and lazy client initialization
src/otdf_python/kas_client.py Added context manager methods for proper resource cleanup
tests/test_kas_client.py Updated test mocks to reflect new httpx and AccessServiceClientSync usage
otdf-python-proto files Regenerated protobuf connect files with new connect-python 0.6.x tooling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the otdf-python-proto submodule, primarily to upgrade the connect-python dependency. The changes include regenerating the protobuf client files to align with the new version, which now uses httpx instead of urllib3. The client code in kas_client.py and kas_connect_rpc_client.py has been updated to support the new API, including adding context manager support for better resource management. The tests have also been updated accordingly. I've identified a potential resource leak issue in the backward-compatibility implementation and suggested a fix.

@b-long b-long changed the title chore(main): update otdf-python-proto submodule fix(main): update otdf-python-proto submodule Jan 7, 2026
@b-long b-long requested a review from Copilot January 7, 2026 01:01
@b-long
Copy link
Owner Author

b-long commented Jan 7, 2026

/gemini review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 51 out of 53 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the otdf-python-proto submodule, primarily to upgrade the connect-python dependency. The changes are extensive, touching generated protobuf client code, dependency specifications, and client implementation logic to adapt to the new connect-python API. The migration appears to be handled correctly, including updating package names, client instantiation, and method call signatures. A significant improvement is the introduction of context manager support for KASClient and KASConnectRPCClient, which ensures proper resource management of HTTP clients. The tests have also been updated accordingly to reflect these changes. Overall, this is a solid update that modernizes the RPC client implementation. I have one minor suggestion for improving code clarity.

@b-long b-long changed the title fix(main): update otdf-python-proto submodule fix(main): ensure compatibility with the latest connect-python Jan 7, 2026
@b-long b-long merged commit 4d160db into main Jan 7, 2026
10 checks passed
@b-long b-long deleted the chore/update-submodule branch January 7, 2026 01:31
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