This is your reference for Python's async/await concurrency model, covering everything from basic coroutines to production patterns with aiohttp and FastAPI. You get practical examples of asyncio.gather() for parallel tasks, proper error handling with return_exceptions, and the often misunderstood event loop mechanics. The blocking I/O section with run_in_executor is especially useful since mixing sync and async code trips up most people. It includes the primitives you actually need like locks and queues, plus real world patterns for async HTTP clients, database connections, and WebSocket handling. The code examples are complete and runnable, not fragments. Honestly, this covers about 90% of what you'll encounter in async Python work, and the progressive disclosure summary is a solid quick reference when you forget the syntax.

skills.sh installs
494
GitHub stars
79
last updated
Aug 21, 2026

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill asyncio --agent claude-code

Installs into .claude/skills of the current project.

Files

Python asyncio - Async/Await Concurrency

Overview

Python's asyncio library enables writing concurrent code using async/await syntax. It's ideal for I/O-bound operations like HTTP requests, database queries, file operations, and WebSocket connections. asyncio provides non-blocking execution without the complexity of threading or multiprocessing.

Key Features:

  • async/await syntax for readable concurrent code
  • Event loop for managing concurrent operations
  • Tasks for running multiple coroutines concurrently
  • Primitives: locks, semaphores, events, queues
  • HTTP client/server with aiohttp
  • Database async support (asyncpg, aiomysql, motor)
  • FastAPI async endpoints
  • WebSocket support
  • Background task management

Installation:

# asyncio is built-in (Python 3.7+)

# Async HTTP client
pip install aiohttp

# Async HTTP requests (alternative)
pip install httpx

# Async database drivers
pip install asyncpg aiomysql motor  # PostgreSQL, MySQL, MongoDB

# FastAPI with async support
pip install fastapi uvicorn[standard]

# Async testing
pip install pytest-asyncio

Basic Async/Await Patterns

1. Simple Async Function

import asyncio

Sponsors

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Category
Python
First seen
Jun 3, 2026

More from bobmatnyc/claude-mpm-skills

All 158

Recommended

More Python
1hieutrtr avatarcode-review-securityhieutrtr/ai1-skillsSecurity-focused code review checklist and automated scanning patterns. Use when reviewing pull requests for security issues, auditing authentication/authorizat440skills.sh installs
2jezweb avatarfastmcpjezweb/claude-skillsBuild MCP servers in Python with FastMCP to expose tools, resources, and prompts to LLMs. Supports storage backends, middleware, OAuth Proxy, OpenAPI integratio406skills.sh installs
3levnikolaevich avatarln-741-linter-configuratorlevnikolaevich/claude-code-skillsConfigures ESLint, Prettier, Ruff, mypy, and .NET analyzers. Use when setting up linting and formatting for a project.381skills.sh installs
4siviter-xyz avatarbackend-engineersiviter-xyz/dot-agentBuild robust backend systems with modern technologies (Node.js, Python, Go, Rust), frameworks (NestJS, FastAPI, Django), databases (PostgreSQL, MongoDB, Redis),349skills.sh installs
5borghei avatarsenior-fullstackborghei/claude-skillsFullstack development toolkit with project scaffolding for Next.js/FastAPI/MERN/Django stacks and code quality analysis. Use when scaffolding new projects, anal318skills.sh installs
6evoscientist avatarexperiment-iterative-coderevoscientist/evoskillsIterative code refinement through plan → code → evaluate → refine cycles. Runs lint checks (ruff), tests (pytest), and structured self-evaluation each cycle, th301skills.sh installs