No project description provided
Project description
protobuf_grpc_distutils
This package enables gRPC protobuf definitions to be installed via pip install
. This project takes
inspiration from protobuf-distutils
and protobuf-custom-build.
Background
When trying to package the auto-generated protobuf Python files, you quickly run into an issue regarding how the Python modules are imported. There are various ways to work around the issue as detailed in that thread. This package assumes that the proto files are structured in a hierarchy that directly maps to your required Python package hierarchy. See the example below.
Usage
In order to use this package, it must be added to the build requirements of your target Python package. A custom build step can then be added
to auto-generate the protobuf and gRPC Python modules when you pip install
your package.
The difference to the protobuf-distutils
package is that instead of looking for the protoc
compiler, it depends on the grpcio-tools
package which provides grpc_tools.protoc
. Otherwise, the same options are passed to the generate_grpc_py_protobufs
method in your setup.py
.
from setuptools import setup
setup(
# ...
name='example_project',
# Require this package, but only for setup (not installation):
setup_requires=['protobuf_grpc_distutils'],
options={
# See below for details.
'generate_grpc_py_protobufs': {
'source_dir': 'path/to/protos',
'extra_proto_paths': ['path/to/other/project/protos'],
'output_dir': 'path/to/project/sources', # default '.'
'proto_files': ['relative/path/to/just_this_file.proto'],
},
},
)
Example
An example project is provided at https://github.com/idex-biometrics/protobuf-grpc-distutils-example.
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
Built Distribution
File details
Details for the file protobuf-grpc-distutils-0.1.2.tar.gz
.
File metadata
- Download URL: protobuf-grpc-distutils-0.1.2.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 723ed45c5aebedfeac94a7f22d0533af61544d89ea06a92ff5530a544503a9fd |
|
MD5 | 84ee9962b9a9a7cf72923ceaab174afb |
|
BLAKE2b-256 | e042ed845bab76de947a3f2cebf0248d95938ee504ce9ceb9f51b254bf8eab6f |
File details
Details for the file protobuf_grpc_distutils-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: protobuf_grpc_distutils-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e73ee9a3c2e0749213779226a6a60fc6c78bce2c8bc0fa9462a6118f1d9be26f |
|
MD5 | 1595fb2beb68d9840a7db721d3870924 |
|
BLAKE2b-256 | 92d2edff017e737292f18c2d5404dda9c83c19650ec9f7e0aeb9277902dd3969 |