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

Open Pipenv terminal with pipenv shell #2855

Closed
iddan opened this Issue Oct 11, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@iddan
Copy link

iddan commented Oct 11, 2018

Environment data

  • VS Code version: 1.28.0
  • Extension version (available under the Extensions sidebar): 2018.9.0
  • OS and version: macOS Mojave 10.14
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv

Actual behavior

When pipenv venv detected terminal is opened by:

source $VENV_LOCATION/bin/activate

Expected behavior

Terminal to open with:

pipenv shell

Why?

Because that way .env would be loaded automatically and activating shell would be encapsulated

@wcass77

This comment was marked as off-topic.

Copy link

wcass77 commented Oct 11, 2018

Is it possible to turn off automatic activation of the virtual environment, or at least get a new shell where it isn't active? For whatever reason this feature wasn't working for me until today (not sure why), but now it is and I would like to turn it off. I sometimes run other things from the terminal in vscode, and I usually use pipenv run with custom aliases in the Pipfile to run things anyway.

Alternatively, the shell could launch a regular shell session and then issue the command pipenv shell as suggested above. That way ctrl-d would exit the virtual environment and drop you into a regular shell. Currently ctrl-d closes the shell completely.

I'm running 1.28.0 and 2018.9.0 of the plugin. I'm running the dev version of pipenv (installed from the master branch on github 2 days ago), as there are bugs in the currently released version. I'm running python 3.7 installed via pyenv.

@DonJayamanne

This comment was marked as off-topic.

Copy link

DonJayamanne commented Oct 11, 2018

@wcass77
To disable activation of the terminal, please update your settings as follows:
"python.terminal.activateEnvironment": false

@DonJayamanne DonJayamanne added the triage label Jan 2, 2019

@DonJayamanne DonJayamanne self-assigned this Jan 2, 2019

@DonJayamanne DonJayamanne removed the triage label Jan 8, 2019

@DonJayamanne DonJayamanne changed the title Feature Request: Open Pipenv terminal with pipenv shell Open Pipenv terminal with pipenv shell Jan 8, 2019

@DonJayamanne

This comment has been minimized.

Copy link

DonJayamanne commented Jan 23, 2019

Problems

  • Open a folder in a terminal and create a pip env
  • Next open VSC and open a completely different folder
  • VSC will not identify the above pipenv as a virtual env

Cause:

  • Extension has discovered all interpreters and above pipenv is not detected as a pipenv (unfortunately its treated as a virtual env, pipenv doesn't provide an api to get around this).
  • Now above env is treated as virtual env
  • Next when we open the folder which has the pipenv mapped to it, the pipenv will not get activated correctly.

@DonJayamanne DonJayamanne referenced this issue Jan 23, 2019

Merged

Fixes for pipenv activation #4105

3 of 3 tasks complete

@pvscbot pvscbot removed the needs PR label Jan 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment