Drop python3.6 support.

Commits for dropping 3.5 support to copy from:

c245b7d855ccd "Initial drop of Python 3.5"
ccdfb44b85 "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 (ebb3046822) 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.
This commit is contained in:
Jimmy 2022-04-04 10:30:11 +12:00
parent d0c1d1ff94
commit 060e4fbf80
17 changed files with 33 additions and 63 deletions

View File

@ -57,7 +57,7 @@ ignore =
PT004,
PT011,
PT012
min-version = 3.6.1
min-version = 3.7.0
max-complexity = 12
per-file-ignores =
qutebrowser/api/hook.py : N801

View File

@ -105,10 +105,10 @@ jobs:
fail-fast: false
matrix:
include:
### PyQt 5.12 (Python 3.6)
- testenv: py36-pyqt512
### PyQt 5.12 (Python 3.7)
- testenv: py37-pyqt512
os: ubuntu-18.04
python: 3.6
python: 3.7
### PyQt 5.13 (Python 3.7)
- testenv: py37-pyqt513
os: ubuntu-20.04

View File

@ -1,5 +1,5 @@
[mypy]
python_version = 3.6
python_version = 3.7
### --strict
warn_unused_configs = True

View File

@ -18,7 +18,7 @@ load-plugins=qute_pylint.config,
pylint.extensions.private_import,
persistent=n
py-version=3.6
py-version=3.7
[MESSAGES CONTROL]
enable=all

View File

@ -74,7 +74,7 @@ Requirements
The following software and libraries are required to run qutebrowser:
* https://www.python.org/[Python] 3.6.1 or newer
* https://www.python.org/[Python] 3.7 or newer
* https://www.qt.io/[Qt] 5.12.0 or newer (5.12 LTS or 5.15 recommended, Qt 6 is
not supported yet) with the following modules:
- QtCore / qtbase
@ -96,10 +96,9 @@ 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.6/3.7/3.8), the following backports are also required:
On older Python versions (3.7/3.8), the following backports are also required:
* https://importlib-resources.readthedocs.io/[importlib_resources] (Python 3.8 or older)
* https://github.com/ericvsmith/dataclasses[dataclasses] (Python 3.6 only)
The following libraries are optional:

View File

@ -111,9 +111,9 @@ unittests and several linters/checkers.
Currently, the following tox environments are available:
* Tests using https://www.pytest.org[pytest]:
- `py36`, `py37`, ...: Run pytest for python 3.6/3.7/... with the system-wide PyQt.
- `py36-pyqt512`, ..., `py36-pyqt515`: Run pytest with the given PyQt version (`py35-*` also works).
- `py36-pyqt515-cov`: Run with coverage support (other Python/PyQt versions work too).
- `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).
* `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.
@ -168,16 +168,16 @@ Examples:
----
# run only pytest tests which failed in last run:
tox -e py35 -- --lf
tox -e py37 -- --lf
# run only the end2end feature tests:
tox -e py35 -- tests/end2end/features
tox -e py37 -- tests/end2end/features
# run everything with undo in the generated name, based on the scenario text
tox -e py35 -- tests/end2end/features/test_tabs_bdd.py -k undo
tox -e py37 -- tests/end2end/features/test_tabs_bdd.py -k undo
# run coverage test for specific file (updates htmlcov/index.html)
tox -e py35-cov -- tests/unit/browser/test_webelem.py
tox -e py37-cov -- tests/unit/browser/test_webelem.py
----
Profiling
@ -544,11 +544,11 @@ ____
Setting up a Windows Development Environment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Install https://www.python.org/downloads/release/python-362/[Python 3.6].
* Install https://www.python.org/downloads/release/python-3911/[Python 3.9].
* Install PyQt via `pip install PyQt5`.
* Create a file at `C:\Windows\system32\python3.bat` with the following content (adjust the path as necessary):
`@C:\Python36\python %*`.
This will make the Python 3.6 interpreter available as `python3`, which is used by various development scripts.
This will make the Python 3.9 interpreter available as `python3`, which is used by various development scripts.
* Install git from the https://git-scm.com/download/win[git-scm downloads page].
Try not to enable `core.autocrlf`, since that will cause `flake8` to complain a lot. Use an editor that can deal with plain line feeds instead.
* Clone your favourite qutebrowser repository.

View File

@ -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.6+) using the
You should be able to install a newer Python (3.7+) 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
@ -447,7 +447,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.6 or newer, otherwise you'll get a "No
- Make sure your `python3` is Python 3.7 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.

View File

@ -88,10 +88,6 @@ class ContentDisposition:
reg = email.headerregistry.HeaderRegistry()
try:
parsed = reg('Content-Disposition', decoded)
except IndexError: # pragma: no cover
# WORKAROUND for https://bugs.python.org/issue37491
# Fixed in Python 3.7.5 and 3.8.0.
raise ContentDispositionError("Missing closing quote character")
except ValueError: # pragma: no cover
# WORKAROUND for https://bugs.python.org/issue42946
raise ContentDispositionError("Non-ASCII digit")

View File

@ -65,7 +65,7 @@ class FilePathCategory(QAbstractListModel):
try:
return glob.glob(glob.escape(val) + '*')
except ValueError as e: # pragma: no cover
# e.g. "embedded null byte" with \x00 on Python 3.6 and 3.7
# e.g. "embedded null byte" with \x00 on Python 3.7
log.completion.debug(f"Failed to glob: {e}")
return []

View File

@ -43,11 +43,11 @@ except ImportError: # pragma: no cover
# to stderr.
def check_python_version():
"""Check if correct python version is run."""
if sys.hexversion < 0x03060100:
if sys.hexversion < 0x03070000:
# 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.6.1 is required to run qutebrowser, but " +
text = ("At least Python 3.7 is required to run qutebrowser, but " +
"it's running with " + version_str + ".\n")
if Tk and '--no-err-windows' not in sys.argv: # pragma: no cover
root = Tk()

View File

@ -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.6.1 features available.
At this point we can be sure we have all python 3.7 features available.
"""
try:

View File

@ -784,30 +784,13 @@ def mimetype_extension(mimetype: str) -> Optional[str]:
This mostly delegates to Python's mimetypes.guess_extension(), but backports some
changes (via a simple override dict) which are missing from earlier Python versions.
Most likely, this can be dropped once the minimum Python version is raised to 3.7.
Most likely, this can be dropped once the minimum Python version is raised to 3.10.
"""
overrides = {
# Added in 3.10
"application/x-hdf5": ".h5",
# Added around 3.8
"application/manifest+json": ".webmanifest",
"application/x-hdf5": ".h5",
# Added in Python 3.7
"application/wasm": ".wasm",
# Wrong values for Python 3.6
# https://bugs.python.org/issue1043134
# https://github.com/python/cpython/pull/14375
"application/octet-stream": ".bin", # not .a
"application/postscript": ".ps", # not .ai
"application/vnd.ms-excel": ".xls", # not .xlb
"application/vnd.ms-powerpoint": ".ppt", # not .pot
"application/xml": ".xsl", # not .rdf
"audio/mpeg": ".mp3", # not .mp2
"image/jpeg": ".jpg", # not .jpe
"image/tiff": ".tiff", # not .tif
"text/html": ".html", # not .htm
"text/plain": ".txt", # not .bat
"video/mpeg": ".mpeg", # not .m1v
}
if mimetype in overrides:
return overrides[mimetype]

View File

@ -72,9 +72,8 @@ try:
['qutebrowser = qutebrowser.qutebrowser:main']},
zip_safe=True,
install_requires=['jinja2', 'PyYAML',
'dataclasses; python_version < "3.7"',
'importlib_resources>=1.1.0; python_version < "3.9"'],
python_requires='>=3.6',
python_requires='>=3.7',
name='qutebrowser',
version=_get_constant('version'),
description=_get_constant('description'),
@ -96,7 +95,6 @@ try:
'Operating System :: MacOS',
'Operating System :: POSIX :: BSD',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',

View File

@ -336,7 +336,7 @@ def test_command_on_start(request, quteproc_new):
quteproc_new.wait_for_quit()
@pytest.mark.parametrize('python', ['python2', 'python3.5'])
@pytest.mark.parametrize('python', ['python2', 'python3.6'])
def test_launching_with_old_python(python):
try:
proc = subprocess.run(
@ -346,7 +346,7 @@ def test_launching_with_old_python(python):
except FileNotFoundError:
pytest.skip(f"{python} not found")
assert proc.returncode == 1
error = "At least Python 3.6.1 is required to run qutebrowser"
error = "At least Python 3.7 is required to run qutebrowser"
assert proc.stderr.decode('ascii').startswith(error)

View File

@ -19,7 +19,6 @@
"""Tests for qutebrowser.config.configtypes."""
import re
import sys
import json
import math
import warnings
@ -1501,12 +1500,8 @@ class TestRegex:
pytest.param('(' * 500, id='too many parens'),
pytest.param(r'foo\Xbar', id='invalid escape X'),
pytest.param(r'foo\Cbar', id='invalid escape C'),
pytest.param(r'[[]]', id='nested set', marks=pytest.mark.skipif(
sys.hexversion < 0x03070000,
reason="Warning was added in Python 3.7")),
pytest.param(r'[a||b]', id='set operation', marks=pytest.mark.skipif(
sys.hexversion < 0x03070000,
reason="Warning was added in Python 3.7")),
pytest.param(r'[[]]', id='nested set'),
pytest.param(r'[a||b]', id='set operation'),
])
def test_to_py_invalid(self, klass, val):
with pytest.raises(configexc.ValidationError):

View File

@ -28,12 +28,12 @@ import pytest
from qutebrowser.misc import checkpyver
TEXT = (r"At least Python 3.6.1 is required to run qutebrowser, but it's "
TEXT = (r"At least Python 3.7 is required to run qutebrowser, but it's "
r"running with \d+\.\d+\.\d+.")
@pytest.mark.not_frozen
@pytest.mark.parametrize('python', ['python2', 'python3.5'])
@pytest.mark.parametrize('python', ['python2', 'python3.6'])
def test_old_python(python):
"""Run checkpyver with old python versions."""
try:

View File

@ -18,7 +18,6 @@ passenv = PYTHON DISPLAY XAUTHORITY HOME USERNAME USER CI XDG_* QUTE_* DOCKER QT
basepython =
py: {env:PYTHON:python3}
py3: {env:PYTHON:python3}
py36: {env:PYTHON:python3.6}
py37: {env:PYTHON:python3.7}
py38: {env:PYTHON:python3.8}
py39: {env:PYTHON:python3.9}