Skip to content

Specify terminal profile to use for Python terminal #21730

Closed as not planned
Closed as not planned

Description

Request

I am requesting two new settings that can either work separately or together:

  • python.terminal.profile
  • python.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.

image

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.

Related issues: #20562, #2559, #21864

Activity

  1. github-actions commented on Aug 2, 2023

    @github-actions

    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.

  2. gundam78 commented on Aug 11, 2023

    @gundam78

    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.activateEnvInTerminals should help.

  3. brettcannon commented on Oct 5, 2023

    @brettcannon
    Member

    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.

  4. locked as resolved and limited conversation to collaborators on Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions