Skip to content

Wire in typing_extensions and set Message generic parameter default - #79

Merged
anuraaga merged 1 commit into
bufbuild:mainfrom
anuraaga:message-default-any
Aug 28, 2026
Merged

anuraaga merged 1 commit into
bufbuild:mainfrom
anuraaga:message-default-any

Conversation

@anuraaga

@anuraaga anuraaga commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

We initially were able to remove typing_extensions since we only used it for assert_never which is easy to backport, but I always expected we would need it eventually. The use case now came up for using Python 3.13 (many years until being baseline version) default typevar (bufbuild/protovalidate-py#522) which isn't easy to backport. It should be possible for a library to support protobuf-py by declaring Message without a type parameter as their argument since they don't generally need to deal with field names, or possible other supporting types we may add. Currently it's not possible for any widely used library since strict type checkers reject it, and we don't want users to have to ignore type checkers in their code.

I have reframed "zero dependencies" as "zero third-party dependencies" because typing_extensions is cpython's official backport library and extremely widely used and fully accepted by the ecosystem, there is no meaningful regression by adding it.

@anuraaga
anuraaga requested a review from ajeetdsouza August 27, 2026 02:22
@anuraaga
anuraaga merged commit e45865f into bufbuild:main Aug 28, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants