uv/crates
Zanie Blue 0dea932d83
Improve Python executable name discovery when using alternative implementations (#7649)
There are two parts to this. 

The first is a restructuring and refactoring. We had some debt around
expected executable name generation, which we address here by
consolidating into a single function that generates a combination of
names. This includes a bit of extra code around free-threaded variants
because this was written on top of #7431 — I'll rebase that on top of
this.

The second addresses some bugs around alternative implementations.
Notably, `uv python list` does not discovery executables with
alternative implementation names. Now, we properly generate all of the
executable names for `VersionRequest::Any` (originally implemented in
https://github.com/astral-sh/uv/pull/7508) to properly show all the
implementations we can find:

```
❯ cargo run -q -- python list --no-python-downloads
cpython-3.12.6-macos-aarch64-none     /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
cpython-3.11.10-macos-aarch64-none    /opt/homebrew/opt/python@3.11/bin/python3.11 -> ../Frameworks/Python.framework/Versions/3.11/bin/python3.11
cpython-3.9.6-macos-aarch64-none      /Library/Developer/CommandLineTools/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3
pypy-3.10.14-macos-aarch64-none       /opt/homebrew/bin/pypy3 -> ../Cellar/pypy3.10/7.3.17/bin/pypy3
```

While doing both of these changes, I ended up changing the priority of
interpreter discovery slightly. For example, given that the executables
are in the same directory, do we query `python` or `python3.10` first
when you request `--python 3.10`? Previously, we'd check `python3.10`
but I think that was an incorrect optimization. I think we should always
prefer the bare name (i.e. `python`) first. Similarly, this applies to
`python` and an executable for an alternative implementation like
`pypy`. If it's not compatible with the request, we'll skip it anyway.
We might have to query more interpreters with this approach but it seems
rare.


Closes https://github.com/astral-sh/uv/issues/7286 superseding
https://github.com/astral-sh/uv/pull/7508
2024-09-23 17:17:55 -05:00
..
bench Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
cache-key Use hasher to compute resolution hash (#5495) 2024-07-26 23:24:09 +00:00
distribution-filename uv: migrate to rkyv 0.8 2024-09-18 14:49:54 -04:00
distribution-types Show a dedicated PubGrub hint for --unsafe-best-match (#7645) 2024-09-23 19:02:19 +00:00
install-wheel-rs Fix link-mode=clone on linux (#7620) 2024-09-22 13:40:52 -04:00
once-map Use FxHash in uv-auth (#6149) 2024-08-16 13:14:51 -04:00
pep440-rs uv: migrate to rkyv 0.8 2024-09-18 14:49:54 -04:00
pep508-rs Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
platform-tags Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
pypi-types uv: migrate to rkyv 0.8 2024-09-18 14:49:54 -04:00
requirements-txt Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv Remove double whitespaces from the code (#7623) 2024-09-23 20:15:06 +00:00
uv-auth Add only_authenticated option to the client (#7545) 2024-09-21 16:09:14 +02:00
uv-build Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-cache Heal cache entries with missing source distributions (#7559) 2024-09-19 20:31:55 +00:00
uv-cache-info Use globwalk for cache-keys matching (#7337) 2024-09-12 15:06:05 -04:00
uv-cli Remove double whitespaces from the code (#7623) 2024-09-23 20:15:06 +00:00
uv-client Add only_authenticated option to the client (#7545) 2024-09-21 16:09:14 +02:00
uv-configuration Add --no-editable support to uv sync and uv export (#7371) 2024-09-17 14:50:36 +00:00
uv-dev Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-dispatch Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-distribution Avoid validating workspace members when --no-sources is provided (#7599) 2024-09-20 19:03:31 +00:00
uv-extract Add support for remaining pip-supported file extensions (#7387) 2024-09-14 19:59:07 +00:00
uv-fs Do not error if the CACHEDIR.TAG file exists but cannot be written to (#7550) 2024-09-19 09:39:59 -05:00
uv-git Respect pyproject.toml credentials from user-provided requirements (#7474) 2024-09-17 15:09:11 -04:00
uv-installer Avoid removing seed packages for uv venv --seed environments (#7410) 2024-09-15 22:27:52 +00:00
uv-macros Autogenerate possible values for enums in reference documentation (#5137) 2024-07-17 12:37:33 -04:00
uv-metadata Avoid erroneous version warning for .dist-info (#7444) 2024-09-16 22:32:56 +00:00
uv-normalize uv: migrate to rkyv 0.8 2024-09-18 14:49:54 -04:00
uv-options-metadata Autogenerate possible values for enums in reference documentation (#5137) 2024-07-17 12:37:33 -04:00
uv-pubgrub chore: fix typos (#7366) 2024-09-13 16:25:19 +00:00
uv-python Improve Python executable name discovery when using alternative implementations (#7649) 2024-09-23 17:17:55 -05:00
uv-requirements Avoid unnecessary progress bar initializations (#7412) 2024-09-15 18:18:28 +00:00
uv-resolver Show a dedicated PubGrub hint for --unsafe-best-match (#7645) 2024-09-23 19:02:19 +00:00
uv-scripts Avoid writing invalid PEP 723 scripts on tool.uv.sources (#6706) 2024-08-27 17:49:08 +00:00
uv-settings Add a --project argument to run a command from a project (#7603) 2024-09-21 20:19:49 +00:00
uv-shell Expand tildes when matching against PATH (#6829) 2024-08-29 19:50:09 +00:00
uv-state Migrate to XDG and Linux strategy for macOS directories (#5806) 2024-08-20 11:31:46 -05:00
uv-tool Improve invalid environment warning messages (#7544) 2024-09-19 09:11:17 -05:00
uv-trampoline Update Rust crate thiserror to v1.0.64 (#7630) 2024-09-22 22:33:03 -04:00
uv-types Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-version Bump version to v0.4.15 (#7612) 2024-09-21 09:01:20 -04:00
uv-virtualenv Use more verbose spelling of "virtualenv" during creation (#7523) 2024-09-18 21:22:37 -05:00
uv-warnings Upgrade to Rust 1.80.0 (#5472) 2024-07-27 01:49:47 +00:00
uv-workspace Avoid adding double-newlines for CRLF (#7640) 2024-09-23 13:58:24 +00:00
README.md Use prettier to format the documentation (#5708) 2024-08-02 08:58:31 -05:00

Crates

bench

Functionality for benchmarking uv.

cache-key

Generic functionality for caching paths, URLs, and other resources across platforms.

distribution-filename

Parse built distribution (wheel) and source distribution (sdist) filenames to extract structured metadata.

distribution-types

Abstractions for representing built distributions (wheels) and source distributions (sdists), and the sources from which they can be downloaded.

install-wheel-rs

Install built distributions (wheels) into a virtual environment.]

once-map

A waitmap-like concurrent hash map for executing tasks exactly once.

pep440-rs

Utilities for interacting with Python version numbers and specifiers.

pep508-rs

Utilities for interacting with PEP 508 dependency specifiers.

platform-host

Functionality for detecting the current platform (operating system, architecture, etc.).

platform-tags

Functionality for parsing and inferring Python platform tags as per PEP 425.

uv

Command-line interface for the uv package manager.

uv-build

A PEP 517-compatible build frontend for uv.

uv-cache

Functionality for caching Python packages and associated metadata.

uv-client

Client for interacting with PyPI-compatible HTTP APIs.

uv-dev

Development utilities for uv.

uv-dispatch

A centralized struct for resolving and building source distributions in isolated environments. Implements the traits defined in uv-types.

uv-distribution

Client for interacting with built distributions (wheels) and source distributions (sdists). Capable of fetching metadata, distribution contents, etc.

uv-extract

Utilities for extracting files from archives.

uv-fs

Utilities for interacting with the filesystem.

uv-git

Functionality for interacting with Git repositories.

uv-installer

Functionality for installing Python packages into a virtual environment.

uv-python

Functionality for detecting and leveraging the current Python interpreter.

uv-normalize

Normalize package and extra names as per Python specifications.

uv-package

Types and functionality for working with Python packages, e.g., parsing wheel files.

uv-requirements

Utilities for reading package requirements from pyproject.toml and requirements.txt files.

uv-resolver

Functionality for resolving Python packages and their dependencies.

uv-shell

Utilities for detecting and manipulating shell environments.

uv-types

Shared traits for uv, to avoid circular dependencies.

pypi-types

General-purpose type definitions for types used in PyPI-compatible APIs.

uv-virtualenv

A venv replacement to create virtual environments in Rust.

uv-warnings

User-facing warnings for uv.

uv-workspace

Workspace abstractions for uv.

requirements-txt

Functionality for parsing requirements.txt files.