Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should uv python install 3 install an alpha version? #12184

Open
bersbersbers opened this issue Mar 15, 2025 · 3 comments · May be fixed by #12194
Open

Should uv python install 3 install an alpha version? #12184

bersbersbers opened this issue Mar 15, 2025 · 3 comments · May be fixed by #12194
Assignees
Labels
bug Something isn't working

Comments

@bersbersbers
Copy link

Summary

Because it does:

'uv' (0.6.6) was installed successfully!

>uv python install 3    
cpython-3.14.0a5-windows-x86_64-none ------------------------------ 2.11 MiB/20.26 MiB                                                            

Platform

Windows 11

Version

0.6.6

Python version

No response

@bersbersbers bersbersbers added the bug Something isn't working label Mar 15, 2025
@charliermarsh
Copy link
Member

Hmm. Probably not, no.

@zanieb
Copy link
Member

zanieb commented Mar 15, 2025

Huh, that's surprising.

@zanieb
Copy link
Member

zanieb commented Mar 15, 2025

I think the logic isn't quite right

/// Construct a new [`PythonDownloadRequest`] from a [`PythonRequest`] if possible.
///
/// Returns [`None`] if the request kind is not compatible with a download, e.g., it is
/// a request for a specific directory or executable name.
pub fn from_request(request: &PythonRequest) -> Option<Self> {
match request {
PythonRequest::Version(version) => Some(Self::default().with_version(version.clone())),

// If we don't allow pre-releases, don't match a key with a pre-release tag
if !self.allows_prereleases() && key.prerelease.is_some() {
return false;
}

/// Whether this download request opts-in to pre-release Python versions.
pub fn allows_prereleases(&self) -> bool {
self.prereleases.unwrap_or_else(|| {
self.version
.as_ref()
.is_some_and(VersionRequest::allows_prereleases)
})
}

/// Whether this request should allow selection of pre-release versions.
pub(crate) fn allows_prereleases(&self) -> bool {
match self {
Self::Default => false,
Self::Any => true,
Self::Major(..) => true,
Self::MajorMinor(..) => true,
Self::MajorMinorPatch(..) => true,
Self::MajorMinorPrerelease(..) => true,
Self::Range(specifiers, _) => specifiers.iter().any(VersionSpecifier::any_prerelease),
}
}

We'll want to try to apply

diff --git a/crates/uv-python/src/discovery.rs b/crates/uv-python/src/discovery.rs
index b5a4972d6..1aa58c20e 100644
--- a/crates/uv-python/src/discovery.rs
+++ b/crates/uv-python/src/discovery.rs
@@ -2275,9 +2275,9 @@ impl VersionRequest {
         match self {
             Self::Default => false,
             Self::Any => true,
-            Self::Major(..) => true,
-            Self::MajorMinor(..) => true,
-            Self::MajorMinorPatch(..) => true,
+            Self::Major(..) => false,
+            Self::MajorMinor(..) => false,
+            Self::MajorMinorPatch(..) => false,
             Self::MajorMinorPrerelease(..) => true,
             Self::Range(specifiers, _) => specifiers.iter().any(VersionSpecifier::any_prerelease),
         }

but we still want uv python install 3.14 to work so we'll need to implement logic for downloads like this existing pattern for discovery

// If we only found pre-releases, they're implicitly allowed and we should return the first one.
if let Some(installation) = first_prerelease {
return Ok(Ok(installation));
}

@zanieb zanieb self-assigned this Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants