Foreword
Read little, type a lot. This book teaches you modern Python the way you need it as a platform engineer: every day you build a small, useful tool – from a word counter and a certificate checker to an agent with an MCP server. By the end you write idiomatic Python, ship your tools as packages and use Python safely for AI.
The training rules
- Type, don’t copy. Write every command and every file yourself once.
- Compare with Expected. After each drill you see what you should get. If yours differs, that is where the real lesson is.
- Pass the checkpoint. Move on only when the check script shows nothing but ✔.
- Solve the challenge on your own. Hint first, then the solution.
- Every tool is a uv project. Its own folder, its own
.venv, no globalpip install. - Lab values stay in the lab. Keys like
sk-lab-master-1234are play money. Real tokens come only from environment variables, never into the code.
Structure of each training day
| Section | Purpose |
|---|---|
| Briefing | The essentials in a few bullet points |
| Drills | The tool step by step, with expected output |
| Checkpoint | Check script: does the tool run, are the tests green? |
| Challenge | An extension without instructions |
| Enterprise Note | What is different in production |
The training plan
| Part | Day | Unit | Tool |
|---|---|---|---|
| Ground | 0 | uv, Python 3.14, ruff, pytest | hallo |
| A – Foundation | 1 | Syntax in brief: strings, lists, dicts, comprehensions | wc |
| 2 | Functions, types, dataclasses, modules | logsum |
|
| 3 | CLI tools with typer, pathlib, subprocess, exit codes | tidy |
|
| 4 | Errors, logging, tests with pytest | checkcert |
|
| B – Toolmaking | 5 | Packaging and quality: uv build, mypy, pre-commit | checkcert as a package |
| 6 | HTTP and APIs: httpx, retries, pydantic | ghrel |
|
| 7 | Concurrency: asyncio, TaskGroup, threads | urlcheck |
|
| 8 | Data: csv, json, sqlite3, polars | costreport |
|
| 9 | Web service with FastAPI and Dockerfile | shorturl |
|
| C – Python for AI | 10 | LLM APIs: chat, streaming, structured output | ask |
| 11 | Embeddings and RAG with numpy and qdrant | docsearch |
|
| 12 | Tool calling, agent loop and MCP | ops-agent |
|
| 13 | Classic ML with scikit-learn, getting started with PyTorch | logclass |
|
| D – Pro | 14 | Performance, profiling, distribution, CI | logsum 10× faster |
| 15 | Competition: timed tool challenges | several | |
| Appendix | A | Cheat Sheet | – |
| B | Final Exam | – |
The training ground
~/py-lab/ one folder per day, each a uv project
├── tag00-hallo/ ─┐
├── tag01-wc/ │ pyproject.toml metadata, dependencies, console script
├── tag02-logsum/ ├── src/<paket>/ the code (src layout)
├── ... │ tests/ pytest
└── tag14-.../ ─┘ .venv/ uv.lock managed by uv
AI part (Day 10–13): Ollama http://127.0.0.1:11434/v1 model ministral-3:3b
Tools: uv for Python, environments and packages, ruff for linting and formatting, pytest for tests, mypy for types, from Day 3 on typer for CLIs. All you need is a Mac or Linux machine with a terminal; Docker is not required.
Tip: Tested with uv 0.9.26, Python 3.14.2, ruff 0.17 and pytest 9.1 on macOS (Apple Silicon). If an output differs:
uv <befehl> --helpand the docs at docs.astral.sh/uv or docs.python.org/3.14.
The companion code
All files from this book are publicly available on GitHub: https://github.com/thomaszachmann/python-zum-anfassen. Day 0 shows you how to get them.
Let’s go.
Thomas Zachmann, October 2026