0.4 The Python labs: what you build for each guide in the series
All labs live in one uv project:
uv init --package py-labs && cd py-labs
mkdir -p labs # each lab is labs/<name>.py
uv run labs/wordfreq.py README.md # run one lab
| Series guide | Python labs in this guide |
|---|---|
| OS & Linux | logstat (Ch 12), supervisor with graceful SIGTERM (34), atomicwrite (35), pyps from /proc (36), shm shared memory (37), minibox namespace container (39) |
| Networking (TCP/IP) | four echo servers (40), dnsq raw-bytes DNS client (41), tinyhttp (42), healthcheck (46) |
| Security from Zero | seal AES-256-GCM (48), Argon2id password store (48), HMAC webhook verify (48), authsvc JWT service (51) |
| Security in Depth | pickle exploit and safe loading (47), safefetch SSRF guard (43), pip-audit in CI (50), detect log detector (52) |
| HTTPS Lifecycle | client with retries and idempotency keys (43), api production FastAPI service (44), TLS/mTLS servers (45), requests trace (64) |
| AI from Zero to LLMs | ticket classifier (56), tinygrad autograd (57), PyTorch MLP and char-LM (58), JSONL corpus builder (60), RAG + agent + MCP server (61) |
| Go / Rust | lru (24, compare Rust §27), hasher (32), the capstone lifecycle (72, compare Rust §64) |
The packages used across the guide (versions as written):
[project]
name = "py-labs"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
"httpx>=0.28",
"requests>=2.32",
"fastapi>=0.120",
"uvicorn>=0.37",
"pydantic>=2.12",
"cryptography>=46",
"argon2-cffi>=25.1",
"pyjwt>=2.10",
"numpy>=2.3",
"pandas>=2.3",
"polars>=1.33",
"matplotlib>=3.10",
"scikit-learn>=1.7",
"rich>=14",
]
[project.optional-dependencies]
ml = ["torch>=2.8", "transformers>=5", "datasets>=4.1", "tokenizers>=0.22", "safetensors>=0.6", "mcp[cli]>=2"]
[dependency-groups]
dev = ["pytest>=8.4", "hypothesis>=6.140", "ruff>=0.13", "mypy>=1.18", "pip-audit>=2.9"]