DM-55493: Adopt prek in place of pre-commit - #302
Merged
Conversation
Replace pre-commit/pre-commit-uv with prek in the lint dependency group, add uv to the dev group, and swap pre-commit for prek across the Makefile, noxfile.py lint session, and CI workflow. Also fixes tests/data/content/dmtn-139/metadata.yaml: prek's native check-yaml is stricter than pre-commit's Python implementation and rejected the multi-line double-quoted description scalar (continuation lines at column 0). Indented the continuation lines two spaces; verified semantics-preserving by comparing yaml.safe_load() output before and after (identical).
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.
Jira: DM-55493
Replaces pre-commit with prek as the lint hook runner, per the campaign's
prek-adoptionmigration.Changes
pyproject.toml:lintdependency group dropspre-commit/pre-commit-uv, addsprek;devgroup gainsuv.Makefile:pre-commit install/autoupdate->prek install/autoupdate.noxfile.py: this is a nox repo — thelintsession now runsprek run --all-filesinstead ofpre-commit run --all-files..github/workflows/ci.yaml: CI'sRun pre-commitstep renamed toRun prek, now runsprek run --all-files.scripts/update-uv-version.sh: replaced with the current version fromlsst/templates(step 7 of the migration; the file already existed here so it applied).uv.lock: reconciled withuv lock(no upgrade) — diff is limited to the swapped lint-group dependencies (pre-commit/pre-commit-uv/cfgv/identify/nodeenv out, prek in).fastapidid not move.Fixture fix (approved, in scope)
tests/data/content/dmtn-139/metadata.yamlfailed prek's nativecheck-yaml("invalid indentation in multiline quoted scalar" at thedescription:field) — prek's Rust check-yaml is stricter than pre-commit's Python implementation here, which was tolerating column-0 continuation lines in a multi-line double-quoted scalar. Indented the continuation lines two spaces to satisfy YAML's block-indentation rule. Verified semantics-preserving:yaml.safe_load()on the file before and after produces an identical Python value (folded scalars fold line breaks to spaces and strip leading whitespace regardless of the source indentation)..pre-commit-config.yamlis untouched — prek consumes it as-is.Validation
uv lock(no--upgrade) +uv sync --frozen --all-groupsuv run --only-group=lint prek run --all-files— all hooks passuv run --group=nox nox -s lint— passespre-commit install/autoupdate/run, nopre-commit/pre-commit-uvinpyproject.toml) — clean