# anyio

> High-level concurrency and networking framework on top of asyncio or Trio

- **URL**: https://www.freshcrate.ai/projects/anyio
- **Author**: pypi
- **Category**: Frameworks
- **Latest version**: `4.13.0` (2026-04-21)
- **License**: Unknown
- **Source**: https://github.com/agronholm/anyio/issues
- **Homepage**: https://pypi.org/project/anyio/
- **Language**: Python
- **GitHub**: 2,442 stars, 197 forks
- **Registry**: pypi (`anyio`)
- **Tags**: `pypi`

## Description

.. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg
  :target: https://github.com/agronholm/anyio/actions/workflows/test.yml
  :alt: Build Status
.. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master
  :target: https://coveralls.io/github/agronholm/anyio?branch=master
  :alt: Code Coverage
.. image:: https://readthedocs.org/projects/anyio/badge/?version=latest
  :target: https://anyio.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation
.. image:: https://badges.gitter.im/gitterHQ/gitter.svg
  :target: https://gitter.im/python-trio/AnyIO
  :alt: Gitter chat
.. image:: https://tidelift.com/badges/package/pypi/anyio
  :target: https://tidelift.com/subscription/pkg/pypi-anyio
  :alt: Tidelift

AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ or
Trio_. It implements Trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmony
with the native SC of Trio itself.

Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ or
Trio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full
refactoring necessary. It will blend in with the native libraries of your chosen backend.

To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it
`here <https://anyio.readthedocs.io/en/stable/why.html>`_.

Documentation
-------------

View full documentation at: https://anyio.readthedocs.io/

Features
--------

AnyIO offers the following functionality:

* Task groups (nurseries_ in trio terminology)
* High-level networking (TCP, UDP and UNIX sockets)

  * `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python
    3.8)
  * async/await style UDP sockets (unlike asyncio where you still have to use Transports and
    Protocols)

* A versatile API for byte streams and object streams
* Inter-task synchronization and communication (locks, conditions, events, semaphores, object
  streams)
* Worker threads
* Subprocesses
* Subinterpreter support for code parallelization (on Python 3.13 and later)
* Asynchronous file I/O (using worker threads)
* Signal handling
* Asynchronous version of the functools_ module

AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures.
It even works with the popular Hypothesis_ library.

.. _asyncio: https://docs.python.org/3/library/asyncio.html
.. _Trio: https://github.com/python-trio/trio
.. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency
.. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning
.. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs
.. _pytest: https://docs.pytest.org/en/latest/
.. _functools: https://docs.python.org/3/library/functools.html
.. _Hypothesis: https://hypothesis.works/

Security contact information
----------------------------

To report a security vulnerability, please use the `Tidelift security contact`_.
Tidelift will coordinate the fix and disclosure.

.. _Tidelift security contact: https://tidelift.com/security

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `4.13.0` | 2026-04-21 | Low | Imported from PyPI (4.13.0) |
| `4.12.1` | 2026-01-06 | Low | - Changed all functions currently raising the private `NoCurrentAsyncBackend` exception (since v4.12.0) to instead raise the public `NoEventLoopError` exception ([\#1048](https://github.com/agronholm/anyio/issues/1048)) - Fixed `anyio.functools.lru_cache` not working with instance methods ([\#1042](https://github.com/agronholm/anyio/issues/1042)) |
| `4.12.0` | 2025-11-30 | Low | - Added support for asyncio's [task call graphs](https://docs.python.org/3/library/asyncio-graph.html) on Python 3.14 and later when using AnyIO's task groups ([\#1025](https://github.com/agronholm/anyio/pull/1025)) - Added an asynchronous implementation of the `functools` module ([\#1001](https://github.com/agronholm/anyio/pull/1001)) - Added support for `uvloop=True` on Windows via the [winloop](https://github.com/Vizonex/Winloop) implementation ([\#960](https://github.com/agronholm/anyio/pu |
| `4.11.0` | 2025-09-23 | Low | - Added support for cancellation reasons (the `reason` parameter to `CancelScope.cancel()`) ([\#975](https://github.com/agronholm/anyio/pull/975)) - Bumped the minimum version of Trio to v0.31.0 - Added the ability to enter the event loop from foreign (non-worker) threads by passing the return value of `anyio.lowlevel.current_token()` to `anyio.from_thread.run()` and `anyio.from_thread.run_sync()` as the `token` keyword argument ([\#256](https://github.com/agronholm/anyio/issues/256)) - Added py |
| `4.10.0` | 2025-08-04 | Low | -   Added the `feed_data()` method to the `BufferedByteReceiveStream` class, allowing users to inject data directly into the buffer -   Added various class methods to wrap existing sockets as listeners or socket streams:     -   `SocketListener.from_socket()`     -   `SocketStream.from_socket()`     -   `UNIXSocketStream.from_socket()`     -   `UDPSocket.from_socket()`     -   `ConnectedUDPSocket.from_socket()`     -   `UNIXDatagramSocket.from_socket()`     -   `ConnectedUNIXDatagramSocket.from_ |
| `4.9.0` | 2025-03-17 | Low | - Added async support for temporary file handling ([\#344](https://github.com/agronholm/anyio/issues/344); PR by @11kkw) -   Added 4 new fixtures for the AnyIO `pytest` plugin:     -   `free_tcp_port_factory`: session scoped fixture returning a callable that generates unused TCP port numbers     -   `free_udp_port_factory`: session scoped fixture returning a callable that generates unused UDP port numbers     -   `free_tcp_port`: function scoped fixture that invokes the `free_tcp_port_factor |
| `4.8.0` | 2025-01-05 | Low | -   Added **experimental** support for running functions in subinterpreters on Python 3.13 and later -   Added support for the `copy()`, `copy_into()`, `move()` and `move_into()` methods in `anyio.Path`, available in Python 3.14 -   Changed `TaskGroup` on asyncio to always spawn tasks non-eagerly, even if using a task factory created via `asyncio.create_eager_task_factory()`, to preserve expected Trio-like task scheduling semantics (PR by @agronholm and @graingert) -   Configure `SO_RCVBUF`, |
| `4.7.0` | 2024-12-05 | Low | -   Updated `TaskGroup` to work with asyncio's eager task factories ([\#764](https://github.com/agronholm/anyio/issues/764)) -   Added the `wait_readable()` and `wait_writable()` functions which will accept an object with a `.fileno()` method or an integer handle, and deprecated their now obsolete versions (`wait_socket_readable()` and `wait_socket_writable()`) (PR by @davidbrochart) -   Changed `EventAdapter` (an `Event` with no bound async backend) to allow `set()` to work even before an async |
| `4.6.2` | 2024-10-13 | Low | -   Fixed regression caused by ([\#807](https://github.com/agronholm/anyio/pull/807)) that prevented the use of parametrized async fixtures |
| `4.5.2` | 2024-10-13 | Low | -   Fixed regression caused by ([\#807](https://github.com/agronholm/anyio/pull/807)) that prevented the use of parametrized async fixtures. |

## Dependency audit

- **Score**: 72/100
- **Total deps**: 4
- **Resolved**: 0
- **Unresolved**: 4
- **License conflicts**: 0
- **Warnings**: 4
- **Scanned**: 2026-05-18

## Citation

- HTML: https://www.freshcrate.ai/projects/anyio
- Markdown: https://www.freshcrate.ai/projects/anyio.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/anyio/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
