-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add command specific variables and define variable priority order #286
Conversation
variables set using `conda env config vars set` are now included when using `anaconda-project run`
ensure that project variables take precedence over conda-meta/state variables
* fixes conda exe path * ensures that conda env config vars list was run
some tests run execvpe without conda
I have discovered that Using Conda |
@AlbertDeFusco should we fix this? That is to say, should we correct how anaconda-project does activation to either use conda's approach directly or reproduce the same steps? |
Now that |
That's a good idea, but it raises an important question about how to handle older versions of conda (like those found in AE). As long as we don't break current behavior, but enable newer/better behavior for newer versions of conda, that would be fine. |
Exactly! It seems like lack of support activate.d has not yet been called out as a bug, so I'm happy to leave this PR as-is and attack activate.d later and potentially only when using against newer conda versions. |
There are now 5 places where environment variables can be set for use in
anaconda-project run
. The order listed here is highest priority first, meaning that variables set in any location override the same variable name if exists lower on the list.Command line invocation
MY_VAR='on cli' anaconda-project run
Shell export
Set within the
anaconda-project.yml
file defined for the command to be runSet within the
anaconda-project.yml
at the top levelWithin the Conda environment after running
anaconda-project prepare
conda env config vars
or through Add environment variables to environment.yml files conda/conda#10169 coupled with [WIP] Utilize environment.yml or requirements.txt directly #275Variable priority examples
The examples here are presented in reverse order from above to demonstrate the override. Each example builds from the previous state.
Conda env config vars
Top-level project key
Adding
variables
to the project file overrides the Conda env.Command-specific variable
Exported in shell
Set on shell command