potiuk opened a new pull request, #65326:
URL: https://github.com/apache/airflow/pull/65326

   Align local mypy runs with CI by syncing the project virtualenv to
   `uv.lock` before mypy executes, and prevent the `update-uv-lock` prek
   hook from silently rewriting `uv.lock` during a commit.
   
   ## Changes
   
   - **`scripts/ci/prek/mypy_local_folder.py`**: before running mypy
     locally, the hook now runs `uv sync --frozen --project <project>` so
     the local `.venv` matches the dependency set CI uses. If the sync
     fails, mypy is not invoked and the hook exits with a clear error.
     The failure message points at the same two-step command
     (`uv sync --frozen` + `uv run --frozen ... mypy`).
   - **`.pre-commit-config.yaml`**: the `update-uv-lock` hook now runs
     `uv lock --frozen` instead of `uv lock`. A pyproject.toml change
     that would touch `uv.lock` now fails the hook, forcing contributors
     to run `uv lock` explicitly and commit the refreshed lock — keeping
     lock updates intentional and reviewable.
   - **`AGENTS.md`** and **`contributing-docs/08_static_code_checks.rst`**:
     updated the type-check / mypy instructions to document the
     `uv sync --frozen --project <PROJECT>` prerequisite and explain why
     (otherwise mypy results can diverge from CI).
   
   ## Motivation
   
   Running mypy locally without syncing the project venv produces
   results that can silently drift from CI, because the local `.venv`
   may contain different package versions than `uv.lock` (e.g. after
   switching branches, installing extras, or running `uv run` with
   different projects). Forcing a `--frozen` sync before mypy makes
   local results reproducible and consistent with CI.
   
   Likewise, allowing `uv lock` (without `--frozen`) to silently
   rewrite `uv.lock` from a commit hook means lock changes can sneak
   into unrelated commits. Failing fast lets contributors decide
   when and how to regenerate the lock.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Opus 4.6 (1M context)
   
   Generated-by: Claude Opus 4.6 (1M context) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to