Skip to content

DM-55493: Adopt prek in place of pre-commit - #302

Merged
jonathansick merged 1 commit into
mainfrom
tickets/DM-55493-prek
Jul 28, 2026
Merged

DM-55493: Adopt prek in place of pre-commit#302
jonathansick merged 1 commit into
mainfrom
tickets/DM-55493-prek

Conversation

@jonathansick

@jonathansick jonathansick commented Jul 28, 2026

Copy link
Copy Markdown
Member

Jira: DM-55493

Replaces pre-commit with prek as the lint hook runner, per the campaign's prek-adoption migration.

Changes

  • pyproject.toml: lint dependency group drops pre-commit/pre-commit-uv, adds prek; dev group gains uv.
  • Makefile: pre-commit install/autoupdate -> prek install/autoupdate.
  • noxfile.py: this is a nox repo — the lint session now runs prek run --all-files instead of pre-commit run --all-files.
  • .github/workflows/ci.yaml: CI's Run pre-commit step renamed to Run prek, now runs prek run --all-files.
  • scripts/update-uv-version.sh: replaced with the current version from lsst/templates (step 7 of the migration; the file already existed here so it applied).
  • uv.lock: reconciled with uv lock (no upgrade) — diff is limited to the swapped lint-group dependencies (pre-commit/pre-commit-uv/cfgv/identify/nodeenv out, prek in). fastapi did not move.

Fixture fix (approved, in scope)

tests/data/content/dmtn-139/metadata.yaml failed prek's native check-yaml ("invalid indentation in multiline quoted scalar" at the description: 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.yaml is untouched — prek consumes it as-is.

Validation

  • uv lock (no --upgrade) + uv sync --frozen --all-groups
  • uv run --only-group=lint prek run --all-files — all hooks pass
  • uv run --group=nox nox -s lint — passes
  • Done-check greps (no leftover pre-commit install/autoupdate/run, no pre-commit/pre-commit-uv in pyproject.toml) — clean

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).
@jonathansick
jonathansick merged commit b8aad5f into main Jul 28, 2026
7 checks passed
@jonathansick
jonathansick deleted the tickets/DM-55493-prek branch July 28, 2026 15:46
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