From: "Michael R. Crusoe" Date: Wed, 14 Aug 2024 15:44:10 +0200 Subject: point to python3-typeshed package for missing types Co-authored-by: Markus Demleitner Forwarded: not-needed --- mypy/modulefinder.py | 4 +++- test-data/unit/check-errorcodes.test | 2 +- test-data/unit/check-modules.test | 2 +- test-data/unit/fine-grained-modules.test | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) --- mypy.orig/mypy/modulefinder.py +++ mypy/mypy/modulefinder.py @@ -104,7 +104,9 @@ notes = [doc_link] elif self is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED: msg = 'Library stubs not installed for "{module}"' - notes = ['Hint: "python3 -m pip install {stub_dist}"'] + notes = ['Hint: On Debian systems, you can install the python3-typeshed package to ' + 'provide mypy with stubs for many popular libraries. ' + 'In virtual Python environments, you can instead run "python3 -m pip install {stub_dist}".'] if not daemon: notes.append( '(or run "mypy --install-types" to install all missing stub packages)' --- mypy.orig/test-data/unit/check-errorcodes.test +++ mypy/test-data/unit/check-errorcodes.test @@ -650,7 +650,7 @@ [case testErrorCodeMissingModule] from defusedxml import xyz # E: Library stubs not installed for "defusedxml" [import-untyped] \ - # N: Hint: "python3 -m pip install types-defusedxml" \ + # N: Hint: On Debian systems, you can install the python3-typeshed package to provide mypy with stubs for many popular libraries. In virtual Python environments, you can instead run "python3 -m pip install types-defusedxml". \ # N: (or run "mypy --install-types" to install all missing stub packages) from nonexistent import foobar # E: Cannot find implementation or library stub for module named "nonexistent" [import-not-found] import nonexistent2 # E: Cannot find implementation or library stub for module named "nonexistent2" [import-not-found] --- mypy.orig/test-data/unit/check-modules.test +++ mypy/test-data/unit/check-modules.test @@ -3123,7 +3123,7 @@ from google.non_existent import x import google.cloud.ndb # E: Library stubs not installed for "google.cloud.ndb" \ - # N: Hint: "python3 -m pip install types-google-cloud-ndb" \ + # N: Hint: On Debian systems, you can install the python3-typeshed package to provide mypy with stubs for many popular libraries. In virtual Python environments, you can instead run "python3 -m pip install types-google-cloud-ndb". \ # N: (or run "mypy --install-types" to install all missing stub packages) \ # N: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports from google.cloud import ndb --- mypy.orig/test-data/unit/fine-grained-modules.test +++ mypy/test-data/unit/fine-grained-modules.test @@ -2199,12 +2199,12 @@ import jack [out] a.py:1: error: Library stubs not installed for "requests" -a.py:1: note: Hint: "python3 -m pip install types-requests" +a.py:1: note: Hint: On Debian systems, you can install the python3-typeshed package to provide mypy with stubs for many popular libraries. In virtual Python environments, you can instead run "python3 -m pip install types-requests". a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports == == a.py:1: error: Library stubs not installed for "jack" -a.py:1: note: Hint: "python3 -m pip install types-JACK-Client" +a.py:1: note: Hint: On Debian systems, you can install the python3-typeshed package to provide mypy with stubs for many popular libraries. In virtual Python environments, you can instead run "python3 -m pip install types-JACK-Client". a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports [case testIgnoreErrorsFromTypeshed]