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

Implicitly add WORKON_HOME to python.venvFolders #118

Closed
DonJayamanne opened this issue Nov 13, 2017 · 3 comments
Closed

Implicitly add WORKON_HOME to python.venvFolders #118

DonJayamanne opened this issue Nov 13, 2017 · 3 comments
Assignees
Labels
feature-request Request for new features or functionality

Comments

@DonJayamanne
Copy link

From @zgoda on May 19, 2017 11:30

I work almost exclusively in virtualenvs and I'd like to be able to select interpreter from list of virtualenvs if both workon command and WORKON_HOME envvar exist.

workon is shell command installed by virtualenvwrapper. When invoked without argument it lists available virtualenvs under its control, in alphabetical order:

$ workon
bde
brewlog
cocos
...
tsp
twt
wsm
yg01

Now I have to set complete path to interpreter in form of $WORKON_HOME/<envname>/bin/python. An alternative is to get virtualenvs by listing subdirs of $WORKON_HOME (this is exactly what workon does).

Copied from original issue: DonJayamanne/pythonVSCode#968

@brettcannon brettcannon added awaiting 1-decision feature-request Request for new features or functionality labels Nov 14, 2017
@brettcannon brettcannon changed the title Feature request: allow selecting interpreter from list of available virtualenvs Implicitly add WORKON_HOME to python.venvPath Apr 5, 2018
@brettcannon
Copy link
Member

This would also help with pipenv who reads from WORKON_HOME as an alternative location to place virtual environments.

@kweerious
Copy link

Looking over the discussion from #2106 and messing around with virtualenvwrapper created environments I found that if you run with the default setup virtualenvwrapper also drops its hook files in that directory. If removed then venvPath works properly.

Might I suggest only acting on directories found within venvPath options?

For anyone using virtualenvwrapper wanting a workaround for now, use the VIRTUALENVWRAPPER_HOOK_DIR to set some different directory and remove your non-environments from your .virtualenvs

Example

export VIRTUALENVWRAPPER_HOOK_DIR=$HOME/.virtualenv_hooks
source /usr/local/bin/virtualenvwrapper.sh
export WORKON_HOME=$HOME/.virtualenvs
"python.venvPath": "/Users/$USER/.virtualenvs"

@brettcannon brettcannon changed the title Implicitly add WORKON_HOME to python.venvPath Implicitly add WORKON_HOME to python.venvFolders Jun 14, 2019
@kimadeline kimadeline self-assigned this Jun 14, 2019
@kimadeline
Copy link

Todo:

  • Add WORKON_HOME to defaults if set
  • Update docstring in package.json to say that we support pipenv and virtualenvwrapper directories (check settings UI) 🎉

@ghost ghost removed the needs PR label Jun 19, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants