Open mgaitan opened 4 months ago
You could also just cache the uv cache directory, e.g.,
- uses: actions/cache@v4
id: cache-uv
with:
path: ~/.cache/uv
key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv
You could also just cache the uv cache directory, e.g.,
- uses: actions/cache@v4 id: cache-uv with: path: ~/.cache/uv key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv
I have just tested this solution and I think it is not worth using it when your requirements are large packages.
I've added the cache in my public playground with https://github.com/alice-biometrics/uv-playground/commit/14871e815ad18382fa238a89d8b896a19e67f080
And run a workflow to test what happens when run without cache: https://github.com/alice-biometrics/uv-playground/actions/runs/8046635708/job/21974
241996
surprisingly, the size of the cache is very large, so it takes a long time to save in the post-cache.
Then, I run it again to test how works with a saved cache: https://github.com/alice-biometrics/uv-playground/actions/runs/8046670133/job/21974345476
The installation time is extremely fast, however, it takes the same amount of time to retrieve the cache as it does to install in a fresh environment with uv.
Example of a workflow without uv cache: https://github.com/alice-biometrics/uv-playground/actions/runs/7986874748/job/21808164311
Heh, I actually wrote a PR that implements this (before this issue, to boot), but no actions/setup-python
maintainer seems to have seen it: https://github.com/actions/setup-python/pull/818
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've been playing with replacing
pip
withuv
in our Gitlab CI pipeline, and it massively speeds up installing packages when you've got the cache. However, I've noticed that theuv
cache is notably larger than thepip
one (along with significantly more files), and the increase in Gitlab's cache time almost outweighs the shift touv
. Anyone else run into this?
I think that's essentially the same that's reported in https://github.com/actions/setup-python/issues/822#issuecomment-1963717925
Description Hey there! I'm suggesting we add caching support for the uv package manager in setup-python.
uv
(uv pip
command currently) is a drop-in replace forpip
, usingrequirements.txt
or any other input file that pip supports for dependencies definitions. The only difference is its cache directory:setup-python
uses the output ofpip cache dir
to find the cache directory, butuv
usesuv cache dir
instead (see https://github.com/astral-sh/uv/pull/1734). It should be a straightforward addition that could help projects usinguv
.Justification uv is 10-100x faster than pip. There is a lot of interest from the community to use this new tool in CI environments (e.g https://github.com/astral-sh/uv/issues/1386)
Are you willing to submit a PR? Yep! Happy to help out and get my hands dirty with a PR to make this happen. However, I'm far of being a Typescript expert.