Skip to content

Commit

Permalink
Initial Python 3.7 drop
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed Jun 26, 2023
1 parent b9855b9 commit 93c7fdd
Show file tree
Hide file tree
Showing 27 changed files with 54 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .flake8
Expand Up @@ -58,7 +58,7 @@ ignore =
PT004,
PT011,
PT012
min-version = 3.7.0
min-version = 3.8.0
max-complexity = 12
per-file-ignores =
qutebrowser/api/hook.py : N801
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -128,10 +128,10 @@ jobs:
fail-fast: false
matrix:
include:
### PyQt 5.15.2 (Python 3.7)
### PyQt 5.15.2 (Python 3.8)
- testenv: py37-pyqt5152
os: ubuntu-20.04
python: "3.7"
python: "3.8"
### PyQt 5.15 (Python 3.10, with coverage)
# FIXME:qt6
# - testenv: py310-pyqt515-cov
Expand All @@ -141,10 +141,10 @@ jobs:
- testenv: py311-pyqt515
os: ubuntu-20.04
python: "3.11"
### PyQt 6.2 (Python 3.7)
### PyQt 6.2 (Python 3.8)
- testenv: py37-pyqt62
os: ubuntu-20.04
python: "3.7"
python: "3.8"
### PyQt 6.3 (Python 3.8)
- testenv: py38-pyqt63
os: ubuntu-20.04
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/recompile-requirements.yml
Expand Up @@ -21,10 +21,6 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .mypy.ini
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.7
python_version = 3.8

### --strict
warn_unused_configs = True
Expand Down
3 changes: 2 additions & 1 deletion .pylintrc
Expand Up @@ -20,7 +20,7 @@ load-plugins=qute_pylint.config,
pylint.extensions.dunder

persistent=n
py-version=3.7
py-version=3.8

[MESSAGES CONTROL]
enable=all
Expand Down Expand Up @@ -52,6 +52,7 @@ disable=locally-disabled,
too-few-public-methods,
import-outside-toplevel,
consider-using-f-string,
consider-using-assignment-expr,
logging-fstring-interpolation,
raise-missing-from,
consider-using-tuple,
Expand Down
8 changes: 2 additions & 6 deletions README.asciidoc
Expand Up @@ -82,7 +82,7 @@ Requirements

The following software and libraries are required to run qutebrowser:

* https://www.python.org/[Python] 3.7 or newer
* https://www.python.org/[Python] 3.8 or newer
* https://www.qt.io/[Qt], either 6.2.0 or newer, or 5.15.0 or newer, with the following modules:
- QtCore / qtbase
- QtQuick (part of qtbase or qtdeclarative in some distributions)
Expand All @@ -103,7 +103,7 @@ websites and using it for transmission of sensitive data._
* https://palletsprojects.com/p/jinja/[jinja2]
* https://github.com/yaml/pyyaml[PyYAML]
On older Python versions (3.7/3.8), the following backports are also required:
On Python 3.8, the following backport is also required:

* https://importlib-resources.readthedocs.io/[importlib_resources]
Expand All @@ -119,10 +119,6 @@ The following libraries are optional:
QtWebEngine backend.
* On Windows, https://pypi.python.org/pypi/colorama/[colorama] for colored log
output.
* https://importlib-metadata.readthedocs.io/[importlib_metadata] on Python 3.7,
to improve QtWebEngine version detection when PyQtWebEngine is
installed via pip (thus, this dependency usually isn't relevant for
packagers).
* https://asciidoc.org/[asciidoc] to generate the documentation for the `:help`
command, when using the git repository (rather than a release).
Expand Down
6 changes: 3 additions & 3 deletions doc/changelog.asciidoc
Expand Up @@ -57,9 +57,9 @@ Added
Removed
~~~~~~~

- Support for Python 3.6 is dropped, as it's been
https://discuss.python.org/t/python-3-6-rides-into-the-sunset/12964[end-of-life upstream]
since December 2021. Python 3.7.0 or newer is now required.
- Python 3.8.0 or newer is now required.
- Support for Python 3.6 and 3.7 is dropped, as they both reached
their [end of life] in December 2021 and June 2023, respectively.
- Support for Qt/PyQt before 5.15.0 and QtWebEngine before 5.15.2 are now
dropped, as older Qt versions are
https://endoflife.date/qt[end-of-life upstream] since mid/late 2020
Expand Down
14 changes: 7 additions & 7 deletions doc/contributing.asciidoc
Expand Up @@ -111,9 +111,9 @@ unittests and several linters/checkers.
Currently, the following tox environments are available:

* Tests using https://www.pytest.org[pytest]:
- `py37`, `py38`, ...: Run pytest for python 3.7/3.8/... with the system-wide PyQt.
- `py37-pyqt512`, ..., `py37-pyqt515`: Run pytest with the given PyQt version (`py37-*` also works).
- `py37-pyqt515-cov`: Run with coverage support (other Python/PyQt versions work too).
- `py38`, `py39`, ...: Run pytest for python 3.8/3.9/... with the system-wide PyQt.
- `py38-pyqt515`, ..., `py38-pyqt65`: Run pytest with the given PyQt version (`py39-*` etc. also works).
- `py38-pyqt515-cov`: Run with coverage support (other Python/PyQt versions work too).
* `flake8`: Run various linting checks via https://pypi.python.org/pypi/flake8[flake8].
* `vulture`: Run https://pypi.python.org/pypi/vulture[vulture] to find
unused code portions.
Expand Down Expand Up @@ -171,16 +171,16 @@ Examples:

----
# run only pytest tests which failed in last run:
tox -e py37 -- --lf
tox -e py38 -- --lf
# run only the end2end feature tests:
tox -e py37 -- tests/end2end/features
tox -e py38 -- tests/end2end/features
# run everything with undo in the generated name, based on the scenario text
tox -e py37 -- tests/end2end/features/test_tabs_bdd.py -k undo
tox -e py38 -- tests/end2end/features/test_tabs_bdd.py -k undo
# run coverage test for specific file (updates htmlcov/index.html)
tox -e py37-cov -- tests/unit/browser/test_webelem.py
tox -e py38-cov -- tests/unit/browser/test_webelem.py
----

Specifying the backend for tests
Expand Down
4 changes: 2 additions & 2 deletions doc/install.asciidoc
Expand Up @@ -38,7 +38,7 @@ version (Qt 5.7, based on a Chromium from March 2016). Furthermore, it packages
Ubuntu 16.04 doesn't come with an up-to-date engine (a new enough QtWebKit, or
QtWebEngine) and also comes with Python 3.5.

You should be able to install a newer Python (3.7+) using the
You should be able to install a newer Python (3.8+) using the
https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa[deadsnakes PPA] or
https://github.com/pyenv/pyenv[pyenv], and then proceed to
<<tox,install qutebrowser in a virtualenv>>. However, this is currently untested. If you
Expand Down Expand Up @@ -452,7 +452,7 @@ This installs all needed Python dependencies in a `.venv` subfolder
This comes with an up-to-date Qt/PyQt including a pre-compiled QtWebEngine
binary, but has a few caveats:

- Make sure your `python3` is Python 3.7 or newer, otherwise you'll get a "No
- Make sure your `python3` is Python 3.8 or newer, otherwise you'll get a "No
matching distribution found" error and/or qutebrowser will not run.
- It only works on 64-bit x86 systems, with other architectures you'll get the
same error.
Expand Down
1 change: 0 additions & 1 deletion misc/requirements/requirements-mypy.txt-raw
Expand Up @@ -7,4 +7,3 @@ types-PyYAML

# So stubs are available even on newer Python versions
importlib_resources
importlib_metadata
5 changes: 1 addition & 4 deletions misc/requirements/requirements-pylint.txt
Expand Up @@ -8,7 +8,7 @@ cryptography==41.0.1
dill==0.3.6
github3.py==4.0.1
idna==3.4
isort==5.11.5
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
pefile==2023.2.7
Expand All @@ -20,10 +20,7 @@ python-dateutil==2.8.2
./scripts/dev/pylint_checkers
requests==2.31.0
six==1.16.0
tomli==2.0.1
tomlkit==0.11.8
typed-ast==1.5.4 ; python_version<"3.8"
typing_extensions==4.6.3
uritemplate==4.1.1
# urllib3==2.0.3
wrapt==1.15.0
8 changes: 1 addition & 7 deletions misc/requirements/requirements-qutebrowser.txt-raw
Expand Up @@ -20,10 +20,4 @@ Pygments # For :view-source --pygments or on QtWebKit
colorama # Colored log output on Windows
adblock # Improved adblocking

# Optional, only relevant when installing PyQt5/PyQtWebEngine via pip.
importlib-metadata # Determining PyQt version
typing_extensions # from importlib-metadata

#@ markers: importlib-resources python_version=="3.7.*" or python_version=="3.8.*"
#@ markers: importlib-metadata python_version=="3.7.*"
#@ markers: typing_extensions python_version<"3.8"
#@ markers: importlib-resources python_version=="3.8.*"
13 changes: 3 additions & 10 deletions misc/requirements/requirements-tests.txt
Expand Up @@ -8,17 +8,15 @@ charset-normalizer==3.1.0
cheroot==10.0.0
click==8.1.3
coverage==7.2.7
exceptiongroup==1.1.1
execnet==1.9.0
filelock==3.12.2
Flask==2.3.2 ; python_version>="3.8"
Flask==2.3.2
hunter==3.6.1
hypothesis==6.79.3
idna==3.4
importlib-metadata==6.7.0
iniconfig==2.0.0
itsdangerous==2.1.2
jaraco.functools==3.8.0 ; python_version>="3.8"
jaraco.functools==3.8.0
# Jinja2==3.1.2
Mako==1.2.4
manhole==1.8.0
Expand Down Expand Up @@ -49,12 +47,7 @@ sortedcontainers==2.4.0
soupsieve==2.4.1
tldextract==3.4.4
toml==0.10.2
tomli==2.0.1
typing_extensions==4.6.3
urllib3==2.0.3
vulture==2.7
Werkzeug==2.3.6 ; python_version>="3.8"
zipp==3.15.0
Flask==2.2.5 ; python_version=="3.7.*"
Werkzeug==2.2.3 ; python_version=="3.7.*"
jaraco.functools<3.8.0 ; python_version=="3.7.*"
Werkzeug==2.3.6
7 changes: 0 additions & 7 deletions misc/requirements/requirements-tests.txt-raw
Expand Up @@ -32,10 +32,3 @@ pytest-xdist
tldextract

#@ ignore: Jinja2, MarkupSafe, colorama
# Python 3.7
#@ markers: Flask python_version>="3.8"
#@ add: Flask==2.2.5 ; python_version=="3.7.*"
#@ markers: Werkzeug python_version>="3.8"
#@ add: Werkzeug==2.2.3 ; python_version=="3.7.*"
#@ markers: jaraco.functools python_version>="3.8"
#@ add: jaraco.functools<3.8.0 ; python_version=="3.7.*"
15 changes: 3 additions & 12 deletions qutebrowser/commands/command.py
Expand Up @@ -403,21 +403,12 @@ def _get_param_value(self, param):
raise TypeError("{}: Legacy tuple type annotation!".format(
self.name))

try:
origin = typing.get_origin(typ) # type: ignore[attr-defined]
except AttributeError:
# typing.get_origin was added in Python 3.8
origin = getattr(typ, '__origin__', None)

origin = typing.get_origin(typ)
if origin is Union:
try:
types = list(typing.get_args(typ)) # type: ignore[attr-defined]
except AttributeError:
# typing.get_args was added in Python 3.8
types = list(typ.__args__)

types = list(typing.get_args(typ))
if param.default is not inspect.Parameter.empty:
types.append(type(param.default))

choices = self.get_arg_info(param).choices
value = argparser.multitype_conv(param, types, value,
str_choices=choices)
Expand Down
4 changes: 2 additions & 2 deletions qutebrowser/misc/checkpyver.py
Expand Up @@ -43,11 +43,11 @@
# to stderr.
def check_python_version():
"""Check if correct python version is run."""
if sys.hexversion < 0x03070000:
if sys.hexversion < 0x03080000:
# We don't use .format() and print_function here just in case someone
# still has < 2.6 installed.
version_str = '.'.join(map(str, sys.version_info[:3]))
text = ("At least Python 3.7 is required to run qutebrowser, but " +
text = ("At least Python 3.8 is required to run qutebrowser, but " +
"it's running with " + version_str + ".\n")

show_errors = '--no-err-windows' not in sys.argv
Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/misc/earlyinit.py
Expand Up @@ -19,7 +19,7 @@

"""Things which need to be done really early (e.g. before importing Qt).
At this point we can be sure we have all python 3.7 features available.
At this point we can be sure we have all python 3.8 features available.
"""

try:
Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/utils/resources.py
Expand Up @@ -27,7 +27,7 @@
from typing import Iterator, Iterable, Union


# We cannot use the stdlib version on 3.7-3.8 because we need the files() API.
# We cannot use the stdlib version on 3.8 because we need the files() API.
if sys.version_info >= (3, 11): # pragma: no cover
# https://github.com/python/cpython/issues/90276
import importlib.resources as importlib_resources
Expand Down
19 changes: 5 additions & 14 deletions qutebrowser/utils/version.py
Expand Up @@ -33,6 +33,7 @@
import getpass
import functools
import dataclasses
import importlib.metadata
from typing import (Mapping, Optional, Sequence, Tuple, ClassVar, Dict, cast,
TYPE_CHECKING)

Expand Down Expand Up @@ -520,19 +521,9 @@ def _get_pyqt_webengine_qt_version() -> Optional[str]:
PyQtWebEngine 5.15.4 renamed it to PyQtWebEngine-Qt5...:
https://www.riverbankcomputing.com/pipermail/pyqt/2021-March/043699.html
Here, we try to use importlib.metadata or its backport (optional dependency) to
figure out that version number. If PyQtWebEngine is installed via pip, this will
give us an accurate answer.
Here, we try to use importlib.metadata to figure out that version number.
If PyQtWebEngine is installed via pip, this will give us an accurate answer.
"""
try:
import importlib.metadata as importlib_metadata # type: ignore[import]
except ImportError:
try:
import importlib_metadata
except ImportError:
log.misc.debug("Neither importlib.metadata nor backport available")
return None

names = (
['PyQt6-WebEngine-Qt6']
if machinery.IS_QT6 else
Expand All @@ -541,8 +532,8 @@ def _get_pyqt_webengine_qt_version() -> Optional[str]:

for name in names:
try:
return importlib_metadata.version(name)
except importlib_metadata.PackageNotFoundError:
return importlib.metadata.version(name)
except importlib.metadata.PackageNotFoundError:
log.misc.debug(f"{name} not found")

return None
Expand Down
5 changes: 1 addition & 4 deletions requirements.txt
Expand Up @@ -2,14 +2,11 @@

adblock==0.6.0
colorama==0.4.6
importlib-metadata==6.7.0 ; python_version=="3.7.*"
importlib-resources==5.12.0 ; python_version=="3.7.*" or python_version=="3.8.*"
importlib-resources==5.12.0 ; python_version=="3.8.*"
Jinja2==3.1.2
MarkupSafe==2.1.3
Pygments==2.15.1
PyYAML==6.0
typing_extensions==4.6.3 ; python_version<"3.8"
zipp==3.15.0
# Unpinned due to recompile_requirements.py limitations
pyobjc-core ; sys_platform=="darwin"
pyobjc-framework-Cocoa ; sys_platform=="darwin"
2 changes: 0 additions & 2 deletions scripts/dev/changelog_urls.json
Expand Up @@ -23,7 +23,6 @@
"Flask": "https://flask.palletsprojects.com/en/latest/changes/",
"Mako": "https://docs.makotemplates.org/en/latest/changelog.html",
"hypothesis": "https://hypothesis.readthedocs.io/en/latest/changes.html",
"exceptiongroup": "https://github.com/agronholm/exceptiongroup/blob/main/CHANGES.rst",
"mypy": "https://mypy-lang.blogspot.com/",
"types-PyYAML": "https://github.com/python/typeshed/commits/main/stubs/PyYAML",
"pytest": "https://docs.pytest.org/en/latest/changelog.html",
Expand Down Expand Up @@ -84,7 +83,6 @@
"pyinstaller": "https://pyinstaller.readthedocs.io/en/stable/CHANGES.html",
"pyinstaller-hooks-contrib": "https://github.com/pyinstaller/pyinstaller-hooks-contrib/blob/master/CHANGELOG.rst",
"pytest-benchmark": "https://pytest-benchmark.readthedocs.io/en/stable/changelog.html",
"typed-ast": "https://github.com/python/typed_ast/commits/master",
"docutils": "https://docutils.sourceforge.io/RELEASE-NOTES.html",
"bump2version": "https://github.com/c4urself/bump2version/blob/master/CHANGELOG.md",
"six": "https://github.com/benjaminp/six/blob/master/CHANGES",
Expand Down

0 comments on commit 93c7fdd

Please sign in to comment.