← 返回
未分类 中文

Nm Parseltongue Python Async

Async Python patterns and concurrency: async APIs, I/O-bound apps, rate limiting, context managers
异步 Python 模式与并发:异步 API、I/O 密集型应用、速率限制、上下文管理器
athola
未分类 clawhub v1.0.2 2 版本 100000 Key: 无需
★ 0
Stars
📥 419
下载
💾 1
安装
2
版本
#latest

概述

> Night Market Skill — ported from claude-night-market/parseltongue. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

Async Python Patterns

asyncio and async/await patterns for Python applications.

Quick Start

import asyncio

async def main():
    print("Hello")
    await asyncio.sleep(1)
    print("World")

asyncio.run(main())

When To Use

  • Building async web APIs (FastAPI, aiohttp)
  • Implementing concurrent I/O operations
  • Creating web scrapers with concurrent requests
  • Developing real-time applications (WebSockets)
  • Processing multiple independent tasks simultaneously
  • Building microservices with async communication

When NOT To Use

  • CPU-bound optimization - use python-performance instead
  • Testing async code - use python-testing async module

Modules

This skill uses progressive loading. Content is organized into focused modules:

  • See modules/basic-patterns.md - Core async/await, gather(), and task management
  • See modules/concurrency-control.md - Semaphores and locks for rate limiting
  • See modules/error-handling-timeouts.md - Error handling, timeouts, and cancellation
  • See modules/advanced-patterns.md - Context managers, iterators, producer-consumer
  • See modules/testing-async.md - Testing with pytest-asyncio
  • See modules/real-world-applications.md - Web scraping and database operations
  • See modules/pitfalls-best-practices.md - Common mistakes and best practices

Load specific modules based on your needs, or reference all for detailed guidance.

Exit Criteria

  • Async patterns applied correctly
  • No blocking operations in async code
  • Proper error handling implemented
  • Rate limiting configured where needed
  • Tests pass with pytest-asyncio
  • Troubleshooting

Common Issues

RuntimeError: no current event loop

Use asyncio.run() as the entry point. Avoid get_event_loop() in Python 3.10+.

Blocking call in async context

Move sync I/O to asyncio.to_thread() or loop.run_in_executor().

Tests hang indefinitely

Ensure pytest-asyncio is installed and test functions are decorated with @pytest.mark.asyncio.

版本历史

共 2 个版本

  • v1.0.2 当前
    2026-05-09 16:50 安全 安全
  • v1.0.1
    2026-05-07 21:23 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Nm Abstract Hooks Eval

athola
评估钩子安全性、性能和SDK合规性。用于审计
★ 0 📥 629

Nm Cartograph Architecture Diagram

athola
生成展示高层组件关系的 Mermaid 架构图
★ 0 📥 633

Nm Attune Project Init

athola
使用 git、CI/CD 工作流、pre-commit hooks 和构建配置搭建新项目
★ 0 📥 636