We’ve just uploaded mypy 1.12 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.
Support Python 3.12 Syntax for Generics (PEP 695)
Support for the new type parameter syntax introduced in Python 3.12 is now enabled by default,
documented, and no longer experimental. It was available through a feature flag in
mypy 1.11 as an experimental feature.
This example demonstrates the new syntax:
# Generic function
def f[T](https://github.com/python/mypy/blob/master/x: T) -> T: ...
reveal_type(f(1)) # Revealed type is 'int'
Generic class
class C[T]:
def init(self, x: T) -> None:
self.x = x
c = C('a')
reveal_type(c.x) # Revealed type is 'str'
Black is now officially tested with Python 3.13 and provides Python 3.13
mypyc-compiled wheels. (#4436) (#4449)
Black will issue an error when used with Python 3.12.5, due to an upstream memory
safety issue in Python 3.12.5 that can cause Black's AST safety checks to fail. Please
use Python 3.12.6 or Python 3.12.4 instead. (#4447)
Black no longer supports running with Python 3.8 (#4452)
Stable style
Fix crashes involving comments in parenthesised return types or X | Y style unions.
(#4453)
Fix skipping Jupyter cells with unknown %% magic (#4462)
Preview style
Fix type annotation spacing between * and more complex type variable tuple (i.e. def fn(*args: *tuple[*Ts, T]) -> None: pass) (#4440)
Caching
Fix bug where the cache was shared between runs with and without --unstable (#4466)
Packaging
Upgrade version of mypyc used to 1.12 beta (#4450) (#4449)
blackd now requires a newer version of aiohttp. (#4451)
Output
Added Python target version information on parse error (#4378)
Add information about Black version to internal error messages (#4457)
Black is now officially tested with Python 3.13 and provides Python 3.13
mypyc-compiled wheels. (#4436) (#4449)
Black will issue an error when used with Python 3.12.5, due to an upstream memory
safety issue in Python 3.12.5 that can cause Black's AST safety checks to fail. Please
use Python 3.12.6 or Python 3.12.4 instead. (#4447)
Black no longer supports running with Python 3.8 (#4452)
Stable style
Fix crashes involving comments in parenthesised return types or X | Y style unions.
(#4453)
Fix skipping Jupyter cells with unknown %% magic (#4462)
Preview style
Fix type annotation spacing between * and more complex type variable tuple (i.e. def fn(*args: *tuple[*Ts, T]) -> None: pass) (#4440)
Caching
Fix bug where the cache was shared between runs with and without --unstable (#4466)
Packaging
Upgrade version of mypyc used to 1.12 beta (#4450) (#4449)
blackd now requires a newer version of aiohttp. (#4451)
Output
Added Python target version information on parse error (#4378)
Add information about Black version to internal error messages (#4457)
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
The pytest rules PT001 and PT023 now default to omitting the decorator parentheses when there are no arguments
(#12838, #13292).
This was a change that we attempted to make in Ruff v0.6.0, but only partially made due to an error on our part.
See the blog post for more details.
The useless-try-except rule (in our tryceratops category) has been recoded from TRY302 to
TRY203 (#13502). This ensures Ruff's code is consistent with
the same rule in the tryceratops linter.
[flake8-simplify] Stabilize preview behavior for SIM115 so that the rule can detect files
being opened from a wider range of standard-library functions (#12959).
CLI
Add explanation of fixable in --statistics command (#13774)
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
The pytest rules PT001 and PT023 now default to omitting the decorator parentheses when there are no arguments
(#12838, #13292).
This was a change that we attempted to make in Ruff v0.6.0, but only partially made due to an error on our part.
See the blog post for more details.
The useless-try-except rule (in our tryceratops category) has been recoded from TRY302 to
TRY203 (#13502). This ensures Ruff's code is consistent with
the same rule in the tryceratops linter.
[flake8-simplify] Stabilize preview behavior for SIM115 so that the rule can detect files
being opened from a wider range of standard-library functions (#12959).
CLI
Add explanation of fixable in --statistics command (#13774)
- Add ``NETRC`` to the list of environment variables always passed through. (:issue:`3410`)
Improved Documentation - 4.23.0
replace [tool.pyproject] and [tool.tox.pyproject] with [tool.tox] in config.rst (:issue:3411)
v4.22.0 (2024-10-15)
Features - 4.22.0
- Implement dependency group support as defined in :pep:`735` - see :ref:`dependency_groups` - by :user:`gaborbernat`. (:issue:`3408`)
v4.21.2 (2024-10-03)
Bugfixes - 4.21.2
Include tox.toml in sdist archives to fix test failures resulting from its lack.
by :user:mgorny (:issue:3389)
v4.21.1 (2024-10-02)
Bugfixes - 4.21.1
- Fix error when using ``requires`` within a TOML configuration file - by :user:`gaborbernat`. (:issue:`3386`)
- Fix error when using ``deps`` within a TOML configuration file - by :user:`gaborbernat`. (:issue:`3387`)
- Multiple fixes for the TOML configuration by :user:`gaborbernat`.:
Do not fail when there is an empty command within commands.
Allow references for set_env by accepting list of dictionaries for it.
Do not try to be smart about reference unrolling, instead allow the user to control it via the extend flag,
available both for posargs and ref replacements.
The ref replacements raw key has been renamed to of. (:issue:3388)
v4.21.0 (2024-09-30)
Features - 4.21.0
Native TOML configuration support - by :user:gaborbernat. (:issue:999)
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 rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Updates the requirements on mypy, black, ruff, tox and pre-commit to permit the latest version. Updates
mypy
from 1.11.2 to 1.12.0Changelog
Sourced from mypy's changelog.
... (truncated)
Commits
f2a39b1
Update version to 1.12.0b4ec37a
Add one more 1.12 changelog item (#17936)cc1c679
Better handling of generic functions in partial plugin (#17925)d65a013
Add latest 1.12 changes to changelog (#17921)2e38965
Fix union callees with functools.partial (#17903)c5d3673
Document ReadOnly (PEP 705) (#17905)964a7a5
Make ReadOnly TypedDict items covariant (#17904)24bfb34
Include CHANGELOG.md in sdists (#17882)21d46ed
documentation for TypeIs (#17821)c692943
Improvements to functools.partial of types (#17898)Updates
black
from 24.8.0 to 24.10.0Release notes
Sourced from black's releases.
Changelog
Sourced from black's changelog.
Commits
1b2427a
Prepare release 24.10.0 (#4471)a22b1eb
Add mypyc 3.13 wheel build (#4449)b7d0e72
Bump AndreMiras/coveralls-python-action from 65c1672f0b8a201702d86c81b79187df...f1a2f92
Include --unstable in cache key (#4466)8d9d18c
Fix skipping Jupyter cells with unknown %% magic (#4462)bbfdba3
Fix docs CI: use venv for uv to fix 'failed to create directory' (#4460)8fb2add
Use builtin generics (#4458)2a45cec
Fix crashes with comments in parentheses (#4453)b4d6d86
Drop Python 3.8 support (#4452)ac018c1
Require newer aiohttp for blackd (#4451)Updates
ruff
from 0.6.8 to 0.7.0Release notes
Sourced from ruff's releases.
... (truncated)
Changelog
Sourced from ruff's changelog.
... (truncated)
Commits
5e6de4e
Changelog for Ruff v0.7 (#13794)70e5c4a
RecodeTRY302
toTRY203
(#13502)9218d6b
Removeallow-unused-imports
setting from the common lint options (#13677)1b79ae9
[ruff-0.7] Stabilise the expansion ofopen-file-with-context-handler
to wor...2b87587
[flake8-pytest-style
] Fix defaults whenlint.flake8-pytest-style
config s...d1e15f6
Remove tab-size setting (#12835)89a8215
Remove error messages for removed CLI aliases (#12833)202c6a6
Removeoutput-format=text
setting (#12836)5c3c0c4
[red-knot] Inference for comparison of union types (#13781)6b7a738
Add explanation of fixable in--statistics
command (#13774)Updates
tox
to 4.23.0Release notes
Sourced from tox's releases.
Changelog
Sourced from tox's changelog.
... (truncated)
Commits
7696a8e
release 4.23.0c01a023
Add NETRC to the default_pass_env list (#3410)971e7da
replace tool.pyproject and tool.tox.pyproject with tool.tox in config… (#3411)81a83bd
Fix typo in docs for dependency_groupsb912cb2
release 4.22.0568b90f
Add dependency-groups support (PEP-735) (#3409)f919d0d
Expose type checking dependencies into an extra (#3404)7c0e3ed
[pre-commit.ci] pre-commit autoupdate (#3406)6db3730
Fix the fix environment definition (#3407)2bf065a
Bump pypa/gh-action-pypi-publish from 1.10.2 to 1.10.3 (#3392)Updates
pre-commit
to 4.0.1Release notes
Sourced from pre-commit's releases.
Changelog
Sourced from pre-commit's changelog.
... (truncated)
Commits
cc4a522
v4.0.1772d7d4
Merge pull request #3324 from pre-commit/migrate-config-purelib222c62b
fix migrate-config for purelib yaml3d5548b
Merge pull request #3323 from pre-commit/pre-commit-ci-update-config4235a87
[pre-commit.ci] pre-commit autoupdatedbccd57
v4.0.0d07e529
Merge pull request #3320 from pre-commit/remove-python-venv801b956
remove deprecated python_venv aliasa2f7b80
Merge pull request #3315 from pre-commit/warn-deprecated-stage-names-on-initd317223
add warning for deprecates stages for remote repos on initDependabot 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 rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show