Asynchronous I/O

Coroutines and Tasks

This section outlines high-level asyncio APIs to work with coroutines and Tasks.

Subprocesses

Source code: Lib/asyncio/subprocess.py, Lib/asyncio/base_subprocess.py

Streams

Source code: Lib/asyncio/streams.py

Queues

Source code: Lib/asyncio/queues.py

Synchronization Primitives

Source code: Lib/asyncio/locks.py

Event Loop

Source code: Lib/asyncio/events.py, Lib/asyncio/base_events.py

Transports and Protocols

Transports and Protocols are used by the low-level event loop APIs such as loop.create_connection(). They use callback-based programming style and enable high-performance implementations of network or IPC protocols (e.g. HTTP).

Futures

Source code: Lib/asyncio/futures.py, Lib/asyncio/base_futures.py

Exceptions

Source code: Lib/asyncio/exceptions.py

Policies

An event loop policy is a global per-process object that controls the management of the event loop. Each event loop has a default policy, which can be changed and customized using the policy API.

Platform Support

The asyncio module is designed to be portable, but some platforms have subtle differences and limitations due to the platforms’ underlying architecture and capabilities.

High-level API Index

This page lists all high-level async/await enabled asyncio APIs.

Low-level API Index

This page lists all low-level asyncio APIs.

Developing with asyncio

Asynchronous programming is different from classic “sequential” programming.

asyncio — Asynchronous I/O

asyncio is a library to write concurrent code using the async/await syntax.