facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.53k stars 215 forks source link

Add an example of how to use grpc in Python #508

Open maryamb opened 10 months ago

maryamb commented 10 months ago

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?

ndmitchell commented 9 months ago

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.