blob: b55d2162b6e73214ab2008e107ae2f818378fbe4 [file]
load("//python:python_grpc_compile.bzl", "python_grpc_compile")
load("@rules_python//python:defs.bzl", "py_library")
def python_grpc_library(**kwargs):
# Compile protos
name_pb = kwargs.get("name") + "_pb"
python_grpc_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
)
# Create python library
py_library(
name = kwargs.get("name"),
srcs = [name_pb],
deps = GRPC_DEPS,
imports = [name_pb],
visibility = kwargs.get("visibility"),
tags = kwargs.get("tags"),
)
GRPC_DEPS = [
"@com_google_protobuf//:protobuf_python",
"@com_github_grpc_grpc//src/python/grpcio/grpc:grpcio",
]