-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
ignore-missing-import option does not work on false positive "Library stubs not installed for X" #10601
Comments
It seems related to # False positives are fine for correctness here, since we will check
# precisely later, so we only look at the root of every filename without
# any concern for the exact details. |
I'm working on a fix. I'm hoping to release mypy 0.902 with the fix this week. |
Previously we used `google` as a package perfix for `google.protobuf`. That wasn't correct, since there are other packages in the Google namespace, such as `google.cloud`. This fixes the prefix to to be `google.protobuf`. Fixes #10601.
Fix is in #10609 (waiting for review). This seems specific to |
) Previously we used `google` as a package prefix for `google.protobuf`. That wasn't correct, since there are other packages in the Google namespace, such as `google.cloud`. This fixes the prefix to to be `google.protobuf`. Fixes #10601.
Thanks for the prompt fix @JukkaL, I appreciate it! |
) Previously we used `google` as a package prefix for `google.protobuf`. That wasn't correct, since there are other packages in the Google namespace, such as `google.cloud`. This fixes the prefix to to be `google.protobuf`. Fixes #10601.
he fix to this issue was released in mypy 0.902. |
@alexanderdamiani Your issue seems different. This issue about multiple libraries under the same top-level package, and I'm not aware other libraries that live under |
@JukkaL
Error:
The above install the package |
Bug Report
Sometimes, multiple packages on pypi will share a namespace once installed. One example pair is
google-cloud-storage
andprotobuf
. If you pip install both of these packages, you can see that they both get installed under a top levelgoogle/
folder:This is a problem when one of the packages has a hit in typeshed, but the other does not. In this case, there is a
types-protobuf
package, but not atypes-google-cloud-storage
package. Runningmypy
will always error, even when--ignore-missing-imports
is set. I believe this happens because it thinks that a known library stub is missing (probably because of the sharedgoogle
namespace), but this is not the case.Further, the error message Hints at an incorrect solution:
This message shows up even when
types-protobuf
is already installed.To Reproduce
Create two files,
requirements.txt
andrepro.py
:# requirements.txt protobuf google-cloud-storage types-protobuf mypy
Install the packages:
pip install -r requirements.txt
Run
mypy
:Unfortunately,
--ignore-missing-imports
does not get rid of the error.I may be missing something, but as far as I can tell there is no way to force this error to go away. Since it always errors out, this makes it very hard to typecheck my code, especially in an automated CICD pipeline.
Also note that the hint is not helpful, as it suggests installing a package that is already installed!
Expected Behavior
--ignore-missing-imports
to get rid of this error.Actual Behavior
Your Environment
mypy.ini
(and other config files): n/aThe text was updated successfully, but these errors were encountered: