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

ENH: Allow ignoring python_min hints #2170

Closed
h-vetinari opened this issue Nov 26, 2024 · 4 comments · Fixed by #2206
Closed

ENH: Allow ignoring python_min hints #2170

h-vetinari opened this issue Nov 26, 2024 · 4 comments · Fixed by #2206

Comments

@h-vetinari
Copy link
Member

Some feedstocks need to opt-out of the test pins for python_min, for example due to being used elsewhere as a downstreams: test against other python versions (c.f. conda-forge/conda-forge.github.io#2387, conda-forge/conda-smithy-feedstock#331, conda-forge/setuptools-feedstock#371).

Given this reality, we shouldn't force those feedstocks to live with linter warnings in perpetuity, but give them a way to silence the linter. In #2090, the following mechanism was introduced

linter:
  skip:
    - lint_noarch_selectors

This could easily be extended to allow

linter:
  skip:
    - hint_python_min
@isuruf
Copy link
Member

isuruf commented Nov 26, 2024

Or if we want to be more explicit

linter:
  skip:
    - hint_python_min_in_host
    - hint_python_min_in_run
    - hint_python_min_in_test_requires

@rgommers
Copy link
Contributor

Another lint I ran into that needed skipping was the check about a build backend being present for a noarch recipe (don't have the exact message at hand now). The reason is that meson-python has an in-tree build backend (namely, itself), so that it doesn't need an external one. This is probably going to be true for all build backends and perhaps a handful of other projects.

This could be handled via a linter skip, or by the linter also looking at the [build-requires] section of pyproject.toml and disabling the warning if backend-path is present.

I like the proposed syntax in the comments above.

@xylar
Copy link

xylar commented Dec 9, 2024

@rgommers, it might be best to make a separate issue for that because it's not related to python_min. But I agree. poetry-core is another package where the backend is provided in code and the warning could be skipped.

@mgorny
Copy link
Contributor

mgorny commented Jan 6, 2025

I'm working on this.

mgorny added a commit to mgorny/conda-smithy that referenced this issue Jan 6, 2025
Support `hint_python_min` in `linter.skip`.  I went for a single token
for all `python_min` hints, since it seems reasonable to assume that
if one explicitly disables this, the feedstock was already inspected
for appropriate `python_min` usage.

Fixes conda-forge#2170
mgorny added a commit to mgorny/conda-smithy that referenced this issue Jan 6, 2025
Support skipping the hints about missing build backend dependency,
e.g. when the package itself is providing the build backend
(e.g. in poetry-core-feedstock).

Also requested in issue conda-forge#2170.
mgorny added a commit to mgorny/conda-smithy that referenced this issue Jan 6, 2025
Support `hint_python_min` in `linter.skip`.  I went for a single token
for all `python_min` hints, since it seems reasonable to assume that
if one explicitly disables this, the feedstock was already inspected
for appropriate `python_min` usage.

Fixes conda-forge#2170
mgorny added a commit to mgorny/conda-smithy that referenced this issue Jan 6, 2025
Support skipping the hints about missing build backend dependency,
e.g. when the package itself is providing the build backend
(e.g. in poetry-core-feedstock).

Also requested in issue conda-forge#2170.
beckermr added a commit that referenced this issue Jan 6, 2025
* Support skipping python_min hints

Support `hint_python_min` in `linter.skip`.  I went for a single token
for all `python_min` hints, since it seems reasonable to assume that
if one explicitly disables this, the feedstock was already inspected
for appropriate `python_min` usage.

Fixes #2170

* Support skipping pip_no_build_backend hints

Support skipping the hints about missing build backend dependency,
e.g. when the package itself is providing the build backend
(e.g. in poetry-core-feedstock).

Also requested in issue #2170.

* Fix `TypeError` when `linter:` or `skip:` keys are empty

Fix the error such as:

```
Traceback (most recent call last):
  File "/home/mgorny/miniforge3/bin/conda-smithy", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/mgorny/git/conda-smithy/conda_smithy/cli.py", line 767, in main
    args.subcommand_func(args)
  File "/home/mgorny/git/conda-smithy/conda_smithy/cli.py", line 645, in __call__
    lints, hints = linter.main(
                   ^^^^^^^^^^^^
  File "/home/mgorny/git/conda-smithy/conda_smithy/lint_recipe.py", line 733, in main
    results, hints = lintify_meta_yaml(
                     ^^^^^^^^^^^^^^^^^^
  File "/home/mgorny/git/conda-smithy/conda_smithy/lint_recipe.py", line 281, in lintify_meta_yaml
    if "lint_noarch_selectors" not in lints_to_skip:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
```

when `conda-forge.yml` contains an empty key, e.g.:

```
linter:
  skip:
```

Noticed this accidentally while testing the other changes.

* Add a news entry

* Don't skip "skip" tests when we expect no warnings

As suggested by @h-vetinari in #2206 (comment).

---------

Co-authored-by: Matthew R. Becker <[email protected]>
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

Successfully merging a pull request may close this issue.

5 participants