Standard Library Best Practices
Reach for batteries-included modules before PyPI - and know when stdlib is not enough.
Search across all documentation pages
Reach for batteries-included modules before PyPI - and know when stdlib is not enough.
Production HTTP clients, password hashing, async DB drivers, schema validation at scale.
Often competitive (hashlib, json); profile before swapping orjson etc.
ADR per new dependency: problem, stdlib alternative rejected, owner, removal criteria.
Add tzdata package to requirements when using zoneinfo.
urllib ok for tightly controlled scripts; services use httpx with timeouts and pooling.
Files for defaults; secrets and per-env overrides in environment variables.
Never unpickle untrusted bytes - json or explicit schemas instead.
Great recipes - but check 3.12+ itertools.batched and stdlib first.
tmp_path fixture, subprocess mocks, fixed datetimes - deterministic unit tests.
uv manages deps; stdlib ships with Python pin - document both in stack footer.
Stack versions: This page was written for Python 3.14.0 (stable 3.14, maintenance 3.13), FastAPI 0.115+, Django 5.2, Flask 3.1, Pydantic 2, PyTorch 2.6+, pandas 2.2+, Polars 1.x, ruff 0.9+, and uv 0.6+.
Reviewed by Chris St. John·Last updated Jul 19, 2026