uv/crates/uv-configuration/src
Charlie Marsh 4f2349119c
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.
2024-09-09 20:19:15 +00:00
..
authentication.rs Retain and respect settings in tool upgrades (#5937) 2024-08-09 18:21:49 +00:00
build_options.rs Show build output by default in `uv build` (#6912) 2024-09-04 15:39:21 +00:00
concurrency.rs Add `UV_CONCURRENT_INSTALLS` variable in favor of `RAYON_NUM_THREADS` (#3646) 2024-05-17 23:12:37 -04:00
config_settings.rs Add support for dynamic cache keys (#7136) 2024-09-09 20:19:15 +00:00
constraints.rs Remove uses of `Option<MarkerTree>` (#5978) 2024-08-10 13:23:29 -04:00
export_format.rs Add `uv export --format requirements.txt` (#6778) 2024-08-29 17:46:42 +00:00
extras.rs Move extra specification into `uv-configuration` (#3897) 2024-05-29 04:49:57 +00:00
hash.rs Implement a `--verify-hashes` hash-checking mode (#4007) 2024-07-17 21:25:31 +00:00
install_options.rs Add `--no-emit-project` and friends to `uv export` (#7110) 2024-09-06 01:01:46 +00:00
lib.rs Add `uv export --format requirements.txt` (#6778) 2024-08-29 17:46:42 +00:00
name_specifiers.rs Add `--no-build`, `--no-build-package`, and binary variants (#4322) 2024-06-14 04:05:00 +00:00
overrides.rs Remove uses of `Option<MarkerTree>` (#5978) 2024-08-10 13:23:29 -04:00
package_options.rs Add support for dynamic cache keys (#7136) 2024-09-09 20:19:15 +00:00
preview.rs Add preview mode and use for warning in `uv run` (#3192) 2024-04-22 15:41:15 -05:00
sources.rs Retain and respect settings in tool upgrades (#5937) 2024-08-09 18:21:49 +00:00
target_triple.rs Add 32-bit Windows target (#6252) 2024-08-20 14:06:25 +00:00
trusted_host.rs Accept either strings or structs for hosts (#6763) 2024-08-28 16:36:12 +00:00