pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
MIT License
6.18k stars 399 forks source link

Add prompt customization #476

Open jimenezj8 opened 4 months ago

jimenezj8 commented 4 months ago

Grants users the option of providing a custom prompt configuration for pyenv-virtualenv by setting an environment variable (preferably, at shell initialization).

I've been using pyenv for years now, and have used this modification personally for most of that time. For those users that prefer to customize their shell prompts for clarity or vanity, this can make pyenv-virtualenv a better experience.

The default prompt looks like:

~ $ eval "$(pyenv init -)"
~ $ eval "$(pyenv virtualenv-init -)"
~ $ pyenv activate my-venv
(my-venv) ~ $

With my proposed changes:

~ $ export PYENV_VIRTUALENV_PROMPT='venv:{venv}'
~ $ eval "$(pyenv init -)"
~ $ eval "$(pyenv virtualenv-init -)"
~ $ pyenv activate my-venv
venv:my-venv ~ $
jimenezj8 commented 4 months ago

@native-api are there any docs on how to run tests? I updated according to a similar PR I found, but want to be thorough in my approach here

native-api commented 4 months ago

@native-api are there any docs on how to run tests? I updated according to a similar PR I found, but want to be thorough in my approach here

There's https://github.com/pyenv/pyenv/blob/02e1d4a293139ecf2c94206ee9c00b388550366e/README.md#development but it's out of date.

You run tests with make test. It also checks out the required version of Bats. To run an individual test, run <path_to_bats> <directory_or_file> -f '<test name substring>'