Skip to content

chore: pin pre-commit hooks to uv.lock with sync-with-uv - #1808

Open
devtejasx wants to merge 2 commits into
stac-utils:mainfrom
devtejasx:chore/sync-with-uv-1587
Open

devtejasx wants to merge 2 commits into
stac-utils:mainfrom
devtejasx:chore/sync-with-uv-1587

Conversation

@devtejasx

Copy link
Copy Markdown
Contributor

Related Issue(s):

Description:

The ruff, ruff-format, codespell, doc8 and mypy hooks were repo: local / language: system, so each ran whatever version was installed in the contributor's environment (and failed outright when the tool was missing). They now come from their upstream hook repos, and a sync-with-uv hook keeps every rev at the version in uv.lock.

mypy now runs in an isolated hook environment, so the packages it type-checks against are listed as additional_dependencies; each pin carries the sync-with-uv pragma, so those follow uv.lock too. pytest-pystac is added to [tool.mypy] mypy_path so the extension tests' pytest_pystac.plugin imports resolve without its editable install. The ruff hook id becomes upstream's ruff-check, and docs/contributing.rst is updated to match.

One trade-off to be aware of: when Dependabot bumps ruff, mypy or a types-* package in uv.lock, pre-commit run --all-files will report the config as out of date until someone runs pre-commit once and commits the re-synced .pre-commit-config.yaml.

No runtime code changes. After rebasing onto current main I re-ran sync-with-uv (0 of 20 pins changed) and the isolated mypy hook (2.3.0, no issues in 127 source files); ruff, codespell and doc8 were run through their new hook environments when the branch was written, and the rebase touched nothing they cover.

PR Checklist:

  • Pre-commit hooks pass (run pre-commit run --all-files)
  • Tests pass (run pytest)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage
  • This PR's title is formatted per conventional commits

AI tool usage:

  • AI tools supported the development of this PR, per the stac-utils AI tool policy. I have reviewed the change and can answer questions about it.

Closes stac-utils#1587.

The ruff, ruff-format, codespell, doc8 and mypy hooks were `repo: local`
hooks with `language: system`, so each one ran whatever version happened
to be installed in the contributor's environment, and failed outright when
the tool was missing. They now come from their upstream hook repositories,
and the sync-with-uv hook keeps every `rev` at the version resolved in
uv.lock, so uv.lock stays the single source of truth for tool versions.

mypy now runs in an isolated hook environment, so the packages it type
checks against are listed as `additional_dependencies`. Each of those pins
carries the `# sync-with-uv` pragma, so they follow uv.lock as well.
`pytest-pystac` is added to `mypy_path` so the extension tests'
`pytest_pystac.plugin` imports resolve without its editable install.

The `ruff` hook id becomes upstream's `ruff-check`; the example in the
contributing guide is updated to match.
codespell reads [tool.codespell] from pyproject.toml through tomllib on Python >= 3.11 and needs tomli below that. The isolated hook environment had no tomli, so on the 3.10 CI job it silently ignored skip = "CHANGELOG.md" and flagged an existing typo in the changelog. The pin follows uv.lock via sync-with-uv like the others.
@gadomski
gadomski self-requested a review September 15, 2026 13:22

This branch has not been deployed

No deployments
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.

Use sync-with-uv

1 participant