mamba-org/boa

Feature Request: integration with pyproject.toml

moqmar opened this issue · 0 comments

Especially for private projects, there is not always a huge separation between python code and packaging, so in most cases we have a pyproject.toml with all the information redundant in the recipe.yaml.

Now that the recipe.yaml format is a valid YAML subset, there are two features I'd like for that:

  1. In https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#templating-with-jinja, a statement {% set data = load_setup_py_data() %} is outlined. Now that pyproject.toml becomes a common file format, I think it would be nice to have e.g. a pyproject field in the context automatically, or e.g. being able to specify it e.g. like this:
    context:
        pyproject: "{{ load_toml('pyproject.toml') }}"
    Then, it'd be easily possible to later refer to the project's metadata as a single source of truth with e.g. name: "{{ pyproject.project.name }}".
  • Would it make sense to also being able to parse the whole recipe from a section in the pyproject.toml, like [tool.boa.recipe]? This could look somewhat like this:
    [project]
    name = "example"
    [tool.boa.recipe.context]
    pyproject = "{{ load_toml('pyproject.toml') }}"
    [tool.boa.recipe.about]
    name = "{{ pyproject.project.name }}"
    [tool.boa.recipe.build]
    script = "pip install ."
    Then, boa could render the recipe from that as something like this before the build, and everything could stay in one single file:
    context:
        pyproject = "{{ load_toml('pyproject.toml') }}"
    about:
        name: "{{ pyproject.project.name }}"
    build:
        script: "pip install ."