A simple chat/messaging app demo using gRPC.
- Python>=3.12 installed
- Poetry installed
- Unix environment (need
curses
in Python)
- Install dependencies
poetry install --no-root
- Activate Poetry environment
eval $(poetry env activate)
- Add
src
to Python path (Change the path to yours)export PYTHONPATH=$PYTHONPATH:path/to/python-grpc-demo/src
- Start the server
python src/server/server.py
- Open another shell and repeat step 1~3, then start the client
python src/client/client.py
To generate a new version of protobuf code, setup the environment first:
poetry install --no-root --extras dev
eval $(poetry env activate)
Then, run the following command:
python scripts/generate.py
python-grpc-demo
├── protos/ # Protocol Buffers definition contents
├── scripts/ # useful commands
│ └── generate.py # generate Python codes from protos/
├── src/ # source code
│ ├── proto_gen/ # generated codes from protos/
│ ├── client/
│ └── server/
├── pyproject.toml # project and dependencies info and settings
└── ......
The app use SQLite to store data. If you want to clear the data, delete server.db
and client.db
.