<#20383 Support more Python Protobuf plugins> Issu...
# github-notifications
c
#20383 Support more Python Protobuf plugins Issue created by isra17 Is your feature request related to a problem? Please describe. The current python protobuf codegen backends allow pants to generate python stubs using
grpcio
. However, there are other available python package such as
grpclib
or
betterproto
that provides
protoc
plugins. Describe the solution you'd like It could be nice to be able to define the python plugin used to generate the python stubs. Maybe something like:
Copy code
protobuf_sources(
    name="protos",
    grpc=True,
    python_protoc_plugin="grpclib"
)
or maybe even make it a list so many protoc plugins can be registered:
Copy code
protobuf_sources(
    name="protos",
    grpc=True,
    python_protoc_plugins=["grpclib", "mypy-protobuf"]
)
I'm not very knowledgeable of pants internal, so I'm not sure if there would be a clean way to make this part extendable by new rules (using the enum system?). Additional context I have a basic working POC here: https://github.com/pantsbuild/pants/compare/main...isra17:pants:protobuf-grpclib?expand=1 Is that something you would want to see contribution for? If so, what about my current approach? If I add the tests, would you take this? pantsbuild/pants