Customizable venv prompt prefix and suffix
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Feature or enhancement
Proposal:
In venv activate PS1 is updated with the fixed format.
Some user like me doesn't like such format for some reason.
For my case, I'd like to keep empty line between the previous output and the current prompt like
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
[/tmp]
<username>@<hostname>%
If I enable venv, it breaks my preference like
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>%
I want to keep empty like between previous output and commands like
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>%
This can be easily achieved keeping the compatibility by taking prefix and suffix for venv name in activate to set PS1 instaed of current "(" and ") ".
It makes someone to use explain venv name as their preferred way like
(Python env: /home/<...>/.venv)
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
(Python env: /home/<...>/.venv)
[/tmp]
<username>@<hostname>%
with
# Auto activate .venv in the new dir
function chpwd() {
if [[ -d "`pwd`/.venv" ]]; then
VIRTUAL_ENV_PROMPT_PREFIX="
(Python env: `pwd`/" source `pwd`/.venv/bin/activate
fi
}
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
- gh-144205
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el script de activación de venv mencionado en la propuesta y revisa cómo establece actualmente PS1. Compara el comportamiento solicitado para un prefijo y un sufijo configurables con el trabajo vinculado en gh-144205; se considera terminado cuando se conserva el valor predeterminado existente y se permite el formato del prompt mostrado en los ejemplos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100