uv icon indicating copy to clipboard operation
uv copied to clipboard

Make `uv venv` use the python version listed in `.python-version` if no `--python` is provided

Open jfcherng opened this issue 1 year ago • 3 comments

As the title. People can list multiple versions in the .python-version file too. The first matched one should be used.

E.g., with the following .python-version, 3.12 is preferred but 3.11 is fine as well.

3.12
3.11

It looks like uv project uses .python-versions (there is a trailing s somehow). pyenv uses .python-version.

jfcherng avatar Feb 22 '24 02:02 jfcherng

HI! That file is for internal development purposes – we need multiple specific Python versions to test this project.

We don't support .python-version markers at all. We definitely can consider it though.

zanieb avatar Feb 22 '24 04:02 zanieb

+1 for this. I have a use case where different branches are currently using different python version as part of a transition so using a versioned file to specify this would be great.

Thank you for this wonderful project!

liiight avatar Mar 04 '24 09:03 liiight

This becomes especially interesting in combination with https://github.com/astral-sh/uv/issues/2607

Spenhouet avatar Apr 20 '24 07:04 Spenhouet

Implemented in https://github.com/astral-sh/uv/pull/4335

konstin avatar Jul 01 '24 14:07 konstin

Just leave a note here the command is: uv venv --preview

jfcherng avatar Jul 01 '24 16:07 jfcherng