rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Have Gazelle generate `py_proto_library` targets

Open dougthor42 opened this issue 4 months ago • 0 comments

🚀 feature request

Relevant Rules

gazelle

Description

As far as I know, there is no gazelle support for making py_proto_library targets.

Describe the solution you'd like

gazelle_binary(
    name = "gazelle_multilang",
    languages = [
        "@rules_python_gazelle_plugin//python",
        "@rules_python_gazelle_plugin//python_proto",  // or something
        "@bazel_gazelle//language/proto",
    ],
    visibility = ["//visibility:public"],
)

Thoughts, notes, addendums, provisios, questions, etc.

  • #1703 mentions things a bit
  • Should this be part of rules_python_gazelle_plugin? Or part of bazel-contrib/bazel-gazelle? Or maybe protocolbuffers/protobuf given that the py_proto_library target is now maintained by them?
  • Separate "language" (as the above example) or just a directive such as # gazelle:python_proto_generation True?
  • Would we require people to also have gazelle generate the proto_library targets (like the example does) or no?
    • If yes, how do we ensure that the proto_library targets are made first?

As https://github.com/bazel-contrib/rules_python/issues/1703#issuecomment-1904913817 says: we'd basically just look at what bazel-gazelle does and copy that here, modulo some name changes.

Describe alternatives you've considered

Bespoke, artisanal, hand-crafted py_proto_library targets.

dougthor42 avatar Jun 16 '25 17:06 dougthor42