2022-08-13 13:26:55 -05:00
|
|
|
#!/usr/bin/env zsh
|
2021-12-08 09:38:24 -06:00
|
|
|
# Updated to use $HOME
|
|
|
|
|
|
|
|
# >>> conda initialize >>>
|
|
|
|
# !! Contents within this block are managed by 'conda init' !!
|
2022-09-09 12:09:16 -05:00
|
|
|
__conda_setup="$("$HOME/mambaforge/bin/conda" 'shell.zsh' 'hook' 2>/dev/null)"
|
2021-12-08 09:38:24 -06:00
|
|
|
if [ $? -eq 0 ]; then
|
2022-09-07 09:16:25 -05:00
|
|
|
eval "$__conda_setup"
|
2021-12-08 09:38:24 -06:00
|
|
|
else
|
2022-09-07 09:16:25 -05:00
|
|
|
if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then
|
|
|
|
. "$HOME/mambaforge/etc/profile.d/conda.sh"
|
|
|
|
else
|
|
|
|
export PATH="$HOME/mambaforge/bin:$PATH"
|
|
|
|
fi
|
2021-12-08 09:38:24 -06:00
|
|
|
fi
|
|
|
|
unset __conda_setup
|
|
|
|
|
|
|
|
if [ -f "$HOME/mambaforge/etc/profile.d/mamba.sh" ]; then
|
2022-09-07 09:16:25 -05:00
|
|
|
. "$HOME/mambaforge/etc/profile.d/mamba.sh"
|
2021-12-08 09:38:24 -06:00
|
|
|
fi
|
2022-12-08 11:01:14 -06:00
|
|
|
|
2021-12-08 09:38:24 -06:00
|
|
|
# <<< conda initialize <<<
|
|
|
|
|
2022-12-01 14:30:31 -06:00
|
|
|
# ! is-tty && [ -d "$HOME/mambaforge/envs/dev" ] && conda activate dev
|
2022-09-01 04:31:07 -05:00
|
|
|
|
2022-09-01 23:38:12 -05:00
|
|
|
# >>> mamba initialize >>>
|
|
|
|
# !! Contents within this block are managed by 'mamba init' !!
|
2022-12-08 11:01:14 -06:00
|
|
|
export MAMBA_EXE="$HOME/bin/micromamba";
|
|
|
|
export MAMBA_ROOT_PREFIX="$HOME/micromamba";
|
|
|
|
__mamba_setup="$('$HOME/bin/micromamba' shell hook --shell zsh --prefix '$HOME/micromamba' 2> /dev/null)"
|
2022-09-01 23:38:12 -05:00
|
|
|
if [ $? -eq 0 ]; then
|
2022-12-08 11:01:14 -06:00
|
|
|
eval "$__mamba_setup"
|
2022-09-01 23:38:12 -05:00
|
|
|
else
|
2022-12-08 11:01:14 -06:00
|
|
|
if [ -f "$HOME/micromamba/etc/profile.d/micromamba.sh" ]; then
|
|
|
|
. "$HOME/micromamba/etc/profile.d/micromamba.sh"
|
|
|
|
else
|
|
|
|
export PATH="$HOME/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
|
|
|
|
fi
|
2022-09-01 23:38:12 -05:00
|
|
|
fi
|
|
|
|
unset __mamba_setup
|
|
|
|
# <<< mamba initialize <<<
|
|
|
|
|
2022-12-08 11:01:14 -06:00
|
|
|
|
|
|
|
# <<< mamba initialize <<<
|
|
|
|
|
2022-09-01 04:31:07 -05:00
|
|
|
snake() {
|
|
|
|
if [[ $1 == "no" ]]; then
|
|
|
|
if [[ $VIRTUAL_ENV != "" ]]; then
|
|
|
|
echo "deactivate python virtualenv: $VIRTUAL_ENV"
|
|
|
|
deactivate
|
|
|
|
elif [[ $CONDA_DEFAULT_ENV != "" ]]; then
|
|
|
|
echo "deactivating conda env: $CONDA_DEFAULT_ENV"
|
|
|
|
conda deactivate
|
|
|
|
else
|
|
|
|
echo 'no environment to leave'
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [[ -d $(pwd)/env ]]; then
|
2022-09-05 18:43:24 -05:00
|
|
|
printf 'activating project-specific env: %s\n' "${PWD##*/}/env"
|
2022-09-01 04:31:07 -05:00
|
|
|
conda activate ./env
|
|
|
|
elif [[ -d $(pwd)/venv ]]; then
|
|
|
|
echo "activating python virtualenv"
|
|
|
|
source ./venv/bin/activate
|
|
|
|
elif [[ -d $(pwd)/.venv ]]; then
|
|
|
|
echo "activating python virtualenv"
|
|
|
|
source ./.venv/bin/activate
|
|
|
|
else
|
|
|
|
echo "is there an environment to activate?"
|
2022-09-05 18:43:24 -05:00
|
|
|
echo "I was expecting either a conda(env) or virtualenv(venv,.venv)"
|
2022-09-01 04:31:07 -05:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|