# Python async libraries

Python async libraries run many I/O-bound tasks concurrently in one thread by switching between them while each waits on the network or disk. An event loop schedules each coroutine or green thread and resumes it when its I/O completes. These libraries let web servers, crawlers, and AI agents handle thousands of open connections at once.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [AnyIO](#anyio) | 1.1B | 2.6K | Nov 2026 | MIT |
| [uvloop](#uvloop) | 296.6M | Not on GitHub | Oct 2026 | MIT OR Apache-2.0 |
| [Tornado](#tornado) | 123.2M | Not on GitHub | Nov 2026 | Apache-2.0 |
| [Trio](#trio) | 42.5M | 7.4K | Oct 2026 | MIT OR Apache-2.0 |
| [gevent](#gevent) | 29.1M | 6.4K | Sep 2026 | MIT |
| [Twisted](#twisted) | 15.4M | Not on GitHub | Oct 2026 | MIT |
| [aiomultiprocess](#aiomultiprocess) | 5.1M | Not on GitHub | Apr 2024 | MIT |
| [Eventlet](#eventlet) | 2.1M | Not on GitHub | Oct 2026 | MIT |

Downloads: pypi, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[AnyIO](#anyio) has the most monthly downloads among the registry packages in this comparison, at 1.0B.

## Capabilities

| Library | Scoped task nurseries | Greenlet task scheduling | Managed process workers |
| --- | --- | --- | --- |
| [AnyIO](#anyio) | Yes | No | Yes |
| [uvloop](#uvloop) | No | No | No |
| [Tornado](#tornado) | No | No | No |
| [Trio](#trio) | Yes | No | No |
| [gevent](#gevent) | No | Yes | No |
| [Twisted](#twisted) | No | No | No |
| [aiomultiprocess](#aiomultiprocess) | No | No | Yes |
| [Eventlet](#eventlet) | No | Yes | No |

## Libraries

### AnyIO

[GitHub](https://github.com/agronholm/anyio) · [pypi](https://pypi.org/project/anyio) · [Docs](https://anyio.readthedocs.io/en/stable/basics.html)

Provides structured concurrency and asynchronous I/O APIs over asyncio or Trio.

- Downloads / mo: 1.1B
- Stars: 2.6K
- Last release: 4.16.0
- License: MIT
- Capabilities: [From the AnyIO docs](https://anyio.readthedocs.io/en/stable/basics.html)

**Strengths**

- **Supports asyncio and Trio backends.** Use the same AnyIO APIs on asyncio or Trio.
- **Contains child-task lifetimes.** Task-group exit waits for children; an error cancels the remaining tasks.

**Watch out for**

- **Native dependencies constrain the backend.** Use asyncio-native dependencies only with the asyncio backend.
- **Cancelled scopes keep raising cancellation.** Shield asynchronous cleanup when it must run inside a cancelled scope.

```sh
python -m pip install anyio==4.16.0
```

**encode/httpcore** (551 stars)

[encode/httpcore](https://github.com/encode/httpcore) 

```python
async def start_tls(
    self,
    ssl_context: ssl.SSLContext,
    server_hostname: str | None = None,
    timeout: float | None = None,
) -> AsyncNetworkStream:
    exc_map = {
        TimeoutError: ConnectTimeout,
        anyio.BrokenResourceError: ConnectError,
        anyio.EndOfStream: ConnectError,
        ssl.SSLError: ConnectError,
    }
    with map_exceptions(exc_map):
        try:
            with anyio.fail_after(timeout):
                ssl_stream = await anyio.streams.tls.TLSStream.wrap(
                    self._stream,
                    ssl_context=ssl_context,
                    hostname=server_hostname,
                    standard_compatible=False,
                    server_side=False,
                )
        except Exception as exc:  # pragma: nocover
            await self.aclose()
            raise exc
    return AnyIOStream(ssl_stream)
```

[httpcore/_backends/anyio.py](https://github.com/encode/httpcore/blob/10a658221deb38a4c5b16db55ab554b0bf731707/httpcore/_backends/anyio.py#L55-L80) · [More projects using AnyIO →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20anyio%20for%20concurrent%20I/O%2C%20transport%20deadlines%20and%20asynchronous%20startup&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import anyio

async def main():
    await anyio.sleep(0)

anyio.run(main)

```

From [tasks.html](https://anyio.readthedocs.io/en/stable/basics.html)

### uvloop

[GitHub](https://github.com/MagicStack/uvloop) · [pypi](https://pypi.org/project/uvloop) · [Docs](https://api.github.com/repos/MagicStack/uvloop/readme)

Replaces the asyncio event loop with one built on libuv.

- Downloads / mo: 296.6M
- Last release: 0.23.0
- License: MIT OR Apache-2.0
- Capabilities: [From the uvloop docs](https://api.github.com/repos/MagicStack/uvloop/readme)

```sh
python -m pip install uvloop==0.23.0
```

**streamlit/streamlit** (46.4K stars)

[streamlit/streamlit](https://github.com/streamlit/streamlit) 

```python
def _run_server_loop(main: Coroutine[Any, Any, None]) -> None:
    """Run ``main`` on a new event loop, using uvloop when available.

    - uvloop provides ``new_event_loop``: run on ``asyncio.Runner`` so we
      avoid the deprecated event-loop policy APIs.
    - uvloop is missing or too old: call ``uvloop.install()`` when it exists,
      then ``asyncio.run()``.
    - Creating the uvloop loop fails: skip ``install()`` and use the stdlib
      loop.
    """
    loop_factory = _get_uvloop_loop_factory()
    if loop_factory is None:
        _try_install_uvloop()
    else:
        try:
            # Create the loop before Runner.run so a factory failure can
            # fall back without wrapping the server coroutine itself.
            loop = loop_factory()
        except Exception:
            # Don't call install() here: that would retry the same uvloop
            # implementation that just failed to create a loop.
            _LOGGER.warning(
                "Failed to create uvloop event loop. Falling back to default loop.",
                exc_info=True,
            )
        else:
            _LOGGER.debug("Starting new uvloop event loop for server")
            with asyncio.Runner(loop_factory=lambda: loop) as runner:
                runner.run(main)
            return

    _LOGGER.debug("Starting new event loop for server")
    asyncio.run(main)
```

[lib/streamlit/web/bootstrap.py](https://github.com/streamlit/streamlit/blob/87ebf36e34594a2deac689dcf37ddf84189d8e4d/lib/streamlit/web/bootstrap.py#L125-L157) · [More projects using uvloop →](https://dashboard.exa.ai/playground/search?q=uvloop%20GitHub%20projects)

**Quickstart**

```python
import asyncio
import uvloop

async def main():
    await asyncio.sleep(0)

uvloop.run(main())

```

From [README.rst](https://api.github.com/repos/MagicStack/uvloop/readme)

### Tornado

[GitHub](https://github.com/tornadoweb/tornado) · [pypi](https://pypi.org/project/tornado) · [Docs](https://www.tornadoweb.org/en/stable/guide/coroutines.html)

Provides a web framework and asynchronous networking library.

- Downloads / mo: 123.2M
- Last release: 6.6.1
- License: Apache-2.0
- Capabilities: [From the Tornado docs](https://www.tornadoweb.org/en/stable/guide/coroutines.html)

```sh
python -m pip install tornado==6.6.1
```

**jupyter-server/jupyter_server** (573 stars)

[jupyter-server/jupyter_server](https://github.com/jupyter-server/jupyter_server) 

```python
def send_ping(self):
    """send a ping to keep the websocket alive"""
    if self.ws_connection is None and self.ping_callback is not None:
        self.ping_callback.stop()
        return

    if self.ws_connection.client_terminated:
        self.close()
        return

    # check for timeout on pong.  Make sure that we really have sent a recent ping in
    # case the machine with both server and client has been suspended since the last ping.
    now = ioloop.IOLoop.current().time()
    since_last_pong = 1e3 * (now - self.last_pong)
    since_last_ping = 1e3 * (now - self.last_ping)
    if since_last_ping < 2 * self.ping_interval and since_last_pong > self.ping_timeout:
        self.log.warning("WebSocket ping timeout after %i ms.", since_last_pong)
        self.close()
        return

    self.ping(b"")
    self.last_ping = now

```

[jupyter_server/base/websocket.py](https://github.com/jupyter-server/jupyter_server/blob/c4c5a51d2cf77d31a266376582ee05c4d661ad4b/jupyter_server/base/websocket.py#L161-L182) · [More projects using Tornado →](https://dashboard.exa.ai/playground/search?q=tornado%20GitHub%20projects)

**Quickstart**

```python
from tornado.ioloop import IOLoop
from tornado import gen

async def main():
    await gen.sleep(0)

IOLoop.current().run_sync(main)

```

From [coroutines.html](https://www.tornadoweb.org/en/stable/guide/coroutines.html)

### Trio

[GitHub](https://github.com/python-trio/trio) · [pypi](https://pypi.org/project/trio) · [Docs](https://trio.readthedocs.io/en/stable/reference-core.html)

Provides native async/await I/O with nurseries and cancellation scopes.

- Downloads / mo: 42.5M
- Stars: 7.4K
- Last release: 0.35.0
- License: MIT OR Apache-2.0
- Capabilities: [From the Trio docs](https://trio.readthedocs.io/en/stable/reference-core.html)

**Strengths**

- **Nurseries contain child-task lifetimes.** Nursery exit waits for every child task to finish.
- **Groups deadlines and cancellation.** Use cancel scopes to apply deadlines or cancellation to enclosed operations.

**Watch out for**

- **Cancellation waits for checkpoints.** Add checkpoints to CPU-bound loops that must respond to cancellation.

```sh
python -m pip install trio==0.35.0
```

**encode/httpcore** (551 stars)

[encode/httpcore](https://github.com/encode/httpcore) 

```python
async def start_tls(
    self,
    ssl_context: ssl.SSLContext,
    server_hostname: str | None = None,
    timeout: float | None = None,
) -> AsyncNetworkStream:
    timeout_or_inf = float("inf") if timeout is None else timeout
    exc_map: ExceptionMapping = {
        trio.TooSlowError: ConnectTimeout,
        trio.BrokenResourceError: ConnectError,
    }
    ssl_stream = trio.SSLStream(
        self._stream,
        ssl_context=ssl_context,
        server_hostname=server_hostname,
        https_compatible=True,
        server_side=False,
    )
    with map_exceptions(exc_map):
        try:
            with trio.fail_after(timeout_or_inf):
                await ssl_stream.do_handshake()
        except Exception as exc:  # pragma: nocover
            await self.aclose()
            raise exc
    return TrioStream(ssl_stream)
```

[httpcore/_backends/trio.py](https://github.com/encode/httpcore/blob/10a658221deb38a4c5b16db55ab554b0bf731707/httpcore/_backends/trio.py#L54-L79) · [More projects using Trio →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20trio%20for%20concurrent%20I/O%2C%20transport%20deadlines%20and%20asynchronous%20startup&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import trio

async def main():
    await trio.sleep(0)

trio.run(main)

```

From [tasks-intro.py](https://trio.readthedocs.io/en/stable/reference-core.html)

### gevent

[GitHub](https://github.com/gevent/gevent) · [pypi](https://pypi.org/project/gevent) · [Docs](https://www.gevent.org/api/gevent.html)

Runs cooperative networking through greenlets and a synchronous-style API.

- Downloads / mo: 29.1M
- Stars: 6.4K
- Last release: 26.9.0
- License: MIT
- Capabilities: [From the gevent docs](https://www.gevent.org/api/gevent.html)

**Strengths**

- **Runs blocking-style cooperative network code.** Use synchronous-style networking APIs while greenlets yield during cooperative I/O.
- **Limits concurrent work with pools.** Use Pool to limit how many greenlets run at once.

**Watch out for**

- **Cooperation requires yielding control.** Yield during CPU-heavy work and use cooperative I/O functions.
- **Monkey-patching must happen early.** Patch before imports capture the original blocking implementations.

```sh
python -m pip install gevent==26.9.0
```

**spyoungtech/grequests** (4.6K stars)

[spyoungtech/grequests](https://github.com/spyoungtech/grequests) 

```python
def map(requests, stream=False, size=None, exception_handler=None, gtimeout=None):
    """Concurrently converts a list of Requests to Responses.

    :param requests: a collection of Request objects.
    :param stream: If True, the content will not be downloaded immediately.
    :param size: Specifies the number of requests to make at a time. If None, no throttling occurs.
    :param exception_handler: Callback function, called when exception occured. Params: Request, Exception
    :param gtimeout: Gevent joinall timeout in seconds. (Note: unrelated to requests timeout)
    """

    requests = list(requests)

    pool = Pool(size) if size else None
    jobs = [send(r, pool, stream=stream) for r in requests]
    gevent.joinall(jobs, timeout=gtimeout)

    ret = []

    for request in requests:
        if request.response is not None:
            ret.append(request.response)
        elif exception_handler and hasattr(request, 'exception'):
            ret.append(exception_handler(request, request.exception))
        elif exception_handler and not hasattr(request, 'exception'):
            ret.append(exception_handler(request, None))
        else:
            ret.append(None)

    return ret
```

[grequests.py](https://github.com/spyoungtech/grequests/blob/60f70e99e942a2df378b4e4f6202dcf862754c2d/grequests.py#L111-L139) · [More projects using gevent →](https://dashboard.exa.ai/playground/search?q=Python%20applications%20using%20gevent%20for%20concurrent%20I/O%2C%20transport%20deadlines%20and%20asynchronous%20startup&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import gevent

job = gevent.spawn(gevent.sleep, 0)
job.join()

```

From [intro.html](https://www.gevent.org/api/gevent.html)

### Twisted

[GitHub](https://github.com/twisted/twisted) · [pypi](https://pypi.org/project/twisted) · [Docs](https://docs.twisted.org/en/stable/core/howto/defer-intro.html)

Provides an asynchronous networking framework.

- Downloads / mo: 15.4M
- Last release: 26.10.0
- License: MIT
- Capabilities: [From the Twisted docs](https://docs.twisted.org/en/stable/core/howto/defer-intro.html)

```sh
python -m pip install twisted==26.10.0
```

**scrapy/scrapy** (65.5K stars)

[scrapy/scrapy](https://github.com/scrapy/scrapy) 

```python
def start(self) -> None:
    if self._running >= self._count:
        return
    self._running += 1
    self._coop.coiterate(self._work).addBoth(self._task_done)
```

[scrapy/utils/defer.py](https://github.com/scrapy/scrapy/blob/86e136b9f3a0fb07f96eec0952d6efe028d281d4/scrapy/utils/defer.py#L219-L223) · [More projects using Twisted →](https://dashboard.exa.ai/playground/search?q=twisted%20GitHub%20projects)

**Quickstart**

```python
from twisted.internet.task import react
from twisted.internet.defer import succeed

react(lambda reactor: succeed(None))

```

From [twisted.internet.task.html](https://docs.twisted.org/en/stable/api/twisted.internet.task.html)

### aiomultiprocess

[GitHub](https://github.com/omnilib/aiomultiprocess) · [pypi](https://pypi.org/project/aiomultiprocess) · [Docs](https://aiomultiprocess.omnilib.dev/en/latest/guide.html)

Provides an asyncio version of the standard multiprocessing module.

- Downloads / mo: 5.1M
- Last release: 0.9.1
- License: MIT
- Capabilities: [From the aiomultiprocess docs](https://aiomultiprocess.omnilib.dev/en/latest/guide.html)

```sh
python -m pip install aiomultiprocess==0.9.1
```

**bridgecrewio/checkov** (9.2K stars)

[bridgecrewio/checkov](https://github.com/bridgecrewio/checkov) 

```python
async def _report_results_to_bridgecrew_async(
    scan_results: Iterable[dict[str, Any]],
    bc_integration: BcPlatformIntegration,
    bc_api_key: str,
) -> Sequence[int]:
    package_scanning_int = PackageScanningIntegration()
    args = [(result, bc_integration, bc_api_key, Path(result["repository"])) for result in scan_results]

    if os.getenv("PYCHARM_HOSTED") == "1":
        # PYCHARM_HOSTED env variable equals 1 when running via Pycharm.
        # it avoids us from crashing, which happens when using multiprocessing via Pycharm's debug-mode
        logging.warning("reporting the results in sequence for avoiding crashing when running via Pycharm")
        exit_codes = []
        for curr_arg in args:
            exit_codes.append(await package_scanning_int.report_results_async(*curr_arg))
    else:
        async with Pool() as pool:
            exit_codes = await pool.starmap(package_scanning_int.report_results_async, args)

    return exit_codes
```

[checkov/common/bridgecrew/vulnerability_scanning/report.py](https://github.com/bridgecrewio/checkov/blob/286946086f105c8edee1d9968823671da17b7242/checkov/common/bridgecrew/vulnerability_scanning/report.py#L18-L37) · [More projects using aiomultiprocess →](https://dashboard.exa.ai/playground/search?q=aiomultiprocess%20GitHub%20projects)

**Quickstart**

```python
import asyncio
from aiomultiprocess import Worker

async def identity(value):
    return value

async def main():
    return await Worker(target=identity, args=(1,))

if __name__ == "__main__":
    asyncio.run(main())

```

From [guide.html](https://aiomultiprocess.omnilib.dev/en/latest/guide.html)

### Eventlet

[GitHub](https://github.com/eventlet/eventlet) · [pypi](https://pypi.org/project/eventlet) · [Docs](https://eventlet.readthedocs.io/en/latest/basic_usage.html)

Provides a concurrent networking library.

- Downloads / mo: 2.1M
- Last release: 0.41.3
- License: MIT
- Capabilities: [From the Eventlet docs](https://eventlet.readthedocs.io/en/latest/basic_usage.html)

```sh
python -m pip install eventlet==0.41.3
```

**openstack/swift** (2.8K stars)

[openstack/swift](https://github.com/openstack/swift) 

```python
def spawn_n(self, *args, **kwargs):
    super(RestrictedGreenPool, self).spawn_n(*args, **kwargs)
    if self._rgp_do_wait:
        self.waitall()
```

[swift/common/wsgi.py](https://github.com/openstack/swift/blob/d33a7c0348075357a8878334a6be0bba6baffa50/swift/common/wsgi.py#L234-L237) · [More projects using Eventlet →](https://dashboard.exa.ai/playground/search?q=eventlet%20GitHub%20projects)

**Quickstart**

```python
import eventlet

job = eventlet.spawn(eventlet.sleep, 0)
job.wait()

```

From [basic_usage.html](https://eventlet.readthedocs.io/en/latest/basic_usage.html)

## FAQ

### Which Python async library should I use?

[AnyIO](#anyio) suits libraries that must run on both asyncio and Trio. [uvloop](#uvloop) suits asyncio servers that want a faster event loop. [gevent](#gevent) suits older synchronous code that needs concurrency without async syntax.

### What is asyncio?

asyncio is the standard library framework for async and await code in Python. It provides the event loop, tasks, and streams that [AnyIO](#anyio) and [uvloop](#uvloop) build on.

### What is AnyIO?

[AnyIO](#anyio) provides structured concurrency and async I/O APIs that run on top of asyncio or Trio. Its task groups cancel sibling tasks together when one task fails.

### What is uvloop?

[uvloop](#uvloop) replaces the default asyncio event loop with one built on libuv. Servers install it with a single call at startup.

### What is gevent?

[gevent](#gevent) runs cooperative networking on greenlets behind a synchronous-style API. Monkey-patching makes standard library sockets yield to other greenlets.

### Asyncio vs threading: what is the difference?

asyncio runs coroutines on one thread and switches tasks only at each await. Threading runs functions on operating system threads that the scheduler can switch at any point.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python async libraries asyncio AnyIO Trio gevent code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
