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
split off recipe render from build; recurse to find meta.yaml #908
Conversation
This now also renders YAML, keeping the keys in the order we expect:
|
Could we tweak it to space out the main sections? |
Also, just to clarify, will this proceed through the download (but not build phase)? What is the option to enable/disable this in case people don't want to proceed that far? |
By default, it will not download the source. You can pass the -s/--source option to do so. If it can't fill in fields without the source, it will throw errors (Jinja strict undefined stuff that @stuarteberg came up with). You can also pass the -o/--output flag to print the output filename (as conda build did/does), rather than the meta.yaml data. Sorry, but adding spaces is not something I want to fight PyYAML to do. It was enough fun getting it to where it is now. If you want to tackle that, I think the right place would be https://github.com/conda/conda-build/pull/908/files#diff-154513cee3e5765ecebd315978958f40R212 |
Looks good to me, but I have a couple of questions:
So in other words, the user is expected to interpret the error and add Also, I have an unrelated question about the output format. (If this PR is still WIP, then this question may be premature...) The current version of your PR writes the fully-rendered YAML to |
@stuarteberg all good ideas. This is why I ping you. I also had the thought that there need not be a --yaml option - who wants output in any other format? If they want the metadata itself as a python object, they can call the As for downloading the source: you're right. I like the transparent failover better than assuming interpretation of error messages. |
Sounds good! |
Current coverage is 100%@@ master #908 diff @@
=====================================
Files 39 0 -39
Lines 5136 0 -5136
Methods 0 0
Messages 0 0
Branches 0 0
=====================================
- Hits 509 0 -509
+ Misses 4627 0 -4627
Partials 0 0
|
I think I missed the recurse portion when skimming this quickly before. Would this be useful for feedstocks? |
@jakirkham Yes, that was my motivation. I can now replace things in the main repo with submodules to feedstocks. Closing the loop, little by little. I still need to tie in rendering the recipe for tools that are expecting static content, but it's progress. |
I've been contemplating a kinda similar feature, but haven't taken the time for a PR yet: What do you guys think about a
... if that's off-topic I can raise it in a different PR. |
I love it. Sorry, I got distracted by the static rendering. Lots of great stuff in this PR. 👍
👍 Do you want help doing this after the release? It sounds like we are entering phase 3. cc @pelson
Are you meaning like a public API or are there other tools that you guys have that will need this? |
@stuarteberg That's not a bad idea. I don't think I would use it, but I'm sure others would. I have many folders of recipes, with very high degrees of overlap. Having this feature would confuse me a lot on which collection I was getting. I do think it deserves its own PR. |
Help removing recipes from conda-recipes would be great. I will ask again about the CLA - if it would be necessary for this. Internal people have to do the internal repo, obviously.
Most just the legacy internal build system. It does a lot of moving packages around and examining metadata, so I need to make sure that wherever it looks, it finds fully rendered recipes. |
I mean if you guys would rather merge PRs that is fine to. I'm not picky here. Whatever works really. I'm just asking so as to know how we and others at conda-forge should start to act in this regard.
I see. Thanks for clarifying. |
So, I'm thinking this might be part of our solution to automating recipe generation to cut down time spent on minutiae. See this comment for some thoughts. |
So, I tried to build this example package, but it doesn't quite work as it doesn't like |
so the issue with conda render is that it expects the few required fields too early - before the first template pass. I'm going to see about changing that. |
@jakirkham should work better now. |
Thanks. I'll give it another try. |
Works. Thanks @msarahan.
|
So, I tried basically using this on the |
Kind of weird that the build number keeps getting turned into a string. Not sure where that is coming from. |
When you are doing this rendering @msarahan, are you including the |
# Next bit of stuff is to support YAML output in the order we expect. | ||
# http://stackoverflow.com/a/17310199/1170370 | ||
class MetaYaml(dict): | ||
fields = ["package", "source", "build", "requirements", "test", "extra"] |
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.
Could we please add about
here?
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.
Should come after test
, but before extra
.
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.
Good catch. Oversight. Will add.
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.
No worries. With this change, things appear to work for me.
Nevermind. Answered my own question. It would be great if we could add |
So, I made this variant based on the included template, which looks like this still kind of WIP, but it is coming along nicely. From that, I can generate the Would be good to figure out how we can work this into more of a Also, we could probably get the The license unfortunately is always a mess as no one seems to think it worthwhile to specify the license version in the |
Added this issue ( #914 ) to try and refactor |
Discussed with @kalefranz. Long-term, need to move logic out of CLI files (main_*). OK for now, though. Merging. |
Hi there, thank you for your contribution! This pull request has been automatically locked because it has not had recent activity after being closed. Please open a new issue or pull request if needed. Thanks! |
Closes #887
This is the start of splitting off recipe rendering from building. I am trying to avoid duplicating code, so I'm splitting the existing code off into other modules.
Right now, it only prints the processed metadata, not a yaml file. That's easy enough to write as an addon option later - I'm expecting that the raw dictionary will be the most useful thing to people, rather than going back to some file on disk. My idea is that the build module will just call functions from this file to render each recipe's meta.yaml.
This works right now, with a trivial test of a recipe from conda-forge (zlib). Original recipe at https://github.com/conda-forge/zlib-feedstock, which I have cloned as a submodule into the packages/zlib folder:
This change also makes conda-build recursively search for meta.yaml in any folder you provide, so it should make conda build more directly compatible with the conda-forge layout of having the recipe one level deeper.
I'll be cleaning this up and coming up with test cases - please kick the tires and point out any details I should pay special attention to.
CC @jakirkham @stuarteberg @kalefranz @pelson @groutr