Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Python Rules

Rule Description
py_proto_repositories Load workspace dependencies.
py_proto_compile Generate python protobuf source files.

python_proto_repositories

Enable python support by loading the dependencies in your workspace.

load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")
py_proto_repositories()

py_proto_compile

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

py_proto_library (not implemented)

Support for a library rule would be dependent on loading of pip dependencies (this does not exist in bazel ecosystem at the moment).