Description
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.
--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):
How it looks now
If I open the directory in VSCode and call Select Interpreter
, I get these options:
What I would like
I would like foobar
to replace the .venv
in the highlighted area in the option list.