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

allow jinja2 templates to be located in current conda environment #578

Merged
merged 5 commits into from
Oct 21, 2015

Conversation

ukoethe
Copy link
Contributor

@ukoethe ukoethe commented Sep 9, 2015

As requested, this is an update of PR #575. (I nonetheless keep #575 open for now so that we can continue our conversation there.)

@ukoethe
Copy link
Contributor Author

ukoethe commented Oct 20, 2015

Would someone from the core team please care to comment on this PR? It is very critical for my work. Thank you very much! @msarahan @ilanschnell

To clarify the PR, I repeat its rationale here:

Jinja templates are a powerful way to configure meta.yaml. Right now, conda build searches for these templates in two locations: <conda_root>/Lib/site-packages/conda_build/templates (for site-specific configurations) and $RECIPE_DIR (for package-specific configurations). I propose to add the current environment (as specified in the environment variable $CONDA_ENV_PATH $CONDA_DEFAULT_ENV) as an additional search location to support environment-specific configurations.

Use case: Suppose one wants to build a set of packages with exactly identical toolset settings (same compiler options, tool versions etc.). This can be achieved by performing the build in a suitably prepared conda environment. However, conda does not yet provide a portable query method for information about the current environment within meta.yaml. The present PR adds this capability. For example, let's say that a jinja-template toolset-info.yaml is placed into the environment's root directory upon installation of some toolset package. This template can now be loaded in meta.yaml via
{% import '$CONDA_ENV_PATH/toolset-info.yaml' as toolset %}

{% import '$CONDA_DEFAULT_ENV/toolset-info.yaml' as toolset %}

and later be accessed via variables like {{ toolset.name }} or {{ toolset.version }} etc.

@ukoethe
Copy link
Contributor Author

ukoethe commented Oct 21, 2015

I just noticed that the environment variable CONDA_ENV_PATH was renamed into CONDA_DEFAULT_ENV recently and updated the PR accordingly.

@ilanschnell
Copy link
Contributor

There is no variable CONDA_ENV_PATH, only CONDA_ENVS_PATH (the environments location directory), which is separate from CONDA_DEFAULT_ENV. None of these have been renamed.

@ukoethe
Copy link
Contributor Author

ukoethe commented Oct 21, 2015

There is no variable CONDA_ENV_PATH, only CONDA_ENVS_PATH (the environments location directory), which is separate from CONDA_DEFAULT_ENV. None of these have been renamed.

Strange. It worked for me, and I'm quite certain that I never defined CONDA_ENV_PATH myself. Anyway, in the latest commit I use CONDA_DEFAULT_ENV instead.

@msarahan
Copy link
Contributor

+1 from me. The travis build failure is unrelated. Missing OpenSSL package that we haven't built on python 3.3 yet.

@msarahan
Copy link
Contributor

Discussed with @ilanschnell and @groutr - we think this is a very nice addition. Thanks!

msarahan added a commit that referenced this pull request Oct 21, 2015
allow jinja2 templates to be located in current conda environment
@msarahan msarahan merged commit 6921f06 into conda:master Oct 21, 2015
@ukoethe
Copy link
Contributor Author

ukoethe commented Oct 22, 2015

Thanks for merging, @msarahan! See conda/conda#1589 (comment) for a usage example.

@ukoethe ukoethe deleted the jinja-search-path branch November 5, 2015 10:14
@github-actions github-actions bot added the locked [bot] locked due to inactivity label May 18, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants