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

Support skipping python_min and pip_no_build_backend hints #2206

Merged
merged 7 commits into from
Jan 6, 2025

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Jan 6, 2025

Checklist

  • Added a news entry
  • Regenerated schema JSON if schema altered (python conda_smithy/schema.py)

Fixes #2170

Add options to skip linter checks for python_min and missing build backend, both requested in #2170. While at it, fix a TypeError that occurs when conda-forge.yml contains empty linter: or skip: keys.

mgorny added 3 commits January 6, 2025 16:01
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
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.
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.
@mgorny mgorny requested a review from a team as a code owner January 6, 2025 15:02
Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I have just one point: I think test_hint_noarch_python_use_python_min should become more similar in logic to test_hint_pip_no_build_backend, as the testing in the former is currently not as good as in the latter.

Comment on lines 3344 to 3345
if not expected_hints:
pytest.skip("No hints expected")
Copy link
Member

Choose a reason for hiding this comment

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

Why should we need to skip this test if there are no expected hints? We could reformulate the test below to expect empty hints, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It always expected empty hints. I've skipped it because it's redundant, i.e. doesn't test anything.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I agree. It's still testing that the config in conda-forge.yml doesn't break the case of "no hints expected".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, I'll update it. In the end, the skips don't save that much time, and could be confusing.

tests/test_lint_recipe.py Show resolved Hide resolved
@beckermr beckermr enabled auto-merge (squash) January 6, 2025 17:43
@beckermr beckermr merged commit 955a2d0 into conda-forge:main Jan 6, 2025
2 checks passed
@mgorny mgorny deleted the skip-python-min branch January 6, 2025 18:12
@mgorny
Copy link
Contributor Author

mgorny commented Jan 6, 2025

Thanks!

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 this pull request may close these issues.

ENH: Allow ignoring python_min hints
3 participants