python-async-concurrency

Python Async & Concurrency

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "python-async-concurrency" with this command: npx skills add sraloff/gravityboots/sraloff-gravityboots-python-async-concurrency

Python Async & Concurrency

When to use this skill

  • Writing high-concurrency I/O bound applications (FastAPI, bots, scrapers).

  • Using asyncio , aiohttp , or httpx .

  • 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 of gather() for better error handling/cancellation.

  • Blocking Code: Run blocking (CPU-bound) code in await asyncio.to_thread(...) .

  1. HTTP Clients
  • HTPX/AIOHTTP: Use httpx.AsyncClient or aiohttp.ClientSession as a context manager.

  • Singleton: Reuse the client session across requests; do not create a new one per request.

  1. 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 ).

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

test-driven-development

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python-core-idioms

No summary provided by upstream source.

Repository SourceNeeds Review
General

apache-lamp-config

No summary provided by upstream source.

Repository SourceNeeds Review