ci: commit uv.lock + cpu-only torch + --locked installs#4
Closed
random-walks wants to merge 1 commit into
Closed
Conversation
Three modest wins on the ~3-7min test-matrix cells. All lossless w/r/t correctness; the trade is a bigger git repo (1.4MB uv.lock). **1. Commit `uv.lock`.** Previously gitignored, which meant every CI run resolved dependencies from scratch against PyPI. Committed now so: - Resolution is deterministic — same run twice, same wheels, no drift from upstream floor-version updates. - Cache keys stabilize (see #2 below). - `uv sync --locked` can assert the lock matches pyproject.toml as a config-drift tripwire (see #3). Libraries have historically not committed lockfiles because users consume floors, not locks — but astral now recommends committing them even for libraries (the lockfile is CI's dependency graph, not the users'). Modern uv-based projects do. **2. Add `uv.lock` to the cache-dependency-glob** on all three jobs so setup-uv's cache invalidates precisely on lockfile bumps rather than generously on any pyproject edit. **3. `uv sync --locked` everywhere.** Enforces the lock is in sync with pyproject on every CI run (fails loudly if someone edits pyproject without regenerating). Side effect: resolution work is skipped. **4. CPU-only torch on Linux test jobs.** The default torch wheel ships with CUDA (~800MB); the CPU-only variant is ~200MB. CI has no GPU anyway, so this is a pure ~600MB / ~60s download-and-extract saving per Linux matrix cell. Configured via env: `UV_EXTRA_INDEX_URL= https://download.pytorch.org/whl/cpu` set only when `runner.os == 'Linux'`. macOS keeps the standard wheel (no CUDA variant there anyway). Top-level `UV_INDEX_STRATEGY=unsafe-best-match` so uv falls back to PyPI for everything else on the index. Expected test-job runtime after (rough estimates, py3.12 Linux cell): - before: ~3m47s (install ~3m, test ~30s) - after: ~2m20s (install ~1m40s cold / ~15s cached, test ~30s) - warm rerun on same PR: ~1m30s (cache hits dominate). None of the three §10 contracts change. Only CI config + the lockfile addition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Folded into #3 — all four commits (ci + docs + changelog) live on release/v0.2.0 now. Closing so the PR list isn't noisy; the CI speedup ships with v0.2.0. |
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
Audits the current CI for lossless speedup wins. Three changes, zero §10 impact:
1. Commit
uv.lockPreviously gitignored. Committed now so:
uv sync --lockedcan assert config-drift between pyproject and lock (see release: v0.2.0 #3).Size: 1.4MB. Astral now recommends committing lockfiles even for libraries — the lockfile is CI's dep graph, not the users'.
2. Richer
cache-dependency-globAll three jobs now cache-key on both
pyproject.tomlANDuv.lock. Precise invalidation — bumping a dep and regenerating the lock rebuilds the cache; touching pyproject without a lock change shouldn't.3.
uv sync --lockedon all jobsEnforces lock-pyproject consistency as a CI-side invariant. A silent drift would fail loudly; the resolver otherwise skips resolution work.
4. CPU-only torch for Linux test jobs
The default torch wheel bundles CUDA (~800MB); the CPU-only variant is ~200MB. CI has no GPU. The ~600MB saving compounds across 4 Linux matrix cells.
Mechanism:
UV_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpuset only whenrunner.os == 'Linux'. macOS keeps the standard wheel (no CUDA variant there anyway). Workflow-levelUV_INDEX_STRATEGY=unsafe-best-matchso uv falls back to PyPI for non-torch deps.Expected gains
Rough per-cell runtime (py3.12 Linux):
py3.14 was the slow cell at ~7min; expected to land closer to 3-4min post-change.
Invariant touched?
None. Pure CI config + lockfile addition.
Test plan
uv sync --locked --extra dev --extra allsucceeds locally (lock in sync)uv run pytest tests/unit— 499 passed locally🤖 Generated with Claude Code