diff options
| author | user <user@clank> | 2026-08-17 14:52:14 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-17 14:52:14 +0200 |
| commit | c9f357d0a138bb77ec344adb3de3ff0889796c51 (patch) | |
| tree | 33fe534a5140c2362774b42175dabba8e0a1b670 /src | |
| parent | sl0ppty: make tools, and a ruff version that cannot drift (diff) | |
| download | slosh-c9f357d0a138bb77ec344adb3de3ff0889796c51.tar.gz slosh-c9f357d0a138bb77ec344adb3de3ff0889796c51.tar.xz slosh-c9f357d0a138bb77ec344adb3de3ff0889796c51.zip | |
sl0ppty: the make tools the last commit described
The previous commit shipped the documentation for `make tools` and the `.gitignore`
line for the venv it creates, and not the target itself. A `git reset --hard`,
undoing a throwaway probe commit, took the working tree with it -- which is what
`--hard` does. The `.gitignore` line was noticed missing and rewritten; the three
files it was standing next to were not, so `docs/design.md` has been describing a
target that did not exist. This is that target.
`ruff` is not a system package on most machines, and `pip install --user ruff` is
refused outright on a distro python (PEP 668):
$ make tools
ruff 0.16.3 in .venv
survives make clean; rm -rf .venv to start over
clang-format stays a system package, because everywhere it is one; `make tools`
says so when it is missing rather than pretending it handled it.
**The venv is looked in before `$PATH`, and that order is the point.** `ruff.toml`
now pins the version with ruff's own `required-version`, so a ruff of the wrong one
refuses to run and names both versions. Preferring `$PATH` would then strand
somebody with 0.14 from their package manager and 0.16.3 sitting in the `.venv` the
repo just built them -- refused by the tool, with the fix on disk and nothing
looking at it. Tested with exactly that, for `make fmt-check` and for the hook.
The pin exists because a formatter whose output moves between releases turns
"formatted" into "formatted by whoever committed last", and the diff lands on the
next person to touch the file. Bumping it is one line in `ruff.toml`, one in the
Makefile, and a reformat commit -- the honest cost of a new version.
The hook resolves ruff the same way, off `git rev-parse --show-toplevel` so it works
from a subdirectory, and its message when ruff is missing now says `make tools`.
Verified from a deleted `.venv`: `make fmt` stops with `ruff not found. run: make
tools`; after `make tools` both `fmt` and `fmt-check` work with nothing on `$PATH`;
`make fmt` over the whole tree changes nothing, so the pinned version agrees with
what is committed; the hook formats a staged Python file through the venv, and still
does with 0.14.0 ahead of it on `$PATH`.
The hook was tested by running `.githooks/pre-commit` directly against a staged
file. The obvious way -- a real probe commit -- needs the working tree clean to be
meaningful, and getting there is what caused the mess this commit is repairing.
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions
