From 09d171c85f26368358ecae6651dc684c4e6f6427 Mon Sep 17 00:00:00 2001 From: toofar Date: Sat, 30 Jul 2022 17:30:10 +1200 Subject: 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). --- misc/requirements/requirements-mypy.txt | 1 + misc/requirements/requirements-mypy.txt-raw | 2 +- qutebrowser/qt.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) 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", -- cgit v1.2.3-54-g00ecf