pyenv / pyenv-virtualenv

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

Add prompt customization #476

Closed jimenezj8 closed 2 months ago

jimenezj8 commented 9 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 9 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 9 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>'

jimenezj8 commented 2 months ago

@native-api sorry for the long delay - finally got around to cleaning up the tests and confirmed that everything passes. The contribution guide doesn't elaborate, so I'm not sure what the next steps here are, would you mind advising?