-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
A005 (builtin module shadowing) should ignore private modules #12949
Comments
Note that you can suppress this via https://docs.astral.sh/ruff/settings/#lint_flake8-builtins_builtins-allowed-modules. |
I would say it's reasonable to flag these though. What do you think @AlexWaygood? |
While we're waiting for others' feedback, I realized I didn't yet provide rationale for why private modules should be excluded from this check, so here is some: Quoting from ruff's own https://docs.astral.sh/ruff/rules/import-private-name/ rule:
I'm not sure how much ruff tries to harmonize conflicting rules that users have enabled, but this could be an opportunity to improve harmony. Also, a lot of the builtin private modules are like
Another interesting observation is that, out of the dozens of private modules in the standard library, https://docs.python.org/3/py-modindex.html documents only two of them, Click for list of builtin private modules in Python 3.9, in case it's helpful
|
All that said, I'm fine with just keeping my... [tool.ruff.lint.flake8-builtins]
builtins-allowed-modules = ["_abc"] config if it's not worth making any changes here. |
Excluding private modules does make sense to me, considering that there are that many. @AlexWaygood what's your take on this? I would then suggest to make the change so that the rule can be stabilized in the next minor. |
I just updated from ruff 0.5.0 to 0.6.1, and had to add an ignore for A005 so that ruff check would continue to pass:
jab/bidict@57a0d0b
Without that ignore, it would fail as follows:
This check is failing because it treats even private builtin modules as not-to-be-shadowed, and Python provides a private
_abc
builtin:I propose that private modules be excluded from this check.
The text was updated successfully, but these errors were encountered: