pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

virtualenvs are redundant in pyenv versions

Open draeath opened this issue 8 years ago • 4 comments

I'm not sure if this is intended/desired behavior, so apologies if not.

Any time versions are checked (pyenv versions, the command-not-found wrapper, etc) there seems to be multiple entries for each created virtualenv.

For instance, follow the following:


    $ for i in 2.7.13 3.5.3 3.6.1; do pyenv install $i; done
    ... things happen
    $ pyenv versions
      system
      2.7.13
      3.5.3
      3.6.1
    $ pyenv virtualenv 2.7.13 ansible
    ... things happen
    $ pyenv versions
      system
      2.7.13
      2.7.13/envs/ansible
      3.5.3
      3.6.1
      ansible

This seems noisy and undesirable - especially as more virtual environments are created! It seems that the "short" version can be inferred from the long version and should just be omitted from the output (you need the long version, from what I understand, because you can have multiple python versions associated with the same virtual environment?)

Similarly other items that refer to the available versions seem to do similar. In this case, attempting to run said program outside of the environment does a search (a nice feature, I should note) but this contains the same redundancy:

    pyenv: ansible: command not found
    
    The `ansible' command exists in these Python versions:
      2.7.13/envs/ansible
      ansible

draeath avatar Jun 12 '17 21:06 draeath

I think it should be possible to use both the short and long version when referring to / activating the version/virtualenv, but maybe we can collapse it it in the output?

you need the long version, from what I understand, because you can have multiple python versions associated with the same virtual environment?

I think the short name has to be unique, too?!

blueyed avatar Jun 12 '17 21:06 blueyed

Collapsing would be good, but there's still various outputs that are just... chatty:

draeath@ginnungagap:~/projects$ pe virtualenvs
  2.7.13/envs/ansible (created from /home/draeath/.pyenv/versions/2.7.13)
  3.6.1/envs/jupyter (created from /home/draeath/.pyenv/versions/3.6.1)
  ansible (created from /home/draeath/.pyenv/versions/2.7.13)
  jupyter (created from /home/draeath/.pyenv/versions/3.6.1)

In the above, I only created 2 environments but it behaves like there's 2x that. It also balloons the versions output too, as such for more flogging of the horse :)

draeath@ginnungagap:~/projects$ pe versions
  system
* 2.7.13 (set by /home/draeath/.pyenv/version)
  2.7.13/envs/ansible
  3.5.3
* 3.6.1 (set by /home/draeath/.pyenv/version)
  3.6.1/envs/jupyter
  ansible
  jupyter

draeath avatar Jun 12 '17 22:06 draeath

Is it possible to create venvs in different path from pyenv_root?

vissible avatar Jan 17 '18 14:01 vissible

I just want to note that there is a --skip-aliases option which drastically reduces noise:

$ pyenv versions --skip-aliases                                                                                                                                                                         
  system
  2.7.15
  2.7.15/envs/neovim2
  3.5.6
  3.7.1
  3.7.1/envs/neovim3

neersighted avatar Nov 22 '18 22:11 neersighted