New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Pyenv version detection #208
Conversation
To test if a Python version is available via Pyenv (e.g. when calling 'vf new -p 3.8.10 my_venv'), VirtualFish called 'pyenv which python$py_version'. However, 'pyenv which python3.8.10' fails and 'pyenv which python 3.8.10' ignores the provided version and always prints whatever Python is currently active. This fix instead checks $PYENV_ROOT/versions/$py_version/bin/python OR $HOME/.pyenv/versions/$py_version/bin/python (if $PYENV_ROOT not set)
Thank you for the contribution, @cecep2. I think you'll find that |
Thanks for merging!
Interesting! This seems to be buggy. On my system with 3.8.10 and 3.9.5 installed, calling Ideally the
I wonder if we could just check the length of the |
That is indeed a simpler approach to the let's-handle-both-short-and-long-version-specifiers idea. One potential problem with that approach is that it could conflict with user expectations. For example, I think in an ideal world, specifying |
I agree, installing the latest available version would be ideal. But considering user expectations, Pyenv doesn't handle |
But I digress… I agree that for the time being, we don't need to be more clever than the underlying tooling. There is a part of me that, when Many thanks for all your enhancements, which I bundled up into the release that was just published. ✨ |
Hopefully this fixes #203.
To test if a Python version is available via Pyenv (e.g. when calling
vf new -p 3.8.10 my_venv
), VirtualFish calledpyenv which python$py_version
. However,pyenv which python3.8.10
fails (at least in the most recent version of Pyenv) andpyenv which python 3.8.10
seems to ignore the provided version and always prints the path of whatever Python version is currently active in Pyenv.This fix instead checks for
$PYENV_ROOT/versions/$py_version/bin/python
OR$HOME/.pyenv/versions/$py_version/bin/python
(if $PYENV_ROOT not set, which might for example be the case when Pyenv was installed with Homebrew). With these changes, specifying versions with just the number works again: