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.
[WARNING] Reference not found for 'daniel diniz ' at /var/folders/6j/khn0mcrj35d1k3yylpl8zl080000gn/T/scriv_rst_fg1z3eh9_chunk line 2 column 9
Exclusion patterns can now be multi-line, thanks to Daniel Diniz <pull 1807_>. This enables many interesting exclusion use-cases, including those requested in issues 118 (entire files), 996 (multiple lines only when appearing together), 1741 (remainder of a function), and 1803 (arbitrary sequence of marked lines). See the multi_line_exclude section of the docs for more details and examples.
The JSON report now includes per-function and per-class coverage information. Thanks to Daniel Diniz for getting the work started. This closes issue 1793 and issue 1532.
Fixed an incorrect calculation of "(no class)" lines in the HTML classes report.
Exclusion patterns can now be multi-line, thanks to Daniel Diniz <pull 1807_>. This enables many interesting exclusion use-cases, including those
requested in issues 118 <issue 118_> (entire files), 996 <issue 996_>_ (multiple lines only when appearing together), 1741 <issue 1741_>_ (remainder of a function), and 1803 <issue 1803_>_
(arbitrary sequence of marked lines). See the :ref:multi_line_exclude
section of the docs for more details and examples.
The JSON report now includes per-function and per-class coverage information.
Thanks to Daniel Diniz <pull 1809_>_ for getting the work started. This
closes issue 1793_ and issue 1532_.
Fixed an incorrect calculation of "(no class)" lines in the HTML classes
report.
#12652: Resolve regression [conda]{.title-ref} environments where no longer being automatically detected.
-- by RonnyPfannschmidt{.interpreted-text role="user"}
8.3.1
pytest 8.3.1 (2024-07-20)
The 8.3.0 release failed to include the change notes and docs for the release. This patch release remedies this. There are no other changes.
8.3.0
pytest 8.3.0 (2024-07-20)
New features
#12231: Added [--xfail-tb]{.title-ref} flag, which turns on traceback output for XFAIL results.
If the [--xfail-tb]{.title-ref} flag is not given, tracebacks for XFAIL results are NOT shown.
The style of traceback for XFAIL is set with [--tb]{.title-ref}, and can be [auto|long|short|line|native|no]{.title-ref}.
Note: Even if you have [--xfail-tb]{.title-ref} set, you won't see them if [--tb=no]{.title-ref}.
Some history:
With pytest 8.0, [-rx]{.title-ref} or [-ra]{.title-ref} would not only turn on summary reports for xfail, but also report the tracebacks for xfail results. This caused issues with some projects that utilize xfail, but don't want to see all of the xfail tracebacks.
This change detaches xfail tracebacks from [-rx]{.title-ref}, and now we turn on xfail tracebacks with [--xfail-tb]{.title-ref}. With this, the default [-rx]{.title-ref}/ [-ra]{.title-ref} behavior is identical to pre-8.0 with respect to xfail tracebacks. While this is a behavior change, it brings default behavior back to pre-8.0.0 behavior, which ultimately was considered the better course of action.
#12281: Added support for keyword matching in marker expressions.
Now tests can be selected by marker keyword arguments.
Supported values are int{.interpreted-text role="class"}, (unescaped) str{.interpreted-text role="class"}, bool{.interpreted-text role="class"} & None{.interpreted-text role="data"}.
See marker examples <marker_keyword_expression_example>{.interpreted-text role="ref"} for more information.
-- by lovetheguitar{.interpreted-text role="user"}
#12567: Added --no-fold-skipped command line option.
If this option is set, then skipped tests in short summary are no longer grouped
by reason but all tests are printed individually with their nodeid in the same
way as other statuses.
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 python-packages group with 5 updates:
1.10.1
1.11.1
3.7.1
3.8.0
0.5.0
0.5.5
7.5.4
7.6.0
8.2.2
8.3.2
Updates
mypy
from 1.10.1 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
pre-commit
from 3.7.1 to 3.8.0Release notes
Sourced from pre-commit's releases.
Changelog
Sourced from pre-commit's changelog.
Commits
d46423f
v3.8.08133abd
Merge pull request #3265 from lorenzwalthert/issue-3206da0c1d0
implement health check for language:rf641f6a
Merge pull request #3264 from pre-commit/pre-commit-ci-update-configa68a19d
fixes for mypy 1.1188317dd
[pre-commit.ci] pre-commit autoupdatefaa6f8c
Merge pull request #3244 from pre-commit/pre-commit-ci-update-configf632459
[pre-commit.ci] pre-commit autoupdate0252908
Merge pull request #3240 from pre-commit/pre-commit-ci-update-config69b5dce
[pre-commit.ci] pre-commit autoupdateUpdates
ruff
from 0.5.0 to 0.5.5Release notes
Sourced from ruff's releases.
... (truncated)
Changelog
Sourced from ruff's changelog.
... (truncated)
Commits
fc16d8d
Bump version to 0.5.5 (#12510)175e5d7
Add missing traceback line inf-string-in-exception
docstring. (#12508)c03f257
Add note about the breaking change innvim-lspconfig
(#12507)6bbb4a2
Add setup docs for Zed editor (#12501)2ce3e3a
Fix the search path tests on MacOS (#12503)2a64ccc
Avoid applyingignore-names
toself
andcls
function names (#12497)928ffd6
IgnoreNPY201
insideexcept
blocks for compatibility with older numpy ver...e52be09
[red-knot] Improve validation for search paths (#12376)8890735
[flake8-bugbear] Allow singleton tuples with starred expressions in B013 (#12...eac965e
[red-knot] Watch search paths (#12407)Updates
coverage[toml]
from 7.5.4 to 7.6.0Release notes
Sourced from coverage[toml]'s releases.
Changelog
Sourced from coverage[toml]'s changelog.
Commits
59a3cd7
docs: sample HTML for 7.6.07f27fa7
docs: prep for 7.6.06a268b0
docs: issues closed by the json region reporting5bfe9e7
chore: bump actions/setup-python from 5.1.0 to 5.1.1 (#1814)ab609ef
docs: mention json region reporting in the changes92d96b9
fix: json report needs 'no class' and 'no function' alsoe47e7e7
refactor: move duplicate code into methods3d6be2b
fix: json format should bump for regionsa9992d2
test: add a test of json regions with branches8b89764
test: json expectations should have explicit format numberUpdates
pytest
from 8.2.2 to 8.3.2Release notes
Sourced from pytest's releases.
... (truncated)
Commits
bbcec9c
Prepare release version 8.3.278fe8b6
Merge pull request #12657 from pytest-dev/patchback/backports/8.3.x/6c806b499...238bad2
Merge pull request #12656 from RonnyPfannschmidt/fix-12652-detect-conda-envae6034a
Merge pull request #12641 from pytest-dev/patchback/backports/8.3.x/c03989cee...31337ab
Merge pull request #12640 from pytest-dev/update-userca3070b
Merge pull request #12637 from pytest-dev/release-8.3.1de98446
Prepare release version 8.3.1bd0a042
Merge pull request #12636 from pytest-dev/update-release-notes664325b
doc/changelog: update 8.3.0 notes19d225d
Merge pull request #12635 from pytest-dev/release-8.3.0Dependabot 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