FunkySayu
FunkySayu

Reputation: 8061

Embed Python's grpcio module into a Bazel project

I tried several different ways to embed the Python grpcio module into my Bazel project but unfortunately, none of them works correctly.

As far as I know, Bazel does not support injection of plugins into the Python environment (so you can directly run import grpcio). Note that Bazel does not support virtual-env and other tools (buildout...).

I found a way to include Pypi packages thanks to this proof of concept but unfortunately it does not work for grpc.io (environment variables are missing).

I am trying to debug the plugin, but I wonder if there is a better way to include grpcio module since the code is based on Bazel?

Upvotes: 5

Views: 864

Answers (1)

Jakob Buchgraber
Jakob Buchgraber

Reputation: 21

As Nathaniel mentioned in the comments, bazel support for gRPC Python is still work in progress.

However, pubref https://github.com/pubref/rules_protobuf offers rules for bazel that support gRPC for all languages (including Python). I have used them for Java and they worked very well.

There is also a gRPC blog post about those rules: http://www.grpc.io/blog/bazel_rules_protobuf

Upvotes: 1

Related Questions