Skip to content

fix(formatting): read ruff pin from pyproject.toml, not missing requirements-dev.txt - #440

Open
latent-9 wants to merge 1 commit into
theroyallab:mainfrom
latent-9:fix/formatting-ruff-pin-pyproject
Open

fix(formatting): read ruff pin from pyproject.toml, not missing requirements-dev.txt#440
latent-9 wants to merge 1 commit into
theroyallab:mainfrom
latent-9:fix/formatting-ruff-pin-pyproject

Conversation

@latent-9

Copy link
Copy Markdown

Is your pull request related to a problem? Please describe.
formatting.sh aborts before it formats anything, for every contributor who runs it. Line 34 checks the required ruff version by grepping requirements-dev.txt:

tool_version_check "ruff" $RUFF_VERSION "$(grep "ruff==" requirements-dev.txt | cut -d'=' -f3)"

But requirements-dev.txt does not exist in the repo — dev dependencies live in pyproject.toml:

[project.optional-dependencies]
dev = [
    "ruff == 0.11.10"
]

Since the script runs under set -eo pipefail, the failed grep makes the required-version substring empty, so tool_version_check sees a mismatch and does exit 1:

Wrong ruff version installed:  is required, not 0.11.10.

Why should this feature be added?
The dev formatting helper is currently unusable. This repoints the version check at the real source of truth (pyproject.toml) and tolerates its spaced ruff == x.y.z pin (the old cut -d= logic assumed the unspaced ruff== form). One-line change.

Examples

  • Before: bash formatting.shgrep: requirements-dev.txt: No such file or directoryWrong ruff version installed: is required, not 0.11.10. → exit 1.
  • After (ruff 0.11.10 installed): version check passes, ruff format / ruff check run.

Additional context
Verified locally under set -eo pipefail: the new extraction yields exactly 0.11.10 from pyproject.toml, matches a correct install, and still flags a wrong one. bash -n clean.

…rements-dev.txt

formatting.sh checked the required ruff version by grepping
requirements-dev.txt, but that file does not exist in the repo; dev
dependencies live in pyproject.toml ([project.optional-dependencies]
dev = ["ruff == 0.11.10"]). Under 'set -eo pipefail' the version check
therefore always fails (empty required version), so the script aborts
before formatting for every contributor who runs it. Read the pin from
pyproject.toml instead, tolerating the spaced 'ruff == x.y.z' form.
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.

1 participant