-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best practices for using uv's cache in CI / Github Actions? #2231
Comments
There is an issue on GitHub Action setup-python discussing this: actions/setup-python#822. They argue that the benefit of caching uv .cache folder depends. |
See also previous discussion at #1386 |
I made a composite action that sets up uv with optional caching, after piecing together all of the information in the various places about how to get things to work. https://github.com/drivendataorg/setup-python-uv-action It supports:
I'm reasonably confident all options should work across the different OS runners. Your mileage may vary on what actually saves time, depending on what your dependencies are. uv resolution and installation is so fast, that I've found the network speed to be the limiting factor in a lot of cases. Downloading from PyPI is often just as fast as loading a cache. Windows runners seem to have particularly bad cache performance so sometimes the cache is actually slower on Windows than downloading from PyPI. |
I've been playing with replacing pip with uv in our Gitlab CI pipeline, and it massively speeds up installing packages when you've got the cache. However, I've noticed that the uv cache is notably larger than the pip one (along with significantly more files), and the increase in Gitlab's cache time almost outweighs the shift to uv. Anyone else run into this? |
I recently just noticed that there's a 40GB |
(Can always |
Perhaps the best practice is now to use https://github.com/astral-sh/setup-uv |
👍 yeah we also documented best practices a while ago https://docs.astral.sh/uv/guides/integration/github/#caching |
Wondering if there's any advice or best practices starting to develop around how to (re)use and share the
uv
cache across multiple Github Actions runners?We repeat the same Python installations across multiple runners / OSes and Python versions. Previously we were taking advantage of Github Actions' caching to save us from redownloading packages, but not any more with
uv
as it it isn't clear how best to reuse the cache or to what extent that helps.The text was updated successfully, but these errors were encountered: