Leave the toolchain cleaner than you found it

Upgrades unlock deletions

Geschrieben von Timo Rieber am 15. Juli 2025

After the framework upgrades, texsite was on Django 4.2, Wagtail 6.3, Python 3.9 through 3.13. All tests green. I could have stopped there.

But the project still carried setup.py, setup.cfg, and three separate linting tools from before I'd adopted Ruff. The frameworks were current; everything around them wasn't.

What I deleted

  1. Add Ruff alongside the existing tools. New [tool.ruff] section in a fresh pyproject.toml, new tox environment, new CI job. Nothing removed yet - both toolchains coexisting.
  2. Run Ruff across the codebase. 19 files touched, almost all migration files, minor formatting.
  3. Purge the old tools. Delete brunette, isort, Flake8 from setup.cfg, setup.py, tox.ini, and CI.
  4. Move the entire project definition into pyproject.toml with Hatchling as build backend. Delete setup.py. Delete setup.cfg.

The tox config tells the story:

# Before
envlist =
    isort
    brunette
    flake8
    py{39,310,311,312,313}-dj{42}-wt{63}

# After
envlist =
    ruff
    py{39,310,311,312,313}-dj{42}-wt{63}
Ini

Three lint environments became one. The fifteen lines of tool-specific tox configuration behind them replaced by seven.

Net negative

Across all four commits: 27 files changed, 133 added, 156 removed. The project ended up with fewer files, fewer dependencies, and less configuration than before the session started. The CI pipeline lost its template for the Python base image. Turns out you can just set image and before_script at the top level when every job uses the same base. Eight lines of indirection that nobody would miss.

Each step got its own commit, its own test run. If Ruff formatted something unexpected, I'd see it without noise from the packaging migration.