astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
25.4k stars 739 forks source link

Should `uv python list` show `pyenv` versions as well? #6479

Closed jimmcslim closed 2 weeks ago

jimmcslim commented 2 months ago

I'm using uv 0.3.1 (Homebrew 2024-08-21)

With the references to pyenv in the uv documentation it is unclear to me if I should also be seeing the list of Python's that pyenv has installed.

From uv python list I get...

cpython-3.12.5-macos-aarch64-none     /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
cpython-3.12.5-macos-aarch64-none     <download available>
cpython-3.11.9-macos-aarch64-none     <download available>
cpython-3.10.14-macos-aarch64-none    <download available>
cpython-3.9.19-macos-aarch64-none     /opt/homebrew/opt/python@3.9/bin/python3.9 -> ../Frameworks/Python.framework/Versions/3.9/bin/python3.9
cpython-3.9.19-macos-aarch64-none     <download available>
cpython-3.9.6-macos-aarch64-none      /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3
cpython-3.8.19-macos-aarch64-none     <download available>

From pyenv versions I get...

* system (set by /Users/jim/.pyenv/version)
  2.7.18
  3.8.12
  3.9.4
  3.10.2
  3.10.3
  3.11.8
  3.12.4

Running python3 and querying us.path.dirname(sys.executable) in the REPL I get /opt/homebrew/opt/python@3.12/bin

If I run pyenv local 3.9.4 and then run uv python list I get...

cpython-3.12.5-macos-aarch64-none     /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
cpython-3.12.5-macos-aarch64-none     <download available>
cpython-3.11.9-macos-aarch64-none     <download available>
cpython-3.10.14-macos-aarch64-none    <download available>
cpython-3.9.19-macos-aarch64-none     /opt/homebrew/opt/python@3.9/bin/python3.9 -> ../Frameworks/Python.framework/Versions/3.9/bin/python3.9
cpython-3.9.19-macos-aarch64-none     <download available>
cpython-3.9.6-macos-aarch64-none      /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3
cpython-3.9.4-macos-aarch64-none      /Users/jim/.pyenv/versions/3.9.4/bin/python3.9
cpython-3.9.4-macos-aarch64-none      /Users/jim/.pyenv/versions/3.9.4/bin/python3 -> python3.9
cpython-3.9.4-macos-aarch64-none      /Users/jim/.pyenv/versions/3.9.4/bin/python -> python3.9
cpython-3.8.19-macos-aarch64-none     <download available>

Which shows that having specified a version of Python in a local .python-version file it finds the pyenv managed version.

Just not sure if I should be expecting to see ALL of the pyenv versions in the uv python list - and if not, might be worth updating the Discovery documentation to make it clear that uv will only have visibility of the currently activated pyenv Python.

zanieb commented 2 months ago

If pyenv puts executables on the PATH, we'll find them, but we don't support querying pyenv-specific locations or pyenv itself. Details on what we support at https://docs.astral.sh/uv/concepts/python-versions/#discovery-of-python-versions