Open mattingram0 opened 4 years ago
I'm running with export VIRTUAL_ENV_DISABLE_PROMPT=
and don't have these issues. YMMV.
@mattingram0 this is actually working as intended. Since Pure is Conda-aware, the user should set conda config --set changeps1 False
so that Conda does not interfere with the prompt set by Pure.
If you wish to disable virtualenv display, you can do so by setting export VIRTUAL_ENV_DISABLE_PROMPT=1
. The reason Pure sets it to 12
(only when unset) is to detect when the user has manually requested not to show virtualenvs in the prompt. The value 12
is there to disable regular virtualenvs from interfering with the Pure prompt.
You can see https://github.com/sindresorhus/pure/pull/440 for the original discussion regarding this.
I'm running with
export VIRTUAL_ENV_DISABLE_PROMPT=
and don't have these issues. YMMV.
Thanks for the suggestion, but unfortunately this didn't work.
@mattingram0 this is actually working as intended. Since Pure is Conda-aware, the user should set
conda config --set changeps1 False
so that Conda does not interfere with the prompt set by Pure.If you wish to disable virtualenv display, you can do so by setting
export VIRTUAL_ENV_DISABLE_PROMPT=1
. The reason Pure sets it to12
(only when unset) is to detect when the user has manually requested not to show virtualenvs in the prompt. The value12
is there to disable regular virtualenvs from interfering with the Pure prompt.You can see #440 for the original discussion regarding this.
Hi mafredi, thanks for the suggestion also and the link to that discussion. Apologies for raising this as an 'issue' in the first place if this is the intended behaviour. Unfortunately setting export VIRTUAL_ENV_DISABLE_PROMPT=1
before activating conda does not have the desired effect of removing the (base) from the prompt.
@mattingram0 you're right, I misremembered this. We don't have a way to turn off Conda env display at the moment and there are multiple issues with that:
conda config --set changeps1 False
to prevent it from modifying the prompt, and this is needed to keep Pure pristineVIRTUAL_ENV_DISABLE_PROMPT
for Conda because that variable already belongs to regular virtualenv
and asking users to enable something that will break another thing is not coolThis is what I can recall from the last time I researched Conda, anyway. Open to new ideas for solving this though because forcing the virtualenv display is definitely not ideal.
@mattingram0 you're right, I misremembered this. We don't have a way to turn off Conda env display at the moment and there are multiple issues with that:
- We don't want to parse user configuration files in Pure - if it's not part of the environment, we don't know about it
- Conda provides no other facility than
conda config --set changeps1 False
to prevent it from modifying the prompt, and this is needed to keep Pure pristine- We don't want to repurpose
VIRTUAL_ENV_DISABLE_PROMPT
for Conda because that variable already belongs to regularvirtualenv
and asking users to enable something that will break another thing is not cool- If at all possible, we'd like to avoid introducing a Conda-specific option for Pure
This is what I can recall from the last time I researched Conda, anyway. Open to new ideas for solving this though because forcing the virtualenv display is definitely not ideal.
Hi again @mafredi, I've done a bit more digging and I think I might have come up with a solution to this. It seems that the CONDA_PROMPT_MODIFIER
env var is not set if changeps1 = false
appears in .condarc
, and is set to (base)
(for example) if changeps1 = true
. So could this be used by Pure to detect if the prompt should be modified or not?
@mattingram0 it would be an ok approach, but for that to work we would need an alternative way to tell Conda not to modify the prompt when Pure manages it. Last time I dug through the source of Conda, I could not find anything like that.
This is where we're at:
changeps1
)For 1) we currently rely on 2). We're telling Conda, don't touch PS1, but tell us your environment and we'll display it. If we were to rely on 2) for deciding wether or not to display the environment, we would have no way to achieve 1).
Hi,
I just stumbled across Pure while setting up a new machine with zsh, and then I wanted to check if it worked with conda (maybe a heads-up in the REDME?) so somehow I stumbled into this issue and here we are...
I remember having the same trouble with the conda prompt modification before, when I wanted to make a custom prompt. As @mafredri said, the CONDA_PROMPT_MODIFIER is not reliable for people who want to customize rather than just remove the conda env hint.
However, this answer on SO led me to the env_prompt
setting in .condarc
which controls the formatting of the prompt modifier. I just remembered about it while reading this, and maybe it could be used somehow?
@mattingram0 As a naive and hackish workaround, you could try setting env_prompt
to an empty string, instead of using changeps1
. I will install pure and conda and try it out myself tomorrow.
I stumbled across this issue today, and after trying all of the mentioned possible fixes and following stackoverflow threads to no avail, I found a maybe-solution that probably breaks things that I'm unaware of, but it's working for me at the moment.
In the pure code it just checks if the CONDA_DEFAULT_ENV
variable is set, and if so display it. So I just did export CONDA_DEFAULT_ENV=""
and it seems to have worked. This probably breaks stuff in conda, but I didn't notice anything so far, at least not any issues that affect my acute usage of conda.
General information
It seems that the Pure prompt does not respect the changeps1: False setting in my ~/.condarc. When not using the Pure prompt the virtual environment name is hidden as expected.
System report (output of
prompt_pure_system_report
):''
❯
1.10.3
export VIRTUAL_ENV_DISABLE_PROMPT=12
typeset -g PROMPT=$'%F{${prompt_pure_colors[path]}}%~%f %}%(12V.%F{$prompt_pure_colors[virtualenv]}%12v%f .)%(?.%F{$prompt_pure_colors[prompt:success]}.%F{$prompt_pure_colors[prompt:error]})${prompt_pure_state[prompt]}%f '
I have:
Problem description
I wish to hide the current Conda environment from the second line of the Pure prompt. Adding changeps1: False to my ~/.condarc has no effect when using Pure.
Reproduction steps
~/.zshrc
with Pure deactivated:Showing the configuration is set to False, and activating Conda:
~/.zshrc
with Pure activated:conda_setup="$('/Users/matt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/Users/matt/anaconda3/etc/profile.d/conda.sh" ]; then . "/Users/matt/anaconda3/etc/profile.d/conda.sh" else export PATH="/Users/matt/anaconda3/bin:$PATH" fi fi unset conda_setup
Thanks in advance for any help anyone is able to give. I believe it may have something to do with
export VIRTUAL_ENV_DISABLE_PROMPT=12
.