Skip to content

Commit 77d278f

Browse files
authored
Avoid selecting pre-releases for Python downloads without a version request (#7278)
Following #7263 the 3.13.0rc2 releases are at the top of the download list but we should not select them unless 3.13 is actually requested. Prior to this, `uv python install` would install `3.13.0rc2`. ``` ❯ cargo run -- python install --no-config Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s Running `target/debug/uv python install --no-config` Searching for Python installations Installed Python 3.12.6 in 1.33s + cpython-3.12.6-macos-aarch64-none ``` ``` ❯ cargo run -- python install --no-config 3.13 Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s Running `target/debug/uv python install --no-config 3.13` Searching for Python versions matching: Python 3.13 Installed Python 3.13.0rc2 in 1.18s + cpython-3.13.0rc2-macos-aarch64-none ```
1 parent f5891e3 commit 77d278f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/uv-python/src/downloads.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ impl PythonDownloadRequest {
225225
.filter(move |download| self.satisfied_by_download(download))
226226
}
227227

228+
/// Whether this request is satisfied by the key of an existing installation.
228229
pub fn satisfied_by_key(&self, key: &PythonInstallationKey) -> bool {
229230
if let Some(arch) = &self.arch {
230231
if key.arch != *arch {
@@ -254,7 +255,14 @@ impl PythonDownloadRequest {
254255
true
255256
}
256257

258+
/// Whether this request is satisfied by a Python download.
259+
///
260+
/// Note that unlike [`Self::satisfied_by_key`], this method will not match a pre-release
261+
/// unless a version is included in the request.
257262
pub fn satisfied_by_download(&self, download: &ManagedPythonDownload) -> bool {
263+
if self.version.is_none() && !download.key().prerelease.is_empty() {
264+
return false;
265+
}
258266
self.satisfied_by_key(download.key())
259267
}
260268

0 commit comments

Comments
 (0)