Skip to content

[grpc] Auto-generate protobuf files during wheel build#16409

Merged
slin1237 merged 1 commit intomainfrom
protobuf
Jan 8, 2026
Merged

[grpc] Auto-generate protobuf files during wheel build#16409
slin1237 merged 1 commit intomainfrom
protobuf

Conversation

@CatherineSue
Copy link
Collaborator

@CatherineSue CatherineSue commented Jan 4, 2026

  • Add setup.py with custom build hooks (build_py, develop, egg_info) to compile .proto files automatically during install
  • Add grpcio-tools to build-system.requires in pyproject.toml
  • Remove pre-generated protobuf files from version control
  • Add generated *_pb2.py, *_pb2_grpc.py, *_pb2.pyi to .gitignore

This eliminates the need to manually run compile_proto.py. The protobuf files are now generated at build time for both regular and editable installs.

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments (/tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci) or contact authorized users to do so.
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Jan 4, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CatherineSue, 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 improves the development workflow by automating the generation of gRPC/protobuf Python files. Previously, developers had to manually run a script to compile these files. Now, the build system handles this automatically during package installation or development setup, streamlining the process and reducing potential for errors or outdated generated code. This change simplifies dependency management and ensures that the generated files are always up-to-date with the .proto definitions.

Highlights

  • Automated Protobuf Generation: The pull request introduces automated generation of gRPC/protobuf Python files during the wheel build and editable install processes, eliminating the need for manual compilation.
  • Build System Integration: A new setup.py file is added with custom setuptools hooks (build_py, develop, egg_info) to trigger the protobuf compilation automatically.
  • Dependency Management: grpcio-tools has been added to build-system.requires in pyproject.toml to ensure the necessary tools are available for protobuf compilation.
  • Version Control Cleanup: Pre-generated protobuf files are removed from version control and added to .gitignore, ensuring that only the .proto source files are tracked.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

@CatherineSue
Copy link
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions bot added the run-ci label Jan 4, 2026
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 introduces a new build system to automatically generate Python protobuf and gRPC files from sglang_scheduler.proto during package installation or development. This is accomplished by adding grpcio-tools as a build dependency in pyproject.toml and implementing a custom setup.py that hooks into setuptools commands (build_py, develop, egg_info) to compile the .proto file and fix generated import paths. Consequently, the previously checked-in generated files (sglang_scheduler_pb2.py, sglang_scheduler_pb2_grpc.py, and their type stubs) are removed from the repository and added to .gitignore. Review feedback suggests improving the robustness of the subprocess.run command construction by passing arguments as a list instead of a shlex.split string, and removing a misleading FileNotFoundError exception handler in setup.py as grpcio-tools issues are already covered by the command's exit code check.

@slin1237
Copy link
Collaborator

slin1237 commented Jan 5, 2026

/rerun-failed-ci

- Add setup.py with custom build hooks (build_py, develop, egg_info)
  to compile .proto files automatically during install
- Add grpcio-tools to build-system.requires in pyproject.toml
- Remove pre-generated protobuf files from version control
- Add generated *_pb2.py, *_pb2_grpc.py, *_pb2.pyi to .gitignore

This follows the pattern used by vllm-tgis-adapter and eliminates
the need to manually run compile_proto.py. The protobuf files are
now generated at build time for both regular and editable installs.
@slin1237 slin1237 merged commit 1688023 into main Jan 8, 2026
72 of 97 checks passed
@slin1237 slin1237 deleted the protobuf branch January 8, 2026 17:09
michaelzhang-ai added a commit to michaelzhang-ai/sglang that referenced this pull request Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments