Update Protocol Specification¶
For developers who want to change the protobuf specification, one needs to first edit jina/proto/jina.proto
and then use jina/proto/build-proto.sh
to regenerate the python interfaces (i.e. jina/proto/jina_pb2.py
and jina/proto/jina_pb2_grpc.py
).
Note
Starting 0.7.5, we provide a Docker image for you to generate Protobuf interface in the containerized environment. That means you don’t need to config the build protobuf/grpc environment locally. Simply use docker run -v $(pwd)/jina/proto:/jina/proto jinaai/protogen where $(pwd)
is your Jina repository root.
Take MacOS as an example,
Download
protoc-$VERSION-$PLATFORM.zip
from the official Github site and decompress it.Copy the binary file and include to your system path:
cp ~/Downloads/protoc-3.7.1-osx-x86_64/bin/protoc /usr/local/bin/ cp -r ~/Downloads/protoc-3.7.1-osx-x86_64/include/* /usr/local/include/
Install gRPC tools dependencies:
brew install automake autoconf libtool
Install gRPC and
grpc_python_plugin
from the source:git clone https://github.com/grpc/grpc.git git submodule update --init make grpc_python_plugin
This will compile the grpc-python-plugin and build it to, e.g.,
~/Documents/grpc/bins/opt/grpc_python_plugin
Generate the python interfaces.
cd jina/proto bash build-proto.sh ~/Documents/grpc/bins/opt/grpc_python_plugin