Make Compression protocol public and default to gzip-only#103
Merged
anuraaga merged 5 commits intoconnectrpc:mainfrom Jan 28, 2026
Merged
Make Compression protocol public and default to gzip-only#103anuraaga merged 5 commits intoconnectrpc:mainfrom
anuraaga merged 5 commits intoconnectrpc:mainfrom
Conversation
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
stefanvanburen
approved these changes
Jan 27, 2026
Member
stefanvanburen
left a comment
There was a problem hiding this comment.
👍, a nit and a question
src/connectrpc/compression/gzip.py
Outdated
| from . import Compression | ||
|
|
||
|
|
||
| class GZipCompression(Compression): |
Member
There was a problem hiding this comment.
minorest of nits: I'd prefer Gzip to GZip here, to match the stdlib.
| interceptors: Iterable[Interceptor] = (), | ||
| read_max_bytes: int | None = None, | ||
| compressions: Iterable[str] | None = None, | ||
| compressions: Sequence[Compression] | None = None, |
Member
There was a problem hiding this comment.
I might have just missed it reading through, but why do we need a Sequence instead of an Iterable here?
Collaborator
Author
There was a problem hiding this comment.
Thanks for calling this out - in a different project I got feedback that Sequence could make sense for an ordered list, i.e. set doesn't work then. But on a second thought, I know that such a parameter would be Iterable in Java so what works there should work here and switched back to it. If a user passes a set anyways, they probably have a strong reason for it for better or worse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reworks the interfaces related to compression to better align behavior with other connect implementations and provide more flexibility, and type safety
Compressionprotocol public. Can be used to implement custom compressionsCompressioninstead ofstrthroughout for type safetyCompressionimplementations for zstd and brotli are provided in public API to allow registering them, possibly with custom levels, as users need