Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow conda environment names to be detected from environment.yml #909

Merged
merged 1 commit into from Apr 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion stdlib.sh
Expand Up @@ -856,7 +856,19 @@ layout_anaconda() {
env_loc="$env_name_or_prefix"
else
# "foo" name
env_name="$env_name_or_prefix"
# if no name was passed, try to parse it from local environment.yml
if [[ -n "$env_name_or_prefix" ]]; then
env_name="$env_name_or_prefix"
elif [[ -e environment.yml ]]; then
env_name_grep_match="$(grep -- '^name:' environment.yml)"
env_name="${env_name_grep_match/#name:*([[:space:]])}"
fi

if [[ -z "$env_name" ]]; then
log_error "Could not determine conda env name (set in environment.yml or pass explicitly)"
return 1
fi

env_loc=$("$conda" env list | grep -- '^'"$env_name"'\s')
env_loc="${env_loc##* }"
fi
Expand Down