scipp / copier_template

Copier template for Scipp projects
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Generate conda/meta.yaml #146

Closed jl-wynen closed 3 months ago

jl-wynen commented 3 months ago

Fixes #85

Please have a careful look to see whether this works for all projects. I think it does but I may have missed a case.

As an example, in Sciline, all that is needed is to change the new content in pyproject.toml to

[tool.conda_meta.dependency_map]
graphviz = "python-graphviz"

[tool.conda_meta.extra_dependencies]
run = [
]
test = [
]

because graphviz is used in basetest.in.

The extra_dependencies mapping exists for cases where we depend on, e.g., scipp[interactive] in pip and depending on scipp in conda is not enough. Then we can add missing stuff here. I thought we had a case like this. However, after implementing it, I could not find one. The only thing I did find is scipp[all] in base.in in ScippNeutron. But that does not affect conda/meta.yaml. So I can remove this feature if you prefer simplicity now and risk revisiting this in the future.

YooSunYoung commented 3 months ago

I thought we had a case like this. However, after implementing it, I could not find one. The only thing I did find is scipp[all] in base.in in ScippNeutron. But that does not affect conda/meta.yaml. So I can remove this feature if you prefer simplicity now and risk revisiting this in the future.

Yeah... it might be easier to keep them here though. The projects that don't need this can delete them after copier update.

jl-wynen commented 3 months ago

I tried it locally, and it copied comments after # as well when it copies basetest.in, but it seems okay in the conda build anyways, which I didn't know : D

Right, I didn't think of this. Should be fine though

SimonHeybrock commented 3 months ago

I just found https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#loading-data-from-other-files, can we use that to get content from pyproject.toml?

jl-wynen commented 3 months ago

I just found https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#loading-data-from-other-files, can we use that to get content from pyproject.toml?

It may be possible to use this. But it would require some non-trivial jinja code to handle differences in conda and pip package names, dependencies with extras (scipp[all]), and parsing basetest.in. I don't think that would be easier to understand than a python script.

SimonHeybrock commented 3 months ago

I just found https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#loading-data-from-other-files, can we use that to get content from pyproject.toml?

It may be possible to use this. But it would require some non-trivial jinja code to handle differences in conda and pip package names, dependencies with extras (scipp[all]), and parsing basetest.in. I don't think that would be easier to understand than a python script.

Well, but maybe all the non-standard cases can be done by hand in the affected projects (there might be very few)? My fear is that having a very non-standard pyproject.toml and losing the ability to manually edit the meta.yaml would come to haunt us.

SimonHeybrock commented 3 months ago

Closing in favor of #147, please comment if you disagree.