Skip to main content

High level compatibility layer for multiple asynchronous event loop implementations

Project description

Build Status Code Coverage Documentation Gitter chat

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.


View full documentation at:


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

  • Asynchronous file I/O (using worker threads)

  • Signal handling

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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anyio-4.3.0.tar.gz (159.6 kB view hashes)

Uploaded Source

Built Distribution

anyio-4.3.0-py3-none-any.whl (85.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page