se-jaeger / zsh-activate-py-environment

ZSH plugin that automagically detects and activates your python environments (poetry, virtualenv, conda) while traversing directories.
Apache License 2.0
26 stars 5 forks source link

fix: spawning a new shell without using STDOUT #9

Closed tapyu closed 8 months ago

tapyu commented 8 months ago

Closes #8

This PR solves #8 at the minimum cost, that is, by modifying the source code as little as possible. Now the new shell spawning comes from run(["poetry", "shell"]) (from zsh-activate-py-environment.py) instead of eval $(zsh-activate-py-environment.py "activate") (from zsh-activate-py-environment.plugin.zsh). This give us the freedom of using STDOUT for communicating with the end user.

Instead of automatically installing all Python dependencies, now, I am just spawning a new shell subprocess as the last command of the Python script. Installing Python dependencies can be rather time consuming, and it might the preferable doing that manually afterwards. Let me know if you agree with this idea.

tapyu commented 8 months ago

It was tested with poetry, you might want to test with other Python environment as well