From the course: Effective Serialization with Python

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Generating serializers

Generating serializers

- [Instructor] To generate the Python code for the weather civilization, you will need the protoc compiler. Protoc is also available for many package managers, such as Homebrew, APT and others. You will need the protoc compiler for this step. If you don't have it, pause the video and install it. I'll wait. To check that you have a working protoc, write the following command in the terminal; protoc --version. I have version 3.11.4, but anything above three should work. To generate the Python bindings run protoc --python_out. And we say that we want the files generated in the current directory. And then the name of the proto file. If you look at what you have, we see now that we have weather_pb2.py generated. Let's have a look. So weather_pb2, this is typical of generated code. It's not readable, and it's not meant to be. In your workflow, you will generate weather_pb2.py every time weather.proto changes. However…

Contents