Skip to main content

protobuf-init

To install:

pip install protobuf-init

This package will create __init__.py files when compiling *.proto files. Optionally, it will create relative imports from generated *_pb.py, *_pb_grpc.py, and *_grpc.py files from protobuf, grpcio, and grpclib packages, respectively.

Using the protos folder of this project as an example, the following command will generate the contents of the example package, also in this project (assuming grpcio-tools is installed):

export PROTO_PATH=./protos
export GEN_PATH=.
python -m grpc_tools.protoc \
    --python_out=$GEN_PATH \
    --mypy_out=$GEN_PATH \
    --init_python_out=$GEN_PATH \
    --init_python_opt=imports=protobuf+grpcio+grpclib \
    --grpc_python_out=$GEN_PATH \
    --grpclib_python_out=$GEN_PATH \
    --proto_path=$PROTO_PATH 
    $(find $PROTO_PATH -name '*.proto')

The --init_python_out=$GEN_PATH flag indicates to call the plugin to create the init files.

The --init_python_opt=imports=protobuf+grpcio+grpclib indicates which relative imports to include in the init files. Allowed options are protobuf, grpcio, grpclib, separated by +. (Note that both grpcio and grpclib generate <ServiceName>Stub objects which would collide in the init file.)

Metadata

Release files for protobuf-init 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for protobuf-init 0.1.1
File Size Uploaded
protobuf-init-0.1.1.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for protobuf-init 0.1.1
File Interpreter ABI Platform
protobuf_init-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / protobuf-init-0.1.1.tar.gz

Download URL protobuf-init-0.1.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4569cb4c2cf9b2cf0a7c2d02cdf54603f0fda4869806ec5865a634447f7f09e9
BLAKE2b-256 checksum
How to use checksums
cdd70da53b9964274d90684600fffa67ca7408920ea696c5c4fca034569ceeb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.2 Darwin/20.1.0

Release files / protobuf_init-0.1.1-py3-none-any.whl

Download URL protobuf_init-0.1.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13cb263b178567b92592bf30836ea224811d83f07854adb01df2b2fefb54a13a
BLAKE2b-256 checksum
How to use checksums
07a056533d47dd0f6465a748b7a24f4a1c8700997790d918da774c77d4eed417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.2 Darwin/20.1.0

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page