Added the BlockingPortalProvider class to aid with constructing synchronous counterparts to asynchronous interfaces that would otherwise require multiple blocking portals
Added __slots__ to AsyncResource so that child classes can use __slots__ (#733; PR by Justin Su)
Added the TaskInfo.has_pending_cancellation() method
Fixed erroneous RuntimeError: called 'started' twice on the same task status when cancelling a task in a TaskGroup created with the start() method before the first checkpoint is reached after calling task_status.started() (#706; PR by Dominik Schwabe)
Fixed two bugs with TaskGroup.start() on asyncio:
Fixed erroneous RuntimeError: called 'started' twice on the same task status when cancelling a task in a TaskGroup created with the start() method before the first checkpoint is reached after calling task_status.started() (#706; PR by Dominik Schwabe)
Fixed the entire task group being cancelled if a TaskGroup.start() call gets cancelled (#685, #710)
Fixed a race condition that caused crashes when multiple event loops of the same backend were running in separate threads and simultaneously attempted to use AnyIO for their first time (#425; PR by David Jiricek and Ganden Schaffner)
Fixed cancellation delivery on asyncio incrementing the wrong cancel scope's cancellation counter when cascading a cancel operation to a child scope, thus failing to uncancel the host task (#716)
Fixed erroneous TypedAttributeLookupError if a typed attribute getter raises KeyError
Fixed the asyncio backend not respecting the PYTHONASYNCIODEBUG environment variable when setting the debug flag in anyio.run()
Fixed SocketStream.receive() not detecting EOF on asyncio if there is also data in the read buffer (#701)
Fixed MemoryObjectStream dropping an item if the item is delivered to a recipient that is waiting to receive an item but has a cancellation pending (#728)
Emit a ResourceWarning for MemoryObjectReceiveStream and MemoryObjectSendStream that were garbage collected without being closed (PR by Andrey Kazantcev)
Fixed MemoryObjectSendStream.send() not raising BrokenResourceError when the last corresponding MemoryObjectReceiveStream is closed while waiting to send a falsey item (#731; PR by Ganden Schaffner)
This library adheres to Semantic Versioning 2.0 <http://semver.org/>_.
UNRELEASED
Added support for the from_uri(), full_match(), parser methods/properties
in anyio.Path, newly added in Python 3.13
4.4.0
Added the BlockingPortalProvider class to aid with constructing synchronous
counterparts to asynchronous interfaces that would otherwise require multiple blocking
portals
Added __slots__ to AsyncResource so that child classes can use __slots__
([#733](https://github.com/agronholm/anyio/issues/733) <https://github.com/agronholm/anyio/pull/733>_; PR by Justin Su)
Added the TaskInfo.has_pending_cancellation() method
Fixed erroneous RuntimeError: called 'started' twice on the same task status
when cancelling a task in a TaskGroup created with the start() method before
the first checkpoint is reached after calling task_status.started()
([#706](https://github.com/agronholm/anyio/issues/706) <https://github.com/agronholm/anyio/issues/706>_; PR by Dominik Schwabe)
Fixed two bugs with TaskGroup.start() on asyncio:
Fixed erroneous RuntimeError: called 'started' twice on the same task status
when cancelling a task in a TaskGroup created with the start() method before
the first checkpoint is reached after calling task_status.started()
([#706](https://github.com/agronholm/anyio/issues/706) <https://github.com/agronholm/anyio/issues/706>_; PR by Dominik Schwabe)
Fixed the entire task group being cancelled if a TaskGroup.start() call gets
cancelled ([#685](https://github.com/agronholm/anyio/issues/685) <https://github.com/agronholm/anyio/issues/685>,
[#710](https://github.com/agronholm/anyio/issues/710) <https://github.com/agronholm/anyio/issues/710>)
Fixed a race condition that caused crashes when multiple event loops of the same
backend were running in separate threads and simultaneously attempted to use AnyIO for
their first time ([#425](https://github.com/agronholm/anyio/issues/425) <https://github.com/agronholm/anyio/issues/425>_; PR by David
Jiricek and Ganden Schaffner)
Fixed cancellation delivery on asyncio incrementing the wrong cancel scope's
cancellation counter when cascading a cancel operation to a child scope, thus failing
to uncancel the host task ([#716](https://github.com/agronholm/anyio/issues/716) <https://github.com/agronholm/anyio/issues/716>_)
Fixed erroneous TypedAttributeLookupError if a typed attribute getter raises
KeyError
Fixed the asyncio backend not respecting the PYTHONASYNCIODEBUG environment
variable when setting the debug flag in anyio.run()
Fixed SocketStream.receive() not detecting EOF on asyncio if there is also data in
the read buffer ([#701](https://github.com/agronholm/anyio/issues/701) <https://github.com/agronholm/anyio/issues/701>_)
Fixed MemoryObjectStream dropping an item if the item is delivered to a recipient
that is waiting to receive an item but has a cancellation pending
([#728](https://github.com/agronholm/anyio/issues/728) <https://github.com/agronholm/anyio/issues/728>_)
Emit a ResourceWarning for MemoryObjectReceiveStream and
MemoryObjectSendStream that were garbage collected without being closed (PR by
Andrey Kazantcev)
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.
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:
This release focuses on compatibility with the upcoming release of
Python 3.13. Most changes are related to the implementation of type
parameter defaults (PEP 696).
Thanks to all of the people who contributed patches, especially Alex
Waygood, who did most of the work adapting typing-extensions to the
CPython PEP 696 implementation.
There is a single change since 4.12.0rc1:
Fix incorrect behaviour of typing_extensions.ParamSpec on Python 3.8 and
3.9 that meant that
isinstance(typing_extensions.ParamSpec("P"), typing.TypeVar) would have a
different result in some situations depending on whether or not a profiling
function had been set using sys.setprofile. Patch by Alex Waygood.
Changes included in 4.12.0rc1:
Improve the implementation of type parameter defaults (PEP 696)
Backport the typing.NoDefault sentinel object from Python 3.13.
TypeVars, ParamSpecs and TypeVarTuples without default values now have
their __default__ attribute set to this sentinel value.
TypeVars, ParamSpecs and TypeVarTuples now have a has_default()
method, matching typing.TypeVar, typing.ParamSpec and
typing.TypeVarTuple on Python 3.13+.
TypeVars, ParamSpecs and TypeVarTuples with default=None passed to
their constructors now have their __default__ attribute set to None
at runtime rather than types.NoneType.
Fix most tests for TypeVar, ParamSpec and TypeVarTuple on Python
3.13.0b1 and newer.
Backport CPython PR #118774,
allowing type parameters without default values to follow those with
default values in some type parameter lists. Patch by Alex Waygood,
backporting a CPython PR by Jelle Zijlstra.
It is now disallowed to use a TypeVar with a default value after a
TypeVarTuple in a type parameter list. This matches the CPython
implementation of PEP 696 on Python 3.13+.
Fix bug in PEP-696 implementation where a default value for a ParamSpec
would be cast to a tuple if a list was provided.
Patch by Alex Waygood.
Fix Protocol tests on Python 3.13.0a6 and newer. 3.13.0a6 adds a new
__static_attributes__ attribute to all classes in Python,
which broke some assumptions made by the implementation of
typing_extensions.Protocol. Similarly, 3.13.0b1 adds the new
__firstlineno__ attribute to all classes.
Fix AttributeError when using typing_extensions.runtime_checkable
in combination with typing.Protocol on Python 3.12.2 or newer.
Patch by Alex Waygood.
At runtime, assert_never now includes the repr of the argument
This release is mostly the same as 4.12.0rc1 but fixes one more
longstanding bug.
Fix incorrect behaviour of typing_extensions.ParamSpec on Python 3.8 and
3.9 that meant that
isinstance(typing_extensions.ParamSpec("P"), typing.TypeVar) would have a
different result in some situations depending on whether or not a profiling
function had been set using sys.setprofile. Patch by Alex Waygood.
Release 4.12.0rc1 (May 16, 2024)
This release focuses on compatibility with the upcoming release of
Python 3.13. Most changes are related to the implementation of type
parameter defaults (PEP 696).
Thanks to all of the people who contributed patches, especially Alex
Waygood, who did most of the work adapting typing-extensions to the
CPython PEP 696 implementation.
Full changelog:
Improve the implementation of type parameter defaults (PEP 696)
Backport the typing.NoDefault sentinel object from Python 3.13.
TypeVars, ParamSpecs and TypeVarTuples without default values now have
their __default__ attribute set to this sentinel value.
TypeVars, ParamSpecs and TypeVarTuples now have a has_default()
method, matching typing.TypeVar, typing.ParamSpec and
typing.TypeVarTuple on Python 3.13+.
TypeVars, ParamSpecs and TypeVarTuples with default=None passed to
their constructors now have their __default__ attribute set to None
at runtime rather than types.NoneType.
Fix most tests for TypeVar, ParamSpec and TypeVarTuple on Python
3.13.0b1 and newer.
Backport CPython PR #118774,
allowing type parameters without default values to follow those with
default values in some type parameter lists. Patch by Alex Waygood,
backporting a CPython PR by Jelle Zijlstra.
It is now disallowed to use a TypeVar with a default value after a
TypeVarTuple in a type parameter list. This matches the CPython
implementation of PEP 696 on Python 3.13+.
Fix bug in PEP-696 implementation where a default value for a ParamSpec
would be cast to a tuple if a list was provided.
Patch by Alex Waygood.
Fix Protocol tests on Python 3.13.0a6 and newer. 3.13.0a6 adds a new
__static_attributes__ attribute to all classes in Python,
which broke some assumptions made by the implementation of
typing_extensions.Protocol. Similarly, 3.13.0b1 adds the new
__firstlineno__ attribute to all classes.
#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:
pytest_ignore_collect{.interpreted-text role="hook"} - the path parameter - use collection_path instead.
pytest_collect_file{.interpreted-text role="hook"} - the path parameter - use file_path instead.
pytest_pycollect_makemodule{.interpreted-text role="hook"} - the path parameter - use module_path instead.
pytest_report_header{.interpreted-text role="hook"} - the startdir parameter - use start_path instead.
pytest_report_collectionfinish{.interpreted-text role="hook"} - the startdir parameter - use start_path instead.
The replacement parameters are available since pytest 7.0.0.
The old parameters will be removed in pytest 9.0.0.
See legacy-path-hooks-deprecated{.interpreted-text role="ref"} for more details.
Features
#11871: Added support for reading command line arguments from a file using the prefix character @, like e.g.: pytest @tests.txt. The file must have one argument per line.
See Read arguments from file <args-from-file>{.interpreted-text role="ref"} for details.
The strict_exception_groups parameter now defaults to True in trio.run and trio.lowlevel.start_guest_run. trio.open_nursery still defaults to the same value as was specified in trio.run/trio.lowlevel.start_guest_run, but if you didn't specify it there then all subsequent calls to trio.open_nursery will change.
This is unfortunately very tricky to change with a deprecation period, as raising a DeprecationWarning whenever strict_exception_groups is not specified would raise a lot of unnecessary warnings.
Notable side effects of changing code to run with strict_exception_groups==True
If an iterator raises StopAsyncIteration or StopIteration inside a nursery, then python will not recognize wrapped instances of those for stopping iteration.
trio.run_process is now documented that it can raise an ExceptionGroup. It previously could do this in very rare circumstances, but with strict_exception_groups set to True it will now do so whenever exceptions occur in deliver_cancel or with problems communicating with the subprocess.
Errors in opening the process is now done outside the internal nursery, so if code previously ran with strict_exception_groups=True there are cases now where an ExceptionGroup is no longer added.
trio.TrioInternalError.__cause__ might be wrapped in one or more ExceptionGroups <ExceptionGroup> (python-trio/trio#2786)
Features
Add trio.testing.wait_all_threads_completed, which blocks until no threads are running tasks. This is intended to be used in the same way as trio.testing.wait_all_tasks_blocked. (python-trio/trio#2937)
Path is now a subclass of pathlib.PurePath, allowing it to interoperate with other standard
pathlib types.
Instantiating Path now returns a concrete platform-specific subclass, one of PosixPath or
WindowsPath, matching the behavior of pathlib.Path. (python-trio/trio#2959)
Bugfixes
The pthread functions are now correctly found on systems using vanilla versions of musl libc. (python-trio/trio#2939)
mkdocs serve no longer locks up the browser when more than 5 tabs are open. This is achieved by closing the polling connection whenever a tab becomes inactive. Background tabs will no longer auto-reload either - that will instead happen as soon the tab is opened again. Context: #3391
New flag serve --open to open the site in a browser.
After the first build is finished, this flag will cause the default OS Web browser to be opened at the home page of the local site.
Context: #3500
Drafts
[!warning]
Changed from version 1.5:
The exclude_docs config was split up into two separate concepts.
The exclude_docs config no longer has any special behavior for mkdocs serve - it now always completely excludes the listed documents from the site.
If you wish to use the "drafts" functionality like the exclude_docs key used to do in MkDocs 1.5, please switch to the new config key draft_docs.
Reduce warning levels when a "draft" page has a link to a non-existent file. Context: #3449
Update to deduction of page titles
MkDocs 1.5 had a change in behavior in deducing the page titles from the first heading. Unfortunately this could cause unescaped HTML tags or entities to appear in edge cases.
Now tags are always fully sanitized from the title. Though it still remains the case that Page.title is expected to contain HTML entities and is passed directly to the themes.
Images (notably, emojis in some extensions) get preserved in the title only through their alt attribute's value.
Built-in themes now also support Polish language (#3613)
"readthedocs" theme
Fix: "readthedocs" theme can now correctly handle deeply nested nav configurations (over 2 levels deep), without confusedly expanding all sections and jumping around vertically. (#3464)
Fix: "readthedocs" theme now shows a link to the repository (with a generic logo) even when isn't one of the 3 known hosters. (#3435)
"readthedocs" theme now also has translation for the word "theme" in the footer that mistakenly always remained in English. (#3613, #3625)
Bumps the python-packages group with 13 updates in the / directory:
4.3.0
4.4.0
7.4.3
7.5.3
7.0.1
7.1.0
1.8.0
1.10.0
0.1.15
0.4.7
4.10.0
4.12.0
6.0.12.12
6.0.12.20240311
8.0.2
8.2.1
0.24.0
0.25.1
1.5.3
1.6.0
9.5.12
9.5.25
1.1.1
1.2.1
5.0.0
5.1.0
Updates
anyio
from 4.3.0 to 4.4.0Release notes
Sourced from anyio's releases.
Changelog
Sourced from anyio's changelog.
... (truncated)
Commits
053e8f0
Bumped up the versione7f750b
Fixed memory object stream sometimes dropping sent items (#735)9f5f14b
Fixed task group getting cancelled if start() gets cancelled (#717)8b648bc
Adjusted the pull request template3ff5e9a
Rearranged changelog items541d1f8
[pre-commit.ci] pre-commit autoupdate (#734)8a07690
FixMemoryObjectSendStream.send(falsey)
not raisingBrokenResourceError
w...4b3de97
Adjust the headings in the PR templatedfc44cf
Added__slots__
toAsyncResource
(#733)96920b0
Fix typo in PR template (#730)Updates
coverage
from 7.4.3 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
importlib-metadata
from 7.0.1 to 7.1.0Changelog
Sourced from importlib-metadata's changelog.
Commits
f5d6b5f
Finalize2ef3b5f
Merge commit '1711b2c198'1711b2c
Need to include names from test.support for py312 compat.47b14ac
Make MetadataPathFinder.find_distributions a classmethod for consistency with...adc4b12
Ensure tests do not leak references in sys.modules.07d894d
Copy backport of isolated_modules from importlib_resources.e30a16d
Consolidated test support logic in jaraco.test.cpython.41ca039
Moved compatibility tests to the compat package, as they're not included in C...5950f43
Remove legacy logic for Python 3.7.ffa719b
Moved compatibility module to compat package.Updates
mypy
from 1.8.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
ruff
from 0.1.15 to 0.4.7Release notes
Sourced from ruff's releases.
... (truncated)
Changelog
Sourced from ruff's changelog.
... (truncated)
Commits
1ad5f9c
Bump version to v0.4.7 (#11646)e914bc3
F401 sort bindings before adding to all (#11648)27f6f04
[red-knot] initial (very incomplete) flow graph (#11624)d62a617
red-knot: Don't refer toModule
instances as IDs (#11649)16a926d
[red-knot] infer int literal types (#11623)05566c6
UpdateWho's Using Ruff?
section to includeGodot
(#11647)7ce17b7
Add Vim and Kate setup guide forruff server
(#11615)f9a6450
Use char index rather than position for indent slice (#11645)8a25531
red-knot: improve internal documentation inmodule.rs
(#11638)9b6d2ce
Fix incorect placement of trailing stub function comments (#11632)Updates
typing-extensions
from 4.10.0 to 4.12.0Release notes
Sourced from typing-extensions's releases.
... (truncated)
Changelog
Sourced from typing-extensions's changelog.
... (truncated)
Commits
f90a8dc
Prepare release 4.12.0 (#408)118e1a6
Make sureisinstance(typing_extensions.ParamSpec("P"), typing.TypeVar)
is u...910141a
Add security documentation (#403)0dbc7c9
Prepare release 4.12.0rc1 (#402)1da5d3d
Update actions/setup-python (#401)72298f0
4.12.0a2 (#400)465ba78
Fix publish workflow (#399)21fde1f
Prepare releaes 4.12.0a1 (#398)63d8277
Add workflow for Trusted Publishing (#395)074d053
Backport PEP-696 specialisation on Python >=3.11.1 (#397)Updates
types-pyyaml
from 6.0.12.12 to 6.0.12.20240311Commits
Updates
pytest
from 8.0.2 to 8.2.1Release notes
Sourced from pytest's releases.
... (truncated)
Commits
66ff8df
Prepare release version 8.2.13ffcfd1
Merge pull request #12340 from pytest-dev/backport-12334-to-8.2.x0b28313
[8.2.x] Add Python 3.13 (beta) supportf3dd93a
[8.2.x] Attest package provenance (#12335)bb5a125
[8.2.x] Spelling (#12331)f179bf2
Merge pull request #12327 from pytest-dev/backport-12325-to-8.2.x2b671b5
[8.2.x] cacheprovider: fix.pytest_cache
not being world-readable65ab7cb
Merge pull request #12324 from pytest-dev/backport-12320-to-8.2.x4d5fb7d
Merge pull request #12319 from pytest-dev/backport-12311-to-8.2.xcbe5996
[8.2.x] changelog: document unittest 8.2 change as breakingUpdates
trio
from 0.24.0 to 0.25.1Release notes
Sourced from trio's releases.
Commits
a464604
Bump version to 0.25.1f46f74d
Merge pull request #2968 from kachida/feat/enable-hoverxref-in-trio-docs78666e7
[pre-commit.ci] pre-commit autoupdate ruff-pre-commit: v0.4.3 → v0.4.47dbbac9
[pre-commit.ci] pre-commit autoupdate ruff-pre-commit: v0.4.2 → v0.4.3f0cb052
use code-block instead of code91edf89
Merge remote-tracking branch 'origin/master' into feat/enable-hoverxref-in-tr...5125043
various fixes1bb98ae
Dependency updates (#2995)d39f186
[pre-commit.ci] pre-commit autoupdate (#2994)e1e3eff
Removetest_run_black
(#2993)Updates
mkdocs
from 1.5.3 to 1.6.0Release notes
Sourced from mkdocs's releases.
... (truncated)
Commits
0998fec
Release 1.6.0 (#3631)bce85bf
Fix for showing repository icon even when a file has no edit_uri (#3657)0ac05da
Re-generate localization files (#3634)6244500
Remove jQuery frommkdocs
theme (#3649)f85d429
Prevent a flash of white color when dark mode is enabled (#3647)e39cce2
Fix style of modal close button (#3651)652813d
Prevent a crash if stdin is not defined (#3609)59a295f
Merge pull request #3493 from waylan/22486f5e748
Merge pull request #3625 from mkdocs/themepo1451fb3
Babel setuptools frontend is still used in the install hookUpdates
mkdocs-material
from 9.5.12 to 9.5.25Release notes
Sourced from mkdocs-material's releases.