summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-10wip: add initial attempt at making rename codemod support wildcardsfeat/pyqt_wrapper_lazy_attemptJimmy
It works! With lots of printf debugging! Now that I've gone through and made it work I need to go back and try to understand it and think about all the cases I haven't tested and might have broken. This is my minimal example: before: from qutebrowser.qt.QtCore import (QUrl, QPoint) from qutebrowser.qt.QtGui import QIcon foo = QUrl("about:blank") bar = QPoint() qux = QIcon() after: from qutebrowser.qt import QtCore, QtGui foo = QtCore.QUrl("about:blank") bar = QtCore.QPoint() qux = QtGui.QIcon() I've already ran into one case that I didn't cover with that: from qutebrowser.qt.QtCore import Qt foo = Qt.Key_Enter
2022-04-10Add initial libcst config.Jimmy
Copies the upstream rename codemod because it has shown pretty good results but I want to change it to support wildcards. For example: python -m libcst.tool codemod rename.RenameCommand qutebrowser/browser/browsertab.py --old_name=qutebrowser.qt.QtCore.pyqtSignal --new_name=qutebrowser.qt:QtCore.pyqtSignal --no-format With the vanilla codemod correctly handles the pyqtSignal import and all the references but I don't want to have to run it for every Qt type. I would like to be able to specify names like: --old_name=qutebrowser.qt.QtCore.* --new_name=qutebrowser.qt:QtCore.*
2022-04-10Fix (py)lintJimmy
mypy is still confused. Probably we can install PyQt5-stubs as qutebrowser.qt-stubs. Might try to do the actual import re-writes before figuring out how to make that work (and in CI) though. Mostly line-to-long and ungrouped imports. If we had black and isort set up they would have done it for me! Not sure why there isn't more stuff complaining about visible indent whatever.
2022-04-10Import PyQt via proxy module loader.Jimmy
We want to load modules from PyQt via our own wrapper so we can transparently support both PyQt5 and PyQt6 without having conditional imports all through the codebase. We have a few options for this: 1. fake modules/packages and do a search and replace of imports 2. import everything we need into one module and adjust imports to use those module attributes 3. do either 1 or 2 AND adjust all the references to Qt types to not be the upstream QtThing but just like "thing" (1) is the least effort and so of course what I have implemented here. Apart from the package stuff is imported from no code needs changing. For example: from PyQt5.QtGui import QKeyEvent, QIcon, QPixmap changes to from qutebrowser.qt.QtGui import QKeyEvent, QIcon, QPixmap For (2) we would have to change that to from qutebrowser.qt import QtGui And then refer to the types like QtGui.QKeyEvent, QtGui.QIcon and QtGui.QPixmap. Automating that re-write would mean learning some new stuff for me so I stuck with the option that can be done in an afternoon for now. (3) just builds on (2) to not have Qt on everything. And it may make adapting to some webengine classes moving in Qt6 easier. This will likely make pylint, mypy and some other stuff very confused. To get a list of all the Qt modules we use you can use semgrep, although I didn't quite get it to re-write stuff for me: semgrep --lang=py -e 'from PyQt5.$SUBMODULE import ($IMPORTEES)' -o findings.json --json qutebrowser scripts/ tests/ And then to parse the json: with open("findings.json") as f: data=json.load(f) results = data['results'] submodules = sorted(set(r['extra']['metavars']['$SUBMODULE']['abstract_content'] for r in results)) for m in submodules: print(f"from pyqt import {m}") for m in submodules: print(f'{m} = importlib.import_module("PyQt5.{m}")') Does the qt.py file need to be moved to be a package? Probably not for this setup, I was trying to do something else at the start... TODO: * see if we can get the static analyses working with this * or try using PyParsing, lib2to3, libCST, or pyupgrade to do (2) and get rid of the proxy loader * undo the mechanical changes to scripts/ (leave them referring to PyQt directly and change them on the Qt branch * undo the mechanical changes to the userscripts (maybe make a standalone version of this for them?) Relates to #995
2022-04-10Re-write all PyQt imports to go via qutebrowser.qtJimmy
This is the first step in making qutebrowser work with both PyQt5 and PyQt6. Namely: not having that module name everywhere throughout the codebase. This was a mechanical re-write performed like so: git ls-files -z | xargs -0 sed -i 's/^\(\s*\)from PyQt5\./\1from qutebrowser.qt./' git ls-files -z | xargs -0 sed -i 's/^\(\s*\)import PyQt5\./\1import qutebrowser.qt./' git ls-files -z | xargs -0 sed -i 's/^\(\s*\)from PyQt5 import/\1from qutebrowser.qt import/' This commit won't run as the imports will currently fail, see the next commit for making them work. I was hoping to use semgrep but, while it seems to detect import patterns fine, using it to autofix them doesn't work so well. When multiple objects are imported from somewhere it attempts to do the autofix once for each thing imported. So the fixes mangle each other because they don't re-compute what they are supposed to do. Eg `semgrep --lang=py -e 'from PyQt5.$SUBMODULE import ($IMPORTEES)' --replacement 'from qutebrowser.qt.$SUBMODULE import ($IMPORTEES)' qutebrowser/mainwindow/tabbedbrowser.py -a` The "importees" part of the import pattern doesn't seem to be optional either.
2022-04-05Merge remote-tracking branch 'origin/feat/remove_pyqt_resources_for_importlib'Florian Bruhin
2022-04-05Update changelogFlorian Bruhin
2022-04-05Merge remote-tracking branch 'origin/pr/7103'Florian Bruhin
2022-04-05Use legacy PDF.js build for macOS/Windows releaseslegacy-pdfjsFlorian Bruhin
Fixes #7108
2022-04-05fix more moved icons/ referencesfeat/remove_pyqt_resources_for_importlibJimmy
For Makefile installs (broke while copying stuff over) and pyinstaller installs (broke on launch).
2022-04-04Fix qute-lastpass testsFlorian Bruhin
2022-04-04Switch to Python 3.7 subprocess APIFlorian Bruhin
Follow-up for #6905
2022-04-04Merge branch 'update-dependencies'Florian Bruhin
2022-04-04Revert "pylint: Disable unnecessary-ellipsis for tests"Florian Bruhin
This reverts commit 2b76b6164093754482d848e7487356215556d0d0.
2022-04-04Update changelog URLsFlorian Bruhin
2022-04-04Update dependenciesqutebrowser bot
2022-04-04scripts: Handle root requirements.txt properlyFlorian Bruhin
Regressed in ac2cb6bb303ceec8429b084cdf372a6c8584d780
2022-04-04Update changelogFlorian Bruhin
2022-04-04Clean up some remaining Python version referencesFlorian Bruhin
2022-04-04Update flake8 config for Python 3.6Florian Bruhin
The 'generator_stop' future import is default in Python 3.7: https://docs.python.org/3/library/__future__.html While we do want 'annotations' eventually, it doesn't bring us any gain right now, see #7098.
2022-04-04Drop types-dataclassesFlorian Bruhin
There is https://github.com/python/typeshed/blob/master/stdlib/dataclasses.pyi for the stdlib one
2022-04-04Merge remote-tracking branch 'origin/pr/7102'Florian Bruhin
2022-04-04Load icons via importlib.resourcesJimmy
The PyQt resources system is gone in 6.2 and deprecated before that. This should be the last usage of it. Switches icons to be read with `utils.resources.read_file_binary()` in `notification.py` (fallback desktop notification icon) and `app.py` (icon for the desktop window). importlib only loads resources under a package, so the icons are moved under the `qutebrowser/` directory. Closes: #6062
2022-04-04Add back empty header indexerror workaroundfeat/remove_py36_supportJimmy
The test case on the bug works for me on py37 but CI is failing on 3.10, maybe this isn't quite the same issue. Anyway, we are getting rid of webkit soon.
2022-04-04Remove 3.6 pins from requirements files.Jimmy
Then regenerate the relevant files. Also drop dataclasses from requirements files. TODO: should we drop the dataclasses-types requirement for mypy too?
2022-04-04Drop python3.6 support.Jimmy
Commits for dropping 3.5 support to copy from: c245b7d855ccd "Initial drop of Python 3.5" ccdfb44b8568b "Drop support for Python 3.6.0" Anything needed to update regarding OS version support in doc/install.asciidoc? TODO: remove 3.6/7 annotations in requirements files and rebuild workflows: not sure I updated it right (run 5.12 with 3.7, same 18.04 OS) but 18.04 seems to have 3.7 on it too so it should work. It'll all change when we drop <5.15 anyway. Not sure what the minimum ubuntu version will be going forward. Regarding mimetype overrides (ebb3046822adb) the doctring says they can all go in 3.7 but .h5 is still missing on py39, not sure if we should care. There are a bunch of old(?) warning messages still ignored in tests/end2end/fixtures/quteprocess.py.
2022-04-03Adjust broken linkFlorian Bruhin
2022-04-03Fix some userscript syntax issuesFlorian Bruhin
Thanks to (a hacked) pyupgrade
2022-04-03Simplify some syntaxFlorian Bruhin
Found via pyupgrade
2022-04-02Actually mark qute-pass executableFlorian Bruhin
2022-04-02Update changelogFlorian Bruhin
2022-04-02Mark qute-pass as executable and add checkerFlorian Bruhin
Regressed in #7068
2022-04-01Release v2.5.0v2.5.0Florian Bruhin
2022-04-01Update changelogFlorian Bruhin
2022-04-01Update content.headers.user_agent completionsFlorian Bruhin
2022-04-01Update changelogFlorian Bruhin
2022-03-31Update changelogFlorian Bruhin
2022-03-31Merge remote-tracking branch 'origin/pr/6543'Florian Bruhin
2022-03-31Fix spellingFlorian Bruhin
2022-03-31Fix lint / changelogFlorian Bruhin
2022-03-31readline: Properly delete first characterFlorian Bruhin
2022-03-31Add :rl-rubout and :rl-filename-ruboutFlorian Bruhin
Closes #4561
2022-03-31readline: Allow passing args to cmdutils.registerFlorian Bruhin
2022-03-31Restore deleted testFlorian Bruhin
2022-03-31Merge remote-tracking branch 'origin/pr/6599'Florian Bruhin
2022-03-31Update changelogFlorian Bruhin
2022-03-31Test system-data dir with flatpakFlorian Bruhin
2022-03-31Merge remote-tracking branch 'origin/pr/6946'Florian Bruhin
2022-03-31Update changelogFlorian Bruhin
2022-03-31Merge remote-tracking branch 'origin/pr/6957'Florian Bruhin