protoletariat
Python protocol buffers for the rest of us
What it is and what it does
Protoletariat is a command-line tool that fixes Python imports in code generated by protoc (the Protocol Buffers compiler). When protoc generates Python modules from .proto files, it creates absolute imports that don't work well in packaged Python code; protoletariat rewrites those imports to relative imports by analyzing the FileDescriptorProtos and applying AST-based rewrite rules.
The tool is designed as a post-processing step: you run protoc first to generate the Python code, then run protoletariat to fix the imports. It supports multiple input sources (protoc, buf, or raw FileDescriptorSet bytes) and can recursively create __init__.py files to turn output directories into proper packages. It depends on astunparse for AST manipulation, click for CLI handling, and protobuf for descriptor parsing.
Use it for:
- Fix broken imports in protoc-generated Python code when building a Python package that uses Protocol Buffers.
- Automate the import rewriting step in a build pipeline that generates gRPC service stubs and message types.
- Convert absolute imports to relative imports in generated protobuf modules to enable proper package distribution.
- Process code generated by buf (the modern protobuf build system) to make imports work in Python packages.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Protoletariat rewrites Python imports generated by protoc, converting absolute imports to relative imports so that generated protobuf code works correctly in Python packages.
No. The package is archived and abandoned, with no maintenance since June 2026. While it has low install friction and permissive licensing, the lack of active development creates risk for compatibility issues with future protobuf or Python versions. If you need to fix protoc-generated imports, consider whether the problem is still relevant with current protobuf versions or whether an actively maintained alternative exists.
Install
protoletariat on PyPI
pip
pip install protoletariatuv
uv add protoletariatpoetry
poetry add protoletariatInstalling protoletariat
Before you install
Low friction install with three lightweight runtime dependencies (astunparse, click, protobuf). However, the package is archived and abandoned as of the last commit on 2026-06-04, with no active maintenance.
License in practice
Licensed under Apache-2.0 (permissive), so you can use it freely in commercial and open-source projects without significant legal constraints.
Quickstart
pip install protoletariat
# After running protoc to generate Python code:
protol --create-package --in-place --python-out out protoc --proto-path=. thing.proto
# This converts absolute imports to relative imports in the generated files.
Requires protoc to be installed and available on your system path; protoletariat is a post-processing tool that runs after protoc generates code.
Verify before relying
- Whether the abandoned status and lack of recent maintenance pose compatibility risks with future protobuf or Python versions.
- Whether the import rewriting approach remains compatible with current protoc output and gRPC code generation.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — astunparse, click, protobuf |
| Maintenance | abandoned — 513 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 2,551,260/month — #3,004 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: protoletariat-3.3.10-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
hatch-protobufA Hatch build plugin that generates Python…
copyleft · top 15,000 on PyPI
setuptools-protobufA setuptools plugin that automates compilation…
permissive · top 15,000 on PyPI
aristaprotoGenerates Python gRPC stubs and message classes…
permissive · top 15,000 on PyPI
absolufy-importsAutomatically converts relative imports to…
permissive · top 15,000 on PyPI
betterprotoGenerates idiomatic Python code from Protobuf 3…
permissive · top 5,000 on PyPI
dbt-protosProvides Python Protocol Buffer bindings for…
permissive · top 1,000 on PyPI
proto-schema-parserParses and generates Protobuf schema files…
permissive · top 15,000 on PyPI
betterproto-fwGenerates idiomatic Python code from Protobuf 3…
permissive · top 15,000 on PyPI
sentry-protosProvides protocol buffer and gRPC schema…
unclear · top 15,000 on PyPI
protoc-gen-connect-pythonA protoc plugin that generates Python client…
permissive · top 15,000 on PyPI