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 running conda-smithy lint in feedstock directory #2250

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Feb 25, 2025

Checklist

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

Fixes #2225

Extend the default behavior of conda-smithy lint to detect if a feedstock directory has been passed in place of the recipe directory (e.g. by running it with no paths specified), and handle the paths appropriately.

The new logic covers three possible scenarios:

  1. If --feedstock-directory is passed, everything works as before.

  2. If not, the specified directory is checked for meta.yaml and recipe.yaml, also as before.

  3. If neither exists, the specified directory is checked for conda-forge.yml. If it exists, it set to be the feedstock directory, and the file is parsed to determine the correct recipe subdirectory.

This is primarily meant to address my common mistake of running:

conda smithy lint

in the feedstock directory, which can lead to pretty confusing error messages, particularly if the feedstock is using v1 recipes, and smithy says it can't find recipe/meta.yaml -- and you start wondering whether you've made a typo in conda-forge.yml or what.

This is an alternative to #2249.

Extend the default behavior of `conda-smithy lint` to detect
if a feedstock directory has been passed in place of the recipe
directory (e.g. by running it with no paths specified), and handle
the paths appropriately.

The new logic covers three possible scenarios:

1. If `--feedstock-directory` is passed, everything works as before.

2. If not, the specified directory is checked for `meta.yaml`
   and `recipe.yaml`, also as before.

3. If neither exists, the specified directory is checked for
   `conda-forge.yml`.  If it exists, it set to be the feedstock
   directory, and the file is parsed to determine the correct recipe
   subdirectory.

This is primarily meant to address my common mistake of running:

    conda smithy lint

in the feedstock directory, which can lead to pretty confusing error
messages, particularly if the feedstock is using v1 recipes, and smithy
says it can't find `recipe/meta.yaml` -- and you start wondering whether
you've made a typo in `conda-forge.yml` or what.

This is an alternative to conda-forge#2249.
@mgorny
Copy link
Contributor Author

mgorny commented Feb 25, 2025

@jaimergp, could you tell me what you think of this? I've moved the logic into a function, so I could add tests for it later.

@mgorny mgorny marked this pull request as ready for review February 26, 2025 15:08
@mgorny mgorny requested a review from a team as a code owner February 26, 2025 15:08
Copy link
Member

@beckermr beckermr left a comment

Choose a reason for hiding this comment

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

We need to check the staged-recipes linter against these changes possibly.

@mgorny
Copy link
Contributor Author

mgorny commented Feb 26, 2025

Sure. Just tested against staged-recipes 29285 and both .github/workflows/scripts/linter.py and conda smithy recipe-lint --conda-forge recipes/* seem to work fine (i.e. the latter reports "fine" examples and lints for the new feedstock).

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.

CLI: lint: Feedstock has no recipe/meta.yaml for v1 recipe
2 participants