From the course: gRPC in Python
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Compiling .proto to Python
From the course: gRPC in Python
Compiling .proto to Python
- [Instructor] Once we wrote our protocol buffer's definition file, we can compile it into Python. To do that, we need the Protobuf compiler. You can either download it from the release version or use a package manager, such as Brew, APT or Choco. To make sure it's installed, you can run protoc --version. I have version 3.19.4, and now I can do protoc, and I'm going to tell it, generate Python file. So Python out equal dot, meaning the current directory and our rides.proto file. Nothing happens, but if you look, now we have rides.pb2. Let's have a look at it. So I can open rides.pb2. And you see, this is saying, generated by protocol buffers, do not edit, which means you shouldn't read that. And actually the code here is unreadable for humans and the do not edit comment also have a meaning that most of the leaders will not try to check this file, if there are any style or other code errors in it.