GitHunt
HJ

hjwp/minimal-python-tdd

A repo with a minimal 2-file setup for doing TDD in Python.

Minimal Python TDD project template

A minimal 2-file setup for doing TDD in Python, eg for code katas.

  • Tests live in tests.py
  • Code lives in kata.py (obviously feel free to move/rename as you wish)
  • Includes 1 placeholder test & function

Dependencies

  • pytest
  • (optionally) mypy
  • (optionally) watchexec, a file-watching command re-runner.

Installation instructions

Create a virtualenv and install pytest. Eg:

uv venv
uv pip install .

(uv is great so if you haven't tried it out yet,
could today be a good excuse? uv install instructions)

Test run

pytest 
# or if you're all-in on uv:
uv run pytest

Auto-run

# run tests on every file change
watchexec pytest
# or
watchexec uv run pytest

# (in a separate terminal)
# run mypy on every file change. notice the "."
watchexec mypy .
# or
watchexec uv run mypy .

Contributors

The Unlicense
Created September 19, 2025
Updated November 24, 2025