uv/crates/uv-python/src
Mikko Leppänen bb0ffa32e4
Support pre-releases in Python version requests - command --python <major.minor.pre-release> (#7335)
## Summary

This PR adds support to include Python pre-releases when requesting
versions.
Check out the docs for commands that support the `Python` option: 
```text
--python, -p python
The Python interpreter to use for the virtual environment.
```
At least the following scenarios are supported:
```bash
3.13.0a1
3.13b2
3.13rc4
313rc1
```

## Test Plan

I added a basic unit test to `uv/crates/uv-python/src/discovery.rs`. I
could have added more, but I have not discovered any relevant places.

CI passes

Note: I was unable to execute the entire test set locally. There were at
least some timeout issues (some tests took over 60 seconds).

========== output ===========
beta version
```bash
cargo run -- venv --python 3.13.0b3                                                                                                           ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/uv venv --python 3.13.0b3`
Using Python 3.13.0b3 interpreter at: /home/mikko/.pyenv/versions/3.13.0b3/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
````
release candidate
```bash
 cargo run -- venv --python 3.13.0rc2                                                                                                          ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.83s
     Running `target/debug/uv venv --python 3.13.0rc2`
Using Python 3.13.0rc2 interpreter at: /home/mikko/.pyenv/versions/3.13.0rc2/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

```bash
cargo run -- venv --python 313rc2                                                                                                             ░▒▓ 94% 󰁹
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
     Running `target/debug/uv venv --python 313rc2`
Using Python 3.13.0rc2 interpreter at: /home/mikko/.pyenv/versions/3.13.0rc2/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
```

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-17 09:46:46 -05:00
..
discovery.rs Support pre-releases in Python version requests - command --python <major.minor.pre-release> (#7335) 2024-09-17 09:46:46 -05:00
downloads.inc Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
downloads.inc.mustache Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
downloads.rs Include pre-release Python versions in uv python list (#7290) 2024-09-11 14:46:16 -05:00
environment.rs Direct users towards uv venv to create a virtual environment (#7188) 2024-09-08 22:33:34 +00:00
implementation.rs Use max rather than min to sort managed Pythons (#5205) 2024-07-19 12:35:17 +00:00
installation.rs Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
interpreter.rs Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
lib.rs Include the parent interpreter in Python discovery when --system is used (#7440) 2024-09-16 22:51:50 -05:00
libc.rs Detect musl and error for musl pbs builds (#6643) 2024-08-27 00:06:53 +00:00
managed.rs Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
microsoft_store.rs Discover Microsoft Store Pythons (#6807) 2024-08-29 20:56:41 +00:00
platform.rs Detect musl and error for musl pbs builds (#6643) 2024-08-27 00:06:53 +00:00
pointer_size.rs Change "toolchain" to "python" (#4735) 2024-07-03 07:44:29 -05:00
prefix.rs Initialize all --prefix subdirectories (#4895) 2024-07-08 14:15:25 +00:00
py_launcher.rs Clearer registry Python sort (#7178) 2024-09-07 15:57:01 -04:00
python_version.rs Drop Python version range enforcement from PythonVersion::from_str (#7264) 2024-09-10 13:34:18 -05:00
target.rs Change "toolchain" to "python" (#4735) 2024-07-03 07:44:29 -05:00
version_files.rs Surface dedicated errors for .python-version conflict with requires-python (#7218) 2024-09-09 17:12:53 -04:00
virtualenv.rs Avoid removing seed packages for uv venv --seed environments (#7410) 2024-09-15 22:27:52 +00:00
which.rs Search for all python3.x in PATH (#5148) 2024-07-18 17:00:01 +02:00