Skip to content

Releases: connectrpc/connect-py

v0.11.1

Choose a tag to compare

@anuraaga anuraaga released this 15 Jul 06:33
ea19bf7

This release fixes a significant issue in the google.protobuf interop for generated code which likely prevents most usage of it. Sorry for the issue.

🛠️ Bug fixes

What's Changed

  • Avoid unnecessary copies in IdentityCompression and reuse protocol singletons by @dongjiang1989 in #299
  • Fix relative path calculation for google.protobuf by @anuraaga in #297

New Contributors

Full Changelog: v0.11.0...v0.11.1

grpcreflect v0.1.0

Choose a tag to compare

@anuraaga anuraaga released this 10 Jul 01:40
537d43b

This is the first release of connectrpc-grpcreflect, a new package containing Connect integration with server-side gRPC reflection. This can be used with commands like buf curl to execute requests against a running server without knowing its schema in advance.

otel v0.2.0

Choose a tag to compare

@anuraaga anuraaga released this 08 Jul 03:48
8b9e635

This release of connectrpc-otel simply updates it to target the connectrpc v0.11.0's API, there are no other changes.

v0.11.0

Choose a tag to compare

@anuraaga anuraaga released this 25 Jun 15:40
9ec755f

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-py is now the default, but google.protobuf is also completely supported via a compatibility layer - read through the Breaking Changes section for how to enable it.

☢️ Breaking changes

Enabling the google.protobuf compatibility shim (Existing users read this!)

Starting with this release, protoc-gen-connectrpc will default to generating stubs that target protobuf-py messages. Existing users should add the protobuf=google option to their plugin settings to instead generate stubs that target existing google.protobuf messages. There are some significant changes to the usage of messages with protobuf-py to match Python semantics better, so we recommend existing users to first enable the shim while updating connectrpc and later consider migrating to protobuf-py independently.

Before:

version: v2
plugins:
  - remote: buf.build/protocolbuffers/python
    out: src
  - remote: buf.build/protocolbuffers/pyi
    out: src
  - remote: buf.build/connectrpc/python
    out: src

After:

version: v2
plugins:
  - remote: buf.build/protocolbuffers/python
    out: src
  - remote: buf.build/protocolbuffers/pyi
    out: src
  - remote: buf.build/connectrpc/python
    out: src
    opt: protobuf=google

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 codec google_protobuf_json_codec.

Before:

from connectrpc.codec import proto_json_codec
client = ElizaServiceClient("http://localhost:8081", codec=proto_json_codec())

After:

from connectrpc.compat import google_protobuf_json_codec
client = ElizaServiceClient("http://localhost:8081", codec=google_protobuf_json_codec())

ErrorDetails exposed as class instead of Any

Previously ConnectError exposed details with the google.protobuf type Any directly. We have replaced this with a dedicated ErrorDetail class that provides the same type_name and message_bytes data for manual unpacking, but also has a convenience value method to convert into a protobuf-py message.

To convert into a google.protobuf message, copy the contents to its Any before unpacking.

Before:

try:
    resp = client.say(SayMessage(sentence="Hello!"))
except ConnectError as e:
    detail = Struct()
    e.details[0].Unpack(detail)
    print(detail)

After:

from google.protobuf.any_pb2 import Any
try:
    resp = client.say(SayMessage(sentence="Hello!"))
except ConnectError as e:
    detail_any = Any(
        type_url=f"type.googleapis.com/{e.details[0].type_name}", 
        value=e.details[0].message_bytes)
    detail = Struct()
    detail_any.Unpack(detail)
    print(detail)

RequestContext and ResponseMetadata expose properties instead of getters

This 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:

authorization = ctx.headers()["authorization"]

with ResponseMetadata() as meta:
    resp = client.say(SayMessage(sentence="Hello!"))
    print(meta.headers()["x-generated-entity"]

After:

authorization = ctx.headers["authorization"]

with ResponseMetadata() as meta:
    resp = client.say(SayMessage(sentence="Hello!"))
    print(meta.headers["x-generated-entity"])

protoc-gen-connectrpc is now written in Python

protoc-gen-connectrpc has been rewritten in Python using protobuf-py's plugin framework. This improves the output of the generated code substantially, but also means we cannot provide prebuilt binaries or a go run mechanism anymore. If needing them, consider wasilibs which runs the same plugin code via WASM.

async protoc option renamed to io enum

Previously we used a tri-state bool for generating all or one of async or sync code. Now we use an io enum set to async or sync, defaulting to generating both.

Before:

version: v2
plugins:
  - remote: buf.build/connectrpc/python
    out: src
    opt: async=true # or async=false

After:

version: v2
plugins:
  - remote: buf.build/connectrpc/python
    out: src
    opt: io=async # or io=sync

📈 Enhancements

  • Generator: emit RequestContext[Input, Output] for service handlers by @smparkes in #264

New Contributors

Full Changelog: v0.10.1...v0.11.0

v0.10.1

Choose a tag to compare

@anuraaga anuraaga released this 29 May 02:18
fa120f6

This is a small release with a bugfix to content-type matching, and reordering of parameters for GET requests to improve performance of HTTP caches.

📈 Enhancements

  • Update unary-get query parameter to match spec ordering by @oliversun9 in #250

🛠️ Bug fixes

  • Ignore content type parameters when matching it by @anuraaga in #235

New Contributors

Full Changelog: v0.10.0...v0.10.1

otel v0.1.1

Choose a tag to compare

@anuraaga anuraaga released this 08 May 01:55
3189d1d

This is a small update to connectrpc-otel to add a missing py.typed file to reflect it is already fully type annotated. There are no other changes.

New Contributors

Full Changelog: v0.10.0...connectrpc-otel/v0.1.1

v0.10.0

Choose a tag to compare

@stefanvanburen stefanvanburen released this 28 Apr 16:05
c195043

☢️ Breaking changes

Pass a Codec instead of proto_json=True to use JSON encoding

The proto_json bool has been replaced by a codec parameter. If you were using the default (proto_json=False), no change is needed — binary protobuf remains the default. If you were opting into JSON encoding:

Before:

async with GreeterClient("http://localhost", proto_json=True) as client:
    ...

After:

from connectrpc.codec import proto_json_codec

async with GreeterClient("http://localhost", codec=proto_json_codec()) as client:
    ...

The new codec parameter accepts any object implementing the Codec protocol, enabling custom encoding strategies — for example, a ProtoJSONCodec subclass with custom marshaling options.

What's Changed

  • Allow customization of server and client codecs by @anuraaga in #192
  • Allow generating only async or sync code by @anuraaga in #214
  • Surface non-Connect handler exceptions to user by @anuraaga in #219

Full Changelog: v0.9.0...v0.10.0

connectrpc-otel v0.1.0

Choose a tag to compare

@anuraaga anuraaga released this 30 Mar 01:02
a4fff71

This is the first release of connectrpc-otel, a package with OpenTelemetry instrumentation for Connect-Python.

Users of OpenTelemetry auto-instrumentation can just add the package as a dependency and will have instrumentation enabled automatically. For more usage instructions, check out the documentation.

v0.9.0

Choose a tag to compare

@anuraaga anuraaga released this 19 Mar 02:39
fd83a6f

BREAKING CHANGE: PyPI package renamed to connectrpc

This is the last version published as the connect-python package - we have migrated to connectrpc as part of this release to match the same code you write with it and will only publish future versions to connectrpc. Make sure to update your dependency specifications to connectrpc to continue to receive updates. Sorry for the churn as we get closer to a stable state.


This release includes a significant rework to compression handling - now, it is possible to implement custom compression methods or configure defaults with custom parameters. This release also allows configuring the supported compression methods for a server rather than automatically inspecting from application dependencies. Defaults now match other Connect implementations, only enabling gzip by default.

We have also added some other small enhancements like gRPC-Web support and improved debugging.

☢️ Breaking changes

Pass compressions rather than strings when configuring the client

Before:

GreeterClient("http://localhost", accept_compressions=["zstd", "br", "gzip"])

After:

from connectrpc.compression.brotli import BrotliCompression
from connectrpc.compression.gzip import GzipCompression
from connectrpc.compression.zstd import ZstdCompression

GreeterClient("http://localhost", accept_compressions=[
    ZstdCompression(), BrotliCompression(), GzipCompression()
])

To configure a client to use gRPC protocol, pass protocol=ProtocolType.GRPC instead of grpc=True

Before:

GreeterClient("http://localhost", grpc=True)

After:

from connectrpc.protocol import ProtocolType

GreeterClient("http://localhost", protocol=ProtocolType.GRPC)

Metadata interceptors now accept Error | None in on_end

Before:

class MyInterceptor:
    def on_end(self, token, ctx):
        ...

After:

class MyInterceptor:
    def on_end(self, token, ctx, error):
        ...

📈 Enhancements

🛠️ Bug fixes

  • Process GET params for empty request messages by @Zaczero in #121
  • Fix server streaming handler not cancelled on client disconnect by @stefanvanburen in #175

New Contributors

Full Changelog: v0.8.1...v0.9.0

v0.8.1

Choose a tag to compare

@anuraaga anuraaga released this 27 Jan 04:58
988f927

This hotfix fixes the default compression level used with gzip, which previously was set too high causing performance issues.

🛠️ Bug fixes

🙇 Thank you

This release was possible thanks to the following contributors who shared their brilliant ideas

@Zaczero

Full Changelog: v0.8.0...v0.8.1