protobuf-py
Idiomatic Protocol Buffers for Python.
What it is and what it does
protobuf-py is a Protocol Buffer implementation for Python that generates readable, type-annotated message classes from .proto files. Unlike alternatives that generate opaque runtime-constructed classes, protobuf-py produces inspectable Python code with proper IDE support and native type hints. It includes a Rust-backed encoder/decoder for performance and claims 100% conformance with the Protobuf specification.
The library depends only on protobuf-py-ext at runtime and requires Python 3.10 or later. It supports typed oneofs with pattern matching, well-known types with helper methods, and reflection over message fields. Generated code uses direct field assignment and includes IDE-friendly presence checking.
Use it for:
- Define and serialize structured data for APIs using .proto schemas with full type safety.
- Build message-driven systems where field presence tracking and oneof pattern matching improve code clarity.
- Generate typed message classes that are inspectable and work well with IDE autocomplete and type checkers.
- Serialize and deserialize binary data using the to_binary() and from_binary() methods.
- Work with well-known types like Timestamp and Duration using built-in helper methods.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates well-typed, readable Python code from Protocol Buffer definitions and provides high-performance serialization/deserialization with a modern, ergonomic API.
Yes, with conditions. The package is actively maintained, has low install friction, and offers genuine ergonomic improvements over alternatives (readable code, native type hints, direct field assignment). However, it is still in Alpha status with a first release only months old; production use should weigh stability risk against the benefits of better developer experience. No known vulnerabilities and permissive licensing are in its favor.
Install
protobuf-py on PyPI
pip
pip install protobuf-pyuv
uv add protobuf-pypoetry
poetry add protobuf-pyInstalling protobuf-py
Before you install
Low friction: pure wheel distribution, single runtime dependency (protobuf-py-ext), and active maintenance with a release within the past week.
License in practice
Apache-2.0 permissive license allows use in commercial and open-source projects without significant restrictions.
Quickstart
from protobuf_py import Message
# After code generation from .proto files:
user = Message(id="123", first_name="Alice")
data = user.to_binary()
user = Message.from_binary(data)
print(user.to_json())
Requires Python 3.10 or later. Code generation from .proto files requires external tooling; generated message classes must be created before importing and using them.
Verify before relying
- Whether protobuf-py-ext is a compiled extension or pure Python, and what system dependencies it may require.
- Performance benchmarks comparing encoder/decoder speed to other Protobuf implementations.
- Stability guarantees given the Alpha development status and recent first release date.
- Whether proto2 support is actually implemented or only proto3 is supported.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — protobuf-py-ext |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 338,468/month — #7,431 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: protobuf_py-0.3.0-py3-none-any.whl
Keywords: protobuf
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
protobuf-py-extNative Rust-based encoder/decoder extension…
unclear · top 15,000 on PyPI
proto-schema-parserParses and generates Protobuf schema files…
permissive · top 15,000 on PyPI
betterprotoGenerates idiomatic Python code from Protobuf 3…
permissive · top 5,000 on PyPI
protovalidateValidates Protocol Buffer messages against…
permissive · top 5,000 on PyPI
betterproto-rust-codecProvides fast Rust-based conversion between…
permissive · top 15,000 on PyPI
protoc-gen-connect-pythonA protoc plugin that generates Python client…
permissive · top 15,000 on PyPI
betterproto2Generates idiomatic Python code from Protobuf…
permissive · top 5,000 on PyPI
baml-bridgeProvides Python bindings for the BAML runtime,…
permissive · top 15,000 on PyPI
proto-plusProto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
dbt-protosProvides Python Protocol Buffer bindings for…
permissive · top 1,000 on PyPI