Print py_version.path
in replacement of (or in addition to) the py_version.executable
when prompting users to select an interpreter to use.
#1418
Labels
⭐ enhancement
Improvements for existing features
Is your feature request related to a problem? Please describe.
Currently, when PDM prompts users to select an interpreter from the ones available in the system, it prints the
py_version.executable
to the terminal. There is also another variable calledpy_version.path
available. While they are identical most of the time, I noticed that the two can be different for pyenv's python shims, and it can lead to confusing results.For example, this is the result of running
pdm init
in an empty folder on my system:Notice that the first listed interpreter is
/usr/bin/python3
. If I select0
and go ahead to finish the init process, and then take a look at.pdm.toml
, this is the content is there:$ cat .pdm.toml [python] path = "/home/oulongwu/.local/share/pyenv/shims/python3"
As we can see, the selected interpreter is actually the shim path of pyenv. However, there is no hint for that in the listed interpreters earlier.
Alternatively, if I select a python interpreter with pyenv before I ran pdm init, I get the following result
Notice how
3
and5
are the same, and4
and6
are the same. However, if I select them and look at the content of.pdm.toml
, I noticed that5
and6
correspond to pyenv's python shims, while3
and4
points to the interpreters installed in$PYENV_ROOT/versions/3.7.14
. Again since there are no hints for that in the selection menu, I found it very confusing.On the other hand, when I tried to use
py_version.path
in the selection menu, I got the following in my second experiment above:This time the pyenv shim paths are distinguished from the actual python interpreter binaries.
Describe the solution you'd like
I think using
python_version.path
is much less confusing thanpython_version.executable
when pyenv is involved. I suggest we at least print outpython_version.path
in addition topython_version.executable
when providing the interpreter selection menu. We can also just usepython_version.path
in place ofpython_version.executable
if you are not against the idea. This is also for consistency of the selection with the content written in.pdm.toml
.The text was updated successfully, but these errors were encountered: