MichaelAquilina / zsh-autoswitch-virtualenv

🐍 ZSH plugin to automatically switch python virtualenvs (including pipenv and poetry) as you move between directories
GNU General Public License v3.0
507 stars 80 forks source link

Slow shell after autoswitch #159

Closed vhristev closed 2 years ago

vhristev commented 2 years ago

Issue Details

When i use autoswitch in poetry project i get super slow shell just hitting enter i can see the delay. The fun part is that if i create new poetry init project i don't see the problem. If i create new mkvenv env in some test folder slowness is not there.

It seems the slowness is with already created projects with poetry but i cannot identify the root cause.

Operating System (uname -a)

uname -a
Darwin vhristev-g1r5-1226.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

zsh version (zsh --version)

zsh --version
zsh 5.8 (x86_64-apple-darwin20.1.0)

autoswitch-virtualenv version

echo "$AUTOSWITCH_VERSION"
3.3.0

How is zsh-autoswitch-virtualenv installed?

Steps to reproduce the issue

Create virtual env with 'mkvenv' enter the dir

Shell debug with export PYENV_DEBUG=1 set -x

Entire debug is 3500+ lines ,so i snip where i see the slowness which is right after +_activate_poetry:3> cut '-d ' -f1

+_activate_poetry:3> poetry env list --full-path
+_activate_poetry:3> sort -k 2
+_activate_poetry:3> tail -n 1
+_activate_poetry:3> cut '-d ' -f1
+_activate_poetry:3> local name=/Users/vhristev/Documents/CB/CB-gitlab/obseye/.venv
+_activate_poetry:4> [[ -n /Users/vhristev/Documents/CB/CB-gitlab/obseye/.venv ]]
+_activate_poetry:5> _maybeworkon /Users/vhristev/Documents/CB/CB-gitlab/obseye/.venv poetry

Debug zsh

MichaelAquilina commented 2 years ago

@vhristev please update and check if the latest changes fix this issue :)

vhristev commented 2 years ago

I can confirm that after the update everything works as charm thank you very much @MichaelAquilina