Skip to main content

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 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

from setuptools_protobuf import Protobuf

setup(
...
    setup_requires=['setuptools-protobuf'],
    protobufs=[Protobuf('example/foo.proto')],
)

setup.cfg

...

[options]
setup_requires =
    setuptools
    setuptools-protobuf

pyproject.toml

[build-system]
requires = ["setuptools", "setuptools-protobuf"]

[tool.setuptools-protobuf]
protobufs = ["example/foo.proto"]

# Wildcards are supported (evaluated relative to `proto_path`, or the
# project root if `proto_path` is unset):
# protobufs = ["example/*.proto", "protos/**/*.proto"]
#
# If `protobufs` is omitted entirely, all `.proto` files under the search
# root are discovered recursively.

# Require the generation of typing hints:
mypy = true

# Or disable typing hint generation entirely. When `mypy` is unset,
# setuptools-protobuf auto-enables stub generation if `protoc-gen-mypy`
# is on PATH and runnable; set this to `false` to opt out (for example,
# when a stale `protoc-gen-mypy` is installed but `mypy_protobuf` is not
# importable in the build environment).
# mypy = false

# Optionally, set the specific protoc version to use:
protoc_version = '25.1'

# Optionally, set a proto file search path (`--proto_path` or `-I` option to protoc)
proto_path = "src"

GitHub actions

To install protoc in a GitHub action, you can use the setup-protoc action:

- name: Install Protoc
  uses: arduino/setup-protoc@v2

Metadata

Release files for setuptools-protobuf 0.1.19

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

Source distribution (sdist)

Source distribution for setuptools-protobuf 0.1.19
File Size Uploaded Provenance Actions
setuptools_protobuf-0.1.19.tar.gz 18.1 kB With provenance Details for setuptools_protobuf-0.1.19.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-protobuf 0.1.19
File Interpreter ABI Platform Actions
setuptools_protobuf-0.1.19-py3-none-any.whl Python 3 none any Details for setuptools_protobuf-0.1.19-py3-none-any.whl

Total release size: 30.1 kB

Release files / setuptools_protobuf-0.1.19.tar.gz

Download URL setuptools_protobuf-0.1.19.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fd5c4cf39339d50cb91ff9deb9809ff91500cd85f188569ed0c7de8a3a556207
BLAKE2b-256 checksum
How to use checksums
459f9e8ad7c926ef8c7f75a76ff6cc7fec916ab36d0bcd00d07f7600e93f433e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / setuptools_protobuf-0.1.19-py3-none-any.whl

Download URL setuptools_protobuf-0.1.19-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adf0f3bb6964c39960e231a0001d15475d61cc4c962600f26c6adc1a67d0f474
BLAKE2b-256 checksum
How to use checksums
f335f4845c5c908813e23993b19dd61d8cf93d30c422710ba1968ae6de2d2a43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for setuptools-protobuf 0.1.19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for setuptools_protobuf-0.1.19.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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