Some recent changes to Protocol Buffers are worth being aware of.
First, we’ve changed our versioning scheme to enable more-nimble updates to language APIs in Protocol Buffers. In the new scheme, each language has its own major version that can be incremented independently of other languages. The minor and patch versions, however, remain coupled. This allows us to introduce breaking changes into some languages without requiring a bump of the major version in languages that did not experience a breaking change.
The first instance of this new versioning scheme is the new version of the Python API, 4.21.0, which follows the preceding version, 3.20.1. Other language APIs are released as 3.21.0.
Next, there are changes in Python language support. Version 4.21.0 is a new major version, following 3.20.1. The new version is based on the upb library, and offers significantly better parsing performance than previous releases, especially for large payloads. It also includes prebuilt binary modules for Apple silicon for increased performance without a manual build.
The new release does contain some breaking changes. Specifically:
- The UnknownFields() method, which relied on an implicitly created class, is replaced with the explicitly-created UnknownFieldSet class.
- Some non-core characteristics may have changed, such as the specific format of certain strings or error messages. These are not considered breaking changes, but may still impact your existing code base.
- Applications that rely on sharing messages between Python and C++ break in the new version. Most developers won’t be affected by this, but users of Nucleus and possibly other libraries may be. As a workaround, you can set an environment variable that forces the library to preserve compatibility.
- Python upb requires generated code that has been generated from protoc 3.19.0 or newer.