Registry / devops / setuptools-protobuf

setuptools-protobuf

JSON →
library0.1.16pypypi✓ verified 83d ago

A setuptools extension for automatically compiling protobuf files (.proto) during the build process. It integrates with setuptools' build system to generate Python protobuf modules without manual protoc invocation. Currently version 0.1.16, stable, with occasional updates.

pip install setuptools-protobuf
INSTALL
IMPORT
SIG · SETUPTOOLS-PROTOBU
S
setuptools-protobuf
devopspythonv0.1.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

setup
from setuptools import setup
from setuptools_protobuf import setup
The extension is not imported directly; you configure it in setup.py via setup_requires or pyproject.toml build-system.requires.

Basic setup.py using setuptools-protobuf. Place .proto files under 'protos/' (or specify via proto_path). The extension compiles them to Python modules during the build.

# setup.py from setuptools import setup setup( name='my-package', version='1.0.0', setup_requires=['setuptools-protobuf', 'protobuf'], proto_build=True, # enables protobuf compilation # proto_package='my.proto.package', # optional: override package # proto_path='protos', # optional: directory for .proto files )
Debug
Known issues
gotchaThe proto_package option in setup.py must match the proto file's 'package' statement; otherwise, generated Python modules may have incorrect import paths.
fix
Ensure proto_package in setup.py equals the 'package' directive in your .proto files (e.g., package my.proto; -> proto_package='my.proto').
affects: all
gotchaprotobuf must be installed before setup.py is invoked; placing it only in setup_requires may fail on some systems (e.g., pip versions < 10).
fix
Install protobuf separately or ensure your build environment (e.g., Docker, CI) has protobuf pre-installed. Use pyproject.toml's build-system.requires for better isolation.
affects: all
breakingThe 'setup_requires' method is deprecated in pip >= 21.3 and may be ignored; use pyproject.toml build-system.requires instead.
fix
Migrate to pyproject.toml:

[build-system]
requires = ["setuptools", "wheel", "setuptools-protobuf", "protobuf"]
build-backend = "setuptools.build_meta"
affects: >=0.1.10
deprecatedPython 3.8 support has been dropped; requires_python is >=3.9.
fix
Use Python 3.9+ or pin to an older version like setuptools-protobuf==0.1.13 if you need Python 3.8.
affects: >=0.1.14
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'protobuf'
protobuf is not installed in the environment where setup.py runs.
fix
Run 'pip install protobuf' before 'python setup.py install' or add 'protobuf' to build-system.requires in pyproject.toml.
error in my_package.some_pb2: cannot import name 'descriptor' from 'google.protobuf'
The generated protobuf modules were compiled with a different protobuf version than the runtime version.
fix
Ensure the version of protobuf used at build time matches the runtime version. Pin protobuf version in setup.py or pyproject.toml.
setuptools.errors.OptionError: No such option: 'proto_build'
setuptools-protobuf is not installed or not loaded during setup. setup_requires not processed correctly.
fix
Verify setuptools-protobuf is listed in setup_requires or build-system.requires. Use pip install -e . for development.
Upgrade
Version history
0.1.16latest on PyPI · released Oct 29, 2025
Audit
Dependencies
protobufrequiredRequired at build time to compile .proto files; must be installed before setup.py runs.
Agent activity
4 hits · last 30 days
node
4
Resources

No resource links recorded.

setuptools-protobuf — pip install setuptools-protobuf · libregistry