mirror of
https://github.com/astral-sh/uv
synced 2026-01-22 05:50:25 -05:00
Prefer Python executable names that match the request over default names (#9066)
This restores behavior previously removed in https://github.com/astral-sh/uv/pull/7649. I thought it'd be clearer (and simpler) to have a consistent Python executable name ordering. However, we've seen some cases where this can be surprising and, in combination with #8481, can result in incorrect behavior. For example, see https://github.com/astral-sh/uv/issues/9046 where we prefer `python3` over `python3.12` in the same directory even though `python3.12` was requested. While `python3` and `python3.12` both point to valid Python 3.12 environments there, the expectation is that when `python3.12` is requested that the `python3.12` executable is preferred. This expectation may be less obvious if the user requests `python@3.12`, but uv does not distinguish between these request forms. Similarly, this may be surprising as by default uv prefers `python` over `python3` but when requesting `python3.12` the preference will be swapped.
This commit is contained in:
@@ -33,6 +33,10 @@ impl ImplementationName {
|
||||
["cpython", "pypy", "graalpy"].into_iter()
|
||||
}
|
||||
|
||||
pub(crate) fn iter_all() -> impl Iterator<Item = Self> {
|
||||
[Self::CPython, Self::PyPy, Self::GraalPy].into_iter()
|
||||
}
|
||||
|
||||
pub fn pretty(self) -> &'static str {
|
||||
match self {
|
||||
Self::CPython => "CPython",
|
||||
|
||||
Reference in New Issue
Block a user