-
Notifications
You must be signed in to change notification settings - Fork 56
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
Mimic asyncio.Timeout behavior #422
Conversation
Thought this was already compatible. We've been using it as a drop-in replacement in aiohttp for a few releases with no issues. |
The compatibility was limited. The common part were top-level I reworded README with keeping strong suggestion to use |
Bumps [async-timeout](https://github.com/aio-libs/async-timeout) from 4.0.3 to 5.0.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/aio-libs/async-timeout/releases">async-timeout's releases</a>.</em></p> <blockquote> <h2>5.0.0</h2> <h2>Features</h2> <ul> <li>Make <code>asyncio_timeout</code> fully compatible with the standard <code>asyncio.Timeout</code> but keep backward compatibility with existing <code>asyncio_timeout.Timeout</code> API. (<code>[#422](aio-libs/async-timeout#422) <https://github.com/aio-libs/async-timeout/issues/422></code>_)</li> </ul> <h2>Improved Documentation</h2> <ul> <li>On the <code>CHANGES/README.rst <https://github.com/aio-libs/async-timeout/tree/master/CHANGES/README.rst></code>_ page, a link to the <code>Towncrier philosophy</code> has been fixed. (<code>[#388](aio-libs/async-timeout#388) <https://github.com/aio-libs/async-timeout/issues/388></code>_)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Drop deprecated sync context manager support, use <code>async with timeout(...): ...</code> instead. (<code>[#421](aio-libs/async-timeout#421) <https://github.com/aio-libs/async-timeout/issues/421></code>_)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/aio-libs/async-timeout/blob/master/CHANGES.rst">async-timeout's changelog</a>.</em></p> <blockquote> <h1>5.0.0 (2024-10-31)</h1> <h2>Features</h2> <ul> <li>Make <code>asyncio_timeout</code> fully compatible with the standard <code>asyncio.Timeout</code> but keep backward compatibility with existing <code>asyncio_timeout.Timeout</code> API. (<code>[#422](aio-libs/async-timeout#422) <https://github.com/aio-libs/async-timeout/issues/422></code>_)</li> </ul> <h2>Improved Documentation</h2> <ul> <li>On the <code>CHANGES/README.rst <https://github.com/aio-libs/async-timeout/tree/master/CHANGES/README.rst></code>_ page, a link to the <code>Towncrier philosophy</code> has been fixed. (<code>[#388](aio-libs/async-timeout#388) <https://github.com/aio-libs/async-timeout/issues/388></code>_)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Drop deprecated sync context manager support, use <code>async with timeout(...): ...</code> instead. (<code>[#421](aio-libs/async-timeout#421) <https://github.com/aio-libs/async-timeout/issues/421></code>_)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/aio-libs/async-timeout/commit/3d3e3e45420ac6ea0ef77c9e32388e252e12ac4d"><code>3d3e3e4</code></a> Bump to 5.0.0</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/d5c21f3dee7eeb06823af77284ad2a899611b28e"><code>d5c21f3</code></a> Mimic asyncio.Timeout behavior (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/422">#422</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/a1111c2597b9ce8d34b823c1b993689339ea9fd6"><code>a1111c2</code></a> Drop deprecated sync context manager support (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/421">#421</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/00fd343ce6ba2ccc291c0f6e09fea8998cbfe3a1"><code>00fd343</code></a> Imports cleanup</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/7b61b33ae0ecee0e0bb0e09f2e5787c647d4ffb8"><code>7b61b33</code></a> Update CI config file</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/e64805c56c322e642d5db743313fd05b10e1d346"><code>e64805c</code></a> Bump docutils from 0.20.1 to 0.21.2 (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/407">#407</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/ca60cc476a379d6e52727ade9209713a37ce3b60"><code>ca60cc4</code></a> Bump pytest from 8.2.1 to 8.3.3 (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/420">#420</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/539c76b56a5e06cafdfb0622530fbcaaa36d9a25"><code>539c76b</code></a> Bump pytest-cov from 4.1.0 to 6.0.0 (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/414">#414</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/d9c19750103955a45cb63e49266e893d18b0b79f"><code>d9c1975</code></a> Bump mypy from 1.10.0 to 1.13.0 (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/416">#416</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/045dd0b496312f05131ed5f2bea7dff2ed11c659"><code>045dd0b</code></a> Bump build from 1.2.1 to 1.2.2.post1 (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/419">#419</a>)</li> <li>Additional commits viewable in <a href="https://github.com/aio-libs/async-timeout/compare/v4.0.3...v5.0.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=async-timeout&package-manager=pip&previous-version=4.0.3&new-version=5.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> 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 <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I don't mind, but many people like to have less dependencies, and that snippet helped to ensure that the dependency is dropped as soon as possible. That's why we did it like that in aiohttp. |
Created #424 for README update. I agree, conditional import in aiohttp is totally fine. |
…ion-tests/utils/agent (#386) Bumps [async-timeout](https://github.com/aio-libs/async-timeout) from 4.0.3 to 5.0.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/aio-libs/async-timeout/releases">async-timeout's releases</a>.</em></p> <blockquote> <h2>5.0.1</h2> <h2>Misc</h2> <ul> <li><code>[#423](aio-libs/async-timeout#423) <https://github.com/aio-libs/async-timeout/issues/423></code>_</li> </ul> <h2>5.0.0</h2> <h2>Features</h2> <ul> <li>Make <code>asyncio_timeout</code> fully compatible with the standard <code>asyncio.Timeout</code> but keep backward compatibility with existing <code>asyncio_timeout.Timeout</code> API. (<code>[#422](aio-libs/async-timeout#422) <https://github.com/aio-libs/async-timeout/issues/422></code>_)</li> </ul> <h2>Improved Documentation</h2> <ul> <li>On the <code>CHANGES/README.rst <https://github.com/aio-libs/async-timeout/tree/master/CHANGES/README.rst></code>_ page, a link to the <code>Towncrier philosophy</code> has been fixed. (<code>[#388](aio-libs/async-timeout#388) <https://github.com/aio-libs/async-timeout/issues/388></code>_)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Drop deprecated sync context manager support, use <code>async with timeout(...): ...</code> instead. (<code>[#421](aio-libs/async-timeout#421) <https://github.com/aio-libs/async-timeout/issues/421></code>_)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/aio-libs/async-timeout/blob/master/CHANGES.rst">async-timeout's changelog</a>.</em></p> <blockquote> <h1>5.0.1 (2024-11-06)</h1> <h2>Misc</h2> <ul> <li><code>[#423](aio-libs/async-timeout#423) <https://github.com/aio-libs/async-timeout/issues/423></code>_</li> </ul> <h1>5.0.0 (2024-10-31)</h1> <h2>Features</h2> <ul> <li>Make <code>asyncio_timeout</code> fully compatible with the standard <code>asyncio.Timeout</code> but keep backward compatibility with existing <code>asyncio_timeout.Timeout</code> API. (<code>[#422](aio-libs/async-timeout#422) <https://github.com/aio-libs/async-timeout/issues/422></code>_)</li> </ul> <h2>Improved Documentation</h2> <ul> <li>On the <code>CHANGES/README.rst <https://github.com/aio-libs/async-timeout/tree/master/CHANGES/README.rst></code>_ page, a link to the <code>Towncrier philosophy</code> has been fixed. (<code>[#388](aio-libs/async-timeout#388) <https://github.com/aio-libs/async-timeout/issues/388></code>_)</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Drop deprecated sync context manager support, use <code>async with timeout(...): ...</code> instead. (<code>[#421](aio-libs/async-timeout#421) <https://github.com/aio-libs/async-timeout/issues/421></code>_)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/aio-libs/async-timeout/commit/cc52d410e733b302873e6e52db9a9b6578d053a4"><code>cc52d41</code></a> Bump to 5.0.1</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/1af7d7165d598af03e51952a679c690690dc7f8e"><code>1af7d71</code></a> Bump to 5.0.1</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/3bf26d96e3d1830a0e72ddab9c6a2c87e1f4380a"><code>3bf26d9</code></a> Fix <a href="https://redirect.github.com/aio-libs/async-timeout/issues/423">#423</a>: add requirements.txt to sdist package (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/425">#425</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/380e8ba5bf77e3cd184df8a5f51dc929d93d8553"><code>380e8ba</code></a> Mention condition import of asyncio.timeout / async_timeout.timeout in README...</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/8a232d0f7fc1af88c8d921500d78bbefc2bc545c"><code>8a232d0</code></a> Update README</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/3d3e3e45420ac6ea0ef77c9e32388e252e12ac4d"><code>3d3e3e4</code></a> Bump to 5.0.0</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/d5c21f3dee7eeb06823af77284ad2a899611b28e"><code>d5c21f3</code></a> Mimic asyncio.Timeout behavior (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/422">#422</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/a1111c2597b9ce8d34b823c1b993689339ea9fd6"><code>a1111c2</code></a> Drop deprecated sync context manager support (<a href="https://redirect.github.com/aio-libs/async-timeout/issues/421">#421</a>)</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/00fd343ce6ba2ccc291c0f6e09fea8998cbfe3a1"><code>00fd343</code></a> Imports cleanup</li> <li><a href="https://github.com/aio-libs/async-timeout/commit/7b61b33ae0ecee0e0bb0e09f2e5787c647d4ffb8"><code>7b61b33</code></a> Update CI config file</li> <li>Additional commits viewable in <a href="https://github.com/aio-libs/async-timeout/compare/v4.0.3...v5.0.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=async-timeout&package-manager=pip&previous-version=4.0.3&new-version=5.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> 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 <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Romain Marcadier <[email protected]>
It makes
asyncio_timeout
fully compatible with the standardasyncio.Timeout
but keeps backward compatibility with previousasyncio_timeout.Timeout
API