pypi / mypy-protobuf
mypy-protobuf
What changed in mypy-protobuf 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-21.
4 breaking2 deprecations9 new APIs and options7 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initmypy-protobuf 510 changes
Breaking changes 2
Exports deprecated enum fields as class-level properties instead of module-level properties and marks them as deprecated.
Refactors import statements to follow a protoc pyi generator-like model, using aliases to prevent field-name collisions and fixing duplicate package name imports.
Deprecations 2
Exports deprecated fields as properties with getters and setters and marks them as deprecated.
Exports deprecated stub methods as properties instead of attributes and marks them as deprecated.
Fixes and other changes 6
Typing is overridden for ClearField on fields without presence and non-oneofs.
When a file is deprecated, all its messages, enums, services, and fields are deprecated too.
Typing is overridden for HasField on fields without presence and non-oneofs.
Typing is overridden for WhichOneof on fields without presence and non-oneofs.
Uses builtins.property to handle conflicts with fields named property.
Mangles all non-provided message type imports to prevent conflicts with field names; message imports remain unmangled to avoid a breaking change.
mypy-protobuf 412 changes
Breaking changes 2
Testing support for protobuf versions below 6.32 is dropped because they do not support editions; those versions may still work but are untested.
Support for py_generic_services is dropped because the protobuf compiler removed it starting in version 6.30.
New APIs and options 9
This option generates only the async version of gRPC stubs.
This type alias supports typing field manipulation functions.
Support is added for protobuf editions up to 2024.
File-level field presence feature settings are supported.
This option generates concrete instead of abstract servicer stubs.
This type alias supports typing field manipulation functions.
This option generates only the sync version of gRPC stubs.
This type alias types the argument to WhichOneof for a given oneof.
This type alias types the return value of WhichOneof for a given oneof.
Fixes and other changes 1
Async stubs use __new__ overloads instead of TypeVar-based __init__ overloads.