The date that doubles as a cache key
One setting in a GitHub Actions build script both locks a Python tool to a cutoff date and labels the cache that stores it, so throwaway tool runs stop re-downloading packages on every build.
Continuous-integration jobs, the automated builds that rerun on every code change, usually re-download any throwaway Python tool they use — sqlite-utils, datasette, llm — from the Python package index every single time, because a one-off run has no lockfile, the exact list of tool versions a cache normally uses to label itself. Simon Willison's fix is one line. He sets uv's UV_EXCLUDE_NEWER to a date, which tells the installer to ignore anything published after it, and then reuses that same date string as the cache's identity.
Every guide for caching these tools identifies the cache by a version-lock file. This is the one case with no lockfile to identify it by.
The elegance is the double duty. UV_EXCLUDE_NEWER normally exists only for reproducibility: don't install a package newer than this day. Here the identical value also names the cache, so two concerns you would normally track in separate places collapse into one string. Bump the date and you get fresh versions plus a fresh cache in a single edit; leave it and every run is a cache hit that never touches the network. A belt-and-suspenders touch sets an offline flag on cache hits, so a run that secretly reached PyPI would fail loudly instead of quietly.
It is a narrow trick for a narrow audience: developers who invoke standalone tools with uvx inside GitHub Actions. But it is a clean gap-filler. Every standard method for caching these tools assumes you have a version-lock file to identify the cache by, and none of them cover the no-lockfile case this handles. The one reservation is age: the post is a day old, so the mechanism rests on setup-uv's documented cache behavior rather than on anyone else having reproduced it yet.
The whole workflow is one short YAML file on the TIL page; copy it, swap the date, and drop it into your own .github/workflows.
Open the repo at til.simonwillison.net →The lenses
The facts
Concepts
How this connects
Tap a node to open it