Using uvx in GitHub Actions in a cache-friendly way

Simon Willison has published a method to cache Python tools invoked via uvx within GitHub Actions workflows. He recommends setting the UV_EXCLUDE_NEWER…

By Vane July 14, 2026 1 min read

Simon Willison has published a method to cache Python tools invoked via uvx within GitHub Actions workflows. He recommends setting the UV_EXCLUDE_NEWER environment variable to a specific date, such as 2026-07-12, at the start of the process. This configuration forces the uvx command to resolve to the most recent tool version available as of that date. The workflow then includes this date as part of the GitHub Actions cache key. Developers can update the tools by simply bumping the date value in a future run.

This approach prevents every workflow execution from fetching a fresh copy of the tool and its dependencies from PyPI. It reduces network traffic and speeds up build times for teams relying on Python utilities in their CI pipelines. The technique offers a practical alternative to managing full virtual environments for every action step.

* The cache key changes only when the date variable is updated.
* Existing tools remain pinned to the release state from the chosen date.
* No full virtual environment needs to be created for each run.

Scroll to Top