@@ -161,20 +161,7 @@ def propose_interpreters( # noqa: C901, PLR0912, PLR0915
161
161
tested_exes .add (exe_id )
162
162
yield interpreter , True
163
163
164
- # 4. otherwise try uv-managed python (~/.local/share/uv/python or platform equivalent)
165
- if uv_python_dir := os .getenv ("UV_PYTHON_INSTALL_DIR" ):
166
- uv_python_path = Path (uv_python_dir ).expanduser ()
167
- elif xdg_data_home := os .getenv ("XDG_DATA_HOME" ):
168
- uv_python_path = Path (xdg_data_home ).expanduser () / "uv" / "python"
169
- else :
170
- uv_python_path = user_data_path ("uv" ) / "python"
171
-
172
- for exe_path in uv_python_path .glob ("*/bin/python" ):
173
- interpreter = PathPythonInfo .from_exe (str (exe_path ), app_data , raise_on_error = False , env = env )
174
- if interpreter is not None :
175
- yield interpreter , True
176
-
177
- # finally just find on path, the path order matters (as the candidates are less easy to control by end user)
164
+ # try to find on path, the path order matters (as the candidates are less easy to control by end user)
178
165
find_candidates = path_exe_finder (spec )
179
166
for pos , path in enumerate (get_paths (env )):
180
167
LOGGER .debug (LazyPathDump (pos , path , env ))
@@ -188,6 +175,19 @@ def propose_interpreters( # noqa: C901, PLR0912, PLR0915
188
175
if interpreter is not None :
189
176
yield interpreter , impl_must_match
190
177
178
+ # otherwise try uv-managed python (~/.local/share/uv/python or platform equivalent)
179
+ if uv_python_dir := os .getenv ("UV_PYTHON_INSTALL_DIR" ):
180
+ uv_python_path = Path (uv_python_dir ).expanduser ()
181
+ elif xdg_data_home := os .getenv ("XDG_DATA_HOME" ):
182
+ uv_python_path = Path (xdg_data_home ).expanduser () / "uv" / "python"
183
+ else :
184
+ uv_python_path = user_data_path ("uv" ) / "python"
185
+
186
+ for exe_path in uv_python_path .glob ("*/bin/python" ):
187
+ interpreter = PathPythonInfo .from_exe (str (exe_path ), app_data , raise_on_error = False , env = env )
188
+ if interpreter is not None :
189
+ yield interpreter , True
190
+
191
191
192
192
def get_paths (env : Mapping [str , str ]) -> Generator [Path , None , None ]:
193
193
path = env .get ("PATH" , None )
0 commit comments