Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The VIRTUAL_ENV_PROMPT variable is ignored when using Python's venv module #640

Open
jwm-evans opened this issue Dec 2, 2024 · 0 comments

Comments

@jwm-evans
Copy link

jwm-evans commented Dec 2, 2024

If I create a new Python virtualenv using python3 -m env --prompt test .venv and activate it by source .venv/bin/activate, the prompt shows ( .venv ) instead of ( test ).

This can be resolved by changing function _omb_prompt_get_virtualenv to:

 function _omb_prompt_get_virtualenv {
   virtualenv=
   [[ ${VIRTUAL_ENV-} ]] || return 1
   if [[ -n $VIRTUAL_ENV_PROMPT ]]; then
     _omb_prompt_format virtualenv "$VIRTUAL_ENV_PROMPT" OMB_PROMPT_VIRTUALENV:VIRTUALENV_THEME_PROMPT
   else
     _omb_prompt_format virtualenv "$(basename "$VIRTUAL_ENV")" OMB_PROMPT_VIRTUALENV:VIRTUALENV_THEME_PROMPT
   fi
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant