We’ve just uploaded mypy 1.10 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 TypeIs (PEP 742)
Mypy now supports TypeIs (PEP 742), which allows
functions to narrow the type of a value, similar to isinstance(). Unlike TypeGuard,
TypeIs can narrow in both the if and else branches of an if statement:
#12355: Fix possible catastrophic performance slowdown on a certain parametrization pattern involving many higher-scoped parameters.
#12367: Fix a regression in pytest 8.2.0 where unittest class instances (a fresh one is created for each test) were not released promptly on test teardown but only on session teardown.
#12381: Fix possible "Directory not empty" crashes arising from concurent cache dir (.pytest_cache) creation. Regressed in pytest 8.2.0.
Improved Documentation
#12290: Updated Sphinx theme to use Furo instead of Flask, enabling Dark mode theme.
#12356: Added a subsection to the documentation for debugging flaky tests to mention
lack of thread safety in pytest as a possible source of flakyness.
#12363: The documentation webpages now links to a canonical version to reduce outdated documentation in search engine results.
8.2.1
pytest 8.2.1 (2024-05-19)
Improvements
#12334: Support for Python 3.13 (beta1 at the time of writing).
Bug Fixes
#12120: Fix [PermissionError]{.title-ref} crashes arising from directories which are not selected on the command-line.
#12191: Keyboard interrupts and system exits are now properly handled during the test collection.
#12300: Fixed handling of 'Function not implemented' error under squashfuse_ll, which is a different way to say that the mountpoint is read-only.
#12308: Fix a regression in pytest 8.2.0 where the permissions of automatically-created .pytest_cache directories became rwx------ instead of the expected rwxr-xr-x.
Trivial/Internal Changes
#12333: pytest releases are now attested using the recent Artifact Attestation support from GitHub, allowing users to verify the provenance of pytest's sdist and wheel artifacts.
8.2.0
pytest 8.2.0 (2024-04-27)
Deprecations
#12069: A deprecation warning is now raised when implementations of one of the following hooks request a deprecated py.path.local parameter instead of the pathlib.Path parameter which replaced it:
Silence deprecation warnings about unclosed event loops that occurred with certain CPython patch releases #817
Known issues
As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the test suite (i.e. session, packages, modules, classes, functions) and allows tests to be run in those loops when marked accordingly. Pytest-asyncio currently assumes that async fixture scope is correlated with the new event loop scope. This prevents fixtures from being evaluated independently from the event loop scope and breaks some existing test suites (see #706). For example, a test suite may require all fixtures and tests to run in the same event loop, but have async fixtures that are set up and torn down for each module. If you're affected by this issue, please continue using the v0.21 release, until it is resolved.
Emit a warning when [tools.setuptools] is present in pyproject.toml and will be ignored. -- by :user:SnoopJ (#4150)
Improved AttributeError error message if pkg_resources.EntryPoint.require is called without extras or distribution
Gracefully "do nothing" when trying to activate a pkg_resources.Distribution with a None location, rather than raising a TypeError
-- by :user:Avasam (#4262)
Typed the dynamically defined variables from pkg_resources -- by :user:Avasam (#4267)
Modernized and refactored VCS handling in package_index. (#4332)
Bugfixes
In install command, use super to call the superclass methods. Avoids race conditions when monkeypatching from _distutils_system_mod occurs late. (#4136)
Fix finder template for lenient editable installs of implicit nested namespaces
constructed by using package_dir to reorganise directory structure. (#4278)
Fix an error with UnicodeDecodeError handling in pkg_resources when trying to read files in UTF-8 with a fallback -- by :user:Avasam (#4348)
Improved Documentation
Uses RST substitution to put badges in 1 line. (#4312)
Deprecations and Removals
Further adoption of UTF-8 in setuptools.
This change regards mostly files produced and consumed during the build process
(e.g. metadata files, script wrappers, automatically updated config files, etc..)
Although precautions were taken to minimize disruptions, some edge cases might
be subject to backwards incompatibility.
Support for "locale" encoding is now deprecated. (#4309)
Remove setuptools.convert_path after long deprecation period.
This function was never defined by setuptools itself, but rather a
side-effect of an import for internal usage. (#4322)
Remove fallback for customisations of distutils' build.sub_command after long
deprecated period.
Users are advised to import build directly from setuptools.command.build. (#4322)
Removed typing_extensions from vendored dependencies -- by :user:Avasam (#4324)
Remove deprecated setuptools.dep_util.
The provided alternative is setuptools.modified. (#4360)
* Babel 2.15.0 will require Python 3.8 or newer. (:gh:`1048`)
Features
* CLDR: Upgrade to CLDR 44 (:gh:`1071`) (@akx)
* Dates: Support for the "fall back to short format" logic for time delta formatting (:gh:`1075`) (@akx)
* Message: More versatile .po IO functions (:gh:`1068`) (@akx)
* Numbers: Improved support for alternate spaces when parsing numbers (:gh:`1007`) (@ronnix's first contribution)
Infrastructure
Upgrade GitHub Actions (:gh:1054) (@cclauss's first contribution)
The Unicode license is now included in locale-data and in the documentation (:gh:1074) (@akx)
Performance improvements for combining data files, especially when measuring
line coverage. A few different quadratic behaviors were eliminated. In one
extreme case of combining 700+ data files, the time dropped from more than
three hours to seven minutes. Thanks for Kraken Tech for funding the fix.
Performance improvements for generating HTML reports, with a side benefit of
reducing memory use, closing issue 1791_. Thanks to Daniel Diniz for
helping to diagnose the problem.
Fix: nested matches of exclude patterns could exclude too much code, as
reported in issue 1779_. This is now fixed.
Changed: previously, coverage.py would consider a module docstring to be an
executable statement if it appeared after line 1 in the file, but not
executable if it was the first line. Now module docstrings are never counted
as executable statements. This can change coverage.py's count of the number
of statements in a file, which can slightly change the coverage percentage
reported.
In the HTML report, the filter term and "hide covered" checkbox settings are
remembered between viewings, thanks to Daniel Diniz <pull 1776_>_.
Python 3.13.0b1 is supported.
Fix: parsing error handling is improved to ensure bizarre source files are
handled gracefully, and to unblock oss-fuzz fuzzing, thanks to Liam DeVoe <pull 1788_>. Closes issue 1787.
This library adheres to Semantic Versioning 2.0 <http://semver.org/>_.
1.2.1
Updated the copying of __notes__ to match CPython behavior (PR by CF Bolz-Tereick)
Corrected the type annotation of the exception handler callback to accept a
BaseExceptionGroup instead of BaseException
Fixed type errors on Python < 3.10 and the type annotation of suppress()
(PR by John Litborn)
1.2.0
Added special monkeypatching if Apport <https://github.com/canonical/apport>_ has
overridden sys.excepthook so it will format exception groups correctly
(PR by John Litborn)
Added a backport of contextlib.suppress() from Python 3.12.1 which also handles
suppressing exceptions inside exception groups
Fixed bare raise in a handler reraising the original naked exception rather than
an exception group which is what is raised when you do a raise in an except*
handler
1.1.3
catch() now raises a TypeError if passed an async exception handler instead of
just giving a RuntimeWarning about the coroutine never being awaited. (#66, PR by
John Litborn)
Fixed plain raise statement in an exception handler callback to work like a
raise in an except* block
Fixed new exception group not being chained to the original exception when raising an
exception group from exceptions raised in handler callbacks
Fixed type annotations of the derive(), subgroup() and split() methods to
match the ones in typeshed
1.1.2
Changed handling of exceptions in exception group handler callbacks to not wrap a
single exception in an exception group, as per
CPython issue 103590 <https://github.com/python/cpython/issues/103590>_
1.1.1
Worked around
CPython issue [#98778](https://github.com/agronholm/exceptiongroup/issues/98778) <https://github.com/python/cpython/issues/98778>_,
urllib.error.HTTPError(..., fp=None) raises KeyError on unknown attribute
access, on affected Python versions. (PR by Zac Hatfield-Dodds)
Bumps the development-dependencies group with 27 updates in the / directory:
24.4.0
24.4.2
3.9.1
3.27.0
1.9.0
1.10.0
5.1.0.20240311
5.1.0.20240425
8.1.1
8.2.2
0.23.6
0.23.7
9.5.18
9.5.26
69.5.1
70.0.0
3.1.6
3.3.0
2.14.0
2.15.0
7.4.4
7.5.3
0.6.1
0.6.2
1.2.0
1.2.1
3.13.4
3.14.0
2.5.35
2.5.36
6.11.0
7.1.0
1.8.0
1.9.1
24.0
24.1
4.2.0
4.2.2
2.17.2
2.18.0
10.7.1
10.8.1
2024.4.16
2024.5.15
0.12.4
0.12.5
4.11.0
4.12.2
20.25.3
20.26.2
4.0.0
4.0.1
3.18.1
3.19.2
Updates
black
from 24.4.0 to 24.4.2Release notes
Sourced from black's releases.
Changelog
Sourced from black's changelog.
Commits
3702ba2
Prepare release 24.4.2 (#4335)e4aaa8a
Fix incorrect f-string tokenization (#4332)ba88fc3
Simplify string tokenization regexes (#4331)5683242
New release templatee7fb048
Prepare release 24.4.1 (#4328)3f0f8f1
Support PEP 696 (#4327)2f88085
Github Action: Directly install from repo ifexport-subst
is skipped (#4313)12ce3db
Move changelog entry to right section (#4326)1354be2
Add support to style function definitions with newlines before function stubs...f4b644b
Prevent wrapping of multiline fstrings in parens (#4325)Updates
commitizen
from 3.9.1 to 3.27.0Release notes
Sourced from commitizen's releases.
... (truncated)
Changelog
Sourced from commitizen's changelog.
... (truncated)
Commits
e9aa5d9
bump: version 3.26.2 → 3.27.0912fda8
test: extend tests for 'TestJsonConfig' and 'TestYamlConfig'4bf8ca6
feat(config_files): add suport for "cz.toml" config file642fe8c
bump: version 3.26.1 → 3.26.23761124
fix(base.py): add encoding when open changlelog_fileee14038
docs: fix a few typos in CHANGELOG.md and .pre-commit-hooks.yamlc18c6a6
docs(cli/screenshots): update CLI screenshotsae73429
bump: version 3.26.0 → 3.26.18f4dbe9
test(commands): add skip_if_below_py_3_10 as the message of argument changes ...4636e50
refactor(KNOWN_SCHEMES): replace set comprehension for list comprehensionUpdates
mypy
from 1.9.0 to 1.10.0Changelog
Sourced from mypy's changelog.
... (truncated)
Commits
3faf0fc
Remove +dev for version for release 1.10a5998d2
Update CHANGELOG.md (#17159)62ea5b0
Various updates to changelog for 1.10 (#17158)2f0864c
Update CHANGELOG.md with draft for release 1.10 (#17150)e1443bb
fix: incorrect returned type of access descriptors on unions of types (#16604)5161ac2
Sync typeshed (#17124)e2fc1f2
Fix crash when expanding invalid Unpack in aCallable
alias (#17028)3ff6e47
Docs: docstrings in checker.py, ast_helpers.py (#16908)732d98e
Fix string formatting for string enums (#16555)8019010
Narrow individual items when matching a tuple to a sequence pattern (#16905)Updates
types-mock
from 5.1.0.20240311 to 5.1.0.20240425Commits
Updates
pytest
from 8.1.1 to 8.2.2Release notes
Sourced from pytest's releases.
... (truncated)
Commits
329d371
Prepare release version 8.2.2214d098
Merge pull request #12414 from bluetech/backport-12409153a436
[8.2.x] fixtures: fix catastrophic performance problem inreorder_items
b41d5a5
Merge pull request #12412 from pytest-dev/backport-12408-to-8.2.x9bb73d7
[8.2.x] cacheprovider: fix "Directory not empty" crash from cache directory c...4569a01
[8.2.x] doc: Update trainings/events (#12402)1d103e5
[8.2.x] Clarify pytest_ignore_collect docs (#12386)240a252
[8.2.x] Add html_baseurl to sphinx conf.py (#12372)a5ee3c4
Merge pull request #12370 from pytest-dev/backport-12368-to-8.2.xf7358ae
[8.2.x] unittest: fix class instances no longer released on test teardown sin...Updates
pytest-asyncio
from 0.23.6 to 0.23.7Release notes
Sourced from pytest-asyncio's releases.
Commits
eb63d5a
docs: Prepared for release of v0.23.7.da04a7a
Build(deps): Bump exceptiongroup in /dependencies/default00c667a
Build(deps): Bump pytest from 8.1.1 to 8.2.0 in /dependencies/default3bd9cd8
[docs] Add changelog entry.15544f0
Revert GitHub Actions and Tox changes.6316b28
Deduplicate simplefilter snippet.3ffdfc5
asyncio.run(port_afinalizer())0107fd7
Remove extra space.3bf700a
Fix GH Action mapping.d15dc31
Fix 3109/3108 typo.Updates
mkdocs-material
from 9.5.18 to 9.5.26Release notes
Sourced from mkdocs-material's releases.
Changelog
Sourced from mkdocs-material's changelog.
... (truncated)
Commits
f887197
Updated changelog0d5a08c
Prepare 9.5.26 release1cc45d5
Fixed active tab stolen on scroll with linked content tabsb5b7e9d
Updated dependenciesc182598
Added distribution files49ebb9b
Improved accessibility of search partial (#7233)5bd843b
Updated dependencies0fc36a1
Added support for local author avatars2412a1b
Documentation (#7221)6c3f846
Updated custom stylesUpdates
setuptools
from 69.5.1 to 70.0.0Changelog
Sourced from setuptools's changelog.
... (truncated)
Commits
5cbf12a
Workaround for release error in v709c1bcc3
Bump version: 69.5.1 → 70.0.04dc0c31
Remove deprecatedsetuptools.dep_util
(#4360)6c1ef57
Remove xfail now that test passes. Ref #4371.d14fa01
Add all site-packages dirs when creating simulated environment for test_edita...6b7f7a1
Preventbin
folders to be taken as extern packages when vendoring (#4370)69141f6
Add doctest for vendorised bin folder2a53cc1
Prevent 'bin' folders to be taken as extern packages7208628
Replace call to deprecatedvalidate_pyproject
command (#4363)96d681a
Remove call to deprecated validate_pyproject commandUpdates
argcomplete
from 3.1.6 to 3.3.0Release notes
Sourced from argcomplete's releases.
Changelog
Sourced from argcomplete's changelog.
Commits
c7cc834
v3.3.054a4846
Preserve compatibility with argparse option tuples of length 4057faff
ruff: preserve quote style9077be9
v3.2.3dd79ddf
Lazy completion loading for Zsh (#475)521082e
Conform to black formattingeafe0a3
Move debug_stream initialization to helper method (#471)2a6c23b
v3.2.29e9bd63
Expand tilde in zsh0be05e9
v3.2.1Updates
babel
from 2.14.0 to 2.15.0Release notes
Sourced from babel's releases.
Changelog
Sourced from babel's changelog.
Commits
40b194f
Prepare for 2.15.0 release (#1079)c2e6c6e
Encode support for the "fall back to short format" logic for time delta forma...1a03526
Include Unicode license inlocale-data
and in documentation (#1074)c0fb56e
Allow alternative space characters as group separator when parsing numbers (#...fe82fbc
Use CLDR 44 and adjust tests to match new data (#1071)e0d1018
Improve .po IO (#1068)40e60a1
Upgrade GitHub Actions (#1054)2a1709a
Drop support for Python 3.7 (EOL since June 2023) (#1048)Updates
coverage
from 7.4.4 to 7.5.3Changelog
Sourced from coverage's changelog.
... (truncated)
Commits
f310d7e
docs: sample HTML for 7.5.3a51d52f
docs: prep for 7.5.3b666f3a
perf: it's faster in all versions if we don't cache tokenize #1791a2b4929
docs: changelog entry forcombine
performance improvementsb9aff50
perf: don't read full line_bits table each timec45ebac
perf: cache alias mapping390cb97
perf: avoid quadratic behavior when combining line coveraged3caf53
docs(build): tweaks to howto909e887
build: bump version242adea
build: don't claim pre-alpha-1 in classifiersUpdates
decli
from 0.6.1 to 0.6.2Updates
exceptiongroup
from 1.2.0 to 1.2.1Release notes
Sourced from exceptiongroup's releases.
Changelog
Sourced from exceptiongroup's changelog.
... (truncated)
Commits
b91b7a3
Added the release version521f02f
Fixed type errors, added type tests (#118)4639b1e
Fixed test failure on Python 3.12.3684b79a
Have tox install the package in editable mode9ebe9f5
Updated GitHub actionse57b07f
[pre-commit.ci] pre-commit autoupdate (#115)8d2f627
[pre-commit.ci] pre-commit autoupdate (#113)ee53e9f
BaseExceptionGroup.derive should not copy notes (#112)2f23259
Corrected the type annotation for the exception handler callback (#109)0c89199
[pre-commit.ci] pre-commit autoupdate (#110)Updates
filelock
from 3.13.4 to 3.14.0Release notes
Sourced from filelock's releases.
Commits
8556141
f... _Description has been truncated_