Open dhalbert opened 3 years ago
TaskGroups going in to CPython 3.11: https://bugs.python.org/issue46752 https://github.com/python/cpython/pull/31270
Quattro version (not using multi-except): https://github.com/Tinche/quattro
I agree it would be a good idea to support structured concurrency, as going head-on with the older asyncio primitives can get pretty messy.
Maybe the anyio lib could be helpful, as it follows the good ideas of trio but can work with the default asyncio backend.
asyncio could really use a
TaskGroup
implementation, as provided by Trio (aka nurseries), Curio, aiotools, and EdgeDB.TaskGroup
was originally slated to be added Python as long ago as 3.8, but was held up because exception group handling was not available. However, exception groups are now being added: PEP 654, PR). Once that PEP is implemented,TaskGroup
will probably follow. But the timeline for PEP 654 to go into the MicroPython core is unclear. So any TaskGroup we add will not be quite compatible, and we probably want to add it in an ancillary library (adafruit_asyncio
orasynciox
orxasyncio
or ??).