grpc and python3

Saturday, March 5, 2022

I want to show the setup I am using to make use of grpc and python. This is the result of me learning the basics of how to do this. I did not find it easy to get going with grpc and python. I felt there are a dozen different ways of doing things, and that the documentation for doing this was too dense.

Without ado, here is the setup I think is easiest to use:

  1. Use the protoc compiler directly.
  2. Use the pure-python grpclib, asyncio-enabled, grpc library.

#1 can be installed via package managers. And #2 will be installed in a Python virtual environment. This results in a handful of dependencies but I've found this combination effective, and more minimal than other setup's that I tried. Also #2 looks quite well-maintained and designed (see it's overview documentation).

Here is a repo that I put together than contains some example code using these tools. Overall I'm quite intrigued grpc and I'm looking forward to learning more about it. Next up will be to write some more test interactions for the example "proto" files I'm using. I might try to simplify the build process with buf.build.