From 203594d48285d35074fc1fb7af7aa14c93992973 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 8 Nov 2025 22:45:46 -0500 Subject: [PATCH] Resolve commits --- .../uv-distribution/src/distribution_database.rs | 13 ++++++++----- crates/uv-distribution/src/remote.rs | 6 +++++- crates/uv-distribution/src/source/mod.rs | 13 ------------- .../anyio/anyio-4.11.0.post24-py3-none-any.whl | Bin .../anyio/anyio-4.11.0.post24.tar.gz | Bin .../anyio/index.html | 0 .../index.html | 0 7 files changed, 13 insertions(+), 19 deletions(-) rename server/v1/git/astral-sh/agronholm/anyio/{ => 64b753b19c9a49e3ae395cde457cf82d51f7e999}/anyio/anyio-4.11.0.post24-py3-none-any.whl (100%) rename server/v1/git/astral-sh/agronholm/anyio/{ => 64b753b19c9a49e3ae395cde457cf82d51f7e999}/anyio/anyio-4.11.0.post24.tar.gz (100%) rename server/v1/git/astral-sh/agronholm/anyio/{ => 64b753b19c9a49e3ae395cde457cf82d51f7e999}/anyio/index.html (100%) rename server/v1/git/astral-sh/agronholm/anyio/{ => 64b753b19c9a49e3ae395cde457cf82d51f7e999}/index.html (100%) diff --git a/crates/uv-distribution/src/distribution_database.rs b/crates/uv-distribution/src/distribution_database.rs index 4a6b3dead..60b1c1d9f 100644 --- a/crates/uv-distribution/src/distribution_database.rs +++ b/crates/uv-distribution/src/distribution_database.rs @@ -10,7 +10,7 @@ use tempfile::TempDir; use tokio::io::{AsyncRead, AsyncSeekExt, ReadBuf}; use tokio::sync::Semaphore; use tokio_util::compat::FuturesAsyncReadCompatExt; -use tracing::{Instrument, info_span, instrument, warn}; +use tracing::{Instrument, info_span, instrument, warn, debug}; use url::Url; use uv_cache::{ArchiveId, CacheBucket, CacheEntry, WheelCache}; @@ -543,6 +543,9 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { source: &BuildableSource<'_>, hashes: HashPolicy<'_>, ) -> Result { + // Resolve the source distribution to a precise revision (i.e., a specific Git commit). + self.builder.resolve_revision(source, &self.client).await?; + // If the metadata was provided by the user directly, prefer it. if let Some(dist) = source.as_dist() { if let Some(metadata) = self @@ -550,10 +553,6 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { .dependency_metadata() .get(dist.name(), dist.version()) { - // If we skipped the build, we should still resolve any Git dependencies to precise - // commits. - self.builder.resolve_revision(source, &self.client).await?; - return Ok(ArchiveMetadata::from_metadata23(metadata.clone())); } } @@ -606,11 +605,13 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { match compatible_dist { CompatibleDist::InstalledDist(..) => {} CompatibleDist::SourceDist { sdist, .. } => { + debug!("Found cached remote source distribution for: {dist}"); let dist = SourceDist::Registry(sdist.clone()); return self.build_wheel_inner(&dist, tags, hashes).await.map(Some); } CompatibleDist::CompatibleWheel { wheel, .. } | CompatibleDist::IncompatibleWheel { wheel, .. } => { + debug!("Found cached remote built distribution for: {dist}"); let dist = BuiltDist::Registry(RegistryBuiltDist { wheels: vec![wheel.clone()], best_wheel_index: 0, @@ -652,6 +653,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { match compatible_dist { CompatibleDist::InstalledDist(..) => {} CompatibleDist::SourceDist { sdist, .. } => { + debug!("Found cached remote source distribution for: {dist}"); let dist = SourceDist::Registry(sdist.clone()); return self .build_wheel_metadata_inner(&BuildableSource::Dist(&dist), hashes) @@ -660,6 +662,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { } CompatibleDist::CompatibleWheel { wheel, .. } | CompatibleDist::IncompatibleWheel { wheel, .. } => { + debug!("Found cached remote built distribution for: {dist}"); let dist = BuiltDist::Registry(RegistryBuiltDist { wheels: vec![wheel.clone()], best_wheel_index: 0, diff --git a/crates/uv-distribution/src/remote.rs b/crates/uv-distribution/src/remote.rs index ee38d5f2a..82de31f01 100644 --- a/crates/uv-distribution/src/remote.rs +++ b/crates/uv-distribution/src/remote.rs @@ -92,10 +92,14 @@ impl<'a, T: BuildContext> RemoteCacheResolver<'a, T> { return Ok(Vec::default()); }; + let Some(precise) = self.build_context.git().get_precise(&dist.git) else { + return Ok(Vec::default()); + }; + // Store the index entries in a cache, to avoid redundant fetches. let index = IndexUrl::from( VerbatimUrl::parse_url(format!( - "http://localhost:8000/v1/git/{workspace}/{}/{}", + "http://localhost:8000/v1/git/{workspace}/{}/{}/{precise}", repo.owner, repo.repo )) .unwrap(), diff --git a/crates/uv-distribution/src/source/mod.rs b/crates/uv-distribution/src/source/mod.rs index 6168ece03..93b68226c 100644 --- a/crates/uv-distribution/src/source/mod.rs +++ b/crates/uv-distribution/src/source/mod.rs @@ -1690,19 +1690,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> { .await { Ok(Some(precise)) => { - // STOPSHIP(charlie): Here, we should check if a pre-built wheel or source - // distribution exists in pyx. If a wheel exists, we can always get the PEP 653 - // metadata. - - // let result = self - // .client - // .managed(|client| { - // client - // .wheel_metadata(dist, self.build_context.capabilities()) - // .boxed_local() - // }) - // .await; - // There's no need to check the cache, since we can't use cached metadata if there are // sources, and we can't know if there are sources without fetching the // `pyproject.toml`. diff --git a/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24-py3-none-any.whl b/server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/anyio/anyio-4.11.0.post24-py3-none-any.whl similarity index 100% rename from server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24-py3-none-any.whl rename to server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/anyio/anyio-4.11.0.post24-py3-none-any.whl diff --git a/server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24.tar.gz b/server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/anyio/anyio-4.11.0.post24.tar.gz similarity index 100% rename from server/v1/git/astral-sh/agronholm/anyio/anyio/anyio-4.11.0.post24.tar.gz rename to server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/anyio/anyio-4.11.0.post24.tar.gz diff --git a/server/v1/git/astral-sh/agronholm/anyio/anyio/index.html b/server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/anyio/index.html similarity index 100% rename from server/v1/git/astral-sh/agronholm/anyio/anyio/index.html rename to server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/anyio/index.html diff --git a/server/v1/git/astral-sh/agronholm/anyio/index.html b/server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/index.html similarity index 100% rename from server/v1/git/astral-sh/agronholm/anyio/index.html rename to server/v1/git/astral-sh/agronholm/anyio/64b753b19c9a49e3ae395cde457cf82d51f7e999/index.html