技能 编程开发 异步 Python 编程模式

异步 Python 编程模式

v20261106
async-python-patterns
提供使用 asyncio、async/await 与并发模式构建异步 Python 应用的指导,涵盖异步 Web API、并发 I/O、任务队列、超时与背压处理、错误处理及测试调试,帮助打造高性能非阻塞系统。
获取技能
480 次下载
概览

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.

Use this skill when

  • 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

Do not use this skill when

  • The workload is CPU-bound with minimal I/O.
  • A simple synchronous script is sufficient.
  • The runtime environment cannot support asyncio/event loop usage.

Instructions

  • Clarify workload characteristics (I/O vs CPU), targets, and runtime constraints.
  • Pick concurrency patterns (tasks, gather, queues, pools) with cancellation rules.
  • Add timeouts, backpressure, and structured error handling.
  • Include testing and debugging guidance for async code paths.
  • If detailed examples are required, open resources/implementation-playbook.md.

Refer to resources/implementation-playbook.md for detailed patterns and examples.

Resources

  • resources/implementation-playbook.md for detailed patterns and examples.
信息
分类 编程开发
名称 async-python-patterns
版本 v20261106
大小 6.16KB
更新时间 2026-11-07
语言