Use windows registry to discover python (#6761)
Our current strategy of parsing the output of `py --list-paths` to get the installed python versions on windows is brittle (#6524, missing `py`, etc.) and it's slow (10ms last time i measured). Instead, we should behave spec-compliant and read the python versions from the registry following PEP 514. It's not fully clear which errors we should ignore and which ones we need to raise. We're using the official rust-for-windows crates for accessing the registry. Fixes #1521 Fixes #6524
This commit is contained in:
@@ -169,8 +169,8 @@ When searching for a Python version, the following locations are checked:
|
||||
- Managed Python installations in the `UV_PYTHON_INSTALL_DIR`.
|
||||
- A Python interpreter on the `PATH` as `python`, `python3`, or `python3.x` on macOS and Linux, or
|
||||
`python.exe` on Windows.
|
||||
- On Windows, the Python interpreter returned by `py --list-paths` that matches the requested
|
||||
version.
|
||||
- On Windows, the Python interpreters in the Windows registry and Microsoft Store Python
|
||||
interpreters (see `py --list-paths`) that match the requested version.
|
||||
|
||||
In some cases, uv allows using a Python version from a virtual environment. In this case, the
|
||||
virtual environment's interpreter will be checked for compatibility with the request before
|
||||
|
||||
Reference in New Issue
Block a user