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
Imports within TYPE_CHECKING can induce "cyclic-import" #3525
Comments
- too-many-* messages were temporarily disabled, and should be re-enabled sooner or later - cyclic-import should be re-enabled when pylint-dev/pylint#3525 is fixed
Not only this but they can produce very weir errors, ones reported to files that do not have any imports related to the cyclic ones inside, at least with current code from master. I cannot reproduce the problem with v2.6.0 release, but that one has other issues. |
error file path: tensorbay/opendataset/JHU_CROWD/loader.py pylint will raise cyclic-import error at ubuntu18.04 python3.8.0 and will not raise error at ubuntu20.04 and macos. 4ylint related issue: pylint-dev/pylint#3525
error file path: tensorbay/opendataset/JHU_CROWD/loader.py pylint will raise cyclic-import error at ubuntu18.04 python3.8.0 and will not raise error at ubuntu20.04 and macos. pylint related issue: pylint-dev/pylint#3525
error file path: tensorbay/opendataset/JHU_CROWD/loader.py pylint will raise cyclic-import error at ubuntu18.04 python3.8.0 and will not raise error at ubuntu20.04 and macos. pylint related issue: pylint-dev/pylint#3525
This issue appears to have been marked as resolved but I'm still running into it on pylint 2.11.1, python 3.9.7. The only thing that seems to fix it is using a block disable. if TYPE_CHECKING:
# pylint: disable=cyclic-import
... Can anyone else confirm if they're experiencing this or if I misinterpreted the status of this issue? |
@BobDotCom any chance you could provide a reproducing example ? |
Suppose you have two modules: a.py and b.py.
a
importsb
, butb
needsa
in order to do type annotations, then this is usually done by importinga
within aTYPE_CHECKING
block. Unfortunately, this causes pylint to reportcyclic-import
.Possibly related to #3285
The text was updated successfully, but these errors were encountered: