We’ve just uploaded mypy 1.11 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)
Mypy now supports the new type parameter syntax introduced in Python 3.12 (PEP 695).
This feature is still experimental and must be enabled with the --enable-incomplete-feature=NewGenericSyntax flag, or with enable_incomplete_feature = NewGenericSyntax in the mypy configuration file.
We plan to enable this by default in the next mypy feature release.
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'
Type alias
type A[T] = C[list[T]]
This feature was contributed by Jukka Lehtosalo.
Support for functools.partial
Mypy now type checks uses of functools.partial. Previously mypy would accept arbitrary arguments.
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
Bumps the pip-dependencies group with 3 updates: black, mypy and reorder-python-imports.
Updates
black
from 24.4.2 to 24.8.0Release notes
Sourced from black's releases.
Changelog
Sourced from black's changelog.
Commits
b965c2a
Prepare release 24.8.0 (#4426)9ccf279
Documentfind_project_root
ignoringpyproject.toml
without[tool.black]
...14b6e61
fix: Enhace black efficiently to skip directories listed in .gitignore (#4415)b1c4dd9
fix: respect braces better in f-string parsing (#4422)4b4ae43
Fix incorrect linenos on fstring tokens with escaped newlines (#4423)7fa1faf
docs: fix the installation command of extra for blackd (#4413)8827acc
Bump sphinx from 7.3.7 to 7.4.0 in /docs (#4404)b0da11d
Bump furo from 2024.5.6 to 2024.7.18 in /docs (#4409)721dff5
fix: avoid formatting backslash strings inside f-strings (#4401)7e2afc9
Updateactions/checkout
to v4 to stop node deprecation warnings (#4379)Updates
mypy
from 1.10.0 to 1.11.1Changelog
Sourced from mypy's changelog.
... (truncated)
Commits
570b90a
Bump version to 1.11b3a102e
FixRawExpressionType.accept
crash with--cache-fine-grained
(#17588)aec04c7
Fix PEP 604 isinstance caching (#17563)cb44e4d
Fixtyping.TypeAliasType
being undefined on python < 3.12 (#17558)6cf9180
Fix types.GenericAlias lookup crash (#17543)64c1ebf
Bump version to 1.11.1+devdbd5f5c
Remove +dev from version for 1.11 releasef0a8c69
Update CHANGELOG for mypy 1.11 (#17540)371f780
CHANGELOG.md update for 1.11 (#17539)2563da0
Fix daemon crash on invalid type in TypedDict (#17495)Updates
reorder-python-imports
from 3.12.0 to 3.13.0Commits
e77caa8
v3.13.0e2015f8
Merge pull request #380 from AlexWaygood/typing-extensions1cadd2f
Update typing rewrites for typing_extensions 4.12.0+64e79f3
Merge pull request #379 from asottile/pre-commit-ci-update-config516fcfc
[pre-commit.ci] pre-commit autoupdate1c43cba
Merge pull request #378 from asottile/pre-commit-ci-update-confige950ccd
[pre-commit.ci] pre-commit autoupdate1ab1be5
Merge pull request #374 from asottile/pre-commit-ci-update-config6d323b1
[pre-commit.ci] pre-commit autoupdate1dc4987
Merge pull request #372 from asottile/pre-commit-ci-update-configDependabot 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