-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Use explicit path in "recipe not found" exception #2249
base: main
Are you sure you want to change the base?
Conversation
Replace the "Feedstock has no ..." error message with a more clear "recipe not found" with explicit path, and a suggestion to pass the `recipe` subdirectory. This should help people like me, who keep forgetting that in top feedstock directory you need to run: conda smithy lint recipe/ instead of just: conda smithy lint and get the message: OSError: Feedstock has no recipe/meta.yaml which is confusing since clearly there is a `recipe/meta.yaml` in the current directory. Unless you're using v1 recipes, then you get even more confused why it tries to use a v0 recipe file.
@@ -743,7 +743,7 @@ def main( | |||
|
|||
if not os.path.exists(recipe_file): | |||
raise OSError( | |||
f"Feedstock has no recipe/{os.path.basename(recipe_file)}" | |||
f'Recipe not found: {recipe_file}; did you pass the "recipe" subdirectory?' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a setting for recipe
, so this shouldn't be hardcoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, "kinda". If you aren't passing the correct directory, then we can't get the setting — and I dare say changing the name is rare enough that "recipe" will be a good hint most of the time. Perhaps it would work if I removed the quotes:
f'Recipe not found: {recipe_file}; did you pass the "recipe" subdirectory?' | |
f'Recipe not found: {recipe_file}; did you pass the recipe subdirectory?' |
?
Thanks! Added a comment, but I wonder if we could a good default so that CLI path is indeed not necessary though. |
Co-authored-by: jaimergp <jaimergp@users.noreply.github.com>
Make it work both with top feedstock directory and the subdirectory? I suppose that would make sense, and I can't see an obvious case where it would backfire. |
So, how about this?
|
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.
The alternative approach was implemented in #2250. |
Checklist
news
entrypython conda_smithy/schema.py
)Replace the "Feedstock has no ..." error message with a more clear "recipe not found" with explicit path, and a suggestion to pass the
recipe
subdirectory. This should help people like me, who keep forgetting that in top feedstock directory you need to run:instead of just:
and get the message:
which is confusing since clearly there is a
recipe/meta.yaml
in the current directory. Unless you're using v1 recipes, then you get even more confused why it tries to use a v0 recipe file.