[issue37663] Making venv activation script prompts consistent

Brett Cannon report at bugs.python.org
Tue Jul 23 16:41:06 EDT 2019


New submission from Brett Cannon <brett at python.org>:

There are five activation scripts and they are all do things differently when it comes to prompt manipulation. Standardizing on one set of semantics would probably be good for consistency and so people know what to expect regardless of their shell.

Currently the various semantics are as follows (see subdirectories in https://github.com/python/cpython/tree/master/Lib/venv/scripts for the code):

- PowerShell: use __VENV_PROMPT__, make it green
- bash: use __VENV_PROMPT__ if defined (which is nearly true; bpo-37661), else if virtual env in a directory named "__" (for some defunked software named Aspen; bpo-37660) then use "[dir]", else "(dir)"
- Command Prompt: use __VENV_PROMPT__
- csh: use __VENV_NAME__ if defined, else calculate name and use "[dir]"
- fish: same as bash, except if not using __VENV_PROMPT__ then use white text on a blue background

So the variances/questions are:
1. Always use __VENV_PROMPT__ and don't bother testing? (bpo-37661 suggests we should, or else come up with a new way to tell whether a custom prompt was provided)
2. Always use colour regardless of whether the prompt is custom? (I vote "yes"; don't care about what the colours happen to be)
3. Parentheses or square brackets? (Due to bpo-37661 I vote for parentheses since that's what people are used to)

----------
components: Library (Lib)
messages: 348355
nosy: brett.cannon, vinay.sajip
priority: normal
severity: normal
status: open
title: Making venv activation script prompts consistent
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37663>
_______________________________________


More information about the Python-bugs-list mailing list