Skip to content

Replace struphy format/lint with plain ruff - #730

Merged
spossann merged 1 commit into
develfrom
ruff-only-formatting
Oct 8, 2026
Merged

spossann merged 1 commit into
develfrom
ruff-only-formatting

Conversation

@max-models

Copy link
Copy Markdown
Member

Summary

struphy lint only enforced ruff format, ruff's import sorting (ruff check --select I) and a check for # $ OpenMP pragmas. struphy format only ran those two ruff commands in a loop. This PR drops both commands and uses ruff directly.

Changes

  • Removed struphy format and struphy lint. This deletes src/struphy/console/format.py (~1550 lines) and its test.
  • Removed the OpenMP # $ check. pyccel now accepts a space after # in OpenMP pragmas.
  • struphy build-init-files moved to src/struphy/console/build_init_files.py. It still regenerates models/, propagators/ and geometry/domains/ __init__.py, then sorts imports and formats them with ruff. Its --linters, --iterations and -y options are removed. The package folders are now found relative to the installed package rather than the current working directory.
  • Import sorting is done by ruff (extend-select = ["I"] in pyproject.toml), replacing isort.
  • Dev extra: removed autopep8, isort, flake8, pylint, ssort, add-trailing-comma and tabulate, and added ruff==0.15.0. Also removed the [tool.autopep8], [tool.isort] and [tool.pylint] config sections and the [flake8] section in setup.cfg.
  • CI:
    • GitHub: removed the struphy_lint_all and isort jobs. The ruff job now runs ruff format --check and ruff check; until now ruff format --check was commented out.
    • GitLab: the four struphy lint jobs are replaced by one ruff job.
    • Neither job needs a struphy install anymore.
  • One-time formatting: struphy lint only covered src/, so I ran ruff check --fix and ruff format on tutorials/, doc/, utils/ and profiling/. That's 25 files, all automatic fixes.
  • Docs: the developer's guide has a new section on formatting and import sorting, plus a section on struphy build-init-files.

How to format now

ruff check --fix   # lint + sort imports
ruff format        # format

Testing

  • ruff format --check and ruff check pass on the whole repo.
  • struphy build-init-files reproduces the committed __init__.py files exactly.
  • The console tests test_state.py and test_params_profile.py pass.

🤖 Generated with Claude Code

- Remove `struphy format` and `struphy lint` (src/struphy/console/format.py)
  and the OpenMP `# $` pragma check (pyccel now accepts the space).
- Move the __init__.py generation to struphy/console/build_init_files.py;
  `struphy build-init-files` formats the result with ruff.
- Enable ruff's isort rules ("I") and drop isort, autopep8, flake8, pylint,
  ssort, add-trailing-comma and tabulate from the dev extra; add ruff.
- CI: remove struphy_lint_all and isort jobs; run `ruff format --check` and
  `ruff check` on GitHub and GitLab.
- Apply ruff format/import sorting to tutorials, doc, utils and profiling.
- Document formatting and import sorting in the developer's guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@max-models
max-models added this pull request to stack #733 October 8, 2026 07:08
@max-models
max-models requested a review from spossann October 8, 2026 07:13
@max-models
max-models marked this pull request as draft October 8, 2026 09:06
@max-models
max-models marked this pull request as ready for review October 8, 2026 09:06
@spossann
spossann merged commit 53ee46d into devel Oct 8, 2026
28 checks passed
@spossann
spossann deleted the ruff-only-formatting branch October 8, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants