Skip to content

Suggests incorrect library stubs for google.cloud imports #15869

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

Closed
OscarVanL opened this issue Aug 14, 2023 · 1 comment
Closed

Suggests incorrect library stubs for google.cloud imports #15869

OscarVanL opened this issue Aug 14, 2023 · 1 comment
Labels
bug mypy got something wrong

Comments

@OscarVanL
Copy link

OscarVanL commented Aug 14, 2023

Bug Report

I use a Google Cloud import:

google-cloud-pubsub==2.3.0

and import it like so:

from google.cloud import pubsub_v1

When running mypy it says:

src/foo.py:6: error: Library stubs not installed for "google.cloud"  [import]
src/foo.py:6: note: Hint: "python3 -m pip install types-google-cloud-ndb"
src/foo.py:6: note: (or run "mypy --install-types" to install all missing stub packages)

However installing types-google-cloud-ndb does not fix this.

To Reproduce

Import from google.cloud import pubsub_v1 from google-cloud-pubsub and run mypy.

Expected Behavior

In this case, no stubs/types package exists for this import, so it should suggest nothing.

You can see here that adding type hints/stubs for google.cloud has not been completed.

Actual Behavior

Because types-google-cloud-ndb is specifically for a different Google library installed via from google.cloud import ndb, see its README, this suggestion is incorrect.

This is a PEP 561 type stub package for the google-cloud-ndb package.

Your Environment

  • Mypy version used: 1.5.0
  • Mypy command-line flags: None
  • Python version used: 3.9.17
@OscarVanL OscarVanL added the bug mypy got something wrong label Aug 14, 2023
@ikonst
Copy link
Contributor

ikonst commented Aug 14, 2023

Duplicate of #15343, recently fixed in #15347.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants