Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Customizable venv prompt prefix and suffix #144203

Open
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-venvRelated to the venv moduletype-featureA feature request or enhancement
@bitterfox

Description

@bitterfox

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 --versionPython 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 --versionPython 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 --versionPython 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 --versionPython 3.14.2(Python env: /home/<...>/.venv) [/tmp]                                                                                                                                                                                                                                                                                                                                                                                                                                  <username>@<hostname>%

with

# Auto activate .venv in the new dirfunction 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-venvRelated to the venv moduletype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp