Asynchronous Programming in Python

8 projects in Python Language. Most starred: uvloop, trio and gevent.

asyncio is the standard library's event loop and the base most async libraries target. uvloop is a drop-in replacement loop built on libuv that speeds up network-heavy asyncio code. Trio is an alternative async library built around structured concurrency, where tasks live inside nurseries and cannot outlive them; that idea influenced asyncio's TaskGroup. AnyIO provides a structured concurrency API that runs on top of either asyncio or Trio, and libraries such as Starlette and HTTPX use it. gevent takes a different route: greenlets and monkey-patching make ordinary blocking code cooperative without async and await. Twisted is the long-standing event-driven framework with implementations of many network protocols.

For CPU-bound work, the global interpreter lock limits threads in standard CPython builds, so concurrent.futures with a ProcessPoolExecutor or the multiprocessing module run code in separate processes. A useful rule: async or threads for I/O-bound work, processes for CPU-bound work. Free-threaded CPython builds, introduced as experimental in Python 3.13, remove the lock but require extensions that support them.

Deeper lists: awesome-asyncio

Async I/O6

asyncioStandard library

Asynchronous I/O, event loop, coroutines and tasks.

anyio

A high-level async concurrency and networking framework that works on top of asyncio or trio.

2.6kupdated 1d ago4.15.1

uvloop

Ultra fast asyncio event loop.

11.9kupdated 5d ago0.23.0

trio

A friendly library for async concurrency and I/O.

7.4kupdated today0.34.0

gevent

A coroutine-based Python networking library that uses greenlet.

6.4kupdated 1mo ago1.2.2

Twisted

An event-driven networking engine.

6kupdated 2d agotwisted-26.4.0

Parallelism2

Esc

Type to search every entry. ↑↓ to move, Enter to open.