-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Refactor meta.yaml lint logic #1906
base: main
Are you sure you want to change the base?
Conversation
+ minor changes and fixes
this will be addressed separately
there are still some TODOs and failing tests
Non-noarch spelling, Literal instead of Union for enum values
replaced by enum order
- test must be package for imports to work - import AbstractSet
b032dd7
to
a654438
Compare
Cc @0xbe7a |
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.
Is there a list somewhere of all the uses of the conda-smithys public API to determine if we need deprecation warnings for all these methods?
return cls(hints=[hint]) | ||
|
||
|
||
Linter = Callable[[dict, T], LintsHints] |
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.
Since every lint is expected to return a LintsHints anyway, why not provide one as an argument and omit the return type. Requiring lint to create an empty LintHints container even if none are returned seems a bit verbose at times
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.
So you're proposing an intentional side effect? I tried to avoid that with my current solution, although it's more verbose, yes.
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.
Yes
"Use linters_meta_yaml.is_jinja_line instead.", | ||
DeprecationWarning, | ||
) | ||
return linters_meta_yaml.is_jinja_line(line) | ||
|
||
|
||
def selector_lines(lines): |
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.
Are any of these util functions actually used outside of conda-smithy
@beckermr? I couldn't find any uses in the conda-forge org outside of this repo. In general, I think we should design a clearly specified public API in the long-term instead of assuming that every public function in this module is a potentially public API. As far as I can tell, other components only use conda_smithy.lint_recipe.main
.
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.
+1
There are good Python libraries I've seen that prefix private modules and functions with _
to create a clear distinction between public and private API.
Any public method should be assumed to be used. As I said before on another pr, unless we plan to release v4, there can be no api changes. |
Also, we should not be introducing any deprecation processes unless core is in agreement on how they work. |
Where should we discuss this? Probably a new issue in this repo? Still, I'm wondering who the users could be that depend on these functions? I would expect that they are only used inside of conda-forge and thus I would expect that the only thing to do would be to ensure that these functions are no longer used anywhere in our codebase. |
Yes a new issue is fine and then on a core call. We're going to bust something for somebody even if we don't know about it. We use semver and that has meaning. |
Also while I'm not opposed to making the functions shorter here, the style in which these PRs are being made is making them difficult/impossible for me to review.
|
Checklist
news
entryThis builds upon #1900 by refactoring the meta.yaml lints out of the ~700 lines
lintify_meta_yaml
function, modularizing the lint logic. While doing that, I added early returns, simplified code and fixed smaller issues.I think a modularized logic like this is a lot more maintainable, but the path forward should definitely be using more Pydantic models for interacting with complex JSON / YAML files.
#1900 needs to be merged first.