mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Allow users to incorporate Git tags into dynamic cache keys (#8259)
## Summary You can now use `cache-keys = [{ git = { commit = true, tags = true } }]` to include both the current commit and set of tags in the cache key. Closes https://github.com/astral-sh/uv/issues/7866. Closes https://github.com/astral-sh/uv/issues/7997.
This commit is contained in:
parent
6a81d302bb
commit
7730861bc5
8 changed files with 290 additions and 116 deletions
|
@ -330,9 +330,9 @@ Note that the use of globs can be expensive, as uv may need to walk the filesyst
|
|||
determine whether any files have changed.
|
||||
|
||||
Cache keys can also include version control information. For example, if a project uses
|
||||
`setuptools_scm` to read its version from a Git tag, you can specify `cache-keys = [{ git = true }, { file = "pyproject.toml" }]`
|
||||
`setuptools_scm` to read its version from a Git commit, you can specify `cache-keys = [{ git = { commit = true }, { file = "pyproject.toml" }]`
|
||||
to include the current Git commit hash in the cache key (in addition to the
|
||||
`pyproject.toml`).
|
||||
`pyproject.toml`). Git tags are also supported via `cache-keys = [{ git = { commit = true, tags = true } }]`.
|
||||
|
||||
Cache keys only affect the project defined by the `pyproject.toml` in which they're
|
||||
specified (as opposed to, e.g., affecting all members in a workspace), and all paths and
|
||||
|
@ -348,13 +348,13 @@ globs are interpreted as relative to the project directory.
|
|||
|
||||
```toml
|
||||
[tool.uv]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "requirements.txt" }, { git = true }]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "requirements.txt" }, { git = { commit = true }]
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "requirements.txt" }, { git = true }]
|
||||
cache-keys = [{ file = "pyproject.toml" }, { file = "requirements.txt" }, { git = { commit = true }]
|
||||
```
|
||||
|
||||
---
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue