From 0db1bf4df7cfff67a28c813a130945ee95356a18 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Fri, 7 Jun 2024 15:05:14 -0700 Subject: [PATCH] Avoid pre-fetching for unbounded minimum versions (#4149) ## Summary I think we should be able to model PubGrub such that this isn't necessary (at least for the case described in the issue), but for now, let's just avoid attempting to build very old distributions in prefetching. Closes https://github.com/astral-sh/uv/issues/4136. --- crates/uv-resolver/src/resolver/batch_prefetch.rs | 3 ++- crates/uv-resolver/src/resolver/mod.rs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/uv-resolver/src/resolver/batch_prefetch.rs b/crates/uv-resolver/src/resolver/batch_prefetch.rs index 0368caba7..dce938e3e 100644 --- a/crates/uv-resolver/src/resolver/batch_prefetch.rs +++ b/crates/uv-resolver/src/resolver/batch_prefetch.rs @@ -132,7 +132,8 @@ impl BatchPrefetcher { let CandidateDist::Compatible(dist) = candidate.dist() else { continue; }; - // Avoid building a lot of source distributions. + + // Avoid prefetching source distributions, which could be expensive. if !dist.prefetchable() { continue; } diff --git a/crates/uv-resolver/src/resolver/mod.rs b/crates/uv-resolver/src/resolver/mod.rs index ece717239..80bd0d4f3 100644 --- a/crates/uv-resolver/src/resolver/mod.rs +++ b/crates/uv-resolver/src/resolver/mod.rs @@ -3,6 +3,7 @@ use std::borrow::Cow; use std::collections::BTreeMap; use std::fmt::{Display, Formatter}; +use std::ops::Bound; use std::sync::Arc; use std::thread; @@ -1402,6 +1403,20 @@ impl ResolverState