Skip to main content

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


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.23.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyprotogen-0.0.23-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file pyprotogen-0.0.23.tar.gz.

File metadata

  • Download URL: pyprotogen-0.0.23.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for pyprotogen-0.0.23.tar.gz
Algorithm Hash digest
SHA256 719be605a2f10c65866716eea71d2dd9b3a94701fba368b0c975544f9f6f9241
MD5 e77052da26a1f851b9775dcd8bc11b6c
BLAKE2b-256 4628c4dc5a6d7e68d41451c5ae0d9429be67dd376be73c34d24699ede975899b

See more details on using hashes here.

File details

Details for the file pyprotogen-0.0.23-py3-none-any.whl.

File metadata

  • Download URL: pyprotogen-0.0.23-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for pyprotogen-0.0.23-py3-none-any.whl
Algorithm Hash digest
SHA256 d0753ce45b356b7a6c57b6c501bc24dc6f3244e7f7c166d52754c970da53fe28
MD5 47f202a443acb55b6125b68be4a6a25b
BLAKE2b-256 c06e81e335abdab156094bca105e199221a48b0c27ddd26a46a5bd365a284006

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page