mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Add support for dynamic cache keys (#7136)
## Summary This PR adds a more flexible cache invalidation abstraction for uv, and uses that new abstraction to improve support for dynamic metadata. Specifically, instead of relying solely on a timestamp, we now pass around a `CacheInfo` struct which (as of now) contains `Option<Timestamp>` and `Option<Commit>`. The `CacheInfo` is saved in `dist-info` as `uv_cache.json`, so we can test already-installed distributions for cache validity (along with testing _cached_ distributions for cache validity). Beyond the defaults (`pyproject.toml`, `setup.py`, and `setup.cfg` changes), users can also specify additional cache keys, and it's easy for us to extend support in the future. Right now, cache keys can either be instructions to include the current commit (for `setuptools_scm` and similar) or file paths (for `hatch-requirements-txt` and similar): ```toml [tool.uv] cache-keys = [{ file = "requirements.txt" }, { git = true }] ``` This change should be fully backwards compatible. Closes https://github.com/astral-sh/uv/issues/6964. Closes https://github.com/astral-sh/uv/issues/6255. Closes https://github.com/astral-sh/uv/issues/6860.
This commit is contained in:
parent
9a7262c360
commit
4f2349119c
47 changed files with 1036 additions and 206 deletions
|
@ -27,4 +27,4 @@ serde = { workspace = true }
|
|||
thiserror = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
url = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue