Use uv.lock as single source of truth for pre-commit tool versions#744
Open
ale-saglia wants to merge 2 commits into
Open
Use uv.lock as single source of truth for pre-commit tool versions#744ale-saglia wants to merge 2 commits into
ale-saglia wants to merge 2 commits into
Conversation
Replace the external ruff and codespell repos in .pre-commit-config.yaml with local hooks that invoke tools via `uv run --frozen`, so the locked versions in uv.lock are always used. Add codespell to the dev dependency group so its version is managed alongside ruff and ty.
Move skip patterns and exclude-file from the pre-commit hook args into [tool.codespell] so they apply consistently in any invocation. Extend the skip list to cover PDFs (binary false positives) and the typst_fontawesome third-party library.
fdcd79d to
8f46926
Compare
This was referenced May 5, 2026
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.
Closes #743
Problem
.pre-commit-config.yamlpinned tool versions independently fromuv.lock, creating two separate sources of truth that could silently drift. The concrete failure reported in #743: thety-checkhook usedadditional_dependencies ["ty>=0.0.24"], which pre-commit resolved to the latest availabletyrelease — newer than the version locked inuv.lock.The newer release tightened type inference, turning existing
# ty: ignorecomments into errors and makingjust checkfail on a fresh clone.The same structural problem affected
ruff, which was pinned to a specific tag in theastral-sh/ruff-pre-commitexternal repo independently ofuv.lock.Solution
Replace all external pre-commit repos for Python tools (
ruff,codespell,ty) with local hooks that invoke tools viauv run --frozen. This way the version is always determined byuv.lock— no version number appears in.pre-commit-config.yamlitself.ruffandtywere already in the dev dependency group; their external repo blocks (astral-sh/ruff-pre-commit, and theadditional_dependenciestrick forty) are replaced bylanguage: systemhooks.codespellis added to the dev dependency group and locked inuv.lock, then made a local hook as well.pre-commit/pre-commit-hooksremains an external repo since it has no equivalent package in the project.Codespell configuration (skip patterns, exclude file) is moved from inline hook args into
[tool.codespell]inpyproject.toml, so the settings apply consistently regardless of how codespell is invoked.The skip list is also extended to cover PDF files (which produce binary false positives) and the bundled
typst_fontawesomethird-party library.Testing
uv run --frozen codespellexits clean.uv run --frozen prek validate-config .pre-commit-config.yamlreportssuccess.