Skip to content

Mimic asyncio.Timeout behavior #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
files = async_timeout, tests
files = async_timeout
check_untyped_defs = True
follow_imports_for_stubs = True
disallow_any_decorated = True
Expand Down
1 change: 1 addition & 0 deletions CHANGES/422.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make ``asyncio_timeout`` fully compatible with the standard ``asyncio.Timeout`` but keep backward compatibility with existing ``asyncio_timeout.Timeout`` API.
19 changes: 8 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ asyncio-compatible timeout context manager.
DEPRECATED
----------

This library has effectively been upstreamed into Python 3.11+. Therefore this library
is considered deprecated and no longer supported. We'll keep the project open in the
unlikely case of security issues until Python 3.10 is officially unsupported.
This library has effectively been upstreamed into Python 3.11+.

To migrate a project that needs to support multiple Python versions, we suggest
using this code (used in our other projects, such as aiohttp)::
Therefore this library is considered deprecated and no longer actively supported.

if sys.version_info >= (3, 11):
import asyncio as async_timeout
else:
import async_timeout
Version 5.0+ provides dual-mode when executed on Python 3.11+:
``asyncio_timeout.Timeout`` is fully compatible with ``asyncio.Timeout`` *and* old
versions of the library.

Then in your dependencies, use::
Anyway, using upstream is highly recommended. ``asyncio_timeout`` exists only for the
sake of backward compatibility, easy supporting both old and new Python by the same
code, and easy misgration.

async-timeout >= 4; python_version < "3.11"

Usage example
-------------
Expand Down
Loading
Loading