Protobuf-py: Protocol Buffers for Python, No Compromises
Protobuf-py is a from-scratch Python Protocol Buffers library that covers the full spec and matches Google's C-based upb engine with a Rust accelerator.
A newly announced library, protobuf-py, is a from-scratch Protocol Buffers implementation for Python. It passes every binary and JSON case in Google's conformance suite across proto2, proto3, and editions, supporting extensions, custom options, unknown fields, dynamic messages, and well-known types. It runs on pure Python 3.10+ with no runtime dependencies, and with an optional Rust accelerator it can match the performance of upb, Google's C-based engine used in production workloads.
Google's official package relies on upb, keeping message data in a C arena while Python objects act merely as handles—resulting in a C++/Java-flavored API with quirks like HasField and WhichOneof. Alternatives like betterproto are friendlier but skip proto2, editions, and extensions. protobuf-py instead keeps message data as native Python objects, producing readable, typed generated code, pattern-matchable oneofs, relative imports, and an explicit type registry that avoids global namespace collisions.
The project grew out of building connect-py, a ConnectRPC implementation, when the team realized Python lacked a solid Protobuf foundation to build on. Benchmarks show upb winning isolated parse/serialize operations, but in an end-to-end real-world workload, protobuf-py edges ahead because reading fields after parsing requires no further translation cost—finally letting Python developers choose full spec coverage and idiomatic ergonomics without trade-offs.