Repository navigation
Conversation
256188c to
574d8bd
Compare
574d8bd to
a549bcc
Compare
Merging this PR will degrade performance by 10.06%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | resolve_warm_jupyter_universal |
11.6 ms | 12.9 ms | -10.06% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing zb/uv-download-packed (a4c397e) with main (4efeeaf)
Footnotes
-
35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
c4e9b61 to
7039897
Compare
7039897 to
f4d6f09
Compare
f4d6f09 to
ab50923
Compare
bdc7dae to
8e18488
Compare
a447c47 to
fdce25e
Compare
| write_atomic( | ||
| self.entry.path(), | ||
| rmp_serde::to_vec_named(&LocalPointer { timestamp, archive })?, | ||
| ) | ||
| .await?; | ||
| Ok(true) |
There was a problem hiding this comment.
[P2] Connect local packed archives to preparation
Local wheels and sdists are copied here and reported as downloaded, but LocalPointer is read only by download_local. Installation and metadata loading still use load_wheel, wheel_metadata_local, and archive_revision, which require the original file. Removing or unmounting that file after uv download therefore makes offline installation fail despite the packed copy. Add a local packed-cache reader to those consumers and cover downloading followed by removal of the original archive.
| let zstd = fs_err::read( | ||
| context | ||
| .workspace_root | ||
| .join("test/links/basic_package-0.1.0-py3-none-any.whl.tar.zst"), | ||
| )?; |
There was a problem hiding this comment.
[P2] Update the offline test for the current wheel format
The referenced .whl.tar.zst fixture does not exist in this checkout, so this test returns an I/O error before exercising download. Restoring the file alone would not fix it: WheelWire deliberately ignores deprecated zstd metadata, so the manifest produces three artifacts, not the asserted four. Remove the compressed-wheel fixture, mock, and cache assertions and update the counts while retaining the incompatible-wheel and sdist coverage.
| pub struct LockedArtifact { | ||
| pub index: Option<IndexUrl>, | ||
| pub cache_key: String, | ||
| pub url: DisplaySafeUrl, |
There was a problem hiding this comment.
[P3] Keep artifact identity structured across the cache boundary
LockedArtifact discards the wheel filename or source version/format in favor of a packed-cache key. Producers and consumers must then independently pair the index with the correct key recipe, including remembering when a source key needs a version. The shared formatting helpers do not enforce that relationship. Return a structured wheel/source artifact kind and derive its key in PackedArchiveEntry constructors, keeping cache identity rules owned by the cache implementation.
fdce25e to
3dea7ca
Compare
| uv_snapshot!(context.filters(), context.sync() | ||
| .args(["--frozen", "--offline", "--reinstall", "--no-build", "--no-binary-package", "basic-package"]), @" |
There was a problem hiding this comment.
[P3] Verify that CI pruning retains the built wheel
--no-binary-package basic-package overrides the global --no-build: BuildOptions::no_build_package returns false for this package. Consequently, this invocation can rebuild from the retained sdist if pruning deletes the built wheel; the fixture requires no build dependencies, so offline mode does not prevent that either. The snapshot therefore does not establish the built-wheel retention claimed by this test. Record the built wheel's path before pruning and assert that it survives, and remove the ineffective --no-build flag.
* Align packed distributions with cache conventions * Fix cache layout CI failures * Document packed cache layout --------- Co-authored-by: Zanie Blue <[email protected]>
a4c397e to
db9fd74
Compare
| let payload = client | ||
| .get_serde_with_retry(req, cache_entry, cache_control.clone(), &response_callback) | ||
| .await?; | ||
| if is_valid(&payload) { | ||
| return Ok(payload); |
There was a problem hiding this comment.
[P2] Invalidate packed pointers after preparation refreshes
A successful origin fetch here updates the prepared cache without invalidating the older packed pointer; revision-checked invalidation currently runs only in the metadata paths. For example, after downloading a mutable wheel URL, a newer lockfile can change its hash and uv sync --frozen --refresh successfully prepare the replacement. A subsequent unrefreshed metadata lookup still prefers the old packed wheel while its policy remains fresh, resolving the old dependencies. Apply the existing revision-checked invalidation to successful origin refreshes during preparation, distinguishing those from cache hits and packed responses. Extend the preparation-refresh test with changed wheel metadata and a subsequent unrefreshed lookup.
Add a preview
uv downloadcommand that reads the existinguv.lockand stores every recorded wheel and source archive, across platforms, in a packed cache without resolving, unpacking, or building packages. Distribution and wheel-metadata readers can consume these archives during later operations, including with--offline.The intent is to separate fetching distributions from preparing them for installation. Today, downloading generally means unpacking into uv's installation-oriented cache, coupling network access to preparation. A separate command lets users fetch everything while online, then install or build later without needing the network or executing build backends during the download phase.
Command semantics
uv downloadtreats the existinguv.lockas an artifact manifest:Normal
uv syncwouldn't start downloading every platform's wheels or retaining packed copies.Cache design
The prototype adds a separate
packed-v1bucket using the same source and normalized-package shards as the wheel cache. Archive payloads and their pointers are flat siblings within each package shard:The SHA-256-named file contains the original archive bytes.
.httpentries retain the HTTP cache policy and point to that payload; local files use timestamped.revpointers. Downloads go through a temporary file, verify any lockfile hash and size, then publish the pointer last. Later reads recheck the stored bytes;--refreshand package-scoped cache cleanup are supported.When installation needs an archive, it can use the packed copy instead of fetching it. Preparation still populates the usual unpacked or built-wheel cache, so unpacking is deferred rather than eliminated and both representations can exist.
Where the prototype takes a shortcut
The current read-side integration adapts a packed file into an HTTP response. That lets the existing wheel and sdist extraction callbacks consume it with relatively little change while retaining the saved cache policy for remote artifacts. Wheel metadata also has a direct packed-file reader, avoiding network metadata requests.
The adapter still performs streamed unpacking, just from disk. An upstream implementation could instead use an explicit file-backed artifact input shared by the wheel and sdist preparation paths, keeping packed-cache policy separate from HTTP caching and allowing consumers to use seekable local archive readers directly.
Boundaries
This makes installation from an unchanged lockfile possible offline; it isn't a complete offline repository mirror. It doesn't fetch Git checkouts, replace local source trees, or discover build dependencies missing from the lockfile.
The principal costs are downloading potentially many platform variants, retaining a second representation after unpacking, and the prototype's full-file integrity pass before each packed read.
Follow-ups
--dry-runtouv download#876uv download#877uv download#878uv download#879--output-dirinuv build#880