Skip to content

Support showing --prompt name as environment interpreter name in Python and Notebook #149

Closed
@thomasaarholt

Description

@thomasaarholt

The directory containing a virtual environment is often named .venv. This is the name that is by default shown in modern terminal prompts when the environment is active. This makes it difficult to identify which .venv is currently active.

Python virtual environments support a feature called prompt, which is essentially a nickname for the environment.

I would like for VSCode Python and Jupyter notebooks to support showing the prompt name in the "Select Interpreter" dialogue.

From the python venv docs

 --prompt PROMPT       Provides an alternative prompt prefix for this
                       environment.

Here is how you add a prompt label to the virtual environment:
python -m venv --prompt "foobar" .venv (creates a virtual environment nicknamed "foobar" in a directory called .venv)
(Similar approaches exist for uv and poetry as well)

After activation, the environment is now shown as "foobar", rather than ".venv" (here using starship prompt):
Image

How it looks now

If I open the directory in VSCode and call Select Interpreter, I get these options:

Image

What I would like

I would like foobar to replace the .venv in the highlighted area in the option list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions