Mypy 1.15 Released (original) (raw)

We’ve just uploaded mypy 1.15 to the Python Package Index (PyPI). Mypy is a static type checker for Python. This release includes new features, performance improvements and bug fixes. 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.

Performance Improvements

Mypy is up to 40% faster in some use cases. This improvement comes largely from tuning the performance of the garbage collector. Additionally, the release includes several micro-optimizations that may be impactful for large projects.

Contributed by Jukka Lehtosalo (PR 18306, PR 18302, PR 18298, PR 18299).

Mypyc Accelerated Mypy Wheels for ARM Linux

For best performance, mypy can be compiled to C extension modules using mypyc. This makes mypy 3-5x faster than when interpreted with pure Python. We now build and upload mypyc accelerated mypy wheels for manylinux_aarch64 to PyPI, making it easy for Linux users on ARM platforms to realise this speedup -- just pip install the latest mypy.

Contributed by Christian Bundy and Marc Mueller (PR mypy_mypyc-wheels#76, PR mypy_mypyc-wheels#89).

--strict-bytes

By default, mypy treats bytearray and memoryview values as assignable to the bytestype, for historical reasons. Use the --strict-bytes flag to disable this behavior. PEP 688 specified the removal of this special case. The flag will be enabled by default in mypy 2.0.

Contributed by Ali Hamdan (PR 18263) and Shantanu Jain (PR 13952).

Improvements to Reachability Analysis and Partial Type Handling in Loops

This change results in mypy better modelling control flow within loops and hence detecting several previously ignored issues. In some cases, this change may require additional explicit variable annotations.

Contributed by Christoph Tyralla (PR 18180, PR 18433). (Speaking of partial types, remember that we plan to enable --local-partial-typesby default in mypy 2.0.)

Better Discovery of Configuration Files

Mypy will now walk up the filesystem (up until a repository or file system root) to discover configuration files. See themypy configuration file documentationfor more details.

Contributed by Mikhail Shiryaev and Shantanu Jain (PR 16965, PR 18482)

Better Line Numbers for Decorators and Slice Expressions

Mypy now uses more correct line numbers for decorators and slice expressions. In some cases, you may have to change the location of a # type: ignore comment.

Contributed by Shantanu Jain (PR 18392, PR 18397).

Drop Support for Python 3.8

Mypy no longer supports running with Python 3.8, which has reached end-of-life. When running mypy with Python 3.9+, it is still possible to type check code that needs to support Python 3.8 with the --python-version 3.8 argument. Support for this will be dropped in the first half of 2025!

Contributed by Marc Mueller (PR 17492).

Mypyc Improvements

Stubgen Improvements

Stubtest Improvements

Fixes to Crashes

Documentation Updates

Other Notable Fixes and Improvements

Acknowledgements

Thanks to all mypy contributors who contributed to this release:

I’d also like to thank my employer, Dropbox, for supporting mypy development.