Skip to main content

Generate Python MyPy stub modules from protobuf files.

Project description

pyprotostuben

Latest Version Python Supported Versions MyPy Strict Test Coverage Downloads GitHub stars

Generate Python modules from protobuf files.

usage

pypi package

install with your favorite python package manager

pip install pyprotostuben

Then use protoc plugins to generate python code. See greeting examples for more info.

protoc plugins

protoc-gen-mypy-stub

Generates python stubs (*_pb2.pyi & *_pb2_grpc.pyi files which then used by MyPy type checker / IDE syntax highlits & suggestions).

features:

  • choose message structure immutability / mutability
  • choose async / sync grpc module stubs
  • grpc servicer abstract methods have full signature (with appropriate type args in generics), thus it is easier to implement methods in IDE

plugin options:

  • message-mutable -- add setters for fields, use mutable containers
  • message-all-init-args-optional -- each field is optional in message constructor (even if field is not optional)
  • grpc-sync -- use sync grpc stubs instead of grpc.aio module and async defs
  • grpc-skip-servicer -- don't generate code for servicers
  • grpc-skip-stub -- don't generate code for stubs
  • no-parallel -- disable multiprocessing
  • debug -- turn on plugin debugging

protoc-gen-brokrpc

Generates *_brokrpc.py modules for BrokRPC framework. This is similar to gRPC codegen (*_pb2_grpc.py modules).

plugin options:

  • no-parallel -- disable multiprocessing
  • debug -- turn on plugin debugging

protoc-gen-echo

Saves protoc plugin input to a file. Helps develop protoc plugins.

plugin options:

  • format={raw|binary|json} (default = raw) -- specify output format
  • dest={path} (default = request.json) -- specify file destination

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

pyprotostuben-0.3.3.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

pyprotostuben-0.3.3-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file pyprotostuben-0.3.3.tar.gz.

File metadata

  • Download URL: pyprotostuben-0.3.3.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyprotostuben-0.3.3.tar.gz
Algorithm Hash digest
SHA256 6854692027c48f10c77659c547d7a3de1d500cd2205a0f8c7d688b2114464336
MD5 1a200fd20659b306c1af0baa1a354e30
BLAKE2b-256 ae75d968ef2c415a56b4dddd97936a44f77827d1ddd5abbb150f837e7f3ea420

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyprotostuben-0.3.3.tar.gz:

Publisher: publish.yaml on zerlok/pyprotostuben

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyprotostuben-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: pyprotostuben-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyprotostuben-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8cbbc8c0d0b980ed5f56ab39555ab16d252007a8e55ea615c27b8421c35ef4d4
MD5 23a8791e95bec2978c677326e55e6482
BLAKE2b-256 ee4f976c3fa54fb6d272e2573397d3b1f220762383197385ba00a3e2a0a03964

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyprotostuben-0.3.3-py3-none-any.whl:

Publisher: publish.yaml on zerlok/pyprotostuben

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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