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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyprotogen-0.0.24.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.24.tar.gz
Algorithm Hash digest
SHA256 a0b04b707c3b1ced083b8cb0a2b21508904974deba8ae4dc9dde327f0d413d96
MD5 6e998364c3baad4cf7895e58fbc3c1b7
BLAKE2b-256 26eef459a8badfb3512224f5daa6ccbb1389fadf90b5b98efc381e971e7a1c28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyprotogen-0.0.24-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.24-py3-none-any.whl
Algorithm Hash digest
SHA256 c549572fa65e3246850a01a890a13e83ae8a79655cde6f68bbeb4be423e5ee9e
MD5 ce0d449767ace3a176fb34846aa7f95d
BLAKE2b-256 f3526162a1da5208249c9ce6e020814af2c71aea9b12bca9df18daffbd23b456

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