Boring Python
Boring Python
A linear guide to writing Python the way it lasts in real projects: simple, explicit, and a little boring. Clarity beats novelty. Readability beats magic. The boring default is the one a teammate can run, test, and change six months later.
Baseline: Python 3.14 · toolchain uv · format/lint ruff · tests pytest. Completely self-contained. You do not need any other title in this library.
Who this is for
- People who have never written Python and want a complete path, not a bag of tricks.
- Working developers who can already
print("hi")but want better defaults. - Anyone building scripts, CLIs, or services who is tired of clever one-liners and hidden frameworks.
You do not need prior Python. You do need a terminal, a text editor, and a willingness to type the examples.
What “boring” means here
Python is a large language with a huge standard library. Well-written Python still looks ordinary: names are clear, functions are short, exceptions are specific, types appear where they help, and async is used when you have I/O to wait on — not because it looks modern.
Each chapter teaches the default that lasts, then shows the trap that looks smarter for a week.
This book is the language, the toolchain, the standard library you actually use, tests, concurrency, and shipping. It is not a tour of web frameworks, dataframes, or ML stacks.
How to read
- Read a chapter.
- Copy the program into the filename in the comment.
- Run it with
uv run python that_file.py(oruv run pytestwhen the chapter says so). - Change one thing. Run it again.
- Do the Try this exercises before moving on.
The book is designed to be read front to back. You can jump to exceptions, typing, or asyncio if you already write Python — but the early chapters define the vocabulary later chapters assume.
How examples work
Every Python listing the reader is told to run is a complete, runnable program (or a complete test file). Nothing is a fragment that “you should imagine the rest of.”
# hello.py
def main():
print("hello, desk")
if __name__ == "__main__":
main()uv run python hello.pyhello, desk
When a chapter needs more than one file (pyproject.toml plus main.py, or a test beside the code), both files are shown in the chapter. There is no separate examples directory.
A small desk (orders, tickets, shifts) shows up across chapters so types, classes, exceptions, and tests feel like one codebase — but each listing still runs on its own.
Early chapters skip type annotations. Types arrive as their own part, then stay.
Map of the book
| Part | Folder | What you leave with |
|---|---|---|
| 1 | 01-foundations |
Why Python exists, install with uv, modules, a language tour |
| 2 | 02-toolchain |
uv, ruff, pyproject.toml, environments |
| 3 | 03-types-and-values |
Built-in types, None, literals, scope |
| 4 | 04-control-flow |
if, match, loops, comprehensions |
| 5 | 05-collections |
lists, tuples, strings, dicts, sets, dataclasses |
| 6 | 06-functions |
signatures, first-class functions, decorators |
| 7 | 07-modules |
imports, packages, __main__ |
| 8 | 08-objects |
classes, composition, properties, the data model |
| 9 | 09-typing |
hints, protocols, generics |
| 10 | 10-errors |
exceptions, groups, context managers |
| 11 | 11-iteration |
iterators, generators, itertools |
| 12 | 12-testing |
pytest, fixtures, mocks, integration |
| 13 | 13-concurrency |
threads, asyncio, processes, guidelines |
| 14 | 14-stdlib |
pathlib, I/O, datetime, JSON, HTTP, logging, subprocess |
| 15 | 15-shipping |
ruff/audit, packaging, release, docs |
| 16 | 16-long-term |
inspect, FFI, profiling, design that lasts |
| 99 | 99-appendices |
glossary and command cheat sheet |
What this book is not
- Not a framework tutorial.
- Not a catalog of every standard-library module.
- Not a collection of interview puzzles.
- Not a CPython-internals encyclopedia.
It is a guide to writing Python that stays understandable when the requirements change.
Formats
HTML, PDF, and EPUB via the library portal.