Skip to main content

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

protobuf-grpc-distutils-0.1.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

protobuf_grpc_distutils-0.1.4-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file protobuf-grpc-distutils-0.1.4.tar.gz.

File metadata

File hashes

Hashes for protobuf-grpc-distutils-0.1.4.tar.gz
Algorithm Hash digest
SHA256 be24b371ec03d17b1626bced2ecba52c891ddc4dfa0f5490a7c39f0e7b391046
MD5 d3e0cc2eee15f6160fc93f66b1878a2d
BLAKE2b-256 3b801715fd092e94f1b411f15ddf35b071821f4535815f4399da0c7fe75fc3df

See more details on using hashes here.

File details

Details for the file protobuf_grpc_distutils-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for protobuf_grpc_distutils-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 beb96bebd016dc47576df8965043fa546b3d1eb7c5c3ab2af27538776798f7c3
MD5 2cda3b7bd1ae95486e809685c147db11
BLAKE2b-256 4bd8793303aaa14a7845e37489587dbd2eb424b15d374f9eebfa9fb0df44e236

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page