-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
"Intermittent" import error when checking a module that import another module which imports a 3rd party package #7276
Comments
Thanks for reporting! Does this also happen with |
Oh, I am sorry. I missed your request.
Indeed, this is even more puzzling since according to documentation:
Do not Thank you. |
We hit this error at least several times a day. |
Does using |
@jmcfallargo Of course, you must install ruamel.yaml first: https://pypi.org/project/ruamel.yaml/ It is just an example. I suspect that this issue can appear with other packages too, but I could not confirm that -- so I use this one in particular in my example. |
@JukkaL No issues with Thank you. |
Correct.
Yeah, it doesn't solve the issue. I'm increasing priority, at least until we better understand why (or how frequently) this happens, since incremental mode issues can be painful to diagnose and work around. |
Thank you, @JukkaL Sorry for not being able to provider further insights on this issue. |
I think what makes ruamel.yaml package "special" is that it uses the Could it be that we're not using the PEP 420 traversal (added by Barry Warsaw in PR #7219) since we're not targetting this package directly? Back Ref: I had reported a similar issue with ruamel here: https://bitbucket.org/ruamel/yaml/issues/328/mypy-complains-that-ruamel-is-missing-type |
For future reference the issue @asfaltboy linked to is now at https://sourceforge.net/p/ruamel-yaml/tickets/328/ |
Unfortunately, a number of tests fail. Please help fixing them :-) Especially the ones to do with cache inconsistencies... There's at least one known bug here: python#7276
Fixed by #10937 |
Unfortunately, a number of tests fail. Please help fixing them :-) Especially the ones to do with cache inconsistencies... There's at least one known bug here: python#7276
python/mypy#7276 branch: feature/TECH-491-support-release-candidates
python/mypy#7276 branch: feature/TECH-491-support-release-candidates
python/mypy#7276 branch: feature/TECH-491-support-release-candidates
python/mypy#7276 branch: feature/TECH-491-support-release-candidates
I am still seeing this issue with
|
See python/mypy#7276 and https://sourceforge.net/p/ruamel-yaml/tickets/328/ for a whole round of finger-pointing (or https://stackoverflow.com/a/78386020/301832 for a summary)
Add `--no-incremental` flag to mypy config to temporarily resolve a flake where mypy is unable to find the Honeydew module. See python/mypy#7276 for details on a similar issue. Run-All-Tests: True Bug: 345717802 Change-Id: I7dff3c4cf5405bf387ffae2802c4b25ff0553f56 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1078421 Reviewed-by: Kevin Cho <chok@google.com> Commit-Queue: Mahesh Saripalli <maheshsr@google.com> Fuchsia-Auto-Submit: Mahesh Saripalli <maheshsr@google.com>
… resolve mypy flake Add `--no-incremental` flag to mypy config to temporarily resolve a flake where mypy is unable to find the Honeydew module. See python/mypy#7276 for details on a similar issue. Run-All-Tests: True Original-Bug: 345717802 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1078421 Original-Revision: 9b5d6807bce05e989e9f7b7afad1430ae4e385ad GitOrigin-RevId: 589ac95b4deca50ca969dadee998a7c244fc6168 Change-Id: I80a6a62dc964f333f8b78d0fc121642ac6dabfd1
Hi,
Sorry for the title. I try to explain myself better.
I have found a strange behaviour in
mypy
related to an import error in a imported module. That is, an error in a module 'b' importing a module 'c' while checking module 'a', which imports 'b'. 'c', of course, is a 3rd party package.In such a case,
mypy
reports nothing on a first round. But if it is run again, it reported aerror: Cannot find module named 'c'
. On a third run, nothing is reported again, while on a fourth run the error re-appears, and so on...This happens even when the type check has been disabled in the import line.
A possible scenario to reproduce this "bug" is as follows:
Create a 'strange_report' package (with an empty
__init__.py
).Create a subpackage called 'a' inside 'strange_report' (with an empty
__init__.py
too).Write an
a.py
module (importer module) such as:b.py
module (imported module)Open terminal and change to directory 'strange_report'.
Module
a.py
can be run withpython -m a.a
If you run
mypy a/a.py
for the first time, you do not get any reports (however, directory '.mypy_cache' is created).But if you run
mypy a/a.py
once again, you get an error:# type: ignore
.However, if cache directory '.mypy_cache' is deleted before running mypy every time, it does not report anything.
Curiously enough, if you check
mypy a/b.py
it consistently reports nothing.I am running on:
Thank for your attention. I hope that will be helpful.
The text was updated successfully, but these errors were encountered: