Skip to content

Specify terminal profile to use for Python terminal #21730

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

Closed
mkoohafkan opened this issue Aug 1, 2023 · 3 comments
Closed

Specify terminal profile to use for Python terminal #21730

mkoohafkan opened this issue Aug 1, 2023 · 3 comments
Labels
area-terminal feature-request Request for new features or functionality

Comments

@mkoohafkan
Copy link

mkoohafkan commented Aug 1, 2023

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

@mkoohafkan mkoohafkan added the feature-request Request for new features or functionality label Aug 1, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 1, 2023
@karthiknadig karthiknadig added needs community feedback Awaiting community feedback and removed triage-needed Needs assignment to the proper sub-team labels Aug 2, 2023
@github-actions
Copy link

github-actions bot commented 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
Copy link

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.

@brettcannon
Copy link
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.

@brettcannon brettcannon closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2023
@github-actions github-actions bot removed the needs community feedback Awaiting community feedback label Oct 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2023
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
Projects
None yet
Development

No branches or pull requests

4 participants