-
-
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
No cyclic-import messages with jobs=0 #4171
Comments
This is issue is mentioned in #374 . |
Sorry, I missed this bug report. |
It might be good to keep this open as it is a simpler repro and the other bug contains a lot of stuff. |
@udifuchs thanks for the report. |
The problem with this trivial example is that it actually detects a non-issue. It seems completely fine to cross-include the modules, as long as the "use" (accessing objects from the module) happens on runtime (not import time). |
Whilst I agree that, in practical terms, the trivial example should "work", I would state that any form of cyclic import is either problematic or will become problematic. That said, if it were possible to detect use-at-import that would be a better, more complete check - but, I suspect that is almost impossible to do thoroughly because of aliasing. Simpler and more useful approaches (vs use-at-import detection) would be to either:
def run_time_use():
"""Safer but uglier.
Still suffers from the potential aliasing problem, but is explicit and scoped, so the problem is contained."""
import A
a.do_something()
"""Dangerous as use-at-import can be introduced later, and deployed to prod"""
import A # pylint: disable=cyclic-import |
Closing as duplicate of #374, I added the example in a comment there. |
Indeed! Reopening because I'm about to mark #374 closed by a separate PR. |
Running
pylint -jobs=0
does not report about cyclic-import. This can be reproduced with a trivial example.a.py
:b.py
:This issue is not new to pylint 2.7. It is more noticeable only because running jobs in parallel became more useful in this version.
The text was updated successfully, but these errors were encountered: