pyguides

Tutorial series

Python Async

6 tutorials — follow in order for the best learning path.

  1. asyncio Basics: Event Loops and Coroutines

    Learn asyncio fundamentals: how event loops work, what coroutines are, and how to run async code in Python.

  2. Async Patterns: Gather, Wait, and Queues

    Master asyncio.gather(), asyncio.wait(), and asyncio.Queue to handle concurrent async tasks in Python.

  3. Async HTTP with aiohttp

    Make asynchronous HTTP requests in Python using aiohttp: sessions, timeouts, connection pooling, and error handling.

  4. Async File I/O with aiofiles in Python

    Learn to read and write files asynchronously in Python using aiofiles, without blocking the asyncio event loop or your application's concurrency.

  5. Task Groups and Exception Handling

    asyncio task groups with ExceptionGroup and except* in Python 3.11+ — concurrent coroutines that succeed or fail as a unit, no orphaned tasks.

  6. Structured Concurrency in Python

    Structured concurrency in Python: how asyncio.TaskGroup, asyncio.timeout, and ExceptionGroup compose into a lifetime-safe model on 3.11+.