
Asyncio
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-codeInstalls 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- Mcp Protocol Builder491
- Typescript Core487
- Bug Fix482
- Supabase Backend Platform482
- Mypy478
- Threat Modeling474
- Wordpress Block Editor Fse474
- Celery470
- Web Performance Optimization469
- Local Llm Ops464
- Golang Testing Strategies458
- Wordpress Advanced Architecture455
- Golang Http Frameworks453
- Sveltekit452
- Digitalocean Management451
- Hono Rpc450
- Flask449
- Hono Middleware444
- Golang Cli Cobra Viper438
- Dependency Audit434
- Wordpress Plugin Fundamentals434
- Phoenix Liveview432
- Wordpress Testing Qa430
- Digitalocean Compute429