skillfed

setuptools-protobuf

Setuptools protobuf extension plugin

setuptools-protobuf v0.1.16 90.0K downloads/30d#13,623 on PyPI17
Permissive license Apachev2 Active released

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

uv

uv add setuptools-protobuf

poetry

poetry add setuptools-protobuf

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Version Control

Tags

protobuf compilation setuptoolsproto file build pluginprotoc integration pythonsetuptools protobuf extensionautomatic proto compilationprotobuf code generation build
build-automationprotobuf

More Version Control packages