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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyprotogen-0.0.26.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.26.tar.gz
Algorithm Hash digest
SHA256 098121696bedd0b9f3e2f09cd8074db86f592d2c93505a701caabe66382146cb
MD5 5936b7ab9a38410fc02a1b6948f74e86
BLAKE2b-256 ae29cf647e28b61b2230d267f49046848578fbcd9920878f21f5ab8c34416b29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyprotogen-0.0.26-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.26-py3-none-any.whl
Algorithm Hash digest
SHA256 dc563b4d4ac7c159119dab1f4ff8ba72062d88f2ece89376209684a52a58ce72
MD5 f64e172e75ab999debf32807f100d784
BLAKE2b-256 11a4720e086a84a8b375eb3116174b854eb73beaccd71e095d8feb0bb04cb023

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