--- name: python description: "Build Python packages, CLIs, APIs, web apps, PEP 723 scripts: uv, Ruff, ty, pytest, Pydantic, FastAPI, Django, Litestar, OTel." license: MIT metadata: kind: collection author: Médéric HURIER (Fmind) source: github.com/fmind/dot/tree/main/skills/python created: "2026-11-21" updated: "2026-11-29" --- # Python Engineering Maintain lean, strictly typed Python packages, CLIs, web services, and PEP 723 scripts using stdlib first, mainstream well-maintained libraries when earned, and existing repo conventions. ## Workflow Load only the guide(s) needed for the current task (avoid bulk-loading every core guide on small edits): [craft](references/craft/GUIDE.md) for design, blast-radius sizing, and library choices; [language](references/language.md) for 3.14+ idioms, typing, subprocess, and I/O boundaries; [testing](references/testing/GUIDE.md) when authoring or auditing tests; plus the matching domain guide below. Defaults: [mlops](../mlops/SKILL.md) for dataframes/ML, [argparse](references/argparse/GUIDE.md#defaults-for-new-clis) for CLIs, and [fastapi](references/fastapi/GUIDE.md) + Granian for web APIs ([django](references/django/GUIDE.md) for ORM/admin monoliths, [litestar](references/litestar/GUIDE.md) for opt-in `msgspec`/HTMX apps, [ui](references/ui.md) for Gradio/NiceGUI). ## Task guides - [api-client](references/api-client/GUIDE.md): Build typed Python HTTPX2 clients with bounded pagination and stdlib retries. - [api-design](references/api-design.md): Design HTTP/RPC/SDK wire contracts: RFC 9457 errors, cursor pagination, idempotency, OpenAPI, and SemVer. - [argparse](references/argparse/GUIDE.md): Design CLI contracts (streams, exits, JSON) and build stdlib argparse CLIs. - [async](references/async.md): Build asyncio/AnyIO concurrency with TaskGroup cancellation, loop_factory, bounded pools, and SIGTERM drain. - [craft](references/craft/GUIDE.md): Apply Google-style Python craft, stdlib-first library choices, two-boundary error logging, and library maintenance. - [database-and-jobs](references/database-and-jobs.md): Configure Postgres/SQLite persistence, Alembic migrations, obstore, queues, and Cloud Tasks. - [django](references/django/GUIDE.md): Build Django applications with ORM, admin, authentication, Granian serving, and native testing. - [fastapi](references/fastapi/GUIDE.md): Build FastAPI ASGI services with Granian, RFC 9457 errors, native SSE, opt-in OTel, and httpx2 testing. - [foundation](references/foundation/GUIDE.md): Configure Python package layout, PyPI metadata, uv/Ruff/ty tooling, workspaces, and project scaffolding. - [language](references/language.md): Apply Python 3.14+ idioms, strict ty typing, exception chaining, subprocess bounds, and atomic file I/O. - [litestar](references/litestar/GUIDE.md): Build opt-in Litestar ASGI apps when msgspec throughput or built-in HTMX/CSRF plugins earn their keep. - [observability](references/observability.md): Instrument Python services with structlog JSON, locals-free stack frames, and opt-in OpenTelemetry OTLP. - [performance](references/performance.md): Profile Python CPU/memory and benchmark CLIs/HTTP with hyperfine, oha, Locust, and 3.15 sampling. - [pydantic](references/pydantic.md): Typed validation, serialization, and settings boundaries with Pydantic and msgspec. - [script](references/script/GUIDE.md): Build standalone PEP 723 single-file Python scripts run via uv run. - [security-and-auth](references/security-and-auth.md): Implement OIDC/OAuth2, JWT, Argon2id, webhook HMAC, CSRF, and HTTP security headers. - [testing](references/testing/GUIDE.md): Write Python tests with pytest, fixtures, property, mutation, and opt-in BDD tests. - [ui](references/ui.md): Build Gradio model demos and NiceGUI dashboards or browser utilities. ## Documentation - Companions: [mlops](../mlops/SKILL.md), [agent-frameworks](../agent-frameworks/SKILL.md), [web-frontend](../web-frontend/SKILL.md), [mise](../mise/SKILL.md), [bootstrap](../github/references/bootstrap.md), [sql](../sql/SKILL.md).