aio-libs / aiohttp

Asynchronous HTTP client/server framework for asyncio and Python
https://docs.aiohttp.org
Other
14.94k stars 1.99k forks source link

Documentation mentions async_timeout as dependency #8379

Closed mdczaplicki closed 14 hours ago

mdczaplicki commented 4 months ago

Describe the bug

The documentation mentions that async_timeout is one of the dependencies of aiohttp, but it's not.

https://docs.aiohttp.org/en/stable/#dependencies

To Reproduce

  1. Install aiohttp==3.9.5
  2. import async_timeout

Expected behavior

Works

Logs/tracebacks

x

Python Version

$ python --version
3.11.9

aiohttp Version

$ python -m pip show aiohttp
3.9.5

multidict Version

$ python -m pip show multidict

yarl Version

$ python -m pip show yarl

OS

x

Related component

Client

Additional context

No response

Code of Conduct

webknjaz commented 4 months ago

It is a fallback in older runtimes: https://github.com/aio-libs/aiohttp/blob/4928ae3/setup.cfg#L54 / https://github.com/aio-libs/aiohttp/blob/4928ae3/aiohttp/client_ws.py#L28. The stdlib is always preferred when available.

This is not a software bug but a documentation issue. Anyway, you shouldn't be relying on transitive dependencies — it's wrong from the packaging perspective. If you use something directly from your code base, that's your direct dependency and you should treat it as such instead of hoping that something else will bring it in occasionally.

mdczaplicki commented 4 months ago

Of course I shouldn't be relying, but that's why I've found it 😁 I've already switched to native. I've just thought that I'll let you know. Thanks!