No project description provided
Project description
pyprotogen
Lib for generation *_pb2.py from *.proto with helper methods
Installation
pip install pyprotogen
Usage
Generation
pyprotogen path/to/input/hello.proto path/to/output/
Generate as python-package
pyprotogen path/to/input/hello.proto path/to/package/output --package-version=0.0.1 --package-authors="Rick, Morty" --name="Package"
--name
— optional;--package-version
— required;--package-authors
— optional;path/to/package/output
— path to the directory where package will be saved.
Usage
- As client
from package.client import get_channel from package.gen.hello_pb2_grpc import HelloStub channel = get_channel(host="your.host") stub = HelloStub(channel)
- As server
from package.server import get_server from package.gen.hello_pb2_grpc import add_HelloServicer_to_server from package.gen.hello_pb2_grpc import HelloServicer class Hello(HelloServicer): pass server = get_server() add_HelloServicer_to_server(Hello(), server) server.add_insecure_port('[::]:50051') server.start() server.wait_for_termination()
Development
- Activate environment
rm -rf .venv || true python3 -m venv .venv source .venv/bin/activate make requirements
- Make changes
- Execute
make test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyprotogen-0.0.5.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for pyprotogen-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 961d0f1a889f50d4eed74f9e99c9e17641200d45ad8a09afe3d0f18feef3eee8 |
|
MD5 | d3d477143d1cda66b79aec7864315407 |
|
BLAKE2b-256 | bc22203f26b02be238de495f2abd2178e05add1a41a57597cc988f183139f613 |