Repository navigation
ci(python-lint): pin ruff to 0.17.0 and run it via the installing interpreter - #378
Merged
Merged
Conversation
…erpreter python_lint ran `pip install --upgrade ruff` when ruff was missing, so every consumer linted with whatever ruff was newest and a ruff release could break all consumers' CI at once. It now installs ruff==0.17.0 (RUFF_VERSION, with an optional reusable-ci `ruff-version` input that defaults to it), replaces a mismatched installed ruff, re-checks the version after install and fails loudly on a mismatch, and runs ruff as `sys.executable -m ruff` so a different ruff on PATH can never be used. ci-tests.yml's unpinned `pip install ruff` is pinned the same way. ci_workflow.py is also reformatted by the repo's pre-commit ruff hooks (.github/linters/ruff.toml); that churn is formatting only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfaLiLJxzi62hjzmR7uAZH
The Python CI check linted ci_workflow.py with the repo-root ruff.toml and found 36 issues that predate the ruff pin: 31 D103, 3 PLW0603, 2 S310. - one-line docstrings on every public function (D103) - _CONFIG_CACHE global replaced by functools.lru_cache on get_repository_config (PLW0603); behaviour is unchanged, tests clear it via cache_clear() - the urllib fallback in _http_get now refuses non-https URLs before urlopen; the S310 noqa is scoped to those two lines and says why - header: last-edited on ci_workflow.py; test_ci_workflow.py gets a header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfaLiLJxzi62hjzmR7uAZH
…refix, docs) - reusable-ci: ruff-version input sits next to python-version; description says "bare version, e.g. 0.17.0", points at RUFF_VERSION instead of duplicating the number, and states that it takes effect once the script ref includes this change; TODO comment on the separate ruff==0.16.10 job - ci_workflow.py: strip a leading v from the RUFF_VERSION override; the override test is parametrized over bare, v-prefixed and padded values and has a docstring - headers: last-edited on ci-tests.yml, version bumps on touched files - changelog: rollout section (script ref follows in a separate PR, as in #374), known consumers and their effect, the ruff-version escape hatch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfaLiLJxzi62hjzmR7uAZH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pin ruff in the shared python-lint
python_lintinci_workflow.pyranpip install --upgrade ruffwhen ruff was missing. Every consumer of reusable-ci therefore linted with whatever ruff was newest, so a ruff release could break all consumers' CI overnight.Changes
ci_workflow.py:RUFF_VERSION = "0.17.0"._ensure_ruffinstallsruff==<version>withsys.executable -m pip. It also replaces an installed ruff whose version differs, re-checks the version after install, and raises on a mismatch.format --checkandcheckrun assys.executable -m ruff, so a different ruff on PATH (pipx, the runner image) is never used.reusable-ci.yml: a new optionalruff-versioninput, empty by default, so the script's constant applies. It is passed to the Lint Python step asRUFF_VERSION.ci-tests.yml: the unpinnedpip install ruffbecomespython -m pip install ruff==0.17.0pluspython -m ruff.tests/workflow_scripts/test_ci_workflow.py. The file now has 18 tests, all passing.python_lintin a temp venv holding ruff 0.16.10: it replaced ruff with 0.17.0 and then linted clean.ci_workflow.pyis also reformatted by this repo's own pre-commit ruff hooks (.github/linters/ruff.toml). That part is formatting only.Not changed
ruff==0.16.10, and is left as is..pre-commit-config.yamlpins ruff-pre-commit at v0.14.3, and is left as is.The consumer is falkcorp/audiobook-organizer, which formats against ruff 0.17.0. It will move its reusable-ci and ghcommon-ref pins to this commit once it merges.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QfaLiLJxzi62hjzmR7uAZH