# What changed in mypy-protobuf

> 22 changes in mypy-protobuf 4 to 5 from its official release notes, upgrade guides and advisories: 4 breaking, 2 deprecations, 9 new APIs and options. Each one cited. Sources checked 2026-10-21. HTML: https://unstale.sh/pypi/mypy-protobuf/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## mypy-protobuf 5

### Breaking changes

- Exports deprecated enum fields as class-level properties instead of module-level properties and marks them as deprecated. (5.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#500)
- Refactors import statements to follow a protoc pyi generator-like model, using aliases to prevent field-name collisions and fixing duplicate package name imports. (5.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#500)

### Deprecations

- Exports deprecated fields as properties with getters and setters and marks them as deprecated. (5.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#500)
- Exports deprecated stub methods as properties instead of attributes and marks them as deprecated. (5.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#500)

### Fixes and other changes

- Typing is overridden for ClearField on fields without presence and non-oneofs. (5.1.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#510)
- When a file is deprecated, all its messages, enums, services, and fields are deprecated too. (5.1.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#510)
- Typing is overridden for HasField on fields without presence and non-oneofs. (5.1.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#510)
- Typing is overridden for WhichOneof on fields without presence and non-oneofs. (5.1.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#510)
- Uses builtins.property to handle conflicts with fields named property. (5.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#500)
- Mangles all non-provided message type imports to prevent conflicts with field names; message imports remain unmangled to avoid a breaking change. (5.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#500)

## mypy-protobuf 4

### Breaking changes

- Testing support for protobuf versions below 6.32 is dropped because they do not support editions; those versions may still work but are untested. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- Support for py_generic_services is dropped because the protobuf compiler removed it starting in version 6.30. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)

### New APIs and options

- This option generates only the async version of gRPC stubs. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- This type alias supports typing field manipulation functions. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- Support is added for protobuf editions up to 2024. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- File-level field presence feature settings are supported. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- This option generates concrete instead of abstract servicer stubs. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- This type alias supports typing field manipulation functions. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- This option generates only the sync version of gRPC stubs. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- This type alias types the argument to WhichOneof for a given oneof. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
- This type alias types the return value of WhichOneof for a given oneof. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)

### Fixes and other changes

- Async stubs use __new__ overloads instead of TypeVar-based __init__ overloads. (4.0.0) — [release notes](https://github.com/nipunn1313/mypy-protobuf/blob/e92875b9ae3a123bfd7b1e249935a33ed7b16a34/CHANGELOG.md#400)
