v0.11.0 #280
anuraaga
announced in
Announcements
v0.11.0
#280
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is a large release - in fact it is so large we have renamed the repo to
connect-py! There are major breaking changes so read these notes in detail. Sorry for the churn, but we hope for this to be the last big bump on the road to a stable release.This release targets the long-awaited protobuf-py, a new Protocol Buffers runtime built from scratch to provide a complete, idiomatic, and performant experience for Python.
protobuf-pyis now the default, butgoogle.protobufis also completely supported via a compatibility layer - read through the Breaking Changes section for how to enable it.☢️ Breaking changes
Enabling the
google.protobufcompatibility shim (Existing users read this!)Starting with this release,
protoc-gen-connectrpcwill default to generating stubs that targetprotobuf-pymessages. Existing users should add theprotobuf=googleoption to their plugin settings to instead generate stubs that target existinggoogle.protobufmessages. There are some significant changes to the usage of messages withprotobuf-pyto match Python semantics better, so we recommend existing users to first enable the shim while updatingconnectrpcand later consider migrating toprotobuf-pyindependently.Before:
After:
The shim is simply an implementation of Connect's
Codec, which is provided by default by generated code when enabling that option. If you set a different codec in your code, for example to use JSON, you will need to update to the new compat codecgoogle_protobuf_json_codec.Before:
After:
ErrorDetails exposed as class instead of Any
Previously
ConnectErrorexposeddetailswith thegoogle.protobuftypeAnydirectly. We have replaced this with a dedicatedErrorDetailclass that provides the sametype_nameandmessage_bytesdata for manual unpacking, but also has a conveniencevaluemethod to convert into aprotobuf-pymessage.To convert into a
google.protobufmessage, copy the contents to itsAnybefore unpacking.Before:
After:
RequestContextandResponseMetadataexpose properties instead of gettersThis will effect many interceptor implementations. If you've written them, you've probably found them to simple accessors as getter methods, which especially looks poor for accessing headers. This has been a long-time mistake in the API and we are using this large release to fix it with this significant breaking change. Attributes are now all properties instead of getter methods.
Before:
After:
protoc-gen-connectrpc is now written in Python
protoc-gen-connectrpchas been rewritten in Python usingprotobuf-py's plugin framework. This improves the output of the generated code substantially, but also means we cannot provide prebuilt binaries or ago runmechanism anymore. If needing them, consider wasilibs which runs the same plugin code via WASM.📈 Enhancements
New Contributors
Full Changelog: v0.10.1...v0.11.0
This discussion was created from the release v0.11.0.
Beta Was this translation helpful? Give feedback.
All reactions