Skip to content

Commit 78f2876

Browse files
committed
Add documentation on cache versioning
1 parent f5601e2 commit 78f2876

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

docs/concepts/cache.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,25 @@ uv determines the cache directory according to, in order:
141141
It is important for performance for the cache directory to be located on the same file system as the
142142
Python environment uv is operating on. Otherwise, uv will not be able to link files from the cache
143143
into the environment and will instead need to fallback to slow copy operations.
144+
145+
## Cache versioning
146+
147+
The uv cache is composed of a number of buckets (e.g., a bucket for wheels, a bucket for source
148+
distributions, a bucket for Git repositories, and so on). Each bucket is versioned, such that if a
149+
release contains a breaking change to the cache format, uv will not attempt to read from or write to
150+
an incompatible cache bucket.
151+
152+
For example, uv 0.4.13 included a breaking change to the core metadata bucket. As such, the bucket
153+
version was increased from v12 to v13.
154+
155+
Within a cache version, changes are guaranteed to be forwards-compatible, but _not_
156+
backwards-compatible.
157+
158+
For example, uv 0.4.8 can read cache entries written by uv 0.4.7, but uv 0.4.7 cannot read cache
159+
entries written by uv 0.4.8. As a result, it's safe to share a cache directory across multiple uv
160+
versions, as long as those versions are strictly increasing over time, as is common in production
161+
and development environments.
162+
163+
If you intend to use multiple uv versions on an ongoing basis, we recommend using separate caches
164+
for each version, as (e.g.) a cache populated by uv 0.4.8 may not be usable by uv 0.4.7, despite the
165+
cache _versions_ remaining unchanged between the releases.

0 commit comments

Comments
 (0)