A very simple python grpc project example simulating a warehouse. We can manage the stock using product
API and place orders with order
API.
The project is separated into 3 independent modules each managed by poetry
:
-
grpc
- this is where thegrpc
protobuf definitions and python biding live. It's possible to build and publish it independently so consumers of the API can implement their own clients to the warehouse service -
service
- module contains a toy implementation ofgrpc
server hostingorder
andproduct
APIs implementations -
client
- an example of command line clients using thegrpc
python binding to interact with theserver
- Create virtual environment for the project with your favourite tool (ex.
pyenv
,conda
) - Install latest version of poetry
- Install invoke -
pip install invoke
- Run
inv init
to install the dependencies.
inv init --include-lock
upgrade all projects dependencies and regeneratepoetry
lock files.inv clean
cleanpython
cache/build and other miscellaneous filesinv protogen
generate pythongrpc
biddings from.proto
definitions fileinv test
runpytest
testsinv format
format projects code base withblack