Skip to content

ci(pre-commit): run mypy in the project environment - #72

Merged
ramondalmau merged 1 commit into
devfrom
chore/precommit-mypy-local
Oct 20, 2026
Merged

ramondalmau merged 1 commit into
devfrom
chore/precommit-mypy-local

Conversation

@ramondalmau

Copy link
Copy Markdown
Collaborator

Summary

The mirrors-mypy pre-commit hook built its own environment with unpinned dependencies.
It now installs numpy 2.5.4, whose type stubs use Python 3.12 syntax while mypy targets
3.11, so the hook failed on every commit, whatever the change (see #70, #71, which had
to use SKIP=mypy).

Replaced by a local hook that runs uv run --frozen mypy src/pyneats/, the same command
as CI and make check, with the locked dependencies. It cannot drift from CI again.

Evidence

  • New hook passes on the whole codebase (pre-commit run mypy --all-files).
  • New hook fails on a deliberately introduced type error (x: int = "..."), so it is not
    passing vacuously.
  • Config validated (pre-commit validate-config); this commit was made with all hooks on.

The mirrors-mypy hook built its own environment with unpinned
dependencies. It now installs numpy 2.5.4, whose type stubs use Python
3.12 syntax while mypy targets 3.11, so the hook failed on every commit
regardless of the change.

Replace it with a local hook that runs `uv run --frozen mypy
src/pyneats/`, the same command as CI and `make check`, with the locked
dependencies, so the hook cannot drift from CI again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ramondalmau
ramondalmau merged commit b065e80 into dev Oct 20, 2026
6 checks passed
@ramondalmau
ramondalmau deleted the chore/precommit-mypy-local branch October 20, 2026 09:30
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