From 2e22dec5beb0f52f234c82be3668a57abfc9986d Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 6 May 2026 16:18:29 +0100 Subject: [PATCH 1/4] Initial detailed list of changes --- CHANGELOG.md | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf5548d0bcaa..1fb214042544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,6 +111,107 @@ the details. Contributed by Jukka Lehtosalo. +### Mypyc Improvements + +- Add note about `librt.strings` thread safety (Jukka Lehtosalo, PR [21383](https://github.com/python/mypy/pull/21383)) +- Document `librt.strings` (Jukka Lehtosalo, PR [21374](https://github.com/python/mypy/pull/21374)) +- Document `librt.time` (Jukka Lehtosalo, PR [21372](https://github.com/python/mypy/pull/21372)) +- Use memory copy for vec init and extend using buffer protocol (Jukka Lehtosalo, PR [21349](https://github.com/python/mypy/pull/21349)) +- Add vec extend function to `librt.vecs` (Jukka Lehtosalo, PR [21340](https://github.com/python/mypy/pull/21340)) +- Fix capsule dependencies of `librt.internal.(Write|Read)Buffer` (Jukka Lehtosalo, PR [21329](https://github.com/python/mypy/pull/21329)) +- Fix `librt.time` primitive now that it is no longer experimental (Ivan Levkivskyi, PR [21318](https://github.com/python/mypy/pull/21318)) +- Support specifying vec capacity during construction (Jukka Lehtosalo, PR [21304](https://github.com/python/mypy/pull/21304)) +- `librt.strings` no longer behind experimental compiler flag (Jukka Lehtosalo, PR [21315](https://github.com/python/mypy/pull/21315)) +- Various `librt.strings` fixes (Jukka Lehtosalo, PR [21314](https://github.com/python/mypy/pull/21314)) +- Fix librt API/ABI version checks (Jukka Lehtosalo, PR [21311](https://github.com/python/mypy/pull/21311)) +- Mark `librt.time.time()` non-experimental (Ivan Levkivskyi, PR [21310](https://github.com/python/mypy/pull/21310)) +- Fix aliasing related segfault with vec append (Jukka Lehtosalo, PR [21303](https://github.com/python/mypy/pull/21303)) +- Generate more type methods for classes with attribute dictionaries (Piotr Sawicki, PR [21290](https://github.com/python/mypy/pull/21290)) +- Fix reference counting for tuple items during deallocation (Shantanu, PR [21245](https://github.com/python/mypy/pull/21245)) +- Release new instances when `__init__` raises (Shantanu, PR [21248](https://github.com/python/mypy/pull/21248)) +- Fix `@property` getter memory leak (Vaggelis Danias, PR [21230](https://github.com/python/mypy/pull/21230)) +- Fix semantics for walrus expression in tuple (Shantanu, PR [21249](https://github.com/python/mypy/pull/21249)) +- Fix crash on import errors during cleanup (Shantanu, PR [21247](https://github.com/python/mypy/pull/21247)) +- Fix reference leak in str index (Shantanu, PR [21251](https://github.com/python/mypy/pull/21251)) +- Fix memory leak in integer true division (Shantanu, PR [21246](https://github.com/python/mypy/pull/21246)) +- Fix reference leaks in `list/dict.clear` (Shantanu, PR [21244](https://github.com/python/mypy/pull/21244)) +- Resolve type aliases in function specialization (esarp, PR [21233](https://github.com/python/mypy/pull/21233)) +- Report an error if an acyclic class inherits from non-acyclic (Piotr Sawicki, PR [21227](https://github.com/python/mypy/pull/21227)) +- Fix `b64decode` to match new CPython behavior (Piotr Sawicki, PR [21200](https://github.com/python/mypy/pull/21200)) +- Add `__contains__` method to vec (Jukka Lehtosalo, PR [21138](https://github.com/python/mypy/pull/21138)) +- Add vec iterators (Jukka Lehtosalo, PR [21135](https://github.com/python/mypy/pull/21135)) + +### Stubtest Improvements + +- Basic support for unpack kwargs (Shantanu, PR [21024](https://github.com/python/mypy/pull/21024)) +- Fix false positive for properties with a deleter (Pranav Manglik, PR [21259](https://github.com/python/mypy/pull/21259)) + +### Documentation Updates + +- Rename "value restriction" to "value-constrained type variable" (Leo Ji, PR [21112](https://github.com/python/mypy/pull/21112)) +- Clarify that invariant-by-default applies to legacy `TypeVar` syntax (Leo Ji, PR [21108](https://github.com/python/mypy/pull/21108)) + +### Fixes to Crashes + +- Fix crash when a file does not exist during semantic analysis (Ivan Levkivskyi, PR [21379](https://github.com/python/mypy/pull/21379)) +- Fix parallel worker crash on syntax error (Ivan Levkivskyi, PR [21202](https://github.com/python/mypy/pull/21202)) + +### Changes to Messages + +- Improve error messages for unexpected keyword arguments in overloaded functions (Kevin Kannammalil, PR [20592](https://github.com/python/mypy/pull/20592)) +- Don't suggest `Foo[...]` when `Foo(arg=...)` is used in annotation (Yosof Badr, PR [21238](https://github.com/python/mypy/pull/21238)) +- Mention what codes are actually ignored in "not covered by type: ignore comment" note (wyattscarpenter, PR [19904](https://github.com/python/mypy/pull/19904)) +- Improve error messages when positional argument is missing (Kevin Kannammalil, PR [20591](https://github.com/python/mypy/pull/20591)) +- Improve "name is not defined" errors with fuzzy matching (Kevin Kannammalil, PR [20693](https://github.com/python/mypy/pull/20693)) +- Add suggestions for misspelled module imports (Kevin Kannammalil, PR [20695](https://github.com/python/mypy/pull/20695)) +- Avoid calling best-match suggestions unless the message is shown (Ivan Levkivskyi, PR [21307](https://github.com/python/mypy/pull/21307)) + +### Other Notable Fixes and Improvements + +- Expose `--num-workers` and `--native-parser` (Ivan Levkivskyi, PR [21387](https://github.com/python/mypy/pull/21387)) +- Fix narrowing for `AbstractSet` and `Mapping` (Shantanu, PR [21352](https://github.com/python/mypy/pull/21352)) +- Preserve gradual guarantee when narrowing `Any` union via equality (Shantanu, PR [21368](https://github.com/python/mypy/pull/21368)) +- Make new parser consistent with the old one (Ivan Levkivskyi, PR [21377](https://github.com/python/mypy/pull/21377)) +- Make type variable upper bound narrowing symmetric (Ivan Levkivskyi, PR [21350](https://github.com/python/mypy/pull/21350)) +- Fail fast when user tries to generate reports with parallel workers (Ivan Levkivskyi, PR [21341](https://github.com/python/mypy/pull/21341)) +- Behave consistently when type-checking stub package directly (Ivan Levkivskyi, PR [21330](https://github.com/python/mypy/pull/21330)) +- Add support for `Final[...]` in dataclasses (Ivan Levkivskyi, PR [21334](https://github.com/python/mypy/pull/21334)) +- Narrow more sequence parents (Shantanu, PR [21327](https://github.com/python/mypy/pull/21327)) +- Support `--package-root` with native parser (Ivan Levkivskyi, PR [21321](https://github.com/python/mypy/pull/21321)) +- Partially support old NumPy plugin in parallel type checking (Ivan Levkivskyi, PR [21324](https://github.com/python/mypy/pull/21324)) +- Handle reachability consistently in parallel type checking (Ivan Levkivskyi, PR [21322](https://github.com/python/mypy/pull/21322)) +- Always respect `@no_type_check` in parallel type checking (Ivan Levkivskyi, PR [21320](https://github.com/python/mypy/pull/21320)) +- Minor fixes in parallel checking (Ivan Levkivskyi, PR [21319](https://github.com/python/mypy/pull/21319)) +- Better narrowing for enums and other types with known equality (Shantanu, PR [21281](https://github.com/python/mypy/pull/21281)) +- Improve call expressions in type annotations with native parser (Jukka Lehtosalo, PR [21300](https://github.com/python/mypy/pull/21300)) +- Depend on `ast-serialize` by default (Jukka Lehtosalo, PR [21297](https://github.com/python/mypy/pull/21297)) +- Fix pathspec error (Ivan Levkivskyi, PR [21296](https://github.com/python/mypy/pull/21296)) +- Use sharding for SQLite cache (Jukka Lehtosalo, PR [21292](https://github.com/python/mypy/pull/21292)) +- Batch module groups for parallel processing (Ivan Levkivskyi, PR [21287](https://github.com/python/mypy/pull/21287)) +- Limit type inference context fallback to walrus operator only (Ivan Levkivskyi, PR [21294](https://github.com/python/mypy/pull/21294)) +- Fix sequential bottleneck in parallel parsing (Jukka Lehtosalo, PR [21291](https://github.com/python/mypy/pull/21291)) +- Support `.git/info/exclude` for `--exclude-gitignore` (RogerJinIS, PR [21286](https://github.com/python/mypy/pull/21286)) +- Let `--allow-redefinition` widen global in function with `None` initialization (Jukka Lehtosalo, PR [21285](https://github.com/python/mypy/pull/21285)) +- Delete Python 2 extra (Shantanu, PR [18374](https://github.com/python/mypy/pull/18374)) +- Use parallel parsing at all stages (Ivan Levkivskyi, PR [21266](https://github.com/python/mypy/pull/21266)) +- Fix plugins logic in parallel type checking (Ivan Levkivskyi, PR [21252](https://github.com/python/mypy/pull/21252)) +- No longer narrow final globals in functions (Ivan Levkivskyi, PR [21241](https://github.com/python/mypy/pull/21241)) +- Narrow unions containing `Any` in conditional branches (Shantanu, PR [21231](https://github.com/python/mypy/pull/21231)) +- Fix Windows IPC race condition when using parallel checking (Jukka Lehtosalo, PR [21228](https://github.com/python/mypy/pull/21228)) +- Report parallel worker exit status on receive failure (Jukka Lehtosalo, PR [21224](https://github.com/python/mypy/pull/21224)) +- Order cases in native parser based on AST node frequency (Jukka Lehtosalo, PR [21219](https://github.com/python/mypy/pull/21219)) +- Split type checking into interface and implementation in parallel workers (Ivan Levkivskyi, PR [21119](https://github.com/python/mypy/pull/21119)) +- Propagate narrowing within chained comparisons (Shantanu, PR [21160](https://github.com/python/mypy/pull/21160)) +- Parse files in parallel when possible (Ivan Levkivskyi, PR [21175](https://github.com/python/mypy/pull/21175)) +- Determine development version hash without running git (Jukka Lehtosalo, PR [21212](https://github.com/python/mypy/pull/21212)) +- Optimize parallel workers start-up (Ivan Levkivskyi, PR [21203](https://github.com/python/mypy/pull/21203)) +- Add proper lazy deserialization (Ivan Levkivskyi, PR [21198](https://github.com/python/mypy/pull/21198)) +- Add `install_types` to options affecting cache (Brian Schubert, PR [21070](https://github.com/python/mypy/pull/21070)) +- Narrow `Any` in conditional type checks (Shantanu, PR [21167](https://github.com/python/mypy/pull/21167)) +- Fix exception handler target location in new parser (Ivan Levkivskyi, PR [21185](https://github.com/python/mypy/pull/21185)) +- Improve traceback display (Shantanu, PR [21155](https://github.com/python/mypy/pull/21155)) +- Include 2 more files in the sdist: CREDITS and typeshed README (Michael R. Crusoe, PR [21131](https://github.com/python/mypy/pull/21131)) + ## Mypy 1.20 We’ve just uploaded mypy 1.20.0 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)). From ad42ef7d7174103e2bc93df877847df25533be7f Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 6 May 2026 16:29:36 +0100 Subject: [PATCH 2/4] Changelog tweaks --- CHANGELOG.md | 55 +++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fb214042544..55b763eb2811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,19 +113,10 @@ Contributed by Jukka Lehtosalo. ### Mypyc Improvements -- Add note about `librt.strings` thread safety (Jukka Lehtosalo, PR [21383](https://github.com/python/mypy/pull/21383)) -- Document `librt.strings` (Jukka Lehtosalo, PR [21374](https://github.com/python/mypy/pull/21374)) - Document `librt.time` (Jukka Lehtosalo, PR [21372](https://github.com/python/mypy/pull/21372)) -- Use memory copy for vec init and extend using buffer protocol (Jukka Lehtosalo, PR [21349](https://github.com/python/mypy/pull/21349)) -- Add vec extend function to `librt.vecs` (Jukka Lehtosalo, PR [21340](https://github.com/python/mypy/pull/21340)) -- Fix capsule dependencies of `librt.internal.(Write|Read)Buffer` (Jukka Lehtosalo, PR [21329](https://github.com/python/mypy/pull/21329)) +- Mark `librt.time.time()` non-experimental (Ivan Levkivskyi, PR [21310](https://github.com/python/mypy/pull/21310)) - Fix `librt.time` primitive now that it is no longer experimental (Ivan Levkivskyi, PR [21318](https://github.com/python/mypy/pull/21318)) -- Support specifying vec capacity during construction (Jukka Lehtosalo, PR [21304](https://github.com/python/mypy/pull/21304)) -- `librt.strings` no longer behind experimental compiler flag (Jukka Lehtosalo, PR [21315](https://github.com/python/mypy/pull/21315)) -- Various `librt.strings` fixes (Jukka Lehtosalo, PR [21314](https://github.com/python/mypy/pull/21314)) - Fix librt API/ABI version checks (Jukka Lehtosalo, PR [21311](https://github.com/python/mypy/pull/21311)) -- Mark `librt.time.time()` non-experimental (Ivan Levkivskyi, PR [21310](https://github.com/python/mypy/pull/21310)) -- Fix aliasing related segfault with vec append (Jukka Lehtosalo, PR [21303](https://github.com/python/mypy/pull/21303)) - Generate more type methods for classes with attribute dictionaries (Piotr Sawicki, PR [21290](https://github.com/python/mypy/pull/21290)) - Fix reference counting for tuple items during deallocation (Shantanu, PR [21245](https://github.com/python/mypy/pull/21245)) - Release new instances when `__init__` raises (Shantanu, PR [21248](https://github.com/python/mypy/pull/21248)) @@ -138,18 +129,6 @@ Contributed by Jukka Lehtosalo. - Resolve type aliases in function specialization (esarp, PR [21233](https://github.com/python/mypy/pull/21233)) - Report an error if an acyclic class inherits from non-acyclic (Piotr Sawicki, PR [21227](https://github.com/python/mypy/pull/21227)) - Fix `b64decode` to match new CPython behavior (Piotr Sawicki, PR [21200](https://github.com/python/mypy/pull/21200)) -- Add `__contains__` method to vec (Jukka Lehtosalo, PR [21138](https://github.com/python/mypy/pull/21138)) -- Add vec iterators (Jukka Lehtosalo, PR [21135](https://github.com/python/mypy/pull/21135)) - -### Stubtest Improvements - -- Basic support for unpack kwargs (Shantanu, PR [21024](https://github.com/python/mypy/pull/21024)) -- Fix false positive for properties with a deleter (Pranav Manglik, PR [21259](https://github.com/python/mypy/pull/21259)) - -### Documentation Updates - -- Rename "value restriction" to "value-constrained type variable" (Leo Ji, PR [21112](https://github.com/python/mypy/pull/21112)) -- Clarify that invariant-by-default applies to legacy `TypeVar` syntax (Leo Ji, PR [21108](https://github.com/python/mypy/pull/21108)) ### Fixes to Crashes @@ -164,27 +143,48 @@ Contributed by Jukka Lehtosalo. - Improve error messages when positional argument is missing (Kevin Kannammalil, PR [20591](https://github.com/python/mypy/pull/20591)) - Improve "name is not defined" errors with fuzzy matching (Kevin Kannammalil, PR [20693](https://github.com/python/mypy/pull/20693)) - Add suggestions for misspelled module imports (Kevin Kannammalil, PR [20695](https://github.com/python/mypy/pull/20695)) + +### Performance Improvements + - Avoid calling best-match suggestions unless the message is shown (Ivan Levkivskyi, PR [21307](https://github.com/python/mypy/pull/21307)) +- Order cases in native parser based on AST node frequency (Jukka Lehtosalo, PR [21219](https://github.com/python/mypy/pull/21219)) + +### Stubtest Improvements + +- Basic support for unpack kwargs (Shantanu, PR [21024](https://github.com/python/mypy/pull/21024)) +- Fix false positive for properties with a deleter (Pranav Manglik, PR [21259](https://github.com/python/mypy/pull/21259)) + +### Documentation Updates + +- Rename "value restriction" to "value-constrained type variable" (Leo Ji, PR [21112](https://github.com/python/mypy/pull/21112)) +- Clarify that invariant-by-default applies to legacy `TypeVar` syntax (Leo Ji, PR [21108](https://github.com/python/mypy/pull/21108)) + +### Improvements to Native Parser + +The new native parser is still experimental. + +- Make new parser consistent with the old one (Ivan Levkivskyi, PR [21377](https://github.com/python/mypy/pull/21377)) +- Support `--package-root` with native parser (Ivan Levkivskyi, PR [21321](https://github.com/python/mypy/pull/21321)) +- Improve call expressions in type annotations with native parser (Jukka Lehtosalo, PR [21300](https://github.com/python/mypy/pull/21300)) +- Depend on `ast-serialize` by default (Jukka Lehtosalo, PR [21297](https://github.com/python/mypy/pull/21297)) +- Parse files in parallel when possible (Ivan Levkivskyi, PR [21175](https://github.com/python/mypy/pull/21175)) +- Use parallel parsing at all stages (Ivan Levkivskyi, PR [21266](https://github.com/python/mypy/pull/21266)) ### Other Notable Fixes and Improvements - Expose `--num-workers` and `--native-parser` (Ivan Levkivskyi, PR [21387](https://github.com/python/mypy/pull/21387)) - Fix narrowing for `AbstractSet` and `Mapping` (Shantanu, PR [21352](https://github.com/python/mypy/pull/21352)) - Preserve gradual guarantee when narrowing `Any` union via equality (Shantanu, PR [21368](https://github.com/python/mypy/pull/21368)) -- Make new parser consistent with the old one (Ivan Levkivskyi, PR [21377](https://github.com/python/mypy/pull/21377)) - Make type variable upper bound narrowing symmetric (Ivan Levkivskyi, PR [21350](https://github.com/python/mypy/pull/21350)) - Fail fast when user tries to generate reports with parallel workers (Ivan Levkivskyi, PR [21341](https://github.com/python/mypy/pull/21341)) - Behave consistently when type-checking stub package directly (Ivan Levkivskyi, PR [21330](https://github.com/python/mypy/pull/21330)) - Add support for `Final[...]` in dataclasses (Ivan Levkivskyi, PR [21334](https://github.com/python/mypy/pull/21334)) - Narrow more sequence parents (Shantanu, PR [21327](https://github.com/python/mypy/pull/21327)) -- Support `--package-root` with native parser (Ivan Levkivskyi, PR [21321](https://github.com/python/mypy/pull/21321)) - Partially support old NumPy plugin in parallel type checking (Ivan Levkivskyi, PR [21324](https://github.com/python/mypy/pull/21324)) - Handle reachability consistently in parallel type checking (Ivan Levkivskyi, PR [21322](https://github.com/python/mypy/pull/21322)) - Always respect `@no_type_check` in parallel type checking (Ivan Levkivskyi, PR [21320](https://github.com/python/mypy/pull/21320)) - Minor fixes in parallel checking (Ivan Levkivskyi, PR [21319](https://github.com/python/mypy/pull/21319)) - Better narrowing for enums and other types with known equality (Shantanu, PR [21281](https://github.com/python/mypy/pull/21281)) -- Improve call expressions in type annotations with native parser (Jukka Lehtosalo, PR [21300](https://github.com/python/mypy/pull/21300)) -- Depend on `ast-serialize` by default (Jukka Lehtosalo, PR [21297](https://github.com/python/mypy/pull/21297)) - Fix pathspec error (Ivan Levkivskyi, PR [21296](https://github.com/python/mypy/pull/21296)) - Use sharding for SQLite cache (Jukka Lehtosalo, PR [21292](https://github.com/python/mypy/pull/21292)) - Batch module groups for parallel processing (Ivan Levkivskyi, PR [21287](https://github.com/python/mypy/pull/21287)) @@ -193,16 +193,13 @@ Contributed by Jukka Lehtosalo. - Support `.git/info/exclude` for `--exclude-gitignore` (RogerJinIS, PR [21286](https://github.com/python/mypy/pull/21286)) - Let `--allow-redefinition` widen global in function with `None` initialization (Jukka Lehtosalo, PR [21285](https://github.com/python/mypy/pull/21285)) - Delete Python 2 extra (Shantanu, PR [18374](https://github.com/python/mypy/pull/18374)) -- Use parallel parsing at all stages (Ivan Levkivskyi, PR [21266](https://github.com/python/mypy/pull/21266)) - Fix plugins logic in parallel type checking (Ivan Levkivskyi, PR [21252](https://github.com/python/mypy/pull/21252)) - No longer narrow final globals in functions (Ivan Levkivskyi, PR [21241](https://github.com/python/mypy/pull/21241)) - Narrow unions containing `Any` in conditional branches (Shantanu, PR [21231](https://github.com/python/mypy/pull/21231)) - Fix Windows IPC race condition when using parallel checking (Jukka Lehtosalo, PR [21228](https://github.com/python/mypy/pull/21228)) - Report parallel worker exit status on receive failure (Jukka Lehtosalo, PR [21224](https://github.com/python/mypy/pull/21224)) -- Order cases in native parser based on AST node frequency (Jukka Lehtosalo, PR [21219](https://github.com/python/mypy/pull/21219)) - Split type checking into interface and implementation in parallel workers (Ivan Levkivskyi, PR [21119](https://github.com/python/mypy/pull/21119)) - Propagate narrowing within chained comparisons (Shantanu, PR [21160](https://github.com/python/mypy/pull/21160)) -- Parse files in parallel when possible (Ivan Levkivskyi, PR [21175](https://github.com/python/mypy/pull/21175)) - Determine development version hash without running git (Jukka Lehtosalo, PR [21212](https://github.com/python/mypy/pull/21212)) - Optimize parallel workers start-up (Ivan Levkivskyi, PR [21203](https://github.com/python/mypy/pull/21203)) - Add proper lazy deserialization (Ivan Levkivskyi, PR [21198](https://github.com/python/mypy/pull/21198)) From bec149fe5097e414b44e3d3a002180f6352b04c8 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 6 May 2026 17:07:29 +0100 Subject: [PATCH 3/4] Add boilerplate + misc changes --- CHANGELOG.md | 77 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55b763eb2811..fe465341718d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,18 @@ ## Next Release -### Enabling `--local-partial-types` by Default +## Mypy 2.0 + +We’ve just uploaded mypy 2.0.0 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)). +Mypy is a static type checker for Python. This release includes new features, performance +improvements and bug fixes. There are also changes to options and defaults. +You can install it as follows: + + python3 -m pip install -U mypy + +You can read the full documentation for this release on [Read the Docs](http://mypy.readthedocs.io). + +### Enable `--local-partial-types` by Default This flag affects the inference of types based on assignments in other scopes. For now, explicitly disabling this continues to be supported, but this support will be removed @@ -11,7 +22,7 @@ in mypy, like the daemon or the new implementation of flexible redefinitions. Contributed by Ivan Levkivskyi, Jukka Lehtosalo, Shantanu in [PR 21163](https://github.com/python/mypy/pull/21163). -### Enabling `--strict-bytes` by Default +### Enable `--strict-bytes` by Default Per [PEP 688](https://peps.python.org/pep-0688), mypy no longer treats `bytearray` and `memoryview` values as assignable to the `bytes` type. @@ -72,6 +83,25 @@ in future mypy releases. Contributed by Ivan Levkivskyi, with additional contributions from Emma Smith and Jukka Lehtosalo. +A very partial list of changes (only the most recent changes): + +- Freeze garbage collection in parallel workers for 4-5% speedup (Ivan Levkivskyi, PR [21302](https://github.com/python/mypy/pull/21302)) +- Expose `--num-workers` and `--native-parser` (Ivan Levkivskyi, PR [21387](https://github.com/python/mypy/pull/21387)) +- Split type checking into interface and implementation in parallel workers (Ivan Levkivskyi, PR [21119](https://github.com/python/mypy/pull/21119)) +- Batch module groups for parallel processing (Ivan Levkivskyi, PR [21287](https://github.com/python/mypy/pull/21287)) +- Optimize parallel workers start-up (Ivan Levkivskyi, PR [21203](https://github.com/python/mypy/pull/21203)) +- Parse files in parallel when possible (Ivan Levkivskyi, PR [21175](https://github.com/python/mypy/pull/21175)) +- Use parallel parsing at all stages (Ivan Levkivskyi, PR [21266](https://github.com/python/mypy/pull/21266)) +- Fix sequential bottleneck in parallel parsing (Jukka Lehtosalo, PR [21291](https://github.com/python/mypy/pull/21291)) +- Fail fast when user tries to generate reports with parallel workers (Ivan Levkivskyi, PR [21341](https://github.com/python/mypy/pull/21341)) +- Partially support old NumPy plugin in parallel type checking (Ivan Levkivskyi, PR [21324](https://github.com/python/mypy/pull/21324)) +- Handle reachability consistently in parallel type checking (Ivan Levkivskyi, PR [21322](https://github.com/python/mypy/pull/21322)) +- Always respect `@no_type_check` in parallel type checking (Ivan Levkivskyi, PR [21320](https://github.com/python/mypy/pull/21320)) +- Minor fixes in parallel checking (Ivan Levkivskyi, PR [21319](https://github.com/python/mypy/pull/21319)) +- Fix plugins logic in parallel type checking (Ivan Levkivskyi, PR [21252](https://github.com/python/mypy/pull/21252)) +- Fix Windows IPC race condition when using parallel checking (Jukka Lehtosalo, PR [21228](https://github.com/python/mypy/pull/21228)) +- Report parallel worker exit status on receive failure (Jukka Lehtosalo, PR [21224](https://github.com/python/mypy/pull/21224)) + ### Drop Support for Targeting Python 3.9 Mypy no longer supports type checking code with `--python-version 3.9`. @@ -146,6 +176,7 @@ Contributed by Jukka Lehtosalo. ### Performance Improvements +- Replace `NamedTuple` with faster regular classes in hot paths (Shantanu, PR [21326](https://github.com/python/mypy/pull/21326)) - Avoid calling best-match suggestions unless the message is shown (Ivan Levkivskyi, PR [21307](https://github.com/python/mypy/pull/21307)) - Order cases in native parser based on AST node frequency (Jukka Lehtosalo, PR [21219](https://github.com/python/mypy/pull/21219)) @@ -167,41 +198,25 @@ The new native parser is still experimental. - Support `--package-root` with native parser (Ivan Levkivskyi, PR [21321](https://github.com/python/mypy/pull/21321)) - Improve call expressions in type annotations with native parser (Jukka Lehtosalo, PR [21300](https://github.com/python/mypy/pull/21300)) - Depend on `ast-serialize` by default (Jukka Lehtosalo, PR [21297](https://github.com/python/mypy/pull/21297)) -- Parse files in parallel when possible (Ivan Levkivskyi, PR [21175](https://github.com/python/mypy/pull/21175)) -- Use parallel parsing at all stages (Ivan Levkivskyi, PR [21266](https://github.com/python/mypy/pull/21266)) ### Other Notable Fixes and Improvements -- Expose `--num-workers` and `--native-parser` (Ivan Levkivskyi, PR [21387](https://github.com/python/mypy/pull/21387)) - Fix narrowing for `AbstractSet` and `Mapping` (Shantanu, PR [21352](https://github.com/python/mypy/pull/21352)) - Preserve gradual guarantee when narrowing `Any` union via equality (Shantanu, PR [21368](https://github.com/python/mypy/pull/21368)) - Make type variable upper bound narrowing symmetric (Ivan Levkivskyi, PR [21350](https://github.com/python/mypy/pull/21350)) -- Fail fast when user tries to generate reports with parallel workers (Ivan Levkivskyi, PR [21341](https://github.com/python/mypy/pull/21341)) - Behave consistently when type-checking stub package directly (Ivan Levkivskyi, PR [21330](https://github.com/python/mypy/pull/21330)) - Add support for `Final[...]` in dataclasses (Ivan Levkivskyi, PR [21334](https://github.com/python/mypy/pull/21334)) - Narrow more sequence parents (Shantanu, PR [21327](https://github.com/python/mypy/pull/21327)) -- Partially support old NumPy plugin in parallel type checking (Ivan Levkivskyi, PR [21324](https://github.com/python/mypy/pull/21324)) -- Handle reachability consistently in parallel type checking (Ivan Levkivskyi, PR [21322](https://github.com/python/mypy/pull/21322)) -- Always respect `@no_type_check` in parallel type checking (Ivan Levkivskyi, PR [21320](https://github.com/python/mypy/pull/21320)) -- Minor fixes in parallel checking (Ivan Levkivskyi, PR [21319](https://github.com/python/mypy/pull/21319)) - Better narrowing for enums and other types with known equality (Shantanu, PR [21281](https://github.com/python/mypy/pull/21281)) - Fix pathspec error (Ivan Levkivskyi, PR [21296](https://github.com/python/mypy/pull/21296)) - Use sharding for SQLite cache (Jukka Lehtosalo, PR [21292](https://github.com/python/mypy/pull/21292)) -- Batch module groups for parallel processing (Ivan Levkivskyi, PR [21287](https://github.com/python/mypy/pull/21287)) - Limit type inference context fallback to walrus operator only (Ivan Levkivskyi, PR [21294](https://github.com/python/mypy/pull/21294)) -- Fix sequential bottleneck in parallel parsing (Jukka Lehtosalo, PR [21291](https://github.com/python/mypy/pull/21291)) - Support `.git/info/exclude` for `--exclude-gitignore` (RogerJinIS, PR [21286](https://github.com/python/mypy/pull/21286)) - Let `--allow-redefinition` widen global in function with `None` initialization (Jukka Lehtosalo, PR [21285](https://github.com/python/mypy/pull/21285)) - Delete Python 2 extra (Shantanu, PR [18374](https://github.com/python/mypy/pull/18374)) -- Fix plugins logic in parallel type checking (Ivan Levkivskyi, PR [21252](https://github.com/python/mypy/pull/21252)) - No longer narrow final globals in functions (Ivan Levkivskyi, PR [21241](https://github.com/python/mypy/pull/21241)) - Narrow unions containing `Any` in conditional branches (Shantanu, PR [21231](https://github.com/python/mypy/pull/21231)) -- Fix Windows IPC race condition when using parallel checking (Jukka Lehtosalo, PR [21228](https://github.com/python/mypy/pull/21228)) -- Report parallel worker exit status on receive failure (Jukka Lehtosalo, PR [21224](https://github.com/python/mypy/pull/21224)) -- Split type checking into interface and implementation in parallel workers (Ivan Levkivskyi, PR [21119](https://github.com/python/mypy/pull/21119)) - Propagate narrowing within chained comparisons (Shantanu, PR [21160](https://github.com/python/mypy/pull/21160)) -- Determine development version hash without running git (Jukka Lehtosalo, PR [21212](https://github.com/python/mypy/pull/21212)) -- Optimize parallel workers start-up (Ivan Levkivskyi, PR [21203](https://github.com/python/mypy/pull/21203)) - Add proper lazy deserialization (Ivan Levkivskyi, PR [21198](https://github.com/python/mypy/pull/21198)) - Add `install_types` to options affecting cache (Brian Schubert, PR [21070](https://github.com/python/mypy/pull/21070)) - Narrow `Any` in conditional type checks (Shantanu, PR [21167](https://github.com/python/mypy/pull/21167)) @@ -209,6 +224,32 @@ The new native parser is still experimental. - Improve traceback display (Shantanu, PR [21155](https://github.com/python/mypy/pull/21155)) - Include 2 more files in the sdist: CREDITS and typeshed README (Michael R. Crusoe, PR [21131](https://github.com/python/mypy/pull/21131)) + +### Typeshed Updates + +Please see [git log](https://github.com/python/typeshed/commits/main?after=c5e47faeda2cf9d233f91bc1dc95814b0cc7ccba+0&branch=main&path=stdlib) for full list of standard library typeshed stub changes. + +### Acknowledgements + +Thanks to all mypy contributors who contributed to this release: +- Brian Schubert +- Ethan Sarp +- Ivan Levkivskyi +- Jukka Lehtosalo +- Kevin Kannammalil +- Leo Ji +- Marc Mueller +- Michael R. Crusoe +- Piotr Sawicki +- Pranav Manglik +- RogerJinIS +- Shantanu +- Vaggelis Danias +- wyattscarpenter +- Yosof Badr + +I’d also like to thank my employer, Dropbox, for supporting mypy development. + ## Mypy 1.20 We’ve just uploaded mypy 1.20.0 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)). From 30ff2517730970b7e4eeef6cbf132821dd99ab7b Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 6 May 2026 17:13:05 +0100 Subject: [PATCH 4/4] Small edits --- CHANGELOG.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe465341718d..0d4f487a030a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,22 +83,22 @@ in future mypy releases. Contributed by Ivan Levkivskyi, with additional contributions from Emma Smith and Jukka Lehtosalo. -A very partial list of changes (only the most recent changes): +Recent related changes since the last release: - Freeze garbage collection in parallel workers for 4-5% speedup (Ivan Levkivskyi, PR [21302](https://github.com/python/mypy/pull/21302)) - Expose `--num-workers` and `--native-parser` (Ivan Levkivskyi, PR [21387](https://github.com/python/mypy/pull/21387)) - Split type checking into interface and implementation in parallel workers (Ivan Levkivskyi, PR [21119](https://github.com/python/mypy/pull/21119)) - Batch module groups for parallel processing (Ivan Levkivskyi, PR [21287](https://github.com/python/mypy/pull/21287)) -- Optimize parallel workers start-up (Ivan Levkivskyi, PR [21203](https://github.com/python/mypy/pull/21203)) +- Optimize parallel worker startup (Ivan Levkivskyi, PR [21203](https://github.com/python/mypy/pull/21203)) - Parse files in parallel when possible (Ivan Levkivskyi, PR [21175](https://github.com/python/mypy/pull/21175)) - Use parallel parsing at all stages (Ivan Levkivskyi, PR [21266](https://github.com/python/mypy/pull/21266)) - Fix sequential bottleneck in parallel parsing (Jukka Lehtosalo, PR [21291](https://github.com/python/mypy/pull/21291)) -- Fail fast when user tries to generate reports with parallel workers (Ivan Levkivskyi, PR [21341](https://github.com/python/mypy/pull/21341)) +- Fail fast when a user tries to generate reports with parallel workers (Ivan Levkivskyi, PR [21341](https://github.com/python/mypy/pull/21341)) - Partially support old NumPy plugin in parallel type checking (Ivan Levkivskyi, PR [21324](https://github.com/python/mypy/pull/21324)) - Handle reachability consistently in parallel type checking (Ivan Levkivskyi, PR [21322](https://github.com/python/mypy/pull/21322)) - Always respect `@no_type_check` in parallel type checking (Ivan Levkivskyi, PR [21320](https://github.com/python/mypy/pull/21320)) - Minor fixes in parallel checking (Ivan Levkivskyi, PR [21319](https://github.com/python/mypy/pull/21319)) -- Fix plugins logic in parallel type checking (Ivan Levkivskyi, PR [21252](https://github.com/python/mypy/pull/21252)) +- Fix plugin logic in parallel type checking (Ivan Levkivskyi, PR [21252](https://github.com/python/mypy/pull/21252)) - Fix Windows IPC race condition when using parallel checking (Jukka Lehtosalo, PR [21228](https://github.com/python/mypy/pull/21228)) - Report parallel worker exit status on receive failure (Jukka Lehtosalo, PR [21224](https://github.com/python/mypy/pull/21224)) @@ -146,7 +146,7 @@ Contributed by Jukka Lehtosalo. - Document `librt.time` (Jukka Lehtosalo, PR [21372](https://github.com/python/mypy/pull/21372)) - Mark `librt.time.time()` non-experimental (Ivan Levkivskyi, PR [21310](https://github.com/python/mypy/pull/21310)) - Fix `librt.time` primitive now that it is no longer experimental (Ivan Levkivskyi, PR [21318](https://github.com/python/mypy/pull/21318)) -- Fix librt API/ABI version checks (Jukka Lehtosalo, PR [21311](https://github.com/python/mypy/pull/21311)) +- Fix `librt` API/ABI version checks (Jukka Lehtosalo, PR [21311](https://github.com/python/mypy/pull/21311)) - Generate more type methods for classes with attribute dictionaries (Piotr Sawicki, PR [21290](https://github.com/python/mypy/pull/21290)) - Fix reference counting for tuple items during deallocation (Shantanu, PR [21245](https://github.com/python/mypy/pull/21245)) - Release new instances when `__init__` raises (Shantanu, PR [21248](https://github.com/python/mypy/pull/21248)) @@ -155,7 +155,7 @@ Contributed by Jukka Lehtosalo. - Fix crash on import errors during cleanup (Shantanu, PR [21247](https://github.com/python/mypy/pull/21247)) - Fix reference leak in str index (Shantanu, PR [21251](https://github.com/python/mypy/pull/21251)) - Fix memory leak in integer true division (Shantanu, PR [21246](https://github.com/python/mypy/pull/21246)) -- Fix reference leaks in `list/dict.clear` (Shantanu, PR [21244](https://github.com/python/mypy/pull/21244)) +- Fix reference leaks in `list.clear()`/`dict.clear()` (Shantanu, PR [21244](https://github.com/python/mypy/pull/21244)) - Resolve type aliases in function specialization (esarp, PR [21233](https://github.com/python/mypy/pull/21233)) - Report an error if an acyclic class inherits from non-acyclic (Piotr Sawicki, PR [21227](https://github.com/python/mypy/pull/21227)) - Fix `b64decode` to match new CPython behavior (Piotr Sawicki, PR [21200](https://github.com/python/mypy/pull/21200)) @@ -190,13 +190,13 @@ Contributed by Jukka Lehtosalo. - Rename "value restriction" to "value-constrained type variable" (Leo Ji, PR [21112](https://github.com/python/mypy/pull/21112)) - Clarify that invariant-by-default applies to legacy `TypeVar` syntax (Leo Ji, PR [21108](https://github.com/python/mypy/pull/21108)) -### Improvements to Native Parser +### Improvements to the Native Parser The new native parser is still experimental. - Make new parser consistent with the old one (Ivan Levkivskyi, PR [21377](https://github.com/python/mypy/pull/21377)) -- Support `--package-root` with native parser (Ivan Levkivskyi, PR [21321](https://github.com/python/mypy/pull/21321)) -- Improve call expressions in type annotations with native parser (Jukka Lehtosalo, PR [21300](https://github.com/python/mypy/pull/21300)) +- Support `--package-root` with the native parser (Ivan Levkivskyi, PR [21321](https://github.com/python/mypy/pull/21321)) +- Improve call expressions in type annotations with the native parser (Jukka Lehtosalo, PR [21300](https://github.com/python/mypy/pull/21300)) - Depend on `ast-serialize` by default (Jukka Lehtosalo, PR [21297](https://github.com/python/mypy/pull/21297)) ### Other Notable Fixes and Improvements @@ -204,15 +204,15 @@ The new native parser is still experimental. - Fix narrowing for `AbstractSet` and `Mapping` (Shantanu, PR [21352](https://github.com/python/mypy/pull/21352)) - Preserve gradual guarantee when narrowing `Any` union via equality (Shantanu, PR [21368](https://github.com/python/mypy/pull/21368)) - Make type variable upper bound narrowing symmetric (Ivan Levkivskyi, PR [21350](https://github.com/python/mypy/pull/21350)) -- Behave consistently when type-checking stub package directly (Ivan Levkivskyi, PR [21330](https://github.com/python/mypy/pull/21330)) +- Behave consistently when type-checking a stub package directly (Ivan Levkivskyi, PR [21330](https://github.com/python/mypy/pull/21330)) - Add support for `Final[...]` in dataclasses (Ivan Levkivskyi, PR [21334](https://github.com/python/mypy/pull/21334)) - Narrow more sequence parents (Shantanu, PR [21327](https://github.com/python/mypy/pull/21327)) - Better narrowing for enums and other types with known equality (Shantanu, PR [21281](https://github.com/python/mypy/pull/21281)) - Fix pathspec error (Ivan Levkivskyi, PR [21296](https://github.com/python/mypy/pull/21296)) -- Use sharding for SQLite cache (Jukka Lehtosalo, PR [21292](https://github.com/python/mypy/pull/21292)) -- Limit type inference context fallback to walrus operator only (Ivan Levkivskyi, PR [21294](https://github.com/python/mypy/pull/21294)) +- Use sharding for the SQLite cache (Jukka Lehtosalo, PR [21292](https://github.com/python/mypy/pull/21292)) +- Limit type inference context fallback to the walrus operator only (Ivan Levkivskyi, PR [21294](https://github.com/python/mypy/pull/21294)) - Support `.git/info/exclude` for `--exclude-gitignore` (RogerJinIS, PR [21286](https://github.com/python/mypy/pull/21286)) -- Let `--allow-redefinition` widen global in function with `None` initialization (Jukka Lehtosalo, PR [21285](https://github.com/python/mypy/pull/21285)) +- Let `--allow-redefinition` widen a global in a function with `None` initialization (Jukka Lehtosalo, PR [21285](https://github.com/python/mypy/pull/21285)) - Delete Python 2 extra (Shantanu, PR [18374](https://github.com/python/mypy/pull/18374)) - No longer narrow final globals in functions (Ivan Levkivskyi, PR [21241](https://github.com/python/mypy/pull/21241)) - Narrow unions containing `Any` in conditional branches (Shantanu, PR [21231](https://github.com/python/mypy/pull/21231)) @@ -222,8 +222,7 @@ The new native parser is still experimental. - Narrow `Any` in conditional type checks (Shantanu, PR [21167](https://github.com/python/mypy/pull/21167)) - Fix exception handler target location in new parser (Ivan Levkivskyi, PR [21185](https://github.com/python/mypy/pull/21185)) - Improve traceback display (Shantanu, PR [21155](https://github.com/python/mypy/pull/21155)) -- Include 2 more files in the sdist: CREDITS and typeshed README (Michael R. Crusoe, PR [21131](https://github.com/python/mypy/pull/21131)) - +- Include two more files in the sdist: `CREDITS` and the typeshed `README` (Michael R. Crusoe, PR [21131](https://github.com/python/mypy/pull/21131)) ### Typeshed Updates