(Semi-)Automatically activate a conda environment when entering a folder that contains a *_env directory as we usually have at the NY DS Team.
This functionality was inspired by conda auto activate, virtualenv auto activate and autoenv and originally forked from drorata's version
To install add this line to your .bashrc or .bash-profile:
source /path/to/conda_auto_env.sh
If you also want this script to be ran automatically, whenever you enter a directory add also the following:
export PROMPT_COMMAND="conda_auto_env;$PROMPT_COMMAND"
This is not recommended as find might be too slow (find is used internally). You could run conda_auto_env
to automatically activate it.
Otherwise, whenever in a directory containing environment.yml
, you can execute conda_auto_env
.