Commit Graph

25252 Commits

Author SHA1 Message Date
Florian Bruhin 59fd7876a1 pytest-bdd 8: Fix borked tag 2024-12-05 19:15:47 +01:00
Florian Bruhin f91dc2d52d pytest-bdd 8: Adjust Python code for multiline steps 2024-12-05 16:19:46 +01:00
Florian Bruhin f4260a6e55 pytest-bdd 8: Fix comments and remaining syntax issues
Looks like inline comments are not permitted anymore.
2024-12-05 16:19:29 +01:00
Florian Bruhin a8a5068e62 pytest-bdd 8: Fix missing multiline step quoting 2024-12-05 16:13:04 +01:00
Florian Bruhin cec00266d0 pytest-bdd 8: Fix tags
Tags containing spaces aren't supported anymore, so we can't add additional skip
descriptions sadly...
2024-12-05 16:11:17 +01:00
Florian Bruhin bb462c2602 pytest-bdd 8: Fix indentations 2024-12-05 16:05:59 +01:00
Florian Bruhin f524926216 Fix tab indentation in feature files 2024-12-05 15:39:56 +01:00
Florian Bruhin 629a38d654 Upgrade to pytest-bdd 8 2024-12-05 15:36:18 +01:00
Marcel Schilling 2aacfe1a8c
Rewrite `.feature` files to use the `"""` syntax
fixes #8342
2024-10-15 15:17:45 +02:00
Florian Bruhin af835c26ad Update changelog 2024-10-15 12:00:25 +02:00
Florian Bruhin ffe7d00a62 Merge branch 'drop-py38' 2024-10-15 11:58:54 +02:00
toofar cc3c1e2050 Enable pylint Too many positional arguments warning
This re-enables the pylint too-many-positional-arguments for the main
application code. It's still disabled for tests because that's how you pull in
pytlint fixtures, and I don't think we want to push people into being creative
with fixtures just to get around that.

When functions are called with many positional arguments the reader has to do
a bit of heavy lifting to figure out in what position a value is being passed,
and it's easier to make mistakes. So I would like to encourage using keyword
arguments for long argument lists.

I've set the `max-positional-arguments` to a completely arbitrary 7, from a
completely arbitrary 5, because there were many more violations under 7. If
like 99% of our functions fit under 7 it's probably fine.

Regarding the exceptions:
* objreg.register: I grepped it and it looks like everything is only passing
  the first two args as positional already, lucky!
*  `_get_color_percentage`: only one usage of it, but I was in "add directive
  comment" mode
* update_3rdparty.py: only one usage, already using kwargs
* pyqtProperty: idk
* commands.py: "its complicated". Many methods in this file map to commands
  used in qutebrowser's command mode. In that case it's usual for them to be
  called as flags, rather than positional. But it could be complicated to wade
  into that, and having one file excluded isn't so bad.
2024-10-15 11:55:04 +02:00
Florian Bruhin ff5d4d3564 Avoid passing a parent to QProcess
With the upgrade to MarkupSafe 3.0, something funny happened when trying to pass
the GUIProcess object to jinja after launching a userscript:

    [...]
    File "[...]/qutebrowser/browser/qutescheme.py", line 291, in qute_process
        src = jinja.render('process.html', title=f'Process {pid}', proc=proc)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "[...]/qutebrowser/utils/jinja.py", line 123, in render
        return environment.get_template(template).render(**kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [...]
    File "html/process.html", line 11, in block 'content'
    File "[...]/lib/python3.11/site-packages/markupsafe/__init__.py", line 42, in escape
        if hasattr(s, "__html__"):
           ^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: wrapped C/C++ object of type GUIProcess has been deleted

This can be reproduced with:

    qutebrowser --temp-basedir ':cmd-later 0 spawn -u -o /bin/echo test'

We pass the `GUIProcess` to the Jinja template as `proc`, which then formats it as
`{{ proc }}`` (to stringify it). For some reason, with the newest MarkupSafe/Jinja
versions, this now triggers the `if hasattr(s, "__html__")` check in MarkupSafe
(which has been around for a while). That then presumably causes PyQt to try and
access the underlying C++ object for `GUIProcess``, but that has already been
deleted.

But why is it deleted in the first place, if we keep track of even completed
processes data ever since we added `:process` in a3adba81c? It looks like the Qt
parent-child relationship is the culprit here: When we pass a parent to the
`GUIProcess`` from the userscript runner, it will get deleted as soon as said
runner is cleaned up (which happens after the userscript has finished).

We probably never noticed this before because we only accessed data from the
Python wrapper and not from the C++ side, but it still seems like a good idea
to avoid passing a parent for a long-lived object (with time-based cleanup) in
the first place.
2024-10-15 11:55:04 +02:00
Florian Bruhin f175f611f8 pylint: Disable too-many-positional-arguments
Added in 3.3.0:
https://pylint.pycqa.org/en/latest/whatsnew/3/3.3/index.html

Some of those arguments could probably indeed be keyword-only,
but for some of the functions shown by pylint, those are qutebrowser command
handlers where a positional argument has different semantics.
2024-10-15 11:55:04 +02:00
Florian Bruhin ab7d04a951 Fix wrong type annotation
This was wrong ever since 0a835ecd92,
but due to the version conditional usage, mypy did not check it.
2024-10-15 11:55:04 +02:00
Florian Bruhin 2ab963cef8 Remove pytz changelog URL 2024-10-15 11:55:04 +02:00
Florian Bruhin 7083fee655 Recompile requirements 2024-10-15 11:55:04 +02:00
Florian Bruhin cc18a624b5 Remove importlib_resources from requirements 2024-10-15 11:55:04 +02:00
Florian Bruhin 0fd6fc19f2 recompile_requirements: Fix with diff.mnemonicPrefix set 2024-10-15 11:55:04 +02:00
Florian Bruhin 088b5973eb Update mimetype overrides
See https://github.com/python/cpython/commits/main/Lib/mimetypes.py
2024-10-15 11:55:04 +02:00
Florian Bruhin eb8121ffd5 Use Callable from collections.abc as well
Did run with ruff pretending to use Python 3.10,
because otherwise it won't reformat those:

    ruff check --select 'UP035' --fix --config 'target-version = "py310"' --unsafe-fixes

This is because collections.abc.Callable inside Optional[...] and Union[...] is
broken with Python 3.9.0 and 3.9.1:

https://github.com/asottile/pyupgrade/issues/677
https://github.com/astral-sh/ruff/issues/2690
https://github.com/python/cpython/issues/87131

However, pylint can detect problematic usages (of which we only have one),
so we might as well use the new thing everywhere possible for consistency.

Also see #7098
2024-10-15 11:54:53 +02:00
Florian Bruhin 97104b2000 Use builtin list/dict/set/... types for annotations
See https://peps.python.org/pep-0585/
and https://docs.python.org/3/whatsnew/3.9.html#type-hinting-generics-in-standard-collections

Done via:

    ruff check --select 'UP006' --fix --config 'target-version = "py39"' --unsafe-fixes

followed by removing unused imports:

    ruff check --select 'F401' --fix --config 'target-version = "py39"'

and a semi-manual review to find imports that are still needed (but ruff doesn't know about yet):

    git diff | grep '^-' | grep import | grep -v "from typing"

Also see #7098.
2024-10-15 11:54:49 +02:00
Florian Bruhin c32b8090ca Import typing classes from collections.abc
See https://peps.python.org/pep-0585/
and https://docs.python.org/3/whatsnew/3.9.html#type-hinting-generics-in-standard-collections

Not changing List/Dict/Set/etc. in this commit, as that's a way bigger change.

Done via:

    ruff check --select 'UP035' --fix --config 'target-version = "py39"'

Also see #7098.
2024-10-15 11:54:35 +02:00
Florian Bruhin 8cf9cc9f1b nsis: Check for newer Windows build
Follow-up to #8321, so we only claim to support what Qt actually officially does.
2024-10-15 11:52:34 +02:00
Florian Bruhin 26b4ec6cef Bleeding requirements: Use pytest-bdd release
See https://github.com/qutebrowser/qutebrowser/issues/8342
2024-10-15 11:42:07 +02:00
Florian Bruhin 463bde5c8e Update changelog 2024-10-15 10:33:53 +02:00
Willow Barraco 61746e0f58 desktop: qutebrowser as webp mime type viewer
This is decent webp viewer, like other web browser.
2024-10-15 10:33:12 +02:00
Florian Bruhin c598cbbc71 Revert "ci: Avoid Archlinux' pyqt6 6.1.7-3 which lacks QSignalSpy"
This reverts commit 27e446d26d.
Archlinux now uses a PyQt 6.8 development snapshot.
2024-10-15 00:47:31 +02:00
toofar f895c022cb
Merge pull request #8337 from qutebrowser/update-dependencies
Update dependencies
2024-10-14 19:21:03 +13:00
qutebrowser bot 80ed616230 Update dependencies 2024-10-14 04:18:59 +00:00
Florian Bruhin 6bf159581e
Merge pull request #8301 from qutebrowser/dependabot/github_actions/peter-evans/create-pull-request-7
Bump peter-evans/create-pull-request from 6 to 7
2024-10-13 21:51:28 +02:00
Florian Bruhin b976a31ffa
Merge pull request #8321 from qutebrowser/feat/8260_drop_qt5_builds
Remove support for making Qt5 builds
2024-10-13 21:45:05 +02:00
Florian Bruhin 27e446d26d ci: Avoid Archlinux' pyqt6 6.1.7-3 which lacks QSignalSpy
See https://github.com/qutebrowser/qutebrowser/issues/8242#issuecomment-2409077518
2024-10-13 20:28:43 +02:00
Florian Bruhin 4d069b8fc3 Use str.removeprefix() and str.removesuffix()
https://docs.python.org/3/whatsnew/3.9.html#new-string-methods-to-remove-prefixes-and-suffixes
2024-10-13 18:24:44 +02:00
Florian Bruhin fe868901ab Remove all importlib_resources backport usage 2024-10-13 18:24:44 +02:00
Florian Bruhin 2ad1a579b1 Remove :debug-cache-stats conditionals 2024-10-13 18:24:44 +02:00
Florian Bruhin 71039e0d53 Minor Python 3.8 dropping adjustments 2024-10-13 18:24:44 +02:00
Florian Bruhin bcff1e90ea Update checkpyver for 3.8 drop 2024-10-13 18:24:44 +02:00
Florian Bruhin eb67b20417 Update docs for Python 3.8 drop 2024-10-13 18:24:44 +02:00
Florian Bruhin 5337882657 Adjust linters for dropping Python 3.8 2024-10-13 18:24:44 +02:00
Florian Bruhin 3288ec8598 Adjust Python versions in setup.py 2024-10-13 18:24:44 +02:00
Florian Bruhin bd3774dfc8 Drop Python 3.8 from tox/CI 2024-10-13 18:24:44 +02:00
Florian Bruhin 02cee732fc
Merge pull request #8334 from qutebrowser/update-dependencies
Update dependencies
2024-10-13 17:20:31 +02:00
qutebrowser bot 6093306ff5 Update dependencies 2024-10-13 14:54:29 +00:00
toofar 50bf3bdd52
Merge pull request #8323 from qutebrowser/update-dependencies
Update dependencies
2024-10-13 15:19:56 +13:00
toofar 7475d385ac Comment out failing test assertion for now
Ref: https://github.com/qutebrowser/qutebrowser/issues/8330
2024-10-13 14:10:43 +13:00
Florian Bruhin 4d2aa13db3 Fix pdf.js downloading tests
See ee89bd1c39
which was part of PDF.js v4.7.76 (2024-10-06).

This should work both with the old and new version.
2024-10-12 22:20:02 +02:00
Florian Bruhin 775db2caef Update Chromium security patch versions 2024-10-12 22:19:58 +02:00
Florian Bruhin cc73134ead Add tenative v3.4.0 changelog 2024-10-12 21:50:07 +02:00
qutebrowser bot eacdca5a36 Release v3.3.1
(cherry picked from commit fc0d7e08bc)
2024-10-12 19:40:58 +00:00