Recipes for asyncio

Running asyncio event loop inside jupyter

  • Jupyter by default is already running its own event loop, so you need nest_asyncio to resolve this issue.
  • AFAIK, you can't use a more performant event loop like uvloop with this method
import nest_asyncio
nest_asyncio.apply()

Async map a coroutine across an iterable (with progress bar)

async_map[source]

async_map(coroutine, iterable, pool_size=2, tqdm_kwargs={}, *args, **kwargs)

Trio