diff --git a/crates/uv/src/commands/project/lock.rs b/crates/uv/src/commands/project/lock.rs index b966313c1..7b5a0f1f8 100644 --- a/crates/uv/src/commands/project/lock.rs +++ b/crates/uv/src/commands/project/lock.rs @@ -3,7 +3,7 @@ use anstream::eprint; use distribution_types::{IndexLocations, UnresolvedRequirementSpecification}; use install_wheel_rs::linker::LinkMode; use uv_cache::Cache; -use uv_client::RegistryClientBuilder; +use uv_client::{FlatIndexClient, RegistryClientBuilder}; use uv_configuration::{ Concurrency, ConfigSettings, ExtrasSpecification, NoBinary, NoBuild, PreviewMode, Reinstall, SetupPyStrategy, Upgrade, @@ -155,7 +155,6 @@ pub(super) async fn do_lock( let concurrency = Concurrency::default(); let config_settings = ConfigSettings::default(); let extras = ExtrasSpecification::default(); - let flat_index = FlatIndex::default(); let in_flight = InFlight::default(); let index = InMemoryIndex::default(); let link_mode = LinkMode::default(); @@ -167,6 +166,13 @@ pub(super) async fn do_lock( let hasher = HashStrategy::Generate; let options = OptionsBuilder::new().exclude_newer(exclude_newer).build(); + // Resolve the flat indexes from `--find-links`. + let flat_index = { + let client = FlatIndexClient::new(&client, cache); + let entries = client.fetch(index_locations.flat_index()).await?; + FlatIndex::from_entries(entries, tags, &hasher, &no_build, &no_binary) + }; + // If an existing lockfile exists, build up a set of preferences. let LockedRequirements { preferences, git } = read_lockfile(workspace, &upgrade).await?; diff --git a/crates/uv/src/commands/project/mod.rs b/crates/uv/src/commands/project/mod.rs index 5c4f1fe80..0d73c64b3 100644 --- a/crates/uv/src/commands/project/mod.rs +++ b/crates/uv/src/commands/project/mod.rs @@ -45,6 +45,9 @@ pub(crate) enum ProjectError { #[error(transparent)] Tags(#[from] platform_tags::TagsError), + #[error(transparent)] + FlatIndex(#[from] uv_client::FlatIndexError), + #[error(transparent)] Lock(#[from] uv_resolver::LockError), diff --git a/crates/uv/src/commands/project/sync.rs b/crates/uv/src/commands/project/sync.rs index d81408465..113aead43 100644 --- a/crates/uv/src/commands/project/sync.rs +++ b/crates/uv/src/commands/project/sync.rs @@ -3,7 +3,7 @@ use anyhow::Result; use distribution_types::IndexLocations; use install_wheel_rs::linker::LinkMode; use uv_cache::Cache; -use uv_client::RegistryClientBuilder; +use uv_client::{FlatIndexClient, RegistryClientBuilder}; use uv_configuration::{ Concurrency, ConfigSettings, ExtrasSpecification, NoBinary, NoBuild, PreviewMode, Reinstall, SetupPyStrategy, @@ -116,7 +116,6 @@ pub(super) async fn do_sync( let concurrency = Concurrency::default(); let config_settings = ConfigSettings::default(); let dry_run = false; - let flat_index = FlatIndex::default(); let git = GitResolver::default(); let hasher = HashStrategy::default(); let in_flight = InFlight::default(); @@ -127,6 +126,13 @@ pub(super) async fn do_sync( let reinstall = Reinstall::default(); let setup_py = SetupPyStrategy::default(); + // Resolve the flat indexes from `--find-links`. + let flat_index = { + let client = FlatIndexClient::new(&client, cache); + let entries = client.fetch(index_locations.flat_index()).await?; + FlatIndex::from_entries(entries, tags, &hasher, &no_build, &no_binary) + }; + // Create a build dispatch. let build_dispatch = BuildDispatch::new( &client,