-
Notifications
You must be signed in to change notification settings - Fork 430
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 arbitrary keys in meta.yaml #874
Conversation
We have discussed this internally, and I think it is a good idea. I need to play with it and make sure the suggestions don't go horribly wrong and confuse people, but the suggestions are generally a good idea. This opens up meta.yaml to be much more extensible. This was possible before by abusing the extras section. @stuarteberg @jakirkham any opinions here? |
Also, one nice way we can version the meta.yaml format is as follows: Example:
|
Haven't looked too close yet. Just a few thoughts though while I think about it more. Should we not require the Might be worth taking a look at how Jupyter notebooks are versioned. Also, @groutr, just trying to follow what you are saying here. Is this meant to go in every recipe or is this going to live in some central location like |
I guess this is reasonable, but I'm not sure I understand the motivation for it. I like the idea of giving the user a suggestion when they misspell a key, but I don't understand when it would be useful to have user-defined keys outside of the
I wouldn't consider this to be "abuse" per se... after all, that's exactly what the In any case, if you have a use-case in mind for these changes, then I've got no objections. I toyed with your PR for a few minutes. I made a few minor changes so I could actually see this idea in action, which I've now submitted as a PR-onto-this-PR in case it's useful: groutr#1. We should keep in mind that, once we make this change, adding new "standard" keys to Furthermore, if we define a new field that is too similar to
I don't know how often we'll end up stomping on people's custom-defined keys with new additions to Again, if you have a particular use-case that is motivating this change, then I guess the above concern is no big deal. But if there's no particular use-case in mind, I'd err on the side of caution (and guaranteed backwards compatibility). |
I'm not sure of all the use cases for this, but one could be at conda-forge. We currently add a |
Soon, conda-forge might be official enough that perhaps fields they find useful should just become "standard" anyway. But in that specific case, I wonder if maybe the Perhaps another case where user-defined fields would be nice is something like this example of mine for constructing a package that needs to download multiple source repositories: https://github.com/stuarteberg/conda-multisrc-example (More discussion here.) But still, the nice thing about that example is that the reader can plainly see that the stuff in |
@jakirkham, an @stuarteberg The There is a change in conda-build in the design phase that will allow downloading from multiple sources.
Conda-build could be more verbose about what values are coming from where. However, the intent of this change is to allow arbitrary data in a meta.yaml (ie, things that wouldn't affect the operation of conda-build anyway). This arbitrary data could be used by tools built around conda-build. |
Not sure on this one. Though if others want to use this tag for different meanings that is certainly their choice. In the case of the
If you want to wade into that discussion, I can certainly point you the right issue. |
I don't quite grok that statement. What else goes into |
Ah, interesting. Thanks for the clarification. |
Nice! Once there is a PR for this, I'd appreciate a ping. So would @timsnyder, presumably. |
Having multiple sources would be very awesome. I know a few cases that I encountered recently where this would help. Couple of questions.
To give these questions context, consider this recipe for |
I have similar questions. Maybe we can save that discussion for the PR that will be used to land that change. I'm sure @groutr will ping interested parties :-) |
Sorry, I let my excitement get the best of me. 😄 Please ping me when that comes out too, @groutr. |
@stuarteberg backwards compatibility is a big concern. I don't think I grasp your thoughts how this would break compatibility. It's not really about adding new standard keys, but about letting other users have things other than standard keys. My versioning comment, poorly worded as it was, is an observation of how making the fields as they are in my PR, they could be versioned easily. By set unions and differences, we can calculate the compatibility target really easily. A versioned format gives us a clearer picture of how far back a recipe is. |
Would it make sense to have an |
@jakirkham Those are very insightful questions. Thanks for the tip about protobuf. I'll definitely factor that into my thought process. |
If we allow users to define their own keys, then they might be surprised if, at some point in the future, we decide to add a new standard key to Depending on exactly what the new standard key is used for within conda-build, the error they see might be confusing. Perhaps the odds of such name clashes are are low, but they are slightly higher due to the fact that even imperfect matches can be detected. (In my example above, I supposed that a user defined a new If we don't consider imperfect matches to be an error, then I guess this isn't an issue. I think imperfect matches should be considered errors, as seen in my PR. But I suppose a really loud warning would suffice, too. I didn't mean this as an outright objection, just a potential concern. If you think it's no big deal, that's good enough for me. :-) Just trying to give thoughtful feedback here... |
@jakirkham a tool to automate the updating of recipes from one version of a format to another I think is a great idea 👍 |
@stuarteberg Ok. I think I understand your reasoning. The best answer I've got is make it loud and clear, though documentation and release notes, what changes are being made to keys. |
metadata: Better error message in check_fields()
@groutr where does this sit? |
As another use case, @stuarteberg, please take a look at these MSYS2 packages from @mingwandroid. Here is an example. If/when these enter conda-forge, we would have a bit of a mess here and it would be good to avoid that if possible. |
I agree with @stuarteberg that it is good that conda-build is oblivious to @jakirkham it won't be difficult for me to rearrange things according to the decisions reached. AFAIR I actually decided to use The |
@msarahan finishing this is still on my shortlist. I'm finishing my rebuild of GDAL. I think that along with merging this, we would be wise to version the meta.yaml (versioning the official set of keys). If there needs to be CEP, I can write one up. |
@stuarteberg Regarding your comment (#874 (comment))
Are these solutions satisfactory? I favor the second solution. The first solution may actually make collisions more likely. |
As usual, I'm a big ol' pessimist... 😩 I'm still unclear on why the
That could be a good thing. Suppose a novice writes this recipe: # Package section
package:
name: mypackage
version: 1.0
# Build section
build:
number: 0
string: py27_0
# Requirements section
requirements:
build:
- python 2.7
run:
- python 2.7
# Test section
test:
requirements:
- pytest The author has made multiple mistakes (at least 3), but if I understand the current proposal, it will be difficult for conda-build to automatically detect them and provide a useful error message. Under certain circumstances, I think the package build might even succeed without any errors at all!
I guess that sounds nice, but it implies changes to the conda-build development/release process, and corresponding awareness (and cooperation) from all conda-build developers. Will the benefits of allowing custom keys be so great that it warrants administrative overhead like this? I dunno, if I were BDFL of the conda project, I'd direct my troops to spend their energy elsewhere. But just to reiterate: My comments above are meant as a mild objection, not a raging protest. If you guys have discussed this internally and you think the pros outweigh the cons, I'm not going to complain. (Thanks for seeking for my input in the first place.) |
|
||
try: | ||
_ = _meta['about']['home'] | ||
_ = _meta['about']['license_family'] |
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 we check for license_family
or just license
? Personally, I would vote for the latter.
Hi there, thank you for your contribution! This pull request has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs. If you would like this pull request to remain open please:
NOTE: If this pull request was closed prematurely, please leave a comment. Thanks! |
1 similar comment
Hi there, thank you for your contribution! This pull request has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs. If you would like this pull request to remain open please:
NOTE: If this pull request was closed prematurely, please leave a comment. Thanks! |
Changes conda-build's approach to arbitrary keys. Before, conda-build was very strict about what was in the meta.yaml. If there were any perceived errors with meta.yaml, conda-build would abort.
Now, conda-build will only enforce exactly two keys. These two keys are absolutely required (as stated in the documentation of conda-build):
package/name
andpackage/version
. These two keys make a valid conda recipe. Every other key is essentially, optional. Conda-build will only act on keys it recognizes. The check recipe functionality has been modified to look for keys that are close to recognized keys in the case of mispellings.This allows users to add arbitrary keys and data to their meta.yaml. There are still officially recognized keys, but conda-build will ignore any keys it doesn't recognize.
The initial changes have been started in this PR. This is also a PR for community feedback.