Distribute Python type hints
Maintainers usually reply within 1 day
@zhangskz is already working on this.
Since Oct 15, 2026.
Assessment
This issue has not been assessed yet.
Description
What language does this apply to?
It's for the Python protobuf package.
Describe the problem you are trying to solve.
We want to be able to fully type check the generated proto code, while using the latest releases.
Without it we get the following errors while using mypy (and similar erros when using other type checkers)
myproto_pb2.pyi:3: error: Library stubs not installed for "google.protobuf" [import-untyped]
myproto_pb2.pyi:4: error: Library stubs not installed for "google.protobuf.internal" [import-untyped]
myproto_pb2.pyi:4: note: Hint: "python3 -m pip install types-protobuf"
myproto_pb2.pyi:4: note: (or run "mypy --install-types" to install all missing stub packages)
myproto_pb2.pyi:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
myproto_pb2.pyi:13: error: Class cannot use "EnumTypeWrapper" as a metaclass (has type "Any") [metaclass]
myproto_pb2.pyi:24: error: Class cannot subclass "Message" (has type "Any") [misc]
myproto_pb2.pyi:32: error: Class cannot subclass "Message" (has type "Any") [misc]
myproto_pb2.pyi:56: error: Class cannot subclass "Message" (has type "Any") [misc]
myproto_pb2.pyi:58: error: Class cannot subclass "Message" (has type "Any") [misc]
myproto_pb2.pyi:109: error: Class cannot subclass "Message" (has type "Any") [misc]
myproto_pb2.pyi:117: error: Class cannot subclass "Message" (has type "Any") [misc]
Found 9 errors in 1 file (checked 2 source files)
Describe the solution you'd like
The python package protobuf should include built in annotations using PEP 561.
Describe alternatives you've considered
The currently suggested alternative it to use the package types-protobuf from typeshed. However, at the time of writing (Oct 15th 2026), the latest released version is for version 7.35.1, while protobuf 7.36 has been available for almost 2 months. See the PR where they add support for the new version.
Also note that support for 7.35.1 was added on August 20th in this PR, more than two months later of the protobuf release.
Additional context
Note that this issue is related to https://github.com/protocolbuffers/protobuf/issues/9918
- Dominant language
- C++
- Stars
- 72.2k
- Forks
- 16.4k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 342
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from protocolbuffers/protobuf
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
protocolbuffers/protobuf#31768 ·
Maintainers usually reply within 1 day
-
feature request packaging & distribution python
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
protocolbuffers/protobuf#31654 ·
Maintainers usually reply within 1 day
-
google-protobuf 0.36.2-release fails to compile for ARMv7: @progbits rejected in global_asm!Possibly taken @farisbasha claimed this 1 day ago. Openbug help wanted rust
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
protocolbuffers/protobuf#31619 · 3 comments ·
Maintainers usually reply within 1 day
-
Null pointer passed to memcpy in lupb_decode() when the second argument is nilPossibly taken A pull request linked to this issue is open or already merged. Openbug help wanted lua
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
protocolbuffers/protobuf#31392 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
protocolbuffers/protobuf#31032 ·
Maintainers usually reply within 1 day
All issues in protocolbuffers/protobuf
Similar issues
-
agent:Windows bug in progress pri:medium sev:low testing windows
Difficulty 1/5 Under an hour Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
godotengine/godot#125651 ·
Maintainers usually reply within 1 day
-
Android: with view recycling on, a recycled View keeps its nextFocusLeftPossibly taken A pull request linked to this issue is open or already merged. OpenNeeds: Triage :mag: Platform: Android
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
react/react-native#60167 ·
Maintainers usually reply within 2 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days