Skip to content

Conversation

@vinoo999
Copy link

@vinoo999 vinoo999 commented Oct 24, 2025

Description

This introduces a proto extra into the package. The core library itself has no direct dependency on protobuf and only rest server and clients require a2a. google-api-core is only a dependency for grpc. Refactor accordingly to reduce dependency mangling introduced by proto for non grpc/rest servers. Assuming a CI regenerates the uv.lock file but can regenerate it otherwise.

This does not follow the runtime validation pattern in #217 as proto dependencies are localized in proto_utils.py.

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)
  • Appropriate docs were updated (if necessary)

@vinoo999 vinoo999 requested a review from a team as a code owner October 24, 2025 18:17
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vinoo999, 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 significantly refactors the project's dependency management by isolating protobuf-related packages into a new proto optional dependency. The primary goal is to reduce the core library's dependency footprint, ensuring that protobuf and google-api-core are only installed when explicitly required by components such as gRPC or REST servers. This change prevents unnecessary dependency conflicts and streamlines installations for users who do not utilize protobuf-dependent features, leading to a more modular and efficient dependency structure.

Highlights

  • Dependency Refactoring: The core package dependencies have been streamlined by removing protobuf and google-api-core from the main dependencies list in pyproject.toml.
  • New proto Optional Dependency: A new optional dependency, proto, has been introduced to encapsulate protobuf requirements, allowing for more granular installation.
  • Updated Server Dependencies: The grpc and rest-server optional dependencies now explicitly require the new proto extra, ensuring protobuf-related packages are only installed when needed by these components. A new jsonrpc-server extra was also added, and http-server now depends on jsonrpc-server and rest-server.
  • Dynamic Protobuf Imports: The src/a2a/utils/proto_utils.py file has been updated to handle google.protobuf imports dynamically, providing a clear ImportError message that guides users to install the proto extra if the dependency is missing.
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.

@vinoo999 vinoo999 changed the title refactor: Separate protobuf dependencies into sensible extras feat: Separate protobuf dependencies into sensible extras Oct 24, 2025
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 effectively refactors the project's dependencies by separating protobuf into an optional [proto] extra. This is a great improvement for users who don't need Protobuf-related functionality, reducing the core dependency footprint. The changes in pyproject.toml correctly move the dependencies, and the try-except block in proto_utils.py provides a clear error message for missing optional dependencies. I have one suggestion in pyproject.toml to further improve the structure and maintainability of the optional dependencies for server implementations.

vinoo999 and others added 3 commits October 24, 2025 14:28
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

[project.optional-dependencies]
http-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"]
proto = ["protobuf>=5.29.5"]
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure protobuf really needs to be a separate dependency group from grpc

Copy link
Author

Choose a reason for hiding this comment

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

can remove the extra altogether if you want to be explicit for the REST and gRPC servers. My goal was removing protobuf dependencies especially for JSON-RPC servers + clients.

If you prefer can do:

jsonrpc-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"]
http-server = ["a2a-sdk[jsonrpc-server]", "protobuf>=5.29.5"]
grpc = ["grpcio>=1.60", "grpcio-tools>=1.60", "grpcio_reflection>=1.7.0", "google-api-core>=1.26.0", "protobuf>=5.29.5"]

Copy link
Author

Choose a reason for hiding this comment

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

http-server is a bit confusing naming of the extra now that JSON-RPC is split out but needed for backward compatibility

@holtskinner holtskinner changed the title feat: Separate protobuf dependencies into sensible extras refactor: Separate protobuf dependencies into sensible extras Oct 27, 2025
Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
@holtskinner
Copy link
Member

@pstephengoogle Can you review and make sure this follows with current plans for the protocol?

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.

3 participants