Awesome Open Source
Awesome Open Source

.. image:: :target: :alt: Build Status .. image:: :target: :alt: Code Coverage .. image:: :target: :alt: Documentation .. image:: :target: :alt: 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 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.

.. _asyncio: .. _trio: .. _structured concurrency: .. _nurseries: .. _Happy eyeballs: .. _pytest: .. _Hypothesis:

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (54,447
asyncio (280
async-await (90