From 060e4fbf8054996b98c60e2f97938945c88cf103 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 4 Apr 2022 10:30:11 +1200 Subject: Drop python3.6 support. 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. --- .flake8 | 2 +- .github/workflows/ci.yml | 6 +++--- .mypy.ini | 2 +- .pylintrc | 2 +- README.asciidoc | 5 ++--- doc/contributing.asciidoc | 18 +++++++++--------- doc/install.asciidoc | 4 ++-- qutebrowser/browser/webkit/http.py | 4 ---- qutebrowser/completion/models/filepathcategory.py | 2 +- qutebrowser/misc/checkpyver.py | 4 ++-- qutebrowser/misc/earlyinit.py | 2 +- qutebrowser/utils/utils.py | 23 +++-------------------- setup.py | 4 +--- tests/end2end/test_invocations.py | 4 ++-- tests/unit/config/test_configtypes.py | 9 ++------- tests/unit/misc/test_checkpyver.py | 4 ++-- tox.ini | 1 - 17 files changed, 33 insertions(+), 63 deletions(-) diff --git a/.flake8 b/.flake8 index 9110dc54c..4ef393a9f 100644 --- a/.flake8 +++ b/.flake8 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afcf720e4..06863ab10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.mypy.ini b/.mypy.ini index 501ab747e..b347323f5 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -1,5 +1,5 @@ [mypy] -python_version = 3.6 +python_version = 3.7 ### --strict warn_unused_configs = True diff --git a/.pylintrc b/.pylintrc index 4ff4f2080..c5a1289fb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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 diff --git a/README.asciidoc b/README.asciidoc index bb1f2562c..30e504032 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -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: diff --git a/doc/contributing.asciidoc b/doc/contributing.asciidoc index 75c19045e..de7389feb 100644 --- a/doc/contributing.asciidoc +++ b/doc/contributing.asciidoc @@ -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. diff --git a/doc/install.asciidoc b/doc/install.asciidoc index dd284fb9a..bb4e08f5a 100644 --- a/doc/install.asciidoc +++ b/doc/install.asciidoc @@ -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 <>. 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. diff --git a/qutebrowser/browser/webkit/http.py b/qutebrowser/browser/webkit/http.py index fed357e62..08a4509eb 100644 --- a/qutebrowser/browser/webkit/http.py +++ b/qutebrowser/browser/webkit/http.py @@ -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") diff --git a/qutebrowser/completion/models/filepathcategory.py b/qutebrowser/completion/models/filepathcategory.py index b7d74f57a..fd2cb58ce 100644 --- a/qutebrowser/completion/models/filepathcategory.py +++ b/qutebrowser/completion/models/filepathcategory.py @@ -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 [] diff --git a/qutebrowser/misc/checkpyver.py b/qutebrowser/misc/checkpyver.py index e9a7a1eef..7d6a524c3 100644 --- a/qutebrowser/misc/checkpyver.py +++ b/qutebrowser/misc/checkpyver.py @@ -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() diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 034d7ff74..45266fd40 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -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: diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 9c68932f3..a28d662b3 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -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] diff --git a/setup.py b/setup.py index 4c4bd3243..cb088e04c 100755 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 43809cfd4..0d49ff109 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -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) diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index ef3007f71..c34efce54 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -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): diff --git a/tests/unit/misc/test_checkpyver.py b/tests/unit/misc/test_checkpyver.py index 52e022a44..a23d02e1c 100644 --- a/tests/unit/misc/test_checkpyver.py +++ b/tests/unit/misc/test_checkpyver.py @@ -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: diff --git a/tox.ini b/tox.ini index 370adbc9e..0990b1b4a 100644 --- a/tox.ini +++ b/tox.ini @@ -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} -- cgit v1.2.3-54-g00ecf