dep-protobuf/upb
Mikita Belahlazau 4f076d951f Add metadata annotations for generated Python protobuf symbols.
The pyi generator now includes Kythe annotations for:
*   Extension field constants (e.g., `EXTENSION_FIELD`).
*   Field number constants (e.g., `STRING_FIELD_FIELD_NUMBER`).
*   `Create` methods in generated Stubby client classes.

These annotations allow the Python indexer to link these generated symbols back to their definitions in the `.proto` files.

PiperOrigin-RevId: 852971617
2026-01-06 16:05:56 -08:00
..
base Made a common longjmp()-handling layer, which can optionally be used on upb_EpsCopyInputStream. 2025-12-11 16:38:10 -08:00
bazel Make it a runtime flag whether we treat closed enums as open. 2025-12-30 14:54:58 -08:00
cmake Added debug printing for MiniTables. 2025-10-24 20:11:37 -07:00
conformance Automated Code Change 2025-07-14 14:47:13 -07:00
hash Automated rollback of commit efacad9581. 2025-11-18 15:24:59 -08:00
io internal change 2025-10-14 11:30:30 -07:00
json internal change 2025-10-14 11:30:30 -07:00
lex Automated rollback of commit efacad9581. 2025-11-18 15:24:59 -08:00
mem Return an error if asked to serialize a proto larger than 2gb 2025-10-20 13:25:27 -07:00
message Add metadata annotations for generated Python protobuf symbols. 2026-01-06 16:05:56 -08:00
mini_descriptor Fix off-by-one check in required field count check. 2025-12-30 10:46:30 -08:00
mini_table Remove upb_ExtensionRegistry_AddAllLinkedExtensions API. 2025-12-01 16:47:48 -08:00
port Add metadata annotations for generated Python protobuf symbols. 2026-01-06 16:05:56 -08:00
reflection Add metadata annotations for generated Python protobuf symbols. 2026-01-06 16:05:56 -08:00
test Automated rollback of commit efacad9581. 2025-11-18 15:24:59 -08:00
text Removed no-op enabled_aliasing parameter to constructor. 2025-11-25 23:24:08 -08:00
util Breaking change: Add [[nodiscard]] to many APIs. 2026-01-05 08:41:35 -08:00
wire Add metadata annotations for generated Python protobuf symbols. 2026-01-06 16:05:56 -08:00
BUILD Moved EpsCopy implementation into a private header. 2025-11-25 09:44:03 -08:00
generated_code_support.h Automated rollback of commit efacad9581. 2025-11-18 15:24:59 -08:00
README.md Fixed broken link in upb README.md (#16717) 2024-05-14 08:34:33 -07:00

μpb: small, fast C protos

μpb (often written 'upb') is a small protobuf implementation written in C.

upb is the core runtime for protobuf languages extensions in Ruby, PHP, and Python.

While upb offers a C API, the C API & ABI are not stable. For this reason, upb is not generally offered as a C library for direct consumption, and there are no releases.

Features

upb has comparable speed to protobuf C++, but is an order of magnitude smaller in code size.

Like the main protobuf implementation in C++, it supports:

  • a generated API (in C)
  • reflection
  • binary & JSON wire formats
  • text format serialization
  • all standard features of protobufs (oneofs, maps, unknown fields, extensions, etc.)
  • full conformance with the protobuf conformance tests

upb also supports some features that C++ does not:

  • optional reflection: generated messages are agnostic to whether reflection will be linked in or not.
  • no global state: no pre-main registration or other global state.
  • fast reflection-based parsing: messages loaded at runtime parse just as fast as compiled-in messages.

However there are a few features it does not support:

  • text format parsing
  • deep descriptor verification: upb's descriptor validation is not as exhaustive as protoc.

Install

For Ruby, use RubyGems:

$ gem install google-protobuf

For PHP, use PECL:

$ sudo pecl install protobuf

For Python, use PyPI:

$ sudo pip install protobuf

Alternatively, you can build and install upb using vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install upb

The upb port in vcpkg is kept up to date by microsoft team members and community contributors.

If the version is out of date, please create an issue or pull request on the vcpkg repository.

Contributing

Please see CONTRIBUTING.md.