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

use cache if available, but do not upload it #315

Open
Ben-grmbl opened this issue Mar 4, 2025 · 2 comments
Open

use cache if available, but do not upload it #315

Ben-grmbl opened this issue Mar 4, 2025 · 2 comments

Comments

@Ben-grmbl
Copy link

Is it possible to use an existing cache entry, if a matching one exist, but not upload any at the end, if there is none?

My use case:

  • a python project with multiple optional dependency groups
  • a matrix workflow that executes tests with multiple combinations of these optional dependencies

so for each matrix test, only certain dependencies are included with uv sync --extra ....

I want to cache only the version with all dependencies.

But depending on which workflow finishes first, after the lock file changes, that workflow's subset of features will be uploaded

I could of course execute uv sync --all-extras after the tests, but that seems wasteful.

Is there a way to disable uploading the new cache for specific cases?

@eifinger
Copy link
Collaborator

eifinger commented Mar 4, 2025

I see two options to achieve this with the existing functionality:

Option 1 - Populate cache job

Run a job which uses setup-uv and calls uv sync --all-extras. Make all other jobs you mention above dependant on that job so you know the full cache is available.

Option 2 - Upload distinct caches per dependency group "set"

Use cache-suffix to add a unique identifier for each sets of dependencies included in the up-/downloaded cache.

Option 1 should suite your described needs.

@Ben-grmbl
Copy link
Author

Thanks for your help!

Option 2 is what I currently use, but it causes a lot of distinct cache entries.

Option 1 I was trying to avoid so far - there are a lot of large dependencies, and even with uv and caching, it takes some time to sync them. I'll see whether I can somehow refactor it so one of the tests always runs first, unless I can come up with a better idea

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

2 participants