1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
From: "Michael R. Crusoe" <crusoe@debian.org>
Date: Wed, 14 Aug 2024 15:44:10 +0200
Subject: point to python3-typeshed package for missing types
Co-authored-by: Markus Demleitner <msdemlei@fsfe.org>
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
@@ -105,7 +105,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
@@ -536,7 +536,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
@@ -3158,7 +3158,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]
|