conda-auto-env
conda-auto-env copied to clipboard
Support zsh and deactivate when leaving environment directories
Hi!
The conda-auto-env
script is really handy but I missed two features, here added:
- Support for
zsh
. - Deactivating environments when leaving their directories.
Also included some minor inconsequential changes to code and comments.
I hope these minor changes will be accepted.
zshell
Easybird gave an easy solution for modifying .zshrc
to support the script but it is better if the script works with just source
(and addresses some minor issues). At least, for me, I missed the comment and spent time on finding a workaround. The modification simply checks the active shell and hooks zsh
differently.
Deactivating environments
When working, often one will jump around between directories and this introduces the issue that whatever environment one was working with last sticks in the terminal. E.g., if one's default/root Conda environment has different versions or packages, these will be not be available after having entered a project directory. This behavior also persists to new tabs in a terminal. A simple work-around was to deactivate the current environment, in favor of the default, when no longer in a subdirectory of the directory that an environment was activated in.
(New pull request because I accidentally included an extraneous file.)
Hi! The script works well (it activates and deactivates the environments) but when using it with a GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin15.0.0)
.
I get the following errors:
$ source conda_auto_env.sh
ps: cmd: keyword not found
ps: no valid keywords; valid keywords:
Would be nice to get it merged though, I was looking exactly for this automatic switching on and off of environments, so thanks for that 👍
Hi, any news if this is going to be merged 😄?
Hi @emirlej. Thanks for the ping but I think this repo is presently stale. I would look through the 30 forks to find the one with features best matching your preferences. There is at least one other fork besides mine that adds the features of this PR. At the top of this PR, you can also find my branch. I haven't been using it for some time though so it may require updating.