Backend
642 installs
async-python-patterns
by wshobson/agents
Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or…
Skill content
Comprehensive guide to asyncio, concurrent patterns, and async/await for building high-performance, non-blocking Python applications. - Covers core concepts (event loops, coroutines, tasks, futures) and 10+ fundamental and advanced patterns including concurrent execution, error handling, timeouts, context managers, and producer-consumer workflows - Includes real-world examples for web scraping with aiohttp, async database operations, and WebSocket servers - Provides performance best practices: connection pooling, batching, and proper handling of blocking code with asyncio.to_thread() and run_in_executor() - Highlights common pitfalls (forgetting await, blocking the event loop, mixing sync/async) and testing strategies with pytest-asyncio Async Python Patterns Comprehensive guidance for implementing asynchronous Python applications using asyncio, concurrent programming patterns, and async/await for building high-performance, non-blocking systems. When to Use This Skill - Building async web APIs (FastAPI, aiohttp, Sanic) - Implementing concurrent I/O operations (database, file, network) - Creating web scrapers with concurrent requests - Developing real-time applications (WebSocket servers, chat systems) - Processing multiple independent tasks simultaneously - Building microservices with async communication - Optimizing I/O-bound workloads - Implementing async background tasks and queues Sync vs Async Decision Guide Before adopting async, consider whether it's the right choice for your use case.