Strict Python
A series on the tools that make a Python project fail on your machine or in CI, not in production. With real errors from my own projects and links to where they failed.
- Development › Python
Strict Python: the tools that warn you before production
The tools that make a Python project fail before production: uv, Ruff, mypy and Pyright, type tests, Hypothesis, coverage, deptry and the CI matrix.
- Development › Python
Ruff in depth: which rules to enable and how not to run three versions
Which Ruff rule families to enable, safe and unsafe fixes, per-folder exceptions and how to avoid running three different Ruff versions in one project.
- Development › Python
mypy and Pyright in depth: strict mode without surprises
What mypy --strict turns on, the cache, Pyright and its modes, running both at once, where to relax without giving up, and what Python 3.14 annotations changed.
- Development › Python
A typed Django ORM: what the type checker sees and what it does not
What mypy and Pyright understand of the Django ORM with django-stubs: the plugin, QuerySet[Model], annotate() and values() with TypedDict, and no plugin.
- Development › Python
Type tests: making the types say what they promise
How to prove your types accept what is right and reject what is wrong: assert_type, expected errors, and mypy and Pyright run from pytest.
- Development › Python
pytest in depth: from fixtures to tests that fail sometimes
pytest beyond the basics: typed fixtures, pytest-django, Hypothesis with st.data(), Playwright without fixed waits, and warnings that sneak into your tests.
- Development › Python
Mutation testing: the test that tests your tests
Why 100 % coverage is not enough: mutation testing with mutmut, a real surviving mutant, and how to split it in CI with parallel shards and a cache.
- Development › Python
The CI matrix: what only fails on another version or another system
How to build a CI matrix with tox and GitHub Actions for Python, Django, databases, Windows and macOS, told through the real failures it uncovered.