Skip to content
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

Question: caching venv vs caching uv? #7

Open
tekumara opened this issue Jul 13, 2024 · 6 comments
Open

Question: caching venv vs caching uv? #7

tekumara opened this issue Jul 13, 2024 · 6 comments

Comments

@tekumara
Copy link

Given a venv can be cached directly, what are the advantages of caching the uv cache instead?

@hynek
Copy link
Owner

hynek commented Jul 22, 2024

This is an excellent and pertinent question, especially since Adam's https://adamj.eu/tech/2023/11/02/github-actions-faster-python-virtual-environments/ just popped up again with an update.

The question is especially interesting because at least for uv, the caching is actually slower than just creating/installing, except for cases like PyPy which led to #6. This is also why this project is still labelled "semi-experimental" and as such I welcome experiments from users like you!

I'm gonna say that the uv cache as used here is nicer for cases where you don't pin your in-dev dependencies (because, say, you don't have enough churn on your project and don't want your history consist solely of Dependabot updates) and still want a certain control over the cache handling.

@hynek hynek pinned this issue Jul 22, 2024
@albertotb
Copy link

albertotb commented Jul 22, 2024

There are some reports in this issue and associated PR, that you probably are already aware of: actions/setup-python#822
They suggest little to no improvement caching the uv folder. I've just wanted to link this here since I'm following this topic closely. Maybe caching the whole venv as Adam suggest is better, but I have not seen any example of that yet.

@henryiii
Copy link
Contributor

henryiii commented Jul 25, 2024

FYI, the latest release of uv (4 hours ago) has a really interesting cache-related option:

uv cache prune --ci

That removes the unpacked files, but leaves the compressed downloads. It's supposed to be good for CI caching. The venv as well as the raw uv cache have a lot of small files, which are much slower to cache.

@hynek
Copy link
Owner

hynek commented Jul 25, 2024

Unfortunately this is where the composite action approach hits a wall: https://github.com/orgs/community/discussions/26743#discussioncomment-3253195

Not sure it's worth learning TypeScript for now, but I'll try adding it to baipp: hynek/build-and-inspect-python-package#135

@henryiii
Copy link
Contributor

What about https://github.com/marketplace/actions/run-and-post-run-action ? That’s the suggestion at the end of that thread.

@hynek
Copy link
Owner

hynek commented Jul 26, 2024

What about https://github.com/marketplace/actions/run-and-post-run-action ? That’s the suggestion at the end of that thread.

nice! Add in #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants