Skip to content
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

version has no --bare option, but versions has a --bare option #2779

Open
jjwatt opened this issue Sep 7, 2023 · 1 comment · May be fixed by #2783
Open

version has no --bare option, but versions has a --bare option #2779

jjwatt opened this issue Sep 7, 2023 · 1 comment · May be fixed by #2783

Comments

@jjwatt
Copy link

jjwatt commented Sep 7, 2023

Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.

Prerequisite

  • [x ] Make sure your problem is not listed in the common build problems.
  • [x ] Make sure no duplicated issue has already been reported in the pyenv issues. You should look for closed issues, too.
  • [x ] Make sure you are not asking us to help solving your specific issue.
    • GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like Gitter, StackOverflow, etc.
  • [x ] Make sure your problem is not derived from packaging (e.g. Homebrew).
    • Please refer to the package documentation for the installation issues, etc.
  • [ x] Make sure your problem is not derived from plugins.
    • This repository is maintaining pyenv and the default python-build plugin only. Please refrain from reporting issues of other plugins here.

Description

Not really a bug. Just a missing flag in a sub-command. --bare with versions is really useful in a test I'm building. Without it, versions is non-deterministic. e.g.,:

~/git/github.com/pyenv/pyenv master ⇣                                                                      
❯ pyenv shell "$(pyenv versions | grep 3.11 | tr -d '[[:space:]]')"
~/git/github.com/pyenv/pyenv master ⇣
❯ pyenv shell "$(pyenv versions | grep 3.11 | tr -d '[[:space:]]')"               
pyenv: version `* 3.11.5 (set by PYENV_VERSION environment variable)' not installed

That makes sense because before I select it:

~/git/github.com/pyenv/pyenv master ⇣                                                                      
❯ pyenv versions | grep 3.11                                                                               
  3.11.5 

and after

~/git/github.com/pyenv/pyenv master ⇣
❯ pyenv versions | grep 3.11
* 3.11.5 (set by PYENV_VERSION environment variable)

Different output because it's decorated with the explanation, which is great, and it's also great to have the --bare option for parsing:

~/git/github.com/pyenv/pyenv master ⇣
❯ pyenv versions --bare | grep 3.11.5
3.11.5

So, now I can use it like this

~/git/github.com/pyenv/pyenv master ⇣                                                                      
❯ pyenv shell "$(pyenv versions --bare | grep 3.11 | tr -d '[[:space:]]')"                                 

But, I pyenv version has no --bare so it would be non-deterministic if I used it.

~/git/github.com/pyenv/pyenv master ⇣                                                                      
❯ pyenv version                                                                                            
3.11.5 (set by PYENV_VERSION environment variable) 
~/git/github.com/pyenv/pyenv master* ⇣
❯ pyenv shell 3.9.18
~/git/github.com/pyenv/pyenv master* ⇣
❯ pyenv version     
3.9.18 (set by PYENV_VERSION environment variable)
~/git/github.com/pyenv/pyenv master* ⇣
❯ unset PYENV_VERSION
~/git/github.com/pyenv/pyenv master* ⇣
❯ pyenv version
3.9.18 (set by /home/jwattenb/git/github.com/pyenv/pyenv/.python-version)

I know I could just focus on $PYENV_VERSION, but this does seem like inconsistent behavior, and the expected behavior doesn't seem too much more difficult.

@native-api
Copy link
Member

$ pyenv version --help
Usage: pyenv version

Shows the currently selected Python version(s) and how it was
selected. To obtain only the version string, use `pyenv
version-name'.

@jjwatt jjwatt linked a pull request Sep 8, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants