-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 environment variables to environment.yml files #10169
Conversation
This adds "variables:" key to set environment variables in the environment.yml file. Any number of variables are supported. The format is. variables: <VARIABLE>: <value> <VARIABLE>: <value> Variables set using `conda env config set vars` are retained with `conda env export` and set with `conda env create` if the variables key is included.
Closing & re-opening this PR to trigger new CI checks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What happens when you don't want to store certain ENV_VARS in Git or want to separate between dev and production. Is there any recipe for an "if not already defined use this" implementation? In prod for example these can be injected via |
This is a very good point and perhaps anaconda-project can help. I'd like to continue to this discussion. https://anaconda-project.readthedocs.io/en/latest/user-guide/tasks/work-with-variables.html This recent PR defines env var priority ordering in anaconda-project and will be part of the next release |
Hi there, thank you for your contribution to Conda! This pull request has been automatically locked since it has not had recent activity after it was closed. Please open a new issue or pull request if needed. |
This PR enables creation and export of conda environments that have environment variable created with
conda env config vars
.Tests have been included for this behavior.
Here' an example
Create and export
First create a new env and set two variables and confirm
When the env is exported the variables are retained in a key called
variables:
And also with the full dependency spec
Create from yaml
The environment.yml spec will allow variables to be set when the env is created.
Confirm that the variables have been set.