setuptools-protobuf
Setuptools protobuf extension plugin
What it is and what it does
setuptools-protobuf is a build-time plugin for setuptools that integrates protobuf compilation into the Python package build process. It wraps the protoc compiler and runs it during setup to convert .proto files into Python modules, placing generated files in the source tree for inclusion in the package. The plugin supports configuration via setup.py, setup.cfg, or pyproject.toml, and can optionally generate type hints when the mypy extra is enabled.
The plugin requires the protoc executable to be available in the build environment—either pre-installed on the system or automatically downloaded by specifying a protoc_version. It is designed for projects that define protocol buffer schemas and need to generate Python code from them as part of their build workflow, eliminating manual compilation steps.
Use it for:
- Include protobuf-generated Python modules in a package distribution without manual pre-compilation
- Automate proto file compilation in CI/CD pipelines using GitHub Actions or similar
- Generate type hints alongside protobuf code by enabling the mypy extra
- Manage multiple .proto files with custom search paths using the proto_path configuration
- Pin a specific protoc version for reproducible builds across different environments
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A setuptools plugin that automates compilation of protobuf files during the Python package build process, generating Python code from .proto definitions.
Yes, if your project uses protobuf schemas and you want to automate code generation during the build process. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a straightforward choice. The main prerequisite is having protoc available; if that's already part of your build environment or CI setup, this plugin integrates cleanly.
Install
setuptools-protobuf on PyPI
pip
pip install setuptools-protobufuv
uv add setuptools-protobufpoetry
poetry add setuptools-protobufInstalling setuptools-protobuf
Before you install
Low friction installation with only setuptools and tomli as runtime dependencies. Active maintenance with recent commits; last release 289 days ago.
License in practice
Licensed under Apache v2 (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
# In pyproject.toml
[build-system]
requires = ["setuptools", "setuptools-protobuf"]
[tool.setuptools-protobuf]
protobufs = ["example/foo.proto"]
# Or in setup.py
from setuptools_protobuf import Protobuf
setup(setup_requires=['setuptools-protobuf'], protobufs=[Protobuf('example/foo.proto')])
The external protoc executable must be present in the environment (from protobuf-compiler package on Debian, or downloaded if protoc_version is specified)
Verify before relying
- Whether typing hint generation (mypy extra) requires mypy as a build-time dependency
- Performance characteristics when compiling large numbers of proto files
- Compatibility with protoc versions outside the tested range
Package facts
| License | Apachev2 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — setuptools, tomli |
| Maintenance | actively maintained — 289 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 89,996/month — #13,623 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: setuptools_protobuf-0.1.16-py3-none-any.whl
Keywords: distutils, setuptools, protobuf
Tags
More Version Control packages
Automatically extracts and manages Python…
permissive · top 1,000 on PyPI
dulwichDulwich provides pure Python access to Git…
unclear · top 1,000 on PyPI
setuptools-rustsetuptools-rust is a setuptools plugin that…
permissive · top 5,000 on PyPI
pygit2pygit2 provides Python bindings to libgit2,…
copyleft · top 5,000 on PyPI
poetry-dynamic-versioningA Poetry plugin that automatically derives and…
permissive · top 5,000 on PyPI
whatthepatchParses and applies patch files in multiple diff…
permissive · top 5,000 on PyPI
hatch-protobufA Hatch build plugin that generates Python…
copyleft · top 15,000 on PyPI
pylint-protobufA Pylint plugin that makes Pylint understand…
permissive · top 15,000 on PyPI
protoletariatProtoletariat rewrites Python imports generated…
permissive · top 5,000 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
nanopbNanopb is a code generator and runtime library…
permissive · top 15,000 on PyPI
setuptools-gitA setuptools plugin that automatically includes…
permissive · top 15,000 on PyPI
opensearch-protobufsProvides pre-generated Python Protocol Buffer…
permissive · top 5,000 on PyPI
setuptools-golangA setuptools extension that builds CPython…
permissive · top 5,000 on PyPI
protobuf_to_pydanticConverts Protobuf message definitions into…
permissive · top 15,000 on PyPI
pbrPBR injects sensible defaults into setuptools…
permissive · top 1,000 on PyPI