uv/crates/uv-python
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
..
python Block Python <3.7 not only on linux (#7266) 2024-09-10 15:15:41 -05:00
src Support pre-releases in Python version requests - command --python <major.minor.pre-release> (#7335) 2024-09-17 09:46:46 -05:00
Cargo.toml Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
download-metadata.json Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
fetch-download-metadata.py Add support for managed Python 3.13 and update CPython versions (#7263) 2024-09-10 14:36:16 -05:00
template-download-metadata.py Deprecate the --isolated flag (#5466) 2024-07-30 22:40:38 +00:00