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

Added load_file_data and load_str_data as functions available in meta.yaml #4480

Merged
merged 8 commits into from
Jun 1, 2022

Conversation

kenodegard
Copy link
Contributor

Continuation of #4465
Credits go to @abrahammurciano

Up until PEPs 517 and 518, the setup.py file was the standard way to declare project metatada. That made the function load_setup_py_data an excellent tool for many projects to avoid repetition of metadata in the meta.yaml file.

No longer. With the introduction of the aforementioned PEPs, metadata can be declared in many different ways. Many (if not most) of these use the pyproject.toml file to store their configurations. A notable example of this is poetry.

Instead of trying to accommodate for each and every tool, I have introduced the function load_file_data which is capable of loading (and parsing) certain common serialisation languages (specifically JSON, TOML, and YAML, but can be easily extended (though that would require changing the source code)). The rationale behind this is that the user can just parse whichever file contains their metadata and structure their meta.yaml to use whichever other tools they use without conda-build having to specifically support it.

As an added bonus, I also added a function which is capable of doing the same but reading from a string instead of from a file, so that users can pass JSON (or any other supported language) via environment variables.

Additionally, I have expounded on the bare documentation of load_setup_py_data, added documentation for the previously undocumented load_file_regex, and added documentation for the two functions I added.

Closes #4207

Related: python-poetry/poetry#3738 (comment)

Possibly related? #3507

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label May 27, 2022
@kenodegard kenodegard force-pushed the cb4465 branch 2 times, most recently from 7efe256 to 267b394 Compare May 27, 2022 00:32
@kenodegard kenodegard added this to the 3.21.9 milestone May 27, 2022
@kenodegard kenodegard modified the milestones: 3.21.9, 3.22.0 May 31, 2022
@bryevdv
Copy link

bryevdv commented Jun 1, 2022

@kenodegard Is there any estimated time frame for the 3.22 release?

Copy link
Member

@beeankha beeankha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some minor suggestions, otherwise LGTM! 👍

abrahammurciano and others added 7 commits June 1, 2022 13:38
@kenodegard
Copy link
Contributor Author

@bryevdv We are working to define a release cadence for conda and conda-build (see conda/ceps#26) but I'd expect to see the next release in 1-2 months.

@kenodegard kenodegard merged commit f2d3990 into conda:master Jun 1, 2022
@kenodegard kenodegard deleted the cb4465 branch June 1, 2022 20:37
@kenodegard kenodegard added the in-progress issue is actively being worked on label Jun 1, 2022
@frgfm
Copy link

frgfm commented Jun 28, 2022

Hello there 👋

That's a wonderful feature! I stumbled across it in the documentation and tried to use. The loading of the pyproject.toml fails silently because this commit hasn't made its way to a release. But its presence in the documentation is confusing (I figured it out coming on this PR and checking the last available release which was right before).

I see that you intend on making regular releases, any plan to make a conda-build release soon? :) 🙏

@marscher
Copy link

marscher commented Jul 10, 2022

I'd also be glad, if this nice feature could make it to a release soon 👍

@frgfm I agree, that the documentation should point to "stable" instead of latest. It happened to me in the past as well. Discovered a bleeding edge feature in the main branch docs and tried it without success. But that's for another issue, right?

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA in-progress issue is actively being worked on locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add a load_pyproject_toml_data() template function
7 participants