From 965da108d4845ab30194ada09f6d00db96b9124a Mon Sep 17 00:00:00 2001 From: Ramon DALMAU Date: Tue, 20 Oct 2026 11:22:25 +0200 Subject: [PATCH] ci(pre-commit): run mypy in the project environment 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 --- .pre-commit-config.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80c6efb..1aa3df9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,15 +11,18 @@ repos: args: [--fix] - id: ruff-format - # Mypy - Type checking (run on src/ only) - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + # Mypy - Type checking (run on src/ only), in the project environment + # (uv.lock), exactly as CI and `make check` run it. The isolated + # mirrors-mypy environment installed unpinned numpy, whose stubs need a + # newer Python than mypy's target, so the hook failed for every commit. + - repo: local hooks: - id: mypy - args: [src/pyneats/] + name: mypy + entry: uv run --frozen mypy src/pyneats/ + language: system + types: [python] pass_filenames: false - additional_dependencies: - - pandas-stubs>=2.0.0 # General pre-commit hooks - repo: https://github.com/pre-commit/pre-commit-hooks