You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you share what the UX for this in aiohttp looks like? (eg maybe a snippet of an interactive interpreter session…)
I'm just wondering if this would actually provide value, or just add noise when shutting down an interpreter (which should force-close any dangling resources anyway, no?).
@florimondmanca closing all connections sounds fine but question is whether it is technically doable as close() is an async function and we cannot await it inside __dell__(). Additionally I think that such an information is very helpful in tracking buggy code with unclosed resources
Here is an example output from aiohttp:
An implementation similar to aiohttp is technically possible — ie log a warning but don’t attempt to close the client (notably because, as you said, it’s an async operation).
One bit to keep in mind is that this would need to be async library agnostic (asyncio/trio) - so the check needs to be deferred to the async backends at some point - so this doesn’t seem like a trivial addition. But if you’d like to give it a shot feel free to. :)
I was setting up the project locally and in the step of installing dependencies. Should it explicitly mention that scripts/install will automatically create a virtual environment?
You can now install the project and its dependencies using:
$ cd httpx
$ scripts/install
Or is it just me that went ahead creating a virtual env and running the command scripts/install hoping it would install dependencies in the environment I created.
Activity
florimondmanca commentedon Mar 25, 2020
Hi @kamilglod
Can you share what the UX for this in aiohttp looks like? (eg maybe a snippet of an interactive interpreter session…)
I'm just wondering if this would actually provide value, or just add noise when shutting down an interpreter (which should force-close any dangling resources anyway, no?).
kamilglod commentedon Mar 25, 2020
@florimondmanca closing all connections sounds fine but question is whether it is technically doable as

close()is an async function and we cannotawaitit inside__dell__(). Additionally I think that such an information is very helpful in tracking buggy code with unclosed resourcesHere is an example output from aiohttp:
florimondmanca commentedon Mar 25, 2020
Thanks, the REPL snippet is useful.
An implementation similar to aiohttp is technically possible — ie log a warning but don’t attempt to close the client (notably because, as you said, it’s an async operation).
One bit to keep in mind is that this would need to be async library agnostic (asyncio/trio) - so the check needs to be deferred to the async backends at some point - so this doesn’t seem like a trivial addition. But if you’d like to give it a shot feel free to. :)
Pradhvan commentedon Jun 17, 2020
@florimondmanca If anyone is not working on it. I would like to give it a try. 😄
Pradhvan commentedon Jun 18, 2020
I was setting up the project locally and in the step of installing dependencies. Should it explicitly mention that
scripts/installwill automatically create a virtual environment?Or is it just me that went ahead creating a virtual env and running the command
scripts/installhoping it would install dependencies in the environment I created.cdeler commentedon Aug 17, 2020
@Pradhvan do you mind if I take this?
Warn a ResourceWarning when AsyncClient hasn't been closed (encode#871)
Warn a ResourceWarning when AsyncClient hasn't been closed (encode#871)
Warn a ResourceWarning when AsyncClient hasn't been closed (encode#871)
cdeler commentedon Aug 18, 2020
@florimondmanca should we add the similar check for
httpx.Client?Pradhvan commentedon Aug 18, 2020
@cdeler yes 😄
8 remaining items
Made Client and AsyncClient checking for being closed in __del__ (enc…
Changed the AsyncClient closing warning type from ResourceWarning (wh…
Fixed RuntimeWarning caused by unclosed AsyncClient (encode#871)
Changed the AsyncClient closing warning type from ResourceWarning (wh…
Fixed RuntimeWarning caused by unclosed AsyncClient (encode#871)
Fixed UserWarning caused by unclosed AsyncClient (encode#871)
Closing AsyncClient in all tests (encode#871)
Closing AsyncClient in all tests (encode#871)
Closing AsyncClient in all tests (encode#871)
Closing AsyncClient in all tests (#871) (#1219)
Made Client and AsyncClient checking for being closed in __del__ (enc…
Changed the AsyncClient closing warning type from ResourceWarning (wh…
Fixed tests and client's __exit__ and __aexit__ after the difficult m…
Issue warning on unclosed `AsyncClient`. (#1197)