Skip to content

Commit 20df602

Browse files
hjmjohnsonericspod
andauthored
Route runtests.sh ruff invocations through PY_EXE (#9089)
`runtests.sh` calls every other formatter (black, isort, pylint, pytype) through `"${PY_EXE}" -m`; the ruff invocations still called a bare `ruff` off `PATH`. `is_pip_installed ruff` checks `$PY_EXE`, so the guard and the invocation could disagree — in a clean venv built per `CONTRIBUTING.md` with no editable `PATH` entry, `./runtests.sh --codeformat` fails with `ruff: command not found` even though ruff is installed and importable from `$PY_EXE`. No behavior change when `ruff` happens to already be on `PATH` (the common case in an activated venv); this only fixes the case where it isn't. <details> <summary>Reproduced before/after</summary> With `$PY_EXE` pointed at a venv holding ruff, and that venv absent from `PATH`: ``` $ MONAI_PY_EXE=/path/to/venv/bin/python bash -c 'PY_EXE=$MONAI_PY_EXE; ruff --version' bash: line 1: ruff: command not found $ MONAI_PY_EXE=/path/to/venv/bin/python bash -c 'PY_EXE=$MONAI_PY_EXE; "${PY_EXE}" -m ruff --version' ruff 0.16.5 ``` `./runtests.sh --ruff` with `$PY_EXE` set and the venv not on `PATH` now reaches `All checks passed!` instead of failing at the version check. </details> <!-- provenance: claude-code session 2026-09-03, branch mono-runtests-ruff-pyexe off dev @ 9ea04d4 related: split out of #9067 (closed) as one of three narrower follow-ups; see #9067 for the fuller ODR investigation. Sibling PRs: pyproject extend-exclude + drop duplicated runtests.sh excludes (stacked on this branch), and cross-reference comments for ruff/black/isort pins (independent). --> Signed-off-by: Hans Johnson <hans-johnson@uiowa.edu> Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 83e0dde commit 20df602

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

runtests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,13 @@ then
619619
then
620620
install_deps
621621
fi
622-
ruff --version
622+
"${PY_EXE}" -m ruff --version
623623

624624
if [ $doRuffFix = true ]
625625
then
626-
ruff check --fix --unsafe-fixes "$homedir"
626+
"${PY_EXE}" -m ruff check --fix --unsafe-fixes "$homedir"
627627
else
628-
ruff check "$homedir"
628+
"${PY_EXE}" -m ruff check "$homedir"
629629
fi
630630

631631
ruff_status=$?

0 commit comments

Comments
 (0)