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

Feature Request: Automatic Environment Activation in Terminal #383

Closed
DonJayamanne opened this issue Dec 9, 2017 · 9 comments · Fixed by #614
Closed

Feature Request: Automatic Environment Activation in Terminal #383

DonJayamanne opened this issue Dec 9, 2017 · 9 comments · Fixed by #614
Assignees
Labels
area-terminal feature-request Request for new features or functionality meta Issue that is tracking an overall project
Milestone

Comments

@DonJayamanne
Copy link

From @threecgreen on August 4, 2017 15:57

Current behavior

Every time I open the built-in terminal in VSCode, I have to remember to activate the project's Python environment.

Expected behavior

I'd like $ source activate my_env for conda or $ source bin/activate for virtualenv to run at VSCode terminal startup if I have selected an Python interpreter other than the system default.

Copied from original issue: DonJayamanne/pythonVSCode#1139

@DonJayamanne
Copy link
Author

From @smcstewart on August 22, 2017 9:37

So, if you have a local .vscode/settings.json with the python.venvPath set, then the terminal could automatically source it. I'd +1 that.

@DonJayamanne
Copy link
Author

You can use the command, 'Python REPL'.
Unfortunately there is no easy to change the external terminal.

@DonJayamanne
Copy link
Author

From @meichthys on September 11, 2017 13:28

@smcstewart were you referring to an external terminal or the integrated vscode terminal?

@DonJayamanne
Copy link
Author

From @smcstewart on September 11, 2017 14:44

@MatthewGieger Yeah, the integrated vscode terminal. The external terminal makes no sense and I can manage that myself. However, if I'm inside an existing Python project, when I open the integrated terminal, it'd be great to automatically source the virtualenv. I thought this was what @threecgreen was getting at.

@DonJayamanne
Copy link
Author

From @meichthys on September 11, 2017 14:49

@smcstewart Yes, agreed. I think that was indeed what @threecgreen was getting at.

@DonJayamanne Do you know if this has been implemented in any way? Also, what do you mean about using the "Python REPL" command? Could you give a quick example?

@DonJayamanne
Copy link
Author

From @fourierserious on December 9, 2017 22:10

In User/Workspace Settings, I use

"terminal.integrated.shellArgs.linux": [
    "--rcfile", "/home/jacob/miniconda3/envs/vscode/etc/bash.bashrc"
]

with the following in my bash.bashrc

source /home/jacob/.bashrc
source /home/jacob/miniconda3/bin/activate vscode

@DonJayamanne DonJayamanne added awaiting 1-decision area-terminal feature-request Request for new features or functionality labels Dec 9, 2017
@DonJayamanne DonJayamanne self-assigned this Jan 4, 2018
@DonJayamanne DonJayamanne added this to the January 2018 milestone Jan 9, 2018
@brettcannon brettcannon added meta Issue that is tracking an overall project and removed meta Issue that is tracking an overall project labels Jan 9, 2018
@DonJayamanne
Copy link
Author

DonJayamanne commented Jan 17, 2018

@brettcannon
Considering the fact that we need to activate the conda environment for conda installs #561,
do we want to extend this feature to the following areas as well:

  • Executing python files in the terminal (we have a command for this)
  • Executing python scripts (code) in the terminal (we have a command or this too)
  • Launching the REPL

Makes sense (less code = easier) to implement this as a generic feature across the board when sending anything to a terminal from our code.
However this would be a change in current behavior. I don't see how this could be a problem though.

@brettcannon
Copy link
Member

I say "yes". Basically when it comes to conda, we should run through an activated environment when possible.

@brettcannon
Copy link
Member

And if people complain we will point out that Anaconda said we should do it this way. 😁

@lock lock bot locked as resolved and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-terminal feature-request Request for new features or functionality meta Issue that is tracking an overall project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants