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

Double venv in prompt #669

Open
2 tasks done
sgript opened this issue Feb 9, 2024 · 2 comments
Open
2 tasks done

Double venv in prompt #669

sgript opened this issue Feb 9, 2024 · 2 comments

Comments

@sgript
Copy link

sgript commented Feb 9, 2024

General information

System report (output of prompt_pure_system_report):

- Zsh: zsh 5.9 (x86_64-apple-darwin23.0) (/bin/zsh)
- Operating system: macOS 14.3.1 (23D60)
- Terminal program: vscode (1.86.1)
- Tmux: no
- Git: git version 2.39.3 (Apple Git-145)
- Pure state:
    - username: `''`
    - prompt: `❯`
    - version: `1.22.0`
- zsh-async version: `1.8.6`
- PROMPT: `typeset -g PROMPT=$'%F{${prompt_pure_colors[path]}}%~%f %F{#BAABFD}${prompt_pure_vcs_info[branch]}%F{218}${prompt_pure_git_dirty}%f %F{$prompt_pure_colors[git:arrow]}${prompt_pure_git_arrows}%f %F{$prompt_pure_colors[execution_time]}${prompt_pure_cmd_exec_time}%f
%}(venv) %(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 '`
- Colors: `typeset -g -A prompt_pure_colors=( [execution_time]=yellow [git:action]=yellow [git:arrow]=cyan [git:branch]='#BAABFD' [git:branch:cached]=red [git:dirty]=218 [git:stash]=cyan [host]=242 [path]='#80DAFF' [prompt:continuation]=242 [prompt:error]='#BAABFD' [prompt:success]='#BAABFD' [suspended_jobs]=red [user]=242 [user:root]=default [virtualenv]=242 )`
- TERM: `export TERM=xterm-256color`
- Virtualenv: `export VIRTUAL_ENV_DISABLE_PROMPT=12`
- Conda: `export CONDA_CHANGEPS1=no`
- Detected frameworks: Oh My Zsh
    - Oh My Zsh:
        - Plugins: git, zsh-autosuggestions

Other information

I have:

  • Tested with another terminal program and can reproduce the issue:
  • Followed the integration instructions for my framework

Problem description

I've got double venv showing in my prompt for Python.
Previously did not have "(venv)", just "venv ❯" showing

(venv) venv ❯ pyenv --version          
pyenv 2.3.35

It seems when I start my shell I get the (venv) pre-appended (becoming (venv) venv ❯), but if I run zsh / source my zsh shell, it gets rid of it and results in just venv ❯ as expected. I expect a package update has caused the (venv) prepending now. So my question was, is it possible to disable the extra venv ❯ from appearing? Ideally however, I preferred just having venv ❯ appear, rather than the uncoloured (venv).

Reproduction steps

  1. Open terminal
  2. See (venv) prepended in front of Pure's venv ❯
  3. Running zsh removes (venv)

My .zshrc:

export ZSH="$HOME/.oh-my-zsh"

export ZSH_THEME=""

plugins=(
    git
    zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh

# -- PURE shell --
fpath+=("$(brew --prefix)/share/zsh/site-functions")
autoload -U promptinit; promptinit

zstyle :prompt:pure:path color '#80DAFF'
zstyle :prompt:pure:git:branch color '#BAABFD'
zstyle :prompt:pure:prompt:success color '#BAABFD'
zstyle :prompt:pure:prompt:error color '#BAABFD'

prompt pure

# -- Homebrew --
eval "$(/opt/homebrew/bin/brew shellenv)"

# -- Git custom commands --
export PATH="$HOME/git-custom-commands:$PATH"

# -- NVM ---
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"  # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"

# -- PYENV --
eval "$(pyenv init -)"

# -- POETRY --
export PATH="/Users/shazaibahmad/.local/bin:$PATH"

# -- DOOM EMACS --
export PATH=$HOME/.emacs.d/bin:$PATH # location of doom
# export PATH="/opt/homebrew/opt/grep/bin/ggrep:$PATH"
export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
PATH="$(brew --prefix grep)/libexec/gnubin:$PATH"

@sgript sgript changed the title Double venv Double venv in prompt Feb 9, 2024
@mafredri
Copy link
Collaborator

mafredri commented Feb 9, 2024

Do you use venv via pyenv? Could you tell us the version of both pyenv and Oh My Zsh that you’re using? I’m guessing one or the other could be causing this.

@rafaelmarino
Copy link

Having the same issue.

OS: Ubuntu 22.04.4 LTS x86_64
Kernel: 5.17.0-1020-oem
Shell: zsh 5.8.1
OMZ: master (12cd3b3)
pyenv: pyenv 2.3.25-1-ge1b7e1b5
vscode: 1.87.0
# .zshrc
ZSH_THEME="" 
plugins=( 
    git
    zsh-autosuggestions
    zsh-syntax-highlighting
    # other plugins...
)

source $ZSH/oh-my-zsh.sh

# NOTE: oh-my-zsh overrides the prompt so Pure must be activated after source $ZSH/oh-my-zsh.sh
# Add path of pure repo to /home/.zsh folder
fpath+=($HOME/.zsh/pure)
autoload -U promptinit; promptinit
prompt pure

# pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

# Node Version Manager (NVM)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

To reproduce, start a new terminal and this is the visual:

~/path main
(venv) venv ❯ 

Two observations:

  • If I do deactivate followed by . venv/bin/activate, then (venv) disappears.
  • If I do zsh, (venv) also disappears.

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

3 participants