Bump mypy from 1.19.1 to 2.4.0
Bumps mypy from 1.19.1 to 2.4.0.
Changelog
Sourced from mypy's changelog.
Mypy Release Notes
Next Release
Mypy 2.4
We've just uploaded mypy 2.4.0 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 mypyYou can read the full documentation for this release on Read the Docs.
Python 3.15 Support
Mypy 2.4 supports running on Python 3.15 and type checking most Python 3.15 features. This includes the new builtin
sentineltype for sentinel values (PEP 661), which mypy now supports (see below for details). Lazy imports (PEP 810) and unpacking in comprehensions (PEP 798) are also supported. Closed TypedDicts (PEP 728) have been supported since mypy 2.2, but theextra_itemsTypedDict argument, also introduced in PEP 728, is still unsupported. Support forextra_itemswill be added in a future mypy release.Native Parser Enabled by Default
Mypy now uses the new native parser by default. It's based on the Ruff parser, and it's significantly faster than the legacy parser, which uses the stdlib
astmodule. The native parser also has other benefits:
- You can target newer Python versions and use recent Python syntax even when running mypy on an older Python version. For example, you can use
--python-version 3.15when running mypy on Python 3.14.- Stub files can use syntax that is newer than the target Python version. For example, stubs can use the PEP 695 generic class syntax (
class Box[T]: ...) when running on or targeting Python 3.10.- Parallel type checking requires the native parser.
The legacy parser is still available through
--no-native-parser, ornative_parser = Falsein the config file (native_parser = falseunder[tool.mypy]in pyproject.toml). We are planning to remove the legacy parser in early 2027. If you run into a problem with the native parser, please report it on the issue tracker.Unlike the legacy parser, the native parser doesn't support type comments for variables defined by
forandwithstatements. These type comments are silently ignored, and the types of the variables are
... (truncated)
Commits
935ba8aBump version to 2.4.0334a678Add link for PR 22066 in mypy 2.4 changelog (#22082)fe69660Finalize mypy 2.4 changelog (#22080)541fd87Various mypy 2.4 changelog updates (#22077)b231182Update native parser docs (#22078)04fe42cInitial Changelog for Mypy 2.4 (#22071)0617494Quick fix for non UTF-8 encodings with new parser (#22066)b2f9b60Bump librt to 0.16.0 (#22067)9d798dcSync typeshed (#22054)0861bb6Reduce max protocol stack size to 20 (#22053)- Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Summary by cubic
Bumps mypy from 1.19.1 to 2.4.0 in uv.lock.
Mypy 2.4.0 enables the native parser by default and adds Python 3.15 support, including the sentinel type (PEP 661). Note that the native parser silently ignores type comments on variables defined by for and with statements; the legacy parser remains available via --no-native-parser.