Skip to content

Repair pre-commit, drop pixi.lock, point .gitattributes at uv.lock - #67

Merged
xhan97 merged 1 commit into
mainfrom
chore/fix-precommit-drop-pixi
Aug 15, 2026
Merged

Repair pre-commit, drop pixi.lock, point .gitattributes at uv.lock#67
xhan97 merged 1 commit into
mainfrom
chore/fix-precommit-drop-pixi

Conversation

@xhan97

@xhan97 xhan97 commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Three related bits of housekeeping. The pre-commit part is the substantive one.

.pre-commit-config.yaml was a trap

It ran ruff-format while CI enforces black, and the two disagree:

$ black --check .          # what CI runs
69 files would be left unchanged.

$ ruff format --check .    # what the hook did
4 files would be reformatted

$ ruff format . && black --check .
5 files reformatted
Oh no! 💥 💔 💥  1 file would be reformatted

Any contributor who ran pre-commit install would have had their commits reformatted into a state that fails the lint job in CI. It went unnoticed only because nothing runs it — no git hook installed, no workflow invoking it — even though pre-commit>=4.3.0 sits in the lint dependency group.

Fixed by making formatting black's alone, running after ruff-check so the formatter has the last word.

The revs had also rotted:

hook was now
ruff-pre-commit v0.12.1 v0.16.3 (matches the project)
prettier pre-commit/mirrors-prettier rbubley/mirrors-prettier v3.9.6
validate-pyproject v0.24.1 v0.25
codespell v2.4.1 v2.4.3
black absent 26.5.1 (matches the pin)

pre-commit/mirrors-prettier is archived upstream. A pre-commit ecosystem is added to dependabot.yml so these stop drifting silently — that drift is how it got here.

Deleting the config would have been simpler, but it would have dropped codespell, validate-pyproject, and prettier, none of which CI runs. [tool.codespell] in pyproject.toml is read by nothing else.

What codespell found once it ran

Eleven hits. Five were false positives:

  • lamda ×2 — the LAMDA lab's domain in author emails (mayx@lamda.nju.edu.cn)
  • anc ×3 — a local variable for "ancestors" in _inode.py

Those are now in ignore-words-list with a comment explaining why. The other six are real and corrected, two of them user-facing:

  • SubsequnceSubsequence in IKTOD's class docstring
  • lableslabels in a doctest example in _ikgod.py (last line of the example, nothing references it)
  • dimention, Exsiting, commiting, continous

Churn worth calling out

prettier normalized indentation in three workflow files and removed a blank line from mkdocs.yml — the first time it has run over them. This is unrelated to the stated purpose of the PR, so:

  • Parsed YAML verified identical before and after for all three workflows
  • mkdocs.yml uses custom tags so it cannot be safe-loaded; its only change is one deleted blank line, and mkdocs build --strict still passes

pixi.lock and .gitattributes

pixi.lock is 438K of lockfile with no pixi.toml and no [tool.pixi] section anywhere — orphaned since the move to uv in November 2025.

.gitattributes existed only to mark it generated, duplicated across two identical lines:

pixi.lock linguist-language=YAML linguist-generated=true
pixi.lock linguist-language=YAML linguist-generated=true

Rather than delete it, it now does the same for uv.lock, which collapses that file in GitHub diffs and keeps it out of language stats. Every dependency PR in this repo buries its real change under hundreds of lock lines; this fixes that.

Verification

All six hooks pass on --all-files. black --check, ruff check, and uv lock --check are clean afterwards — the round-trip that was previously broken.

.pre-commit-config.yaml had rotted into a trap. It ran ruff-format while
CI enforces black, and the two disagree: black reports the tree clean,
ruff format rewrites five files, and black then rejects one of them. Any
contributor who ran `pre-commit install` would have had their commits
reformatted into a state that fails the lint job. It went unnoticed only
because nothing runs it -- no git hook is installed and no workflow
invokes it -- despite pre-commit sitting in the lint dependency group.

Formatting is now black's alone, running after ruff-check so the
formatter has the last word. Hook revs are current: ruff was pinned at
0.12.1 against a project on 0.16.3, and prettier pointed at
pre-commit/mirrors-prettier, which upstream archived; that moves to the
maintained rbubley fork. A pre-commit ecosystem is added to dependabot so
these stop drifting silently.

Deleting the config instead would have been simpler but would have
dropped codespell, validate-pyproject, and prettier, none of which CI
runs.

With the hooks working, codespell found eleven hits. Five were false
positives -- `lamda` is the LAMDA lab's domain in author emails, `anc` a
local for "ancestors" -- and are now in ignore-words-list with a note.
The other six are corrected, including "Subsequnce" in IKTOD's class
docstring and a misspelled variable in a doctest example, both
user-facing.

prettier also normalized indentation in three workflow files and removed
a blank line from mkdocs.yml, the first time it has run over them.
Verified the parsed YAML is identical before and after, and that the docs
still build under --strict.

pixi.lock is removed: 438K of lockfile with no pixi.toml and no
[tool.pixi] section, orphaned since the move to uv. .gitattributes
existed only to mark it generated, so it now does the same for uv.lock,
which collapses that file in diffs and keeps it out of language stats.
@xhan97
xhan97 merged commit 21584e1 into main Aug 15, 2026
17 checks passed
@xhan97
xhan97 deleted the chore/fix-precommit-drop-pixi branch August 15, 2026 18:16
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