Add support for Python version requests in uv python list (#12375)

Allows `uv python list <request>` to filter the installed list. I often
want this and it's not hard to add.

I tested the remote download filtering locally (#12381 is needed for
snapshot tests)

```
❯ cargo run -q -- python list --all-versions 3.13
cpython-3.13.2-macos-aarch64-none    <download available>
cpython-3.13.1-macos-aarch64-none    /opt/homebrew/opt/python@3.13/bin/python3.13 -> ../Frameworks/Python.framework/Versions/3.13/bin/python3.13
cpython-3.13.1-macos-aarch64-none    <download available>
cpython-3.13.0-macos-aarch64-none    /Users/zb/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/bin/python3.13
❯ cargo run -q -- python list --all-versions 3.13 --only-installed
cpython-3.13.1-macos-aarch64-none    /opt/homebrew/opt/python@3.13/bin/python3.13 -> ../Frameworks/Python.framework/Versions/3.13/bin/python3.13
cpython-3.13.0-macos-aarch64-none    /Users/zb/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/bin/python3.13
```
This commit is contained in:
Zanie Blue
2025-03-22 22:13:58 -05:00
committed by GitHub
parent cdd6de555b
commit ec499807f8
7 changed files with 199 additions and 15 deletions
+12
View File
@@ -173,6 +173,18 @@ To list installed and available Python versions:
$ uv python list
```
To filter the Python versions, provide a request, e.g., to show all Python 3.13 interpreters:
```console
$ uv python list 3.13
```
Or, to show all PyPy interpreters:
```console
$ uv python list pypy
```
By default, downloads for other platforms and old patch versions are hidden.
To view all versions: