Customizable venv prompt prefix and suffix
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem im Vorschlag referenzierten venv-Aktivierungsskript und prüfe, wie es derzeit PS1 setzt. Vergleiche das angeforderte Verhalten für konfigurierbares Präfix und Suffix mit der verknüpften Arbeit in gh-144205; abgeschlossen ist die Aufgabe, wenn der bestehende Standard erhalten bleibt und gleichzeitig das in den Beispielen gezeigte Prompt-Format ermöglicht wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100