A minimal example for demonstrating gRPC in Python
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE Initial commit Sep 25, 2017
README.md
calculator.proto
calculator.py
calculator_pb2.py
calculator_pb2_grpc.py
client.py Initial commit Sep 25, 2017
requirements.txt Initial commit Sep 25, 2017
server.py Initial commit Sep 25, 2017

README.md

Basic gRPC in Python

Contains a minimal working example for rolling gRPC in Python.

For more details, read the accompanying blog post.

Quickstart

git clone https://github.com/ramananbalakrishnan/basic-grpc-python
cd basic-grpc-python
pip install -r requirements.txt
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. calculator.proto
python server.py
python client.py

File reference

basic-grpc-python/
├── calculator.py          # module containing a function
|
├── calculator.proto       # protobuf definition file
|
├── calculator_pb2_grpc.py # generated class for server/client
├── calculator_pb2.py      # generated class for message
|
├── server.py              # a server to expose the function
└── client.py              # a sample client