Skip to content

feat(gazelle): python_proto_naming_convention directive controls py_proto_library naming #3093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

shaldengeki
Copy link
Contributor

@shaldengeki shaldengeki commented Jul 15, 2025

Closes #3081.

This adds support in the Gazelle plugin for controlling how the generated py_proto_library rules are named; support for these was originally added in #3057. We do this via a new Gazelle directive, python_proto_naming_convention, which is similar to python_library_naming_convention and the like, except it interpolates $proto_name$, which is the proto_library rule minus any trailing _proto. We default to $proto_name$_py_pb2.

For instance, for a proto_library named foo_proto, the default value would generate foo_py_pb2, aligning with the convention stated in the Bazel docs.

Copy link
Collaborator

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

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

Nice! I tested this on our monorepo and generated 227 py_proto_library targets. Hot damn!

There are a variety of nits and requests but otherwise this is looking great, thanks!

@shaldengeki shaldengeki requested a review from dougthor42 July 15, 2025 06:04
Copy link
Collaborator

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

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

🚀

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.

Gazelle plugin should have a configurable naming convention for py_proto_library targets
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy