Open hhstore opened 6 years ago
官方教程: https://developers.google.com/protocol-buffers/docs/pythontutorial
示例: https://github.com/protocolbuffers/protobuf/tree/master/examples#python
proto3: https://developers.google.com/protocol-buffers/docs/proto3
示例 proto 定义: https://github.com/protocolbuffers/protobuf/blob/master/examples/addressbook.proto
# 官方:
pip install protobuf
protoc --version
## 编译:
protoc -I = $ SRC_DIR --python_out = $ DST_DIR $ SRC_DIR / addressbook.proto
protoc --go_out=. *.proto
pip install grpcio
pip install grpcio-tools
pip install googleapis-common-protos
# 编译 bp + grpc:
# gen all:
gen-gpc-pb-all:
python -m grpc_tools.protoc \
--proto_path=./backend/protos \
--python_out=./backend/protos \
--grpc_python_out=./backend/protos \
./backend/protos/*.proto
# gen:
python -m grpc_tools.protoc \
--proto_path=. \
--python_out=. \
--grpc_python_out=. \
*.proto
protoc --go_out=. *.proto
protobuf:
官方:
ref:
gRPC:
官方: