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

How to swap order of two sections? #51

Open
sgbaird opened this issue Jun 5, 2022 · 3 comments
Open

How to swap order of two sections? #51

sgbaird opened this issue Jun 5, 2022 · 3 comments

Comments

@sgbaird
Copy link
Contributor

sgbaird commented Jun 5, 2022

conda/grayskull#288

@sgbaird
Copy link
Contributor Author

sgbaird commented Jun 9, 2022

Workaround:

my_recipe = Recipe(load_file=fpath)

# ensure proper order for conda-forge
keys = list(my_recipe.keys())

# https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html
key_order = [
    "package",
    "source",
    "build",
    "requirements",
    "test",
    "outputs",
    "about",
    "app",
    "extra",
]
unshared_keys = np.setdiff1d(key_order, keys)

ordered_keys = copy(key_order)
for key in unshared_keys:
    ordered_keys.remove(key)

for key in ordered_keys:
    my_recipe.yaml.move_to_end(key)

Example:
https://github.com/conda-forge/staged-recipes/blob/98342ca72c3e4ad5fecb3218d77842faf6aa4535/recipes/mp-time-split/meta.yaml

@sgbaird
Copy link
Contributor Author

sgbaird commented Jun 9, 2022

@marcelotrevisani What do you think about a my_recipe.sort() method? conda/grayskull#288 (comment)

Happy to open a PR, otherwise will stick with my workaround until July or later 🙂

@marcelotrevisani
Copy link
Owner

That would be interesting, indeed :)

Sorry for my delay, I was completely off from my computer for the past 2 weeks, some personal matters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants