Rule | Description |
---|---|
py_proto_repositories | Load workspace dependencies. |
py_proto_compile | Generate python protobuf source files. |
Enable python support by loading the dependencies in your workspace.
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")
py_proto_repositories()
This is a thin wrapper over the
proto_compile rule having language
@org_pubref_rules_protobuf//python
.
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_compile")
py_proto_compile(
name = "protos",
protos = ["message.proto"],
with_grpc = True, # only one file is generated with or without grpc
)
$ bazel build :protos
Target //:protos up-to-date:
bazel-genfiles/message_pb2.py
Support for a library rule would be dependent on loading of pip dependencies (this does not exist in bazel ecosystem at the moment).