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

pyenv-virtualenv: prompt changing not working for fish #385

Open
aronla opened this issue May 11, 2021 · 9 comments
Open

pyenv-virtualenv: prompt changing not working for fish #385

aronla opened this issue May 11, 2021 · 9 comments

Comments

@aronla
Copy link

aronla commented May 11, 2021

Hi! I'm using fish and I'm running into the above message when I do pyenv activate my_venv.
If I do source .../my_venv/activate.fish the prompt shows up so it doesn't look as if it should be impossible to get the same to work with pyenv activate.

This issue is very related/the same as the stale #284

Thank you, and thanks for a great project!

@agoose77
Copy link

@aronla what message are you seeing?

@aronla
Copy link
Author

aronla commented May 13, 2021

@agoose77 I get the following:

> pyenv activate myenv
pyenv-virtualenv: prompt changing not working for fish
>

However, when sourcing activate.fish for the env, I get a prompt as expected:
myenv >

@bbeaudreault
Copy link

I'm also having this issue

@MSDuncan82
Copy link

I am having this issue as well

@yochem
Copy link

yochem commented Jun 18, 2021

It seems like prompt changing will be removed from future release too, I don't know why this is the case.

PYENV_VIRTUALENV_DISABLE_PROMPT="${PYENV_VIRTUALENV_DISABLE_PROMPT:-${PYENV_VIRTUAL_ENV_DISABLE_PROMPT}}"
PYENV_VIRTUALENV_DISABLE_PROMPT="${PYENV_VIRTUALENV_DISABLE_PROMPT:-${VIRTUAL_ENV_DISABLE_PROMPT}}"
if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then
case "${shell}" in
fish )
if [ -z "${QUIET}" ]; then
echo "pyenv-virtualenv: prompt changing not working for fish." 1>&2
fi
;;
* )
if [ -z "${QUIET}" ]; then
echo "pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior." 1>&2
fi
cat <<EOS
export _OLD_VIRTUAL_PS1="\${PS1}";
export PS1="(${venv}) \${PS1}";
EOS
;;
esac
fi

@native-api
Copy link
Member

native-api commented Oct 8, 2021

Most probably, Virtualenv didn't support Fish when this code was written but now, it does. So feel free to submit a PR.

@ian-h-chamberlain
Copy link

As a workaround, I have added to my config.fish to disable the message:

set -gx PYENV_VIRTUALENV_DISABLE_PROMPT 1

and in my fish_prompt function I use

set pyenv_version (pyenv version-name | string split ':')

and use $pyenv_version to display the active version in the prompt.

@petroslamb
Copy link

petroslamb commented May 21, 2022

Hi, is this latest comment the solution?

  • I installed fish and omf and the pyenv integration and there is no promt, which for me is typical when developing in Python.

  • I hovered around SO and several open/closed issue threads and still not sure why prompt showing was removed or how to bring it back.

Is the right solution to copy paste the above code? Is there something else?

image

@jnns
Copy link

jnns commented Oct 8, 2023

For what it's worth, the following out-of-the-box prompts will display the current virtualenv (select them with the fish_config command):

  • Disco
  • Nim
  • Simple Pythonista

EDIT: Or just use https://github.com/IlanCosman/tide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants