Repository navigation
Specify terminal profile to use for Python terminal #21730
Description
Request
I am requesting two new settings that can either work separately or together:
python.terminal.profilepython.terminal.activateEnvInTerminals
I would like to point the "Python terminal" to a specific integrated profile. Currently, the Python terminal always points to the default terminal specified by e.g. terminal.integrated.defaultProfile.windows setting. It would be great if users could point it to a particular terminal profile, via a setting like python.terminal.profile that accepts a terminal profile name (in exactly the same way that terminal.integrated.defaultProfile.windows does). I could see this new setting also being a list or dictionary with entries for Windows, OSX, and Linux.
I would also like more flexibility in choosing which terminals attempt to automatically activate a Python environment. Currently, we have the choice to auto-activate environments in the current terminal via python.terminal.activateEnvInCurrentTerminal and in all terminals via python.terminal.activateEnvironment. I would like to see a new setting like python.terminal.activateEnvInTerminals that accepts a list of named terminal profiles.
Current workaround
Set terminal.integrated.defaultProfile.windows to a custom profile and python.terminal.activateEnvironment to True in the workspace settings.
Background
I am experimenting with ways to separate Conda environment activation from the standard Powershell terminal. My current solution is to create a "Conda" terminal like so:
...,
"python.condaHome" : "C:\\Anaconda3",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Conda": {
"source": "PowerShell",
"icon": "terminal-powershell",
"overrideName": true,
"args": ["-ExecutionPolicy", "ByPass", "-NoExit", "-Command", "& '${config:python.condaHome}\\shell\\condabin\\conda-hook.ps1' "]
}
},which allows me to add Conda functionality to the terminal. When combined with the "python.terminal.activateEnvironment" setting, it also activates the specific environment associated with the project. However, given the currently available settings I cannot launch this custom environment via the "Python: Create Terminal" command, nor can I activate the environment automatically unless I set python.terminal.activateEnvironment to True.

Activity
github-actions commentedon Aug 2, 2023
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
gundam78 commentedon Aug 11, 2023
I 👍 upvote!I have 2 terminal profiles: custom 'tmux' for keeping session and default 'bash'. I would like to only active venv in 'bash' (default behavior), but not in 'tmux'.
python.terminal.activateEnvInTerminalsshould help.brettcannon commentedon Oct 5, 2023
Thank you for submitting your feature request and everyone who considered it! Unfortunately, this issue did not receive enough votes over the allotted time, and so we are closing the issue.