Skip to content

types-google-cloud-ndb is recommended incorrectly #15343

Closed
@asottile

Description

@asottile

Bug Report

this stub package only provides the google.cloud.ndb.* namespace -- however it is suggested for any missing google import

To Reproduce

from google.cloud.exceptions import NotFound

Expected Behavior

it should not recommend this package unless the specific module is imported

Actual Behavior

$ yes | ./venv/bin/mypy t.py --install-types
t.py:1: error: Library stubs not installed for "google.cloud.exceptions"  [import]
t.py:1: note: Hint: "python3 -m pip install types-google-cloud-ndb"
t.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
t.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

Installing missing stub packages:
/tmp/y/venv/bin/python -m pip install types-google-cloud-ndb

Install? [yN] 
Collecting types-google-cloud-ndb
  Using cached types_google_cloud_ndb-2.1.0.7-py3-none-any.whl (16 kB)
Installing collected packages: types-google-cloud-ndb
Successfully installed types-google-cloud-ndb-2.1.0.7

note: Run mypy again for up-to-date results with installed types
asottile@asottile-sentry:/tmp/y
$ yes | ./venv/bin/mypy t.py --install-types
t.py:1: error: Library stubs not installed for "google.cloud.exceptions"  [import]
t.py:1: note: Hint: "python3 -m pip install types-google-cloud-ndb"
t.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
t.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

Installing missing stub packages:
/tmp/y/venv/bin/python -m pip install types-google-cloud-ndb

Install? [yN] 
Requirement already satisfied: types-google-cloud-ndb in ./venv/lib/python3.10/site-packages (2.1.0.7)

note: Run mypy again for up-to-date results with installed types

Your Environment

  • Mypy version used: 1.3.0
  • Mypy command-line flags: --install-types
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: 3.10.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions