chore: only depend on async-timeout below Python 3.11 - #2248
Open
enriquealonso01 wants to merge 1 commit into
Open
enriquealonso01 wants to merge 1 commit into
enriquealonso01 wants to merge 1 commit into
Conversation
Closes apify#2052. asyncio.timeout is stdlib from 3.11, so on 3.11+ the package no longer needs the backport; the dependency gains a python_full_version < '3.11' marker instead of applying to everyone. SharedTimeout, the only consumer, goes through a single timeout_ctx binding picked at import time, so the call sites are unchanged. asyncio.Timeout raises TimeoutError, a subclass of asyncio.TimeoutError, which is what the existing tests already expect via pytest.raises(asyncio.TimeoutError). Verified on 3.11: tests/unit/_utils 319 passed; full unit suite 2473 passed with only 4 pre-existing failures that reproduce identically on clean master (browser/playwright environment issues, unrelated). ruff check and format clean. uv lock re-resolved: async-timeout is now 3.10-only.
Mantisus
suggested changes
Sep 22, 2026
Collaborator
There was a problem hiding this comment.
Hi @enriquealonso01, thank you for your contribution. But please don't close the issue #2052, save it for TODO
Mantisus
reviewed
Sep 22, 2026
| else: | ||
| # async-timeout backports asyncio.timeout for Python 3.10; drop once the | ||
| # project floor is 3.11 (its Timeout also raises TimeoutError, a subclass | ||
| # of asyncio.TimeoutError, on expiry). |
Collaborator
There was a problem hiding this comment.
Suggested change
| # of asyncio.TimeoutError, on expiry). | |
| # TODO: `async-timeout` backports `asyncio.timeout` for Python 3.10; drop once the | |
| # project floor bump to 3.11 | |
| # https://github.com/apify/crawlee-python/issues/2052 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Closes #2052 — but with a narrowing instead of a hard removal, because
requires-python = ">=3.10"and stdlibasyncio.timeoutonly exists from 3.11.pyproject.toml:async-timeout>=5.0.1gets apython_full_version < '3.11'marker.src/crawlee/_utils/time.py:SharedTimeout(the only consumer) pickstimeout_ctx = asyncio.timeouton 3.11+ or theasync-timeoutbackport otherwise, at import time. Call sites are unchanged; theTimeout | Noneannotation stays honest viaasyncio.Timeout.uv.lock: re-resolved;async-timeoutis now 3.10-only.Verification
tests/unit/_utils: 322 passed.test_firefox_headless_headers) is a missing Playwright Firefox binary in the CI-less sandbox environment and reproduces identically on cleanmaster; it is unrelated to this change.uv lock --checkpasses;ruff check+ruff format --checkclean.SharedTimeouton 3.11 expires and raisesasyncio.TimeoutErroras before.If maintainers prefer the hard removal from the issue title, dropping the marker + the backport import is a two-line follow-up — happy to do it if you'd rather drop 3.10 support in this PR.