xlsongc opened a new pull request, #76043:
URL: https://github.com/apache/airflow/pull/76043
When a provider's `pyproject.toml` or `provider.yaml` changes, for example
after a rebase, the pytest plugin refreshes
`generated/provider_dependencies.json` at startup by running `uv run
scripts/ci/prek/update_providers_dependencies.py`. Under `uv run --project
<distribution> pytest`, the `uv` it finds is the virtualenv's copy from the dev
group, and `uv run --project` does not upgrade that copy. So after `[tool.uv]
required-version` is raised, test startup fails like this (89 lines in total):
```text
error: Required uv version `>=0.13.4` does not match the running version
`0.12.18`. Update `uv` by running `uv self update`.
Traceback (most recent call last):
...
subprocess.CalledProcessError: Command '['uv', 'run',
'.../scripts/ci/prek/update_providers_dependencies.py']' returned non-zero exit
status 2.
```
The hint doesn't fix it: `uv self update` updates the uv you run from the
shell, not the virtualenv copy, and a Homebrew-installed uv cannot update
itself.
Before each refresh, the plugin now compares `uv --version` with `[tool.uv]
required-version` and exits with one line instead, for example:
```text
uv 0.12.18 at /path/to/airflow/.venv/bin/uv does not match `[tool.uv]
required-version = ">=0.13.4"` in pyproject.toml, so the provider dependencies
cannot be refreshed. Run `uv sync` to update the uv in the virtualenv, or
upgrade uv.
```
- The check runs only when a refresh is needed, so an older uv still runs
the tests when the provider dependencies are up to date.
- It is skipped when `required-version` is missing.
- prek hooks (`check_uv_version` in `scripts/ci/prek/common_prek_utils.py`)
and breeze (`environment_check.py`) already check the uv version up front. The
plugin can't import either, so the check is a few lines here.
- The two calls run at module level when the plugin loads, so the unit tests
cover `_check_uv_version` and the call sites were checked end to end.
Tested locally: `TestCheckUvVersion` and the rest of
`devel-common/tests/unit/tests_common/test_pytest_plugin.py`; end to end with
uv 0.12.18 first on PATH and the provider dependency hash missing, stale and up
to date, plus a current uv; prek pre-commit hooks, including mypy for
devel-common; a test file each from `airflow-core` and `providers/common/ai`.
The core suites that `breeze verify` lists did not run locally because my CI
image is out of date, so CI covers them.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Opus 5.5) 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]