mkirshad opened a new pull request, #77764:
URL: https://github.com/apache/airflow/pull/77764
Adds an opt-in `hash_resolved_requirements` flag (default `False`) to
`PythonVirtualenvOperator` and `@task.virtualenv`. When enabled together
with `venv_cache_path`, the operator resolves the requirements to pinned
versions *without installing* (via `uv pip compile`, or
`pip install --dry-run --report` on pip >= 23) and folds the resolved
pins into the venv cache hash. A new release of an unpinned dependency
then produces a new cache key (a fresh venv) instead of silently reusing
the stale cached one.
Kept off by default, per the discussion in the issue: resolution adds a
resolver run and a network dependency to every task start, which existing
users should not pay unless they ask for it. With the flag off, the hash
input is byte-identical to today's.
This carries forward #69894 (by HerenderKumar — credit to them for the
implementation), which implemented the agreed design but was closed by
the stale bot without ever receiving a review. Changes on top of that PR:
rebased onto current main (the operators test module was restructured in
the meantime), re-verified behaviour, and extended the tests (hash
stability across resolutions, per-operator memoization, the
warning-without-cache-path path, decorator passthrough).
Notes for reviewers:
- When the flag is set without `venv_cache_path`, the operator logs a
warning and skips resolution (resolution only buys anything when there
is a cache to key).
- Resolution failures raise `RequirementsResolutionError` carrying the
resolver command and its stderr.
- Non-goals, as scoped in the issue: no change to the default behaviour,
and no automatic disposal of superseded cached venvs (the ballooning
concern is documented instead — each new resolution creates a new
`venv-*` dir, existing venvs are never mutated).
closes: #41328
related: #69894
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Claude Fable 5)
Generated-by: Claude Code (Claude Fable 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]