Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Latest commit

 

History

History
 
 

python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

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).