fix: dependency cache bugs for fork PR CI#1394
Merged
Conversation
pypa/hatch@install bundles hatchling, so hatch env create never downloads it via uv. Explicitly install hatchling via uv to populate the cache — needed for uv's build isolation in offline mode.
setup-uv forcibly overrides UV_CACHE_DIR to a temp path even when set in job env. Use the cache-local-path input parameter instead, which setup-uv respects. This ensures uv writes to ~/.cache/uv (matching the cache save/restore paths) instead of a temp dir.
uv pip install --system uses a different cache resolution path than uv's build isolation. Use uv build --wheel which triggers the exact same build isolation mechanism that consumers use, ensuring hatchling is cached in the right format.
…ling) hatch -v build triggers uv's build isolation which caches hatchling. The separate uv build --wheel step was redundant. With cache-local-path now correctly set, hatch build writes to ~/.cache/uv.
uv cache is index-URL-scoped — entries are keyed by the URL hash of the index that was used to download them. The warmer downloads via JFrog, so cache entries are stored under JFrog's URL hash. Without setting the same URL in offline mode, uv defaults to pypi.org's hash and finds nothing. Set UV_INDEX_URL to JFrog's URL (without credentials) in offline mode. uv never contacts it — it only uses the hash to find the right cache bucket. Verified locally: warmer populates cache online, consumer creates hatch envs + runs code-quality + builds offline successfully.
Use setup-python in warmer instead of uv python install so Python paths match the consumer. Only create default + verify hatch envs. Remove temporary debug step from main.yml.
Three issues fixed: 1. Pre-commit venv broken symlink: warmer used uv python install (path differs from consumer's setup-python). Fix: use setup-python 3.10 for default env, uv python install only for 3.11-3.13 test matrix (their symlinks don't matter — only wheels are cached). 2. pip has no offline mode: PIP_NO_INDEX blocks all index access including build deps like setuptools. Fix: warmer creates a pip wheelhouse (~/.cache/pip-wheelhouse), consumer sets PIP_FIND_LINKS to use it. 3. Test matrix needs version-specific wheels: restored uv python install 3.11-3.13 and test env creation for all versions.
pip download fails when dependency specs with commas (e.g. "click>=8.2.0, <9.0.0") are passed as shell-expanded args. Write to a requirements file and use -r instead. Verified locally: full E2E offline test passes (env create, code-quality, build). Verify step has platform mismatch locally but will work on CI (Linux wheels).
1 task
benc-db
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issues preventing the dependency cache (#1386) from working on fork PRs:
setup-uvoverrode the cache dir to a temp path. Usecache-local-pathto pin it.UV_INDEX_URLto match the warmer's JFrog URL.setup-pythonin warmer.PIP_NO_INDEXblocks all index access. Create a pip wheelhouse and usePIP_FIND_LINKS.strategy.fail-fast, added missingid: coverage_comment.Test plan
warm-cachejob succeeds on this PRmain.ymljobs pass offline