-
Notifications
You must be signed in to change notification settings - Fork 18
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 jinja2 functions env and versionformat #83
Conversation
I will give my honest feedback on these 2 functions:
|
Thanks for your opinion. Regarding the use of:
As to Why the above two methods should be included in conda-devenv? If one uses
I think these two utility methods would be extremely beneficial, simplify the If the idea that none of these small, but useful, additions are needed in |
I think would be better if You can use the pre-selectors such I agree with @edisongustavo , I think that might be an error-prone implementation |
The The This would keep conda-devenv usage more or less consistent with that of conda-build. So, what about instead of |
I think that should be better! @allanleal |
@marcelotrevisani |
Oh sorry, @prusse-martin , I think I was not clear. |
@prusse-martin Thanks for the observation about the selectors. Does this also apply to the env var
Based on an existing |
My 2 cents: I'm not against having About My two points lean heavily on the mantra of "it is easy to put something as a feature or part of an API, but very hard to get it out" because then you need to worry about backward compatibility. So I lean on being very careful to adding new features in general, specially when they are a little murky. |
@allanleal If you plan to have that available during parsing the jinja2 code yes it does applies.
But do you have a use case where is that necessary? |
@nicoddemus I agree with all you just said. Having said that, yes, let's not have these functions. The ongoing discussion now is if we should have, for example, the environment variable My main interest is to have a simple way to reference the python version of the conda environment in the Maybe you guys are using an alternative solution that works well and this addition to conda-devenv is too not needed. |
@prusse-martin When we use CONDA_PY to control builds. For example: matrix:
- CONFIG: Debug
CONDA_PY: 36
- CONFIG: Release
CONDA_PY: 37 |
If the env var |
Yes. During activation, |
For that case you can use the version directly then: matrix:
- CONFIG: Debug
CONDA_PY: 3.6
- CONFIG: Release
CONDA_PY: 3.7 Then in your dependencies:
- python={{ os.environ.get('CONDA_PY', '3.6') Or even call it something else (
This seems confusing, why not use a single environment variable for everything? Perhaps you are under the impression that |
@tadeu and I had a discussion about this in the past, in using CONDA_PY exactly as you just wrote, e.g., The idea would be to use CONDA_PY with the same convention as other conda tools. |
Oh @tadeu might comment here then... I thought only
|
Since conda-devenv does not interfere with conda-build (because this one requires its own recipe), maybe I should replace CONDA_PY in my use cases by something else (say, Thus, we forget about this need of Meaning, we close this PR! 😉 🎉 |
Great, thanks! I think the the whole discussion was really worthwhile anyway! 👍 Thanks everyone who participated. |
I think something that we have to remember on this project: conda-devenv is an "enhanced version" of conda-env. Not conda-build. The addition of selectors from conda-build is nice, but then we're entering muddy waters, so we have to be very careful when dealing in this territory. Or am I mistaken? |
Also, something that I'm thinking is that we should probably add a way for users to add their "custom functions" when using conda-devenv without having to change the source code of conda-devenv. If we add this feature then his What do you guys think? If you agree I will create an issue with more details. |
I think you're absolutely right @edisongustavo . I would just say that good ideas adopted there (and possibly in other tools) might be suitable here too. For example, preprocessing selectors in comments such as |
This would be great, @edisongustavo . I tried before doing this:
and it did not work. If you could add this support, or something similar, that would be appreciated. |
@edisongustavo are you suggesting some thing like the symbols in a file akin to |
I think we should open another issue to discuss this. 😁 |
Yes. That would be awesome. |
Agree. |
This PR proposes the addition of two functions in the jinja2 dictionary of variables. They are
env
andversionformat
.env
is just a syntactic sugar toos.environt.get
method.versionformat
is useful when version information is available in integer format, but a semantic version format is needed (e.g.,37
instead of3.7
).With the proposed changes, the following conda-devenv yaml file:
becomes: