Repository navigation
Add an __init__.py to the cookiecutter hooks - #676
Merged
Merged
Conversation
pylint now fails on `cookiecutter/hooks` with `F0010: Unable to load file cookiecutter/hooks/__init__.py`. This breaks CI for every PR, including the Dependabot ones. The local `cookiecutter/` directory is an implicit namespace package, and the installed `cookiecutter` package has a `cookiecutter.hooks` module. Since pylint 4.1.4 and astroid 4.4.0, either of which is enough, pylint takes `cookiecutter/hooks` for a regular package and looks for an `__init__.py` that doesn't exist. Both releases include fixes for pylint-dev/pylint#10278, which seem to cause this regression. I reported it as pylint-dev/pylint#11902. Adding the `__init__.py` makes the directory a regular package, which works with both the old and the new versions. Cookiecutter ignores the file, because it only runs files named after a hook. Listing the hook files explicitly in the noxfile would also work, but new files added to the directory would then be silently left out of the checks. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
llucax
marked this pull request as ready for review
December 1, 2026 14:11
llucax
requested review from
Marenz,
daniel-zullo-frequenz and
florian-wagner-frequenz
and removed request for
a team
December 1, 2026 14:11
llucax
enabled auto-merge
December 1, 2026 14:11
daniel-zullo-frequenz
approved these changes
Dec 1, 2026
Merged
via the queue into
frequenz-floss:v0.x.x
with commit Dec 1, 2026
dd7f45b
10 of 11 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pylint now reports
F0010: Unable to load file cookiecutter/hooks/__init__.py. This is a regression in pylint 4.1.4 and astroid 4.4.0, either of which is enough to trigger it. I reported it upstream as pylint-dev/pylint#11902.Adding the
__init__.pyworks with both the old and new versions, and cookiecutter ignores the file.