python-async-concurrency
SKILL.md
Python Async & Concurrency
When to use this skill
- Writing high-concurrency I/O bound applications (FastAPI, bots, scrapers).
- Using
asyncio,aiohttp, orhttpx. - Managing background tasks or task queues.
1. Asyncio Basics
- Entry Point: Use
asyncio.run(main())for the entry point. - TaskGroups: Use
async with asyncio.TaskGroup() as tg(Python 3.11+) instead ofgather()for better error handling/cancellation. - Blocking Code: Run blocking (CPU-bound) code in
await asyncio.to_thread(...).
2. HTTP Clients
- HTPX/AIOHTTP: Use
httpx.AsyncClientoraiohttp.ClientSessionas a context manager. - Singleton: Reuse the client session across requests; do not create a new one per request.
3. Pitfalls
- Sync in Async: Never call blocking sync functions (requests, time.sleep) inside async functions.
- Fire and Forget: Avoid unreferenced background tasks; keep a reference to prevent garbage collection (or use
TaskGroup).
Weekly Installs
3
Repository
sraloff/gravitybootsGitHub Stars
2
First Seen
Feb 21, 2026
Security Audits
Installed on
opencode3
gemini-cli3
github-copilot3
codex3
kimi-cli3
amp3