buck2 icon indicating copy to clipboard operation
buck2 copied to clipboard

Add an example of how to use grpc in Python

Open maryamb opened this issue 2 years ago • 1 comments

Are there already rules for building grpc artifacts in Python? I could see some for rust but none for Python. If the related rules already exist, can you add some examples of how to use them (for Python). If not, can you sketch how we can make such rules?

maryamb avatar Nov 28 '23 04:11 maryamb

https://github.com/facebook/buck2/blob/6b06646a36b0ac8b33378fd4103e461e2cec20ba/proto_defs.bzl#L13 is probably a reasonable start. Note that we defined a macro that just internally uses genrule to run the protobuf compiler. I'd figure out what command lines you need to convert proto files into Python files, code it up as a genrule, and then depend on the outputs as the Python.

We should probably have first-class proto rules in Buck2 one day, but no one has got around to that yet.

ndmitchell avatar Dec 17 '23 20:12 ndmitchell