How to use this guide
- Part 0 (Start here): setup with
uv, how this guide fits the series, a Go ↔ Rust ↔ Python phrasebook, the labs, and an honest answer to "why Python for AI?". Read the phrasebook even if you skip everything else. - Beginner (Part I): the interpreter, names and objects (the chapter that explains most Python bugs), numbers, text and bytes, control flow, functions, collections, exceptions, files, modules. Ends with a 🔎 Checkpoint and two terminal projects.
- Intermediate (Part II): iterators and generators, decorators, classes,
the data model (dunder methods), protocols, type hints, the standard
library you will use every week, testing with pytest, and packaging. Ends
with a checkpoint, a
grepclone, and an LRU cache. - Advanced (Part III): how CPython runs your code, memory and garbage collection, the GIL and free-threaded Python, multiprocessing, asyncio, descriptors and metaclasses, and performance work.
- Systems Python (Part IV): the OS guide
in Python: syscalls, processes and signals, crash-safe files,
/proc,mmap, Python as a better shell, and a Linux container withos.unshare. - Network Python (Part V): the networking
and HTTPS guides in Python: sockets
four ways, a DNS client from raw bytes, HTTP from a bare socket, HTTP
clients done right, a production API, and TLS/mTLS with
ssl. - Security-focused Python (Part VI): Python's own attack surface
(
pickle,eval,shell=True, archive extraction), cryptography done correctly, web security, the supply chain, and an auth service. Ties to both security guides. - Python for data and AI (Part VII): NumPy, pandas and Polars, scikit-learn, autograd from scratch, PyTorch, Hugging Face, data pipelines for training, and LLM apps (RAG, tool-calling agents, an MCP server) against a local open-weight model. This Part hands you to the AI guide.
- Open source walkthrough (Part VIII): how to read a real codebase, then
requeststraced fromrequests.get()through sessions, adapters,urllib3's connection pool, TLS, and the socket. Ends with running its test suite and making a change. - Expert and professional (Part IX): library and API design, logging and observability, debugging, containers, an anti-pattern catalog, and the capstone: one request through OS → network → security → AI, in Python.
- Appendices: a traceback decoder, a tooling cheat sheet, a glossary, a 90-day plan, and the other guides and books this one draws on.
Conventions:
- Code targets Python 3.13+. Every complete program was run with
CPython 3.13.9 (macOS) and the official
python:3.14-slimimage (Linux). Features that need 3.14 are marked (3.14+). Third-party package versions are the ones current when the guide was written; they are pinned in eachpyproject.tomlsnippet. - Snippets that are wrong on purpose start with
# WRONGor end with the traceback they produce. Each one is followed by the fix. >>>lines are typed at the interactive interpreter (the REPL). The line after them is what Python prints.- Real-world example boxes connect a feature to code you will actually write. War story boxes describe a real class of incident.
- Across the series notes link to the chapter in another guide that covers the same topic from the OS, network, security, Go, Rust, or AI side.