STY: setup python formatting with ruff#392
Conversation
5320a84 to
e61ee57
Compare
e61ee57 to
e04cabc
Compare
|
I eyeballed every change and made a couple manual tweaks around trailing commas, which I recommend reading about as it's about the only place where |
|
Of course this PR should be low priority as it brings very little value, however I'd still like to ask for a rapid cycle because of its size: the longer it lingers in the backlog, the more pain it'll be to maintain it. |
There was a problem hiding this comment.
Pull request overview
This PR introduces Ruff-based Python formatting and applies the formatter across the repository to standardize style and reduce formatting drift in scripts, tests, and tooling.
Changes:
- Add
ruff-formatto pre-commit and pin Ruff target version to Python 3.10. - Apply Ruff formatting across many Python test drivers and helper scripts.
- Record the formatting-only commit in
.git-blame-ignore-revsto keep blame history useful.
Reviewed changes
Copilot reviewed 98 out of 99 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/utils/lookupTable/testme.py | Ruff formatting (spacing/quotes/indentation). |
| test/utils/dumpImage/testme.py | Ruff formatting (spacing/blank line after docstring). |
| test/utils/columnDensity/testme.py | Ruff formatting (spacing/blank line after docstring). |
| test/SelfGravity/UniformCollapse/testme.py | Ruff formatting (indentation/spacing, minor layout). |
| test/SelfGravity/UniformCollapse/python/testidefix.py | Ruff formatting (spacing/quotes/line wraps). |
| test/SelfGravity/RandomSphereCartesian/testme.py | Ruff formatting (indentation/spacing). |
| test/SelfGravity/RandomSphereCartesian/python/testidefix.py | Ruff formatting (function signature spacing, wraps). |
| test/SelfGravity/RandomSphere/testme.py | Ruff formatting (indentation/spacing). |
| test/SelfGravity/RandomSphere/python/testidefix.py | Ruff formatting (quotes/spacing/wraps). |
| test/SelfGravity/JeansInstability/testme.py | Ruff formatting (indentation/spacing). |
| test/SelfGravity/JeansInstability/python/testidefix.py | Ruff formatting (spacing/quotes). |
| test/SelfGravity/DustyCollapse/testme.py | Ruff formatting (indentation/spacing). |
| test/SelfGravity/DustyCollapse/python/testidefix.py | Ruff formatting (spacing, expression layout). |
| test/Pluto/HD/sod/python/testidefix.py | Ruff formatting (argparse formatting, wraps). |
| test/Planet/PlanetTorque3D/testme.py | Ruff formatting (indentation/spacing). |
| test/Planet/PlanetTorque3D/python/testidefix.py | Ruff formatting (spacing/plot section layout). |
| test/Planet/PlanetSpiral2D/testme.py | Ruff formatting (indentation/spacing). |
| test/Planet/PlanetSpiral2D/python/testidefix.py | Ruff formatting (operators/line wraps). |
| test/Planet/PlanetsIsActiveRK52D/testme.py | Ruff formatting (indentation/spacing). |
| test/Planet/PlanetsIsActiveRK52D/python/testidefix.py | Ruff formatting (line wraps, condition formatting). |
| test/Planet/PlanetPlanetRK42D/testme.py | Ruff formatting (indentation/spacing, asserts layout). |
| test/Planet/PlanetPlanetRK42D/python/testidefix.py | Ruff formatting (spacing/line wraps). |
| test/Planet/PlanetMigration2D/testme.py | Ruff formatting (indentation/spacing). |
| test/Planet/PlanetMigration2D/python/testidefix.py | Ruff formatting (spacing/plot layout). |
| test/Planet/Planet3Body/testme.py | Ruff formatting (indentation/spacing). |
| test/Planet/Planet3Body/python/testidefix.py | Ruff formatting (spacing/plot section layout). |
| test/MHD/sphBragViscosity/testme.py | Ruff formatting (indentation/spacing/comments alignment). |
| test/MHD/sphBragViscosity/python/testidefix.py | Ruff formatting (spacing/quotes/loops). |
| test/MHD/sphBragTDiffusion/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/sphBragTDiffusion/python/testidefix.py | Ruff formatting (spacing/quotes/loops). |
| test/MHD/sod/testme.py | Ruff formatting (indentation/spacing, loop layout). |
| test/MHD/sod-iso/testme.py | Ruff formatting (indentation/spacing, loop layout). |
| test/MHD/ShearingBox/testme.py | Ruff formatting (indentation/spacing, tolerance assignment). |
| test/MHD/ShearingBox/python/testidefix.py | Ruff formatting; retains a + +(...) expression in error norm. |
| test/MHD/ResistiveAlfvenWave/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/ResistiveAlfvenWave/python/testidefix.py | Ruff formatting (spacing/quotes). |
| test/MHD/OrszagTang3D/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/OrszagTang/testme.py | Ruff formatting (list layout/indentation). |
| test/MHD/MTI/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/MTI/python/testidefix.py | Ruff formatting (spacing/quotes/line wraps). |
| test/MHD/LinearWaveTest/testme.py | Ruff formatting (function layout/indentation). |
| test/MHD/LinearWaveTest/python/testidefix.py | Ruff formatting (argparse/loop indentation). |
| test/MHD/HallWhistler/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/HallWhistler/python/testidefix.py | Ruff formatting (spacing/quotes/plot section layout). |
| test/MHD/FargoMHDSpherical/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/Coarsening/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/Coarsening/python/testidefix.py | Ruff formatting (spacing/quotes/line wraps). |
| test/MHD/clessTDiffusion/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/clessTDiffusion/python/testidefix.py | Ruff formatting (spacing/quotes). |
| test/MHD/AxisFluxTube/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/AxisFluxTube/python/checkAxisBounds.py | Ruff formatting (spacing/quotes). |
| test/MHD/AmbipolarShearingBox/python/testidefix.py | Ruff formatting (spacing/quotes). |
| test/MHD/AmbipolarCshock3D/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/AmbipolarCshock3D/python/testidefix.py | Ruff formatting (spacing/quotes/line wraps). |
| test/MHD/AmbipolarCshock/testme.py | Ruff formatting (indentation/spacing). |
| test/MHD/AmbipolarCshock/python/testidefix.py | Ruff formatting (spacing/quotes/line wraps). |
| test/IO/xdmf/testme.py | Ruff formatting (indentation/spacing, small refactor layout). |
| test/IO/pydefix/testme.py | Ruff formatting (indentation/spacing). |
| test/IO/pydefix/pydefix_example.py | Ruff formatting (indentation/line wraps). |
| test/IO/dump/testme.py | Ruff formatting (indentation/spacing). |
| test/HD/ViscousFlowPastCylinder/testme.py | Ruff formatting (indentation/spacing). |
| test/HD/ViscousDisk/testme.py | Ruff formatting (indentation/spacing). |
| test/HD/ViscousDisk/python/testidefix.py | Ruff formatting (spacing/quotes/line wraps). |
| test/HD/thermalDiffusion/testme.py | Ruff formatting (indentation/spacing). |
| test/HD/thermalDiffusion/python/testidefix.py | Ruff formatting (spacing/quotes). |
| test/HD/sod/testme.py | Ruff formatting (indentation/spacing, loop layout). |
| test/HD/sod/python/testidefix.py | Ruff formatting (argparse formatting, wraps). |
| test/HD/sod/pydefix_example.py | Ruff formatting (spacing/quotes). |
| test/HD/sod-iso/testme.py | Ruff formatting (indentation/spacing, loop layout). |
| test/HD/sod-iso/python/testidefix.py | Ruff formatting (spacing/quotes/wraps). |
| test/HD/ShearingBox/testme.py | Ruff formatting (indentation/spacing). |
| test/HD/ShearingBox/python/testidefix.py | Ruff formatting; retains a + +(...) expression in error norm. |
| test/HD/SedovBlastWave/testme.py | Ruff formatting (indentation/spacing, comment spacing). |
| test/HD/SedovBlastWave/python/testidefix.py | Ruff formatting (spacing/quotes/wraps). |
| test/HD/MachReflection/testme.py | Ruff formatting (indentation/spacing). |
| test/HD/FargoPlanet/testme.py | Ruff formatting (function layout/indentation). |
| test/Dust/DustyWave/testme.py | Ruff formatting (indentation/spacing). |
| test/Dust/DustyWave/python/testidefix.py | Ruff formatting (spacing/quotes/wraps). |
| test/Dust/DustyShock/testme.py | Ruff formatting (indentation/spacing). |
| test/Dust/DustyShock/python/testidefix.py | Ruff formatting (spacing/quotes/wraps). |
| test/Dust/DustEnergy/testme.py | Ruff formatting (indentation/spacing). |
| test/Dust/DustEnergy/python/testidefix.py | Ruff formatting (spacing/quotes). |
| test.py | Ruff formatting (indentation/blank lines). |
| pytools/vtk_io.py | Ruff formatting (line wraps, minor whitespace). |
| pytools/tests/test_idfx_test_run.py | Ruff formatting (rewrap long expected structure). |
| pytools/sod.py | Ruff formatting (float literals/spacing, rewrap function defs). |
| pytools/idfx_io.py | Ruff formatting (remove stray blank line, quote normalization). |
| pytools/dump_io.py | Ruff formatting (blank line after module docstring). |
| make_tarballs.py | Ruff formatting (minor spacing in expression). |
| doc/source/plot_idefix_bench.py | Ruff formatting (quote normalization, spacing). |
| doc/source/conf.py | Ruff formatting (quote normalization, list/dict formatting). |
| .pre-commit-config.yaml | Add ruff-format hook and set --target-version=py310 for Ruff hooks. |
| .git-blame-ignore-revs | Add the Ruff-formatting commit to blame ignore list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| error = np.sqrt( | ||
| (V["vx"] / v0 - y.sol(V["t"])[0, :]) ** 2 | ||
| + (V["vy"] / v0 - y.sol(V["t"])[1, :]) ** 2 | ||
| + +((V["vz"] / v0 - y.sol(V["t"])[2, :]) ** 2) |
| error = np.sqrt( | ||
| (V["vx"] / v0 - y.sol(V["t"])[0, :]) ** 2 | ||
| + (V["vy"] / v0 - y.sol(V["t"])[1, :]) ** 2 | ||
| + +((V["vz"] / v0 - y.sol(V["t"])[2, :]) ** 2) |
No description provided.