python / python/typeshed

Replace mypy-protobuf with protobuf pyi_out

Open
#14,753 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

I noticed that pyi_out is a lot cleaner and more readable that mypy-protobuf. Since pyi generation is part of protobuf it is probably prefered instead of unofficial mypy_protobuf.

And there is also one interesting sideeffect that enums constants are not compatible between themselves exposing couple of bugs in our code.

For example:

enum EnumA {
  A_A = 0;
  A_B = 1;
}

enum EnumB {
  B_A = 0;
  B_B = 1;
}

message Msg {
  EnumA name = 1;
}

mypy is not bothered that name can also be used with B_A and B_B. But it works with pyi_out generated code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the repository configuration or scripts that invoke mypy-protobuf and inspect how generated Python stubs are used. Compare the current output with protobuf's pyi_out behavior, then verify that the replacement preserves the expected stubs and prevents incompatible enum constants from being accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.