Python Cheatsheet 20 — Modern Project Setup (uv + ruff + mypy + pytest)
Cheatsheet: full pyproject.toml, pre-commit, GitHub Actions, layout, conventions.
Cheatsheet: full pyproject.toml, pre-commit, GitHub Actions, layout, conventions.
Practical Python data: Polars for in-memory DataFrames, DuckDB for SQL on files, Ibis for portable expression API, and how to compose them.
Practical FastAPI DI: scoped dependencies, async DB sessions, auth chains, request-scoped state, lifespan resources, and where DI starts to bite.
Practical Python 3.13: free-threaded (no-GIL) mode, experimental JIT, better REPL, deprecations, and an honest look at what to adopt now.
Practical uv: project setup, dependency management, lockfiles, tool installs, scripts with inline deps, and why it replaced pip/poetry for many teams.
Practical Python profiling: py-spy in production, scalene for line-level CPU+memory, memray for leaks, async profiling, and the discipline of measuring before optimizing.
Practical Python logging: structlog over stdlib, JSON for parseability, correlation IDs via contextvars, levels that mean something, and PII redaction.
Practical Python packaging: pyproject.toml as source of truth, uv / hatch for builds, src layout, wheels with Cython / Rust, and publishing without drama.
Practical Python async: TaskGroup for structured concurrency, asyncio.timeout, gather pitfalls, anyio for portability, and how to avoid lost exceptions.
Picking a Python validation library: Pydantic v2 (default), msgspec (10× faster, leaner), attrs (no validation; pure dataclass replacement). When each wins.