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

异步Python并发编程模式

v20260509
async-python-patterns
本技能提供全面的指南,用于构建高性能、非阻塞的Python异步应用。它侧重于利用asyncio和async/await实现并发编程模式,特别适用于处理I/O密集型任务,如构建异步API、实时聊天系统或并发网络爬虫,帮助开发者优化工作负载。
获取技能
84 次下载
概览

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.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
信息
Category 编程开发
Name async-python-patterns
版本 v20260509
大小 6.3KB
更新时间 2026-05-10
语言