Uh oh!
There was an error while loading. Please reload this page.
MNT: upgrade ruff pre-commit hook, move its configuration out of pre-commit-config.yaml and fix lints - #371
Conversation
31f6bdd to
7038f67CompareSeeing a couple failures with which indicate that the python interpreter used in CI is older than 3.10. Footnotes |
7038f67 to
8f4785dCompareneutrinoceros
commented
Apr 4, 2026
updated base branch to develop |
python updated to 3.14 from sources on the self-hosted runner. Should work fine. |
8f4785d to
59cb74eCompareneutrinoceros
commented
Apr 4, 2026
thanks. Pre-commit still failed on CI but it looks like some unrelated networking error. |
59cb74e to
fd38d2fCompareneutrinoceros
commented
Apr 5, 2026
linting passed, but now the env under which tests are run looks broken. |
glesur
commented
Apr 7, 2026
tests are failing because somehow #367 is not included upstream. Can you rebase ? |
neutrinoceros
commented
Apr 7, 2026
I don't think that's it. I did check that commits from #367 are in my branch's history. In any case rebasing locally turned into a no-op |
Uh oh!
There was an error while loading. Please reload this page.
0fb065c to
60dd0e9Compareglesur
commented
Apr 15, 2026
I put this PR on hold: forcing python3.14 on the host running the tests has too many side effects, including breaking the package manager and breaking the pydefix test for all the other branches (including master) |
neutrinoceros
commented
Apr 15, 2026
sure. Python 3.11 or 3.12 would probably be safer bets, but there's no rush. |
glesur
commented
Apr 15, 2026
apt, running on debian 11 |
neutrinoceros
commented
Apr 15, 2026
glesur
commented
Jul 9, 2026
@neutrinoceros can you add a dummy commit to trigger the CI? python and cuda have been updated on the testing infrastructure, this PR should now succeed. |
neutrinoceros
commented
Jul 10, 2026
not as is. Recent changes have also added to the pile of smells that ruff flags. I'll fix them too and rebase |
c20427b to
3564149Compare- add missing stacklevel in a Python warning - use conventional naming for unused loop variables in Python - Fix violations to rules, B011, B006 and B904
3564149 to
f2116c9CompareThere was a problem hiding this comment.
Pull request overview
This PR modernizes the Python linting setup by upgrading the Ruff pre-commit hook and moving Ruff configuration into a dedicated ruff.toml, then applies the resulting lint-driven cleanups across test scripts and pytools.
Changes:
- Upgraded Ruff’s pre-commit hook and migrated its rule selection/ignores into a new
ruff.toml. - Performed widespread import ordering / blank-line normalization across many test helper scripts to satisfy Ruff/isort.
- Applied small Python correctness/quality tweaks in
pytools(e.g., safer default-arg patterns, better exception chaining, improved warnings attribution).
Reviewed changes
Copilot reviewed 97 out of 97 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/utils/lookupTable/testme.py | Import/blank-line formatting for Ruff |
| test/utils/dumpImage/testme.py | Import/blank-line formatting for Ruff |
| test/utils/columnDensity/testme.py | Import/blank-line formatting for Ruff |
| test/SelfGravity/UniformCollapse/testme.py | Import/blank-line formatting for Ruff |
| test/SelfGravity/UniformCollapse/python/testidefix.py | Import ordering/grouping cleanup |
| test/SelfGravity/RandomSphereCartesian/testme.py | Import/blank-line formatting for Ruff |
| test/SelfGravity/RandomSphereCartesian/python/testidefix.py | Import ordering/grouping cleanup |
| test/SelfGravity/RandomSphere/testme.py | Import/blank-line formatting for Ruff |
| test/SelfGravity/RandomSphere/python/testidefix.py | Import ordering/grouping cleanup |
| test/SelfGravity/JeansInstability/testme.py | Import/blank-line formatting for Ruff |
| test/SelfGravity/JeansInstability/python/testidefix.py | Import ordering/grouping cleanup |
| test/SelfGravity/DustyCollapse/testme.py | Import/blank-line formatting for Ruff |
| test/SelfGravity/DustyCollapse/python/testidefix.py | Import ordering/grouping cleanup |
| test/Pluto/HD/sod/python/testidefix.py | Import ordering/grouping cleanup |
| test/Pluto/HD/sod/python/sod.py | Adds zip(..., strict=True) for safer mapping construction |
| test/Pluto/HD/sod/python/idefixTools.py | Blank-line normalization |
| test/Planet/PlanetTorque3D/testme.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetTorque3D/python/testidefix.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetSpiral2D/testme.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetSpiral2D/python/testidefix.py | Import ordering/grouping cleanup |
| test/Planet/PlanetsIsActiveRK52D/testme.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetsIsActiveRK52D/python/testidefix.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetPlanetRK42D/testme.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetPlanetRK42D/python/testidefix.py | Import ordering/grouping cleanup |
| test/Planet/PlanetMigration2D/testme.py | Import/blank-line formatting for Ruff |
| test/Planet/PlanetMigration2D/python/testidefix.py | Import/blank-line formatting for Ruff |
| test/Planet/Planet3Body/testme.py | Import/blank-line formatting for Ruff |
| test/Planet/Planet3Body/python/testidefix.py | Import/blank-line formatting for Ruff |
| test/MHD/sphBragViscosity/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/sphBragViscosity/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/sphBragTDiffusion/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/sphBragTDiffusion/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/sod/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/sod-iso/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/ShearingBox/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/ShearingBox/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/ResistiveAlfvenWave/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/ResistiveAlfvenWave/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/OrszagTang3D/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/OrszagTang/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/MTI/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/MTI/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/LinearWaveTest/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/LinearWaveTest/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/HallWhistler/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/HallWhistler/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/FargoMHDSpherical/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/Coarsening/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/Coarsening/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/clessTDiffusion/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/clessTDiffusion/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/AxisFluxTube/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/AxisFluxTube/python/checkAxisBounds.py | Import ordering/grouping cleanup |
| test/MHD/AmbipolarShearingBox/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/AmbipolarCshock3D/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/AmbipolarCshock3D/python/testidefix.py | Import ordering/grouping cleanup |
| test/MHD/AmbipolarCshock/testme.py | Import/blank-line formatting for Ruff |
| test/MHD/AmbipolarCshock/python/testidefix.py | Import ordering/grouping cleanup |
| test/IO/xdmf/testme.py | Fixes control flow so the XDMF existence check is reliably executed |
| test/IO/pydefix/testme.py | Import/blank-line formatting for Ruff |
| test/IO/pydefix/pydefix_example.py | Import ordering/grouping cleanup |
| test/IO/dump/testme.py | Import/blank-line formatting for Ruff |
| test/HD/ViscousFlowPastCylinder/testme.py | Import/blank-line formatting for Ruff |
| test/HD/ViscousDisk/testme.py | Import/blank-line formatting for Ruff |
| test/HD/ViscousDisk/python/testidefix.py | Import ordering/grouping cleanup |
| test/HD/thermalDiffusion/testme.py | Import/blank-line formatting for Ruff |
| test/HD/thermalDiffusion/python/testidefix.py | Import ordering/grouping cleanup |
| test/HD/sod/testme.py | Import/blank-line formatting for Ruff |
| test/HD/sod/python/testidefix.py | Import ordering/grouping cleanup |
| test/HD/sod/pydefix_example.py | Import ordering/grouping cleanup |
| test/HD/sod-iso/testme.py | Import/blank-line formatting for Ruff |
| test/HD/sod-iso/python/testidefix.py | Import ordering/grouping cleanup |
| test/HD/ShearingBox/testme.py | Import/blank-line formatting for Ruff |
| test/HD/ShearingBox/python/testidefix.py | Import ordering/grouping cleanup |
| test/HD/SedovBlastWave/testme.py | Import/blank-line formatting for Ruff |
| test/HD/SedovBlastWave/python/testidefix.py | Import ordering/grouping cleanup |
| test/HD/MachReflection/testme.py | Import/blank-line formatting for Ruff |
| test/HD/FargoPlanet/testme.py | Import/blank-line formatting for Ruff |
| test/Dust/DustyWave/testme.py | Import/blank-line formatting for Ruff |
| test/Dust/DustyWave/python/testidefix.py | Import ordering/grouping cleanup |
| test/Dust/DustyShock/testme.py | Import/blank-line formatting for Ruff |
| test/Dust/DustyShock/python/testidefix.py | Import ordering/grouping cleanup |
| test/Dust/DustEnergy/testme.py | Import/blank-line formatting for Ruff |
| test/Dust/DustEnergy/python/testidefix.py | Import ordering/grouping cleanup |
| test.py | Import/blank-line formatting for Ruff |
| ruff.toml | New Ruff configuration (target version + lint selection/ignores) |
| pytools/vtk_io.py | Import ordering + warnings.warn(..., stacklevel=...) improvement |
| pytools/tests/test_idfx_test_run.py | Import ordering/grouping cleanup |
| pytools/tests/test_idfx_test_gen.py | Import ordering/grouping cleanup |
| pytools/sod.py | Adds zip(..., strict=True) for safer mapping construction |
| pytools/idfx_test.py | Import ordering + safer defaults for optional dict args |
| pytools/idfx_test_run.py | Import ordering + exception chaining + NotImplementedError |
| pytools/idfx_test_gen.py | Avoids mutable default args by using None + initialization |
| pytools/idfx_io.py | Minor loop variable cleanup (_) |
| pytools/dump_io.py | Minor loop variable cleanup (_) |
| doc/source/plot_idefix_bench.py | Import ordering/blank-line normalization |
| .pre-commit-config.yaml | Upgrades Ruff pre-commit revision and switches to ruff-check hook |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
| if override is None: | ||
| override = {} |
There was a problem hiding this comment.
Indentation inconsistencies can trivially be resolved in the long run by also enabling the formatter hook from ruff. Happy to open a follow up PR to achieve this.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.

Moving ruff's config to
ruff.tomlallows running ruff's LSP in an IDE and see lints beforegit commitis invoked.I also upgraded the tool to a much more recent version and applied newly discovered lints.