Commit Graph

25164 Commits

Author SHA1 Message Date
toofar 4ba0e00bbd Ignore no dictionary errors on CI
The message is:

    The following paths were searched for Qt WebEngine dictionaries:
      /tmp/qutebrowser-basedir-qrhbqblr/data/qtwebengine_dictionaries
    but could not find it.
    Spellchecking can not be enabled.

Tests are failing on "Logged unexpected errors".
2024-09-06 18:13:21 +12:00
toofar d49dd3d48f fix changelog urls 2024-09-06 17:43:12 +12:00
qutebrowser bot 16781b5b09 Update dependencies 2024-09-03 07:26:01 +00:00
toofar adf39e9f72 also update jaroco-context as a workaround
see previous commit
2024-09-03 19:17:09 +12:00
toofar 433074c681 Add importlib_resources to tests requirements file as workaround
Currently the dependency update job is failing[1] because one of the
tests installs multiple requirements files before running the tests and
it claims they have conflicting versions of `importlib_resources` (6.4.0
vs 6.4.4). 6.4.0 is in the pinned files and there is a 6.4.4 available.

Looking though the logs the first time I see importlib_resources==6.4.0
is when printing the requirements for the `test` requirements file.
But it's not mentioned at all when installing that file. Which makes me
think it found it's way into the virtualenv by some other means.

Looking at git blame for the test requirements lock file, it looks like
importlib_resources was introduced in
https://github.com/qutebrowser/qutebrowser/pull/8269 and indeed I can
see version 6.4.0 in setuptools vendored folder[2].

So it looks like this is another issue caused by setuptools adding their
vendored packages into sys.path.

Options I can see for resolving this:

a. add importlib_resources as a dependency in requirements.txt-raw so
  that we always pull down the newest one, even though we don't need it
b. add an @ignore line for importlib_resources
    * I think in the unlikely event we end up needing it then it being
      ignored might be hard to spot
c. drop python 3.8 support
d. switch to a requirements compilation method that doesn't use `pip
  freeze`

I've chosen (a) here because I think it's less surprising than (b), less
work than (c) and I already have a PR up for (d). And it's only pulled
down for 3.8 anyhow, so we'll drop this workaround when we drop that.

[1]: https://github.com/qutebrowser/qutebrowser/actions/runs/10660624684/job/29544897516
[2]: https://github.com/pypa/setuptools/tree/main/setuptools/_vendor
2024-09-03 19:02:52 +12:00
Florian Bruhin 213a163623 test: Ignore new libEGL warnings
Seem to fail all tests on Archlinux-unstable
2024-08-23 21:44:20 +02:00
Florian Bruhin 130479e2bd Add missing copyright / license headers to qutebrowser.qt
Done via:

reuse annotate \
    --exclude-year \
    -c 'Florian Bruhin (The Compiler) <mail@qutebrowser.org>' \
    --license="GPL-3.0-or-later" \
    qutebrowser/qt/*.py
2024-08-22 15:12:22 +02:00
toofar 451cc6fd56 Refer to mkvenv script by full path in install docs
Might help with people copying and pasting commands. I don't think the
script installs itself in bin/ in the virtualenv it creates?

Closes: #8263
2024-08-18 13:23:02 +12:00
Florian Bruhin f3459a8f14 Reset PyInstaller environment on :restart
Starting with PyInstaller 6.10 (6.9?), we're supposed to tell PyInstaller when
we restart our application (and a subprocess should outlive this process).

In their words:

    The above requirement was introduced in PyInstaller 6.9, which changed the
    way the bootloader treats a process spawned via the same executable as its
    parent process. Whereas previously the default assumption was that it is
    running a new instance of (the same) program, the new assumption is that the
    spawned process is some sort of a worker subprocess that can reuse the
    already-unpacked resources. This change was done because the worker-process
    scenarios are more common, and more difficult to explicitly accommodate
    across various multiprocessing frameworks and other code that spawns worker
    processes via sys.executable.

https://pyinstaller.org/en/stable/common-issues-and-pitfalls.html#independent-subprocess
https://pyinstaller.org/en/stable/CHANGES.html (6.10)

While from a quick test on Windows, things still worked without setting the
variable (possibly because we don't use a onefile build), it still seems
reasonable to do what PyInstaller recommends doing.

Follow-up to #8269.
2024-08-13 16:03:54 +02:00
Florian Bruhin ba210f52f1 Simplify type annotation
See #8269
2024-08-13 11:58:50 +02:00
toofar afe3e4aef5
Merge pull request #8269 from qutebrowser/update-dependencies
Update dependencies
2024-08-13 18:01:47 +12:00
toofar 452408870b adjust babel changelog (case change) 2024-08-12 19:29:07 +12:00
toofar 096a4edec2 Add changelog URLs
Few new vendored packages showing up from setuptools for environments
where pkg_resources is being imported for some reasons.

I don't think these requirements should be in our requirements files,
they aren't direct dependancies and they aren't declared as dependancies
of setuptools (and we are currently excluding setuptools from our
requirements files anyway, although apparently that is not the right
thing to do these days). These are actually not installed as normal
packages by are vendored packages shipped with setuptools.

Options I see to deal with them:

1. suck it up and add them to the compiled requirements files
  * not ideal, but should be harmless. They are real packages that the
    setuptools authors have chose to use
2. exclude these new packages using the markers in comments
  * maybe, seems like it could lead to issues in the future if any of
    these packages start getting declared as proper dependancies
3. find out where pkg_resources is being imported and stop it
  * I don't seem to be able to reproduce this behaviour locally, even
    when using a py3.8 docker container. And we are literally only
    running `pip freeze` via subprocess, what could the difference be?
  * I don't particularly want to delve into the arcane python packaging
    stuff, it seems to be layers and layers of very specific issues and
    old vendored packages
4. stop using pip freeze to compile requirements files and just compute
   them based off of the raw files themselves
   * Don't give us the chance to use stuff that we don't depend on but
     happens to be installed. We get other nice things with this too

This commit does (1). I'll open a follow up PR to do (4).
2024-08-12 19:29:07 +12:00
toofar 0050fc99dc mypy: adapt new type hints to pyqt5
Ah! I'm having flashbacks to last year.

1. pyqt5 has plural enum names = define conditional type variable
2. pyqt5 doesn't wrap all the nullable things in Optional = sneakily
   make the existing overload function signature conditional.
   There might be some other was to solve this, not sure. I know we have
   qtutils.add_optional() but in this case it's complaining that the
   signature doesn't match the parent. Narrowing or widening the type of
   the returned object doesn't affect the function signature. Possibly
   we could define our own type variable MaybeOptional...
2024-08-12 19:29:06 +12:00
toofar aceef82b24 mypy: Attempt to extract base class from completion categories
The methods in `completionmodel.py` dealing with completion categories
were annotated with `QAbstractItemModel`. In mypy's latest 3.11 update
it correctly pointed out that there is code relying on some attributes,
like `name`, being on the categories but `QAbstractItemModel` didn't
implement those attributes.

This commit adds a new base class for completion categories which
defines the extra attributes we expect. It also changes the type hints
to ensure all list categories inherit from it.

There is a couple of downsides to the current implementation:
* It's using multiple inheritance
  * the completionmodel code currently expects categories to have all
    the methods of `QAbstractItemModel` plus a few other attributes.
    Each of the categories inherit from a different Qt model, so we
    can't just remove the Qt model from their class definition.
  * trying to extract the Qt models to a `widget` class is way too much
    work to fit in a dependency update, and I'm not sure it'll be the
    right thing to do because the categories are primarily Qt models, so
    we would have have to proxy most methods. Perhaps if they added
    their extra metadata to a central registry or something
  * I tried using a typing.Protocol for BaseCategory but when trying to
    make it also inherit from QAbstractItemModel it got grumpy at me
* It doesn't enforce that the attributes are actually set
  * it makes mypy happy that they are there, but there is nothing
    warning child classes they have forgotten to set them. Mypy does at
    least warn about categories that don't inherit from `BaseCategory`
    so implementors will hopefully go there an look at it.
  * Apparently you can do some stuff with abstract properties, that
    might even have type hinting support. But that's a bit much for me
    to want to pile in there tonight

At lest the type hints in `completionmodel.py` are more correct now!
2024-08-12 19:29:06 +12:00
toofar 98f85cbfcc Fix more type hints
New mypy 3.11 update got smarter and raise some issues, they appear to
be correct in all cases.

There are several `type: ignore[unreachable]` comments in conditionals
on `sys.stderr` being None, which were introduce in a comment
specifically to handle a case where `sys.stderr` could be None. So
presumable the ignore comments were just to shut mypy up when it was
making mistakes.

In `debug.py` it was complaining that the class handling branch was
unreachable, because the type hint was overly restrictive. We do indeed
handle both classes and objects.

`log.py` got some extra Optional annotations around a variable that
isn't set if `sys.stderr` is None.
2024-08-12 18:16:21 +12:00
toofar b91e142643 Remove `callback` arg to webkit print preview
mypy 1.11 has new and improved support for checking partial functions,
and it works great! It says:

    qutebrowser/components/misccommands.py: note: In function "_print_preview":
    qutebrowser/components/misccommands.py:74: error: Unexpected keyword argument "callback" for "to_printer" of
    "AbstractPrinting"  [call-arg]
            diag.paintRequested.connect(functools.partial(
                                        ^
    qutebrowser/browser/browsertab.py:269: note: "to_printer" of "AbstractPrinting" defined here

We indeed removed the callback arg in 377749c76f

And running `:print --preview` on webkit crashes with:

    TypeError: WebKitPrinting.to_printer() got an unexpected keyword argument 'callback'

With this change print preview works again (on webkit), which I'm a
little surprised by!
2024-08-12 18:16:21 +12:00
toofar e2f718a518 Adjust some type hints to better match parent classes
mypy 1.11 has stricter checking of the type signature overridden methods: https://github.com/python/mypy/blob/master/CHANGELOG.md#stricter-checks-for-untyped-overrides

There's a couple of places where I added type hints and had to duplicate the
default kwarg value from the parent.

In `completionmodel.py` it was complaining that the type signature of
`parent()` didn't match that of `QAbstractItemModel` and `QObject`. I've
changed it to be happy, and incidently made it so the positional arg is
optional, otherwise it's impossible to call `QObject.parent()`. Options that I
see:

1. support both variant of parent() - what I've done, the technically correct
   solution
2. have the two overload definitions but in the actual implementation make the
   positional argument required - would mean one overload signature was a lie,
   but would make it more clear how to call `CompletionModel.parent()
3. do type: ignore[override] and leave it as it was

In the end I don't expect there to be many callers of
`CompletionModel.parent(child)`.

I also added a few more function type hints to `completionmodel.py` while I
was there. Not all of them though!

In `objreg.py` I expanded the user of `_IndexType` because as
7b9d70203f say, the window register uses int as the key.
2024-08-12 18:16:21 +12:00
qutebrowser bot 59b2cc71ce Update dependencies 2024-08-12 04:21:43 +00:00
Florian Bruhin b9441cad45 Fix crash when the renderer process terminates for an unknown reason
With PyQt 6, this gets represented as
QWebEnginePage.RenderProcessTerminationStatus(-1)
which is != -1, thus leading to a KeyError.

Updating to a RendererProcessTerminationStatus
enum value works fine on both PyQt5 and PyQt6.
2024-08-04 21:00:50 +02:00
toofar 43fa657f55 Make failed subframe styling error matching more flexible
In the Qt6.8.0-beta2 release for some reason the error message now looks like;

    Failed to style frame: Failed to read a named property '_qutebrowser' from 'Window': Blocked a frame with origin "http://localhost:35549" from accessing a cross-origin frame.

It seems to have an extra "Failed to read a named property '_qutebrowser' from
'Window'" before the "Blocked a frame ..." bit. Seems like maybe a nested
exception situation? Not sure what's going on there but the exception is still
being caught, which is the point of the test.

Hopefully we don't have more issues with subframes cropping up...
2024-07-28 18:58:29 +12:00
toofar 779bb73920 Update pakjoy and chromium versions for Qt6.8
Looks like the kde-unstable arch repo has updated again. It says
6.8.0beta2-1.

I guess the number might change again in the future, still a couple of
months to go before release.
2024-07-28 16:00:17 +12:00
toofar c3f34a8a39 update docs and changelog for URL match patterns link 2024-07-27 11:20:17 +12:00
toofar 152571c9cd Merge pull request #8268 from greenfoo/update_match_patterns_link
Update link to chrome match patterns documentation
2024-07-27 11:13:16 +12:00
Fernando Ramos d65489da91 Update link to match patterns documentation 2024-07-21 21:53:18 +02:00
Florian Bruhin 5003929cdd pakjoy: Fix Qt 5 tests 2024-07-15 08:11:10 +02:00
Florian Bruhin 086c1b4c08 scripts: Adjust PyQt[56]-sip package names 2024-07-15 08:09:13 +02:00
qutebrowser bot a2c8ebf257 Update dependencies 2024-07-15 04:21:46 +00:00
Florian Bruhin 6e84639276 pakjoy: Test behavior when explicitly enabled 2024-07-14 22:14:00 +02:00
Florian Bruhin dfcb6e3f7c pakjoy: Improve error message and add test 2024-07-14 22:04:56 +02:00
owl 67aeae367c
pakjoy: show error message if workaround was explicitly requested and failed 2024-07-14 21:32:25 +02:00
Florian Bruhin 564293fb6e Update pakjoy setting description 2024-07-12 16:33:14 +02:00
Florian Bruhin 2088ecebd9 pakjoy: Add more hardcoded IDs and fix tests 2024-07-12 16:00:52 +02:00
Florian Bruhin bcf792a0dc Add more hardcoded IDs and tests 2024-07-12 15:28:38 +02:00
owl d9b9349656
Add setting to disable Google Hangouts extension
Fixes #8257
2024-07-12 12:36:50 +02:00
toofar 71291280ac
Merge pull request #8256 from qutebrowser/update-dependencies
Update dependencies
2024-07-08 18:38:31 +12:00
qutebrowser bot 2dbb518a8d Update dependencies 2024-07-08 04:20:22 +00:00
Florian Bruhin a5c5cdb08b Fix some typos
Thanks to https://github.com/crate-ci/typos
2024-07-02 13:40:15 +02:00
Florian Bruhin 5f50586ca4 style: Deal with unreachable code and pylint
https://pylint.pycqa.org/en/latest/whatsnew/3/3.2/index.html#what-s-new-in-pylint-3-2-4
2024-07-01 16:44:56 +02:00
Florian Bruhin aae05613b5 style: Use dict.fromkeys()
Added in flake8-comprehensions 3.15.0:
https://github.com/adamchainz/flake8-comprehensions/blob/main/CHANGELOG.rst
2024-07-01 16:43:09 +02:00
qutebrowser bot 95075d20ff Update dependencies 2024-07-01 04:21:28 +00:00
Florian Bruhin 4d2361288d ci: Fix pip/python usage for QtWebKit
I'm sure I tested this locally before pushing
b241b0360b but now it's broken?

This seems to fix things now. See #8247.
2024-06-29 21:59:43 +02:00
Florian Bruhin b241b0360b ci: Install a newer Python 3.10 for QtWebKit image
Starting with the upgrade to Hypothesis 6.103.4 we got hangs when pytest exits.
This is caused by:

https://github.com/HypothesisWorks/hypothesis/pull/4013

combined with:

https://github.com/python/cpython/issues/102126

which was fixed in Python 3.10.11, but the latest 3.10 packaged by Archlinux was
3.10.10.

Thus, we instead build a newer 3.10 from the AUR.
This bumps the build time up to about 20 minutes on my machine, which is
probably acceptable since those are nightly builds only anyways. We could
probably half that by disabling --enable-optimization, but that would be at the
cost of making the actual test runs (which run more often) slower.

Closes #8247
2024-06-29 20:47:59 +02:00
Florian Bruhin b78fc5765a ci: Drop macOS 11
Will be dropped on GitHub Actions tomorrow:
https://github.blog/changelog/2024-05-20-actions-upcoming-changes-to-github-hosted-macos-runners/

For unit tests, we now run them on macOS 13 instead, thus testing on all three
macOS versions we currently support.

For releases, this forces us to now support macOS 12 as the oldest supported
version and drop macOS 11 support. Thus, we should not have a v3.2.2 release.

Not backporting this commit so CI fails there rather than silently bumping up
requirements.
2024-06-27 22:04:40 +02:00
Florian Bruhin df1066b833 Replace all logging._acquireLock usages
Follow-up to d0cc8d4, see #8205
2024-06-26 17:41:30 +02:00
Florian Bruhin f377fd36d9 Fix up changelog
Cherry-picking 21ee2d093a resulted in an accidental v3.3.0 section in the changelog.
2024-06-25 11:19:55 +02:00
qutebrowser bot f9cfef973a Release v3.2.1
(cherry picked from commit 8cb4556245)
2024-06-25 09:07:53 +00:00
Florian Bruhin 547530e33c Move apple silicon releases to v3.2.1 2024-06-25 10:40:46 +02:00
Florian Bruhin 307245c8cf Update changelog 2024-06-25 10:06:27 +02:00
Florian Bruhin addff4f8c4
Merge pull request #8245 from qutebrowser/update-dependencies
Update dependencies
2024-06-25 10:02:03 +02:00