astral-sh / uv

An extremely fast Python package installer and resolver, written in Rust.
https://astral.sh/
Apache License 2.0
15.17k stars 437 forks source link

FR: (`uv venv`) add support for '-p 3.13t' as a shorthand for '-p 3.13*t' ? #4828

Open neutrinoceros opened 1 week ago

neutrinoceros commented 1 week ago

pyenv recently introduced free-threading variants for Python 3.13: https://github.com/pyenv/pyenv/pull/2995 https://github.com/pyenv/pyenv/pull/3001

Assuming I installed Python 3.13.0b3 (both variants) as:

pyenv install 3.13.0b3 3.13t-dev
pyenv local 3.13.0b3 3.13t-dev

and as of pyenv 2.4.4 + uv 0.2.21, the following invocations work:

$ python3.13 --version
Python 3.13.0b3

$ python3.13t --version
Python 3.13.0b3+

$ uv venv -p 3.13
Using Python 3.13.0b3 interpreter at: /Users/clm/.pyenv/versions/3.13.0b3/bin/python3.13
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate

$ uv venv -p python3.13
Using Python 3.13.0b3 interpreter at: /Users/clm/.pyenv/versions/3.13.0b3/bin/python3.13
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate

$ uv venv -p python3.13t
Using Python 3.13.0b3 interpreter at: /Users/clm/.pyenv/versions/3.13t-dev/bin/python3.13t
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate

but this one doesn't:

$ uv venv -p 3.13t
  × No interpreter found for executable name `3.13t` in system path

This is still fresh paint and not a well established naming convention yet, but since it's pushed in pyenv by PEP 703 author Sam Gross, maybe it's reasonable to support it already ? It certainly wasn't obvious to me that I could use uv venv -p python3.13t, and I discovered it by trial and error.

zanieb commented 1 week ago

Related https://github.com/astral-sh/uv/issues/4400

Agree we should add support for requesting free-threaded builds via shorthand.