Skip to content

Commit

Permalink
Refactor uv python install (#8701)
Browse files Browse the repository at this point in the history
Pulling out of #8650 for
readability.

Trying to clean this up to simplify extensions in the future. This is
not a strict refactor, there are behavioral changes here.

- Adds some structs for managing state.
- Addresses some likely inconsistent behavior for weird edge-cases. 
- We fill platform information before checking if a request is
satisfied.
- We error earlier if we can't find a download for the request, i.e.,
even if you somehow have it installed.
- Only reports versions as uninstalled if a download actually replaces
them.
- Moves some of the default output to tracing messages.
- Even if an installation was already satisfied, we'll check that it is
setup properly
  • Loading branch information
zanieb authored Oct 30, 2024
1 parent bed47d5 commit 893257b
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 176 deletions.
4 changes: 2 additions & 2 deletions crates/uv-python/src/downloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub enum DownloadResult {
}

impl ManagedPythonDownload {
/// Return the first [`PythonDownload`] matching a request, if any.
/// Return the first [`ManagedPythonDownload`] matching a request, if any.
pub fn from_request(
request: &PythonDownloadRequest,
) -> Result<&'static ManagedPythonDownload, Error> {
Expand All @@ -433,7 +433,7 @@ impl ManagedPythonDownload {
.ok_or(Error::NoDownloadFound(request.clone()))
}

/// Iterate over all [`PythonDownload`]'s.
/// Iterate over all [`ManagedPythonDownload`]s.
pub fn iter_all() -> impl Iterator<Item = &'static ManagedPythonDownload> {
PYTHON_DOWNLOADS
.iter()
Expand Down
Loading

0 comments on commit 893257b

Please sign in to comment.