performant-python
Installation
SKILL.md
Performant Python Skill
Goal
Building high-concurrency, low-latency Python services by leveraging asynchronous patterns, optimized runtimes, and efficient memory management.
Capabilities
1. Asynchronous Mastery (Asyncio & FastAPI)
- Non-blocking I/O: Use
async/awaitfor all network and disk I/O. Userun_in_executorfor CPU-bound tasks to avoid blocking the event loop. - Event Loop Tuning: Use
uvloopas the drop-in replacement for the default asyncio loop for significant speedups. - Concurrent Execution: Use
asyncio.gather()orasyncio.TaskGroup(Python 3.11+) for parallel I/O operations.
2. Database & Data Handling
- Async Drivers: Use
asyncpgfor PostgreSQL oraiomysql. Use SQLAlchemy/Tortoise with async support. - Serialization: Use
ORJSONResponseorUJSONResponsein FastAPI for faster JSON encoding/decoding. - Efficient Models: Use Pydantic v2 for its Rust-based speed. Use
.model_dump(include={...})to minimize data transfer.