# protobuf support for setuptools
Plugin for `setuptools` that adds support for compiling protobuf files.
## Dependencies
The plugin requires the external ``protoc`` executable that is part of the
[protobuf project](https://github.com/protocolbuffers/protobuf) to be present.
On Debian systems, this executable is shipped in the ``protobuf-compiler`` package.
If the ``protoc_version`` option is specified, the specified version of protoc
will be downloaded from github. When it is not specified, a ``protoc`` binary is
expected to be present in the environment. You can override the binary with the
PROTOC environment variable.
Optionally, it can also generate typing hints if the ``mypy`` extra is selected.
There is no separate ``install_proto`` command; generated files (e.g. \_pb2.py
files) are placed in the source tree and expected to be installed by other
install commands.
## Usage
You can configure `setuptools-protobuf` in either `setup.py`, `setup.cfg` or `pyproject.toml`.
### setup.py
```python
from setuptools_protobuf import Protobuf
setup(
...
setup_requires=['setuptools-protobuf'],
protobufs=[Protobuf('example/foo.proto')],
)
```
### setup.cfg
```ini
...
[options]
setup_requires =
setuptools
setuptools-protobuf
```
### pyproject.toml
```toml
[build-system]
requires = ["setuptools", "setuptools-protobuf"]
[tool.setuptools-protobuf]
protobufs = ["example/foo.proto"]
# Require the generation of typing hints:
mypy = true
# Optionally, set the specific protoc version to use:
protoc_version = '25.1'
```
## GitHub actions
To install protoc in a GitHub action, you can use the
[setup-protoc](https://github.com/arduino/setup-protoc) action:
```yaml
- name: Install Protoc
uses: arduino/setup-protoc@v2
```
Raw data
{
"_id": null,
"home_page": null,
"name": "setuptools-protobuf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "distutils, setuptools, protobuf",
"author": null,
"author_email": "Jelmer Vernoo\u0133 <jelmer@jelmer.uk>",
"download_url": "https://files.pythonhosted.org/packages/c9/73/6884cd49335fafad24014199c0d2717f7e7731f29f84d681ea7a07c5f41f/setuptools_protobuf-0.1.13.tar.gz",
"platform": null,
"description": "# protobuf support for setuptools\n\nPlugin for `setuptools` that adds support for compiling protobuf files.\n\n## Dependencies\n\nThe plugin requires the external ``protoc`` executable that is part of the\n[protobuf project](https://github.com/protocolbuffers/protobuf) to be present.\nOn Debian systems, this executable is shipped in the ``protobuf-compiler`` package.\n\nIf the ``protoc_version`` option is specified, the specified version of protoc\nwill be downloaded from github. When it is not specified, a ``protoc`` binary is\nexpected to be present in the environment. You can override the binary with the\nPROTOC environment variable.\n\nOptionally, it can also generate typing hints if the ``mypy`` extra is selected.\n\nThere is no separate ``install_proto`` command; generated files (e.g. \\_pb2.py\nfiles) are placed in the source tree and expected to be installed by other\ninstall commands.\n\n## Usage\n\nYou can configure `setuptools-protobuf` in either `setup.py`, `setup.cfg` or `pyproject.toml`.\n\n### setup.py\n\n```python\nfrom setuptools_protobuf import Protobuf\n\nsetup(\n...\n setup_requires=['setuptools-protobuf'],\n protobufs=[Protobuf('example/foo.proto')],\n)\n```\n\n### setup.cfg\n\n```ini\n...\n\n[options]\nsetup_requires =\n setuptools\n setuptools-protobuf\n```\n\n### pyproject.toml\n\n```toml\n[build-system]\nrequires = [\"setuptools\", \"setuptools-protobuf\"]\n\n[tool.setuptools-protobuf]\nprotobufs = [\"example/foo.proto\"]\n\n# Require the generation of typing hints:\nmypy = true\n\n# Optionally, set the specific protoc version to use:\nprotoc_version = '25.1'\n```\n\n## GitHub actions\n\nTo install protoc in a GitHub action, you can use the\n[setup-protoc](https://github.com/arduino/setup-protoc) action:\n\n```yaml\n- name: Install Protoc\n uses: arduino/setup-protoc@v2\n```\n",
"bugtrack_url": null,
"license": "Apachev2",
"summary": "Setuptools protobuf extension plugin",
"version": "0.1.13",
"project_urls": {
"homepage": "https://github.com/jelmer/setuptools-protobuf"
},
"split_keywords": [
"distutils",
" setuptools",
" protobuf"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7047709c75e41299e65b3a7e27a898001af4b82e543a33b35c258d8e6dd953ab",
"md5": "54977324933969f16e4360f8b5e2ce07",
"sha256": "33bd45efc152eb38a7cb02e2e6d88488d3a8ccea654e9e06e5d17db891e990ec"
},
"downloads": -1,
"filename": "setuptools_protobuf-0.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54977324933969f16e4360f8b5e2ce07",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9462,
"upload_time": "2024-05-05T13:02:55",
"upload_time_iso_8601": "2024-05-05T13:02:55.405936Z",
"url": "https://files.pythonhosted.org/packages/70/47/709c75e41299e65b3a7e27a898001af4b82e543a33b35c258d8e6dd953ab/setuptools_protobuf-0.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c9736884cd49335fafad24014199c0d2717f7e7731f29f84d681ea7a07c5f41f",
"md5": "5f048b6ef2ab119d5f7301cea8a9e37b",
"sha256": "f224c2f751baf1e5620aeb904b8b6e1a54ef18fc217e9f36398b70d35cb6e716"
},
"downloads": -1,
"filename": "setuptools_protobuf-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "5f048b6ef2ab119d5f7301cea8a9e37b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10364,
"upload_time": "2024-05-05T13:02:56",
"upload_time_iso_8601": "2024-05-05T13:02:56.628324Z",
"url": "https://files.pythonhosted.org/packages/c9/73/6884cd49335fafad24014199c0d2717f7e7731f29f84d681ea7a07c5f41f/setuptools_protobuf-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-05 13:02:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jelmer",
"github_project": "setuptools-protobuf",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "setuptools-protobuf"
}