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

improve conda linting message: No valid build backend found #2103

Open
1 task done
JohannesBuchner opened this issue Oct 27, 2024 · 3 comments
Open
1 task done

improve conda linting message: No valid build backend found #2103

JohannesBuchner opened this issue Oct 27, 2024 · 3 comments
Labels

Comments

@JohannesBuchner
Copy link

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

I got this message:

"Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe/meta.yaml) and found it was in an excellent condition.
I do have some suggestions for making it better though...

For recipe/meta.yaml:

No valid build backend found for Python recipe for package ultranest using pip. Python recipes using pip need to explicitly specify a build backend in the host section. If your recipe has built with only pip in the host section in the past, you likely should add setuptools to the host section of your recipe.

"

There are many technical terms specific to conda and python packaging here, such as "build backend" and "host section".
The text writes "in the host section" implying that I have one in recipe.yaml. I do have requirements->host, am I supposed to write it there? https://github.com/conda-forge/ultranest-feedstock/blob/main/recipe/meta.yaml

Like many maintainers, I do not spend all day working on conda recipes and do not keep its documentation and terminology in my forehead. I just use it to get things done. It would be very helpful to design the linter to either a) add a suggested snippet of the relevant recipe section to such messages, b) add a link to an example that addresses this message, c) add a link to the conda documentation where the problem and solution is explained.

Installed packages

N/A

Environment info

N/A

@ocefpaf
Copy link
Member

ocefpaf commented Oct 28, 2024

There are many technical terms specific to conda and python packaging here, such as "build backend" and "host section".
The text writes "in the host section" implying that I have one in recipe.yaml. I do have requirements->host, am I supposed to write it there?

Correct.

Like many maintainers, I do not spend all day working on conda recipes and do not keep its documentation and terminology in my forehead.

Any improvements to the message/docs are welcomed. The host was easy to find. Backend is python specific, not conda, and foryour package it seems to be setuptools. See https://github.com/JohannesBuchner/UltraNest/blob/fbde672781762ef01aa24b46bdd01c614e0b0005/pyproject.toml#L3

@beckermr
Copy link
Member

Very happy to help make things clearer! One question about that. The message says

"If your recipe has built with only pip in the host section in the past, you likely should add setuptools to the host section of your recipe."

The idea was to provide specific instructions for the most common case. What was confusing about this for you?

We maintain conda recipes so much that we cannot tell, as you say above, and so any help in making it clearer would be very welcome.

Thank you!

@JohannesBuchner
Copy link
Author

JohannesBuchner commented Oct 30, 2024

Thanks for the question.

My recipe has a build section:

build:
  number: 1
  # may need to later add "skip: True  # [win]" to disable Windows.
  script_env:
    - MPLBACKEND=agg
  skip: true  # [py<30 or python_impl == "pypy"]
  script: {{ PYTHON }} -m pip install . -vv

so my first instinct was that I should add it there.

There is a requirements section which has a host sub-section:

requirements:
  build:
    - python                                 # [build_platform != target_platform]
    - cross-python_{{ target_platform }}     # [build_platform != target_platform]
    - cython                                 # [build_platform != target_platform]
    - numpy                                  # [build_platform != target_platform]
    # cython project, so need a compiler
    - {{ compiler('c') }}
    - {{ stdlib("c") }}
    - cython
  host:
    - python
    - pip
    - cython
    - numpy
    - pytest-runner

I would suggest changing "you likely should add setuptools to the host section of your recipe"
to "you likely should add setuptools to the host section within the requirements section of your recipe"

Having the link to the docs would make it clear.

It is also confusing because both sub-sections and sections are called "sections" in https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#host so my next thought was that I would have to add another section that I had never heard of.

I would suggest having a look at the other rules of the linter and adding pointers to the documentation to those as well. It just saves the maintainer time to not have to come up with the right google keywords and find the right page, when the linter already can narrow it down and point to the documentation or upgrade notes explaining the context.

Thank you for your consideration.

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

No branches or pull requests

3 participants