# protobuf_grpc_distutils
This package enables gRPC protobuf definitions to be installed via `pip install`. This project takes
inspiration from [protobuf-distutils](https://github.com/protocolbuffers/protobuf/tree/main/python/protobuf_distutils)
and [protobuf-custom-build](https://github.com/sbrother/protobuf-custom-build).
## Background
When trying to package the auto-generated protobuf Python files, you quickly run into an [issue](https://github.com/protocolbuffers/protobuf/issues/1491)
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.
Raw data
{
"_id": null,
"home_page": "",
"name": "protobuf-grpc-distutils",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "protobuf,grpc",
"author": "Shareef Jalloq",
"author_email": "shareef.jalloq@idexbiometrics.com",
"download_url": "https://files.pythonhosted.org/packages/58/20/20dd3621d6482f16db111d4a328cfdf583446c2de19283f842f4fab2b93a/protobuf-grpc-distutils-0.1.5.tar.gz",
"platform": null,
"description": "# protobuf_grpc_distutils\n\nThis package enables gRPC protobuf definitions to be installed via `pip install`. This project takes\ninspiration from [protobuf-distutils](https://github.com/protocolbuffers/protobuf/tree/main/python/protobuf_distutils)\nand [protobuf-custom-build](https://github.com/sbrother/protobuf-custom-build).\n\n## Background\n\nWhen trying to package the auto-generated protobuf Python files, you quickly run into an [issue](https://github.com/protocolbuffers/protobuf/issues/1491)\nregarding 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\nproto files are structured in a hierarchy that directly maps to your required Python package hierarchy. See the example below.\n\n## Usage\n\nIn 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\nto auto-generate the protobuf and gRPC Python modules when you `pip install` your package.\n\nThe difference to the `protobuf-distutils` package is that instead of looking for the `protoc` compiler, it depends on the `grpcio-tools` \npackage which provides `grpc_tools.protoc`. Otherwise, the same options are passed to the `generate_grpc_py_protobufs` method in your `setup.py`.\n\n```\nfrom setuptools import setup\nsetup(\n # ...\n name='example_project',\n\n # Require this package, but only for setup (not installation):\n setup_requires=['protobuf_grpc_distutils'],\n\n options={\n # See below for details.\n 'generate_grpc_py_protobufs': {\n 'source_dir': 'path/to/protos',\n 'extra_proto_paths': ['path/to/other/project/protos'],\n 'output_dir': 'path/to/project/sources', # default '.'\n 'proto_files': ['relative/path/to/just_this_file.proto'],\n },\n },\n)\n```\n\n## Example\n\nAn example project is provided at https://github.com/idex-biometrics/protobuf-grpc-distutils-example.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "",
"version": "0.1.5",
"split_keywords": [
"protobuf",
"grpc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5e7dcb881c199980cc3515c72e0aaade8897b9a4709366baff7f86a225e01689",
"md5": "95510ab01119dee755d8c5eaf4d45b72",
"sha256": "67a7fdace30c2dece27244a8bcf93b19fad4b54d6351148226ec8327bd18e0a4"
},
"downloads": -1,
"filename": "protobuf_grpc_distutils-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "95510ab01119dee755d8c5eaf4d45b72",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6301,
"upload_time": "2023-01-18T13:01:02",
"upload_time_iso_8601": "2023-01-18T13:01:02.765064Z",
"url": "https://files.pythonhosted.org/packages/5e/7d/cb881c199980cc3515c72e0aaade8897b9a4709366baff7f86a225e01689/protobuf_grpc_distutils-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "582020dd3621d6482f16db111d4a328cfdf583446c2de19283f842f4fab2b93a",
"md5": "f3d35bbc8165c867f56ad3fb993e3583",
"sha256": "0c1b680f4bc71e3cd87808384bb5010c4a9afb899956608979d0c524dd4e4bdd"
},
"downloads": -1,
"filename": "protobuf-grpc-distutils-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "f3d35bbc8165c867f56ad3fb993e3583",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5751,
"upload_time": "2023-01-18T13:01:03",
"upload_time_iso_8601": "2023-01-18T13:01:03.799574Z",
"url": "https://files.pythonhosted.org/packages/58/20/20dd3621d6482f16db111d4a328cfdf583446c2de19283f842f4fab2b93a/protobuf-grpc-distutils-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-18 13:01:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "protobuf-grpc-distutils"
}