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.22.tar.gz
(6.5 kB
view details)
Built Distribution
File details
Details for the file pyprotogen-0.0.22.tar.gz
.
File metadata
- Download URL: pyprotogen-0.0.22.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7502a5f846203f3aba8d905bf61c15b238156a92867bc26d362149fa7be01614 |
|
MD5 | 9c88c7fe19b508510ee6c0a187bbf27c |
|
BLAKE2b-256 | 57e5c58e5bd3c8bcd7071fb1dc42833f04fd8b234fc1c3b7252cee14b897ac14 |
File details
Details for the file pyprotogen-0.0.22-py3-none-any.whl
.
File metadata
- Download URL: pyprotogen-0.0.22-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40f0c625def240ae86905dde2bfc53f5697940fb297d26f2e5f7a91c7e036057 |
|
MD5 | 5e12e221f9f022010172c89ad9eeadb9 |
|
BLAKE2b-256 | 1ce90db2c8cde7b71afc70e9034168a268e4c3406e7d0c0a93dfe7564246768f |