You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/04/15 15:43:39 UTC
[PR] Sync local virtualenv before mypy and freeze uv.lock prek hook [airflow]
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sync local virtualenv before mypy and freeze uv.lock prek hook [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #65326:
URL: https://github.com/apache/airflow/pull/65326
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sync local virtualenv before mypy and freeze uv.lock prek hook [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #65326:
URL: https://github.com/apache/airflow/pull/65326#issuecomment-4254860861
### Backport successfully created: v3-2-test
Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
<table>
<tr>
<th>Status</th>
<th>Branch</th>
<th>Result</th>
</tr>
<tr>
<td>✅</td>
<td>v3-2-test</td>
<td><a href="https://github.com/apache/airflow/pull/65334"><img src="https://img.shields.io/badge/PR-65334-blue" alt="PR Link"></a></td>
</tr>
</table>
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org