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.25.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.25-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyprotogen-0.0.25.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.25.tar.gz
Algorithm Hash digest
SHA256 bbcf1fe9bce3e562fbaecb80bbf5baa77981d72a910d8399b32e07e0f2a6f9d9
MD5 1e10b944510365421489fc70c2e7a67b
BLAKE2b-256 dc12decf3b964b440582dfd983588cdf0b7e80d949c48e1c5f056fef7bba2aa2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyprotogen-0.0.25-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.25-py3-none-any.whl
Algorithm Hash digest
SHA256 24017cbcf31c9124a3dddc17eb326f2b7e50771829c2535a509c891b715b9599
MD5 d6783bf8d0b9cf5c31ceaf745f13bb47
BLAKE2b-256 c5a15d403166642ad6ca058d374d7e3699aea3b7f7eddf85862e111971d25e76

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