| 1 |
From: "Michael R. Crusoe" <[email protected]> |
| 2 |
Date: Wed, 14 Aug 2024 15:44:10 +0200 |
| 3 |
Subject: point to python3-typeshed package for missing types |
| 4 |
|
| 5 |
Co-authored-by: Markus Demleitner <[email protected]> |
| 6 |
Forwarded: not-needed |
| 7 |
--- |
| 8 |
mypy/modulefinder.py | 4 +++- |
| 9 |
test-data/unit/check-errorcodes.test | 2 +- |
| 10 |
test-data/unit/check-modules.test | 2 +- |
| 11 |
test-data/unit/fine-grained-modules.test | 4 ++-- |
| 12 |
4 files changed, 7 insertions(+), 5 deletions(-) |
| 13 |
|
| 14 |
--- mypy.orig/mypy/modulefinder.py |
| 15 |
+++ mypy/mypy/modulefinder.py |
| 16 |
@@ -104,7 +104,9 @@ |
| 17 |
notes = [doc_link] |
| 18 |
elif self is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED: |
| 19 |
msg = 'Library stubs not installed for "{module}"' |
| 20 |
- notes = ['Hint: "python3 -m pip install {stub_dist}"'] |
| 21 |
+ notes = ['Hint: On Debian systems, you can install the python3-typeshed package to ' |
| 22 |
+ 'provide mypy with stubs for many popular libraries. ' |
| 23 |
+ 'In virtual Python environments, you can instead run "python3 -m pip install {stub_dist}".'] |
| 24 |
if not daemon: |
| 25 |
notes.append( |
| 26 |
'(or run "mypy --install-types" to install all missing stub packages)' |
| 27 |
--- mypy.orig/test-data/unit/check-errorcodes.test |
| 28 |
+++ mypy/test-data/unit/check-errorcodes.test |
| 29 |
@@ -650,7 +650,7 @@ |
| 30 |
|
| 31 |
[case testErrorCodeMissingModule] |
| 32 |
from defusedxml import xyz # E: Library stubs not installed for "defusedxml" [import-untyped] \ |
| 33 |
- # N: Hint: "python3 -m pip install types-defusedxml" \ |
| 34 |
+ # 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". \ |
| 35 |
# N: (or run "mypy --install-types" to install all missing stub packages) |
| 36 |
from nonexistent import foobar # E: Cannot find implementation or library stub for module named "nonexistent" [import-not-found] |
| 37 |
import nonexistent2 # E: Cannot find implementation or library stub for module named "nonexistent2" [import-not-found] |
| 38 |
--- mypy.orig/test-data/unit/check-modules.test |
| 39 |
+++ mypy/test-data/unit/check-modules.test |
| 40 |
@@ -3123,7 +3123,7 @@ |
| 41 |
from google.non_existent import x |
| 42 |
|
| 43 |
import google.cloud.ndb # E: Library stubs not installed for "google.cloud.ndb" \ |
| 44 |
- # N: Hint: "python3 -m pip install types-google-cloud-ndb" \ |
| 45 |
+ # 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". \ |
| 46 |
# N: (or run "mypy --install-types" to install all missing stub packages) \ |
| 47 |
# N: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports |
| 48 |
from google.cloud import ndb |
| 49 |
--- mypy.orig/test-data/unit/fine-grained-modules.test |
| 50 |
+++ mypy/test-data/unit/fine-grained-modules.test |
| 51 |
@@ -2199,12 +2199,12 @@ |
| 52 |
import jack |
| 53 |
[out] |
| 54 |
a.py:1: error: Library stubs not installed for "requests" |
| 55 |
-a.py:1: note: Hint: "python3 -m pip install types-requests" |
| 56 |
+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". |
| 57 |
a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports |
| 58 |
== |
| 59 |
== |
| 60 |
a.py:1: error: Library stubs not installed for "jack" |
| 61 |
-a.py:1: note: Hint: "python3 -m pip install types-JACK-Client" |
| 62 |
+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". |
| 63 |
a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports |
| 64 |
|
| 65 |
[case testIgnoreErrorsFromTypeshed] |