Add parallel discovery of Python versions for uv python list#18684
Add parallel discovery of Python versions for uv python list#18684
uv python list#18684Conversation
crates/uv-python/src/discovery.rs
Outdated
| true | ||
| } | ||
|
|
||
| /// In test mode, change the source to `Managed` if a version was marked as such via |
There was a problem hiding this comment.
| /// In test mode, change the source to `Managed` if a version was marked as such via | |
| /// In test mode, change the source to [`PythonSource::Managed`] if a version was marked as such via |
crates/uv-python/src/discovery.rs
Outdated
| fn update_installation_source_for_tests(installation: &mut PythonInstallation) { | ||
| if std::env::var(uv_static::EnvVars::UV_INTERNAL__TEST_PYTHON_MANAGED).is_ok() | ||
| && installation.interpreter.is_managed() | ||
| { | ||
| installation.source = PythonSource::Managed; | ||
| } | ||
| } |
There was a problem hiding this comment.
Should we use #[must_use] add a with_source method that returns Self so we don't need a mut here?
crates/uv-python/src/discovery.rs
Outdated
| } | ||
|
|
||
| /// Check whether an installation satisfies the standard post-query discovery filters. | ||
| fn satisfies_discovery_filters( |
There was a problem hiding this comment.
| fn satisfies_discovery_filters( | |
| fn installation_satisfies_discovery_filters( |
crates/uv-python/src/discovery.rs
Outdated
| if !interpreter_satisfies_environment_preference( | ||
| installation.source, | ||
| &installation.interpreter, |
There was a problem hiding this comment.
Can interpreter_satisfies_environment_preference be installation_satisfies_environment_preference and not take the decomposed values?
There was a problem hiding this comment.
It seems like it could also be EnvironmentPreference.allows_installation(...)?
crates/uv-python/src/discovery.rs
Outdated
| let request = version.clone().into_request_for_source(installation.source); | ||
| if !request.matches_interpreter(&installation.interpreter) { | ||
| debug!( | ||
| "Skipping interpreter at `{}` from {}: does not satisfy request `{request}`", | ||
| installation.interpreter.sys_executable().user_display(), | ||
| installation.source, | ||
| ); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Should we abstract this with VersionRequest.matches_installation?
| } | ||
|
|
||
| /// Collect queried Python installations from executables, dropping non-critical discovery | ||
| /// errors. |
There was a problem hiding this comment.
We should have a comment linking to [iter_..]
crates/uv-python/src/discovery.rs
Outdated
|
|
||
| /// Find Python installations that satisfy the standard discovery filters, querying | ||
| /// interpreters concurrently. | ||
| fn find_matching_python_installations( |
There was a problem hiding this comment.
| fn find_matching_python_installations( | |
| fn find_all_matching_python_installations( |
crates/uv-python/src/discovery.rs
Outdated
|
|
||
| /// Create a [`PythonInstallation`] from a Python interpreter path. | ||
| fn python_installation_from_executable( | ||
| fn python_installation_from_provided_executable( |
There was a problem hiding this comment.
This method seems useless, we should just inline usage
crates/uv-python/src/discovery.rs
Outdated
| if !preference.allows_source(PythonSource::ProvidedPath) { | ||
| return Err(Error::SourceNotAllowed( | ||
| request.clone(), | ||
| PythonSource::ProvidedPath, | ||
| preference, | ||
| )); | ||
| } |
There was a problem hiding this comment.
Could this be moved to preference.check_allows_request_source -> Result<(), Err)? so we can reuse it outside the match instead now that it's repeated?
No description provided.