summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2022-07-30 17:30:10 +1200
committertoofar <toofar@spalge.com>2022-07-30 19:31:10 +1200
commit09d171c85f26368358ecae6651dc684c4e6f6427 (patch)
treebb93bbea22a817a9e63b3f1e64a0b5263146adc4
parent379257df9c5d72f0dcb3d370f5be1b53adedb394 (diff)
downloadqutebrowser-09d171c85f26368358ecae6651dc684c4e6f6427.tar.gz
qutebrowser-09d171c85f26368358ecae6651dc684c4e6f6427.zip
Add pyqt5 stubs back for mypy
It seems it does lower the number of errors! Still lots of errors that appear to be from the PyQt5 path though (eg complaining that webenginecore doesn't have QWebEngineDownloadRequest because we copied that over for qt5) I'm starting to think just making our own copy of the stub files might actually be a better option, despite it probably being hard to make work with everyone's local setup (eg their IDEs).
-rw-r--r--misc/requirements/requirements-mypy.txt1
-rw-r--r--misc/requirements/requirements-mypy.txt-raw2
-rw-r--r--qutebrowser/qt.py2
3 files changed, 4 insertions, 1 deletions
diff --git a/misc/requirements/requirements-mypy.txt b/misc/requirements/requirements-mypy.txt
index 47253c95b..62c130253 100644
--- a/misc/requirements/requirements-mypy.txt
+++ b/misc/requirements/requirements-mypy.txt
@@ -11,6 +11,7 @@ mypy==0.961
mypy-extensions==0.4.3
pluggy==1.0.0
Pygments==2.12.0
+PyQt5-stubs==5.15.6.0
PyQt6-stubs @ git+https://github.com/toofar/PyQt6-stubs.git@7e0929694eea67d5ce33908808669d8896ebaaa2
tomli==2.0.1
types-PyYAML==6.0.8
diff --git a/misc/requirements/requirements-mypy.txt-raw b/misc/requirements/requirements-mypy.txt-raw
index 94d5342ef..13f766e84 100644
--- a/misc/requirements/requirements-mypy.txt-raw
+++ b/misc/requirements/requirements-mypy.txt-raw
@@ -2,7 +2,7 @@ mypy
lxml # For HTML reports
diff-cover
-#PyQt5-stubs
+PyQt5-stubs
#git+https://github.com/python-qt-tools/PyQt6-stubs.git#main
git+https://github.com/toofar/PyQt6-stubs.git#main
types-PyYAML
diff --git a/qutebrowser/qt.py b/qutebrowser/qt.py
index ea8520278..4948ad5cc 100644
--- a/qutebrowser/qt.py
+++ b/qutebrowser/qt.py
@@ -94,6 +94,8 @@ try:
from PyQt5 import QtWebEngineCore as webenginecore
from PyQt5 import QtWebEngineWidgets as webenginewidgets
# Some stuff moved from widgets to core in Qt6
+ # fixme:mypy cannot follow these renamings and I can't seem to get it
+ # to ignore the PyQt5 codepaths.
for attr in [
"QWebEngineSettings",
"QWebEngineProfile",