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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyprotogen-0.0.27.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.27.tar.gz
Algorithm Hash digest
SHA256 0406c637f5f5a60f3eb54723fd76e602ff4b15bf974e85792fc750b7d9b5861e
MD5 cf0b56091a9c2dac645f1c94a30a7370
BLAKE2b-256 60ea5e8ff2698ece7bbc01e67f990ed1af5f0135b1d9af124a28af504903adfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyprotogen-0.0.27-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.27-py3-none-any.whl
Algorithm Hash digest
SHA256 852d36aa6f51255e15bed8e9b6cd32a5d72c9d74bc692766aa9605a2f5b4f4b9
MD5 1ed1a8925f7402d9cf46abc9a420508f
BLAKE2b-256 1f945e742e0439ab59edfe71eb075d6a511584fb847c948a35be13a61c88bb72

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