From 29d3072ee1f982df582b88b4e120453cbbefd37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 9 Sep 2024 09:44:00 +0200 Subject: [PATCH] only support pythons that are not EOL (https://endoflife.date/python) Even debian oldstable has python 3.9. For internet-facing libraries it is not secure for contributor to install unsupported python versions in order to test them. Reducing the number of python versions will make maintenance and testing easier. is not secure to contributor to install unsupported python versions in order to test them. --- .appveyor.yml | 29 ----------------------------- .github/workflows/python-tox.yml | 3 --- README.rst | 16 ++-------------- html5lib/html5parser.py | 4 ++-- setup.py | 6 +----- tox.ini | 2 +- toxver.py | 7 ------- 7 files changed, 6 insertions(+), 61 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index e6f7bf48..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -# appveyor.yml - https://www.appveyor.com/docs/lang/python -# https://www.appveyor.com/docs/windows-images-software/#visual-studio-2022 ---- -image: Visual Studio 2022 -environment: - matrix: - - PY_PYTHON: 2.7 - TOXENV: py27-base - - PY_PYTHON: 2.7 - TOXENV: py27-optional - - PY_PYTHON: 3.7 - TOXENV: py37-base - - PY_PYTHON: 3.7 - TOXENV: py37-optional - -install: - - git submodule update --init --recursive - - py --list - - py -VV - - py -m pip install --upgrade pip - - py -m pip install tox - -build: off - -test_script: - - py -m tox - -after_test: - - py debug-info.py diff --git a/.github/workflows/python-tox.yml b/.github/workflows/python-tox.yml index 5ed83175..0912abb3 100644 --- a/.github/workflows/python-tox.yml +++ b/.github/workflows/python-tox.yml @@ -12,9 +12,6 @@ jobs: os: [ubuntu-latest, windows-latest] deps: [base, optional] include: - - python: "pypy-2.7" - os: ubuntu-latest - deps: base - python: "pypy-3.10" os: ubuntu-latest deps: base diff --git a/README.rst b/README.rst index 6a623a43..befc7aaa 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ or: By default, the ``document`` will be an ``xml.etree`` element instance. Whenever possible, html5lib chooses the accelerated ``ElementTree`` -implementation (i.e. ``xml.etree.cElementTree`` on Python 2.x). +implementation. Two other tree types are supported: ``xml.dom.minidom`` and ``lxml.etree``. To use an alternative format, specify the name of @@ -41,18 +41,6 @@ a treebuilder: with open("mydocument.html", "rb") as f: lxml_etree_document = html5lib.parse(f, treebuilder="lxml") -When using with ``urllib2`` (Python 2), the charset from HTTP should be -pass into html5lib as follows: - -.. code-block:: python - - from contextlib import closing - from urllib2 import urlopen - import html5lib - - with closing(urlopen("http://example.com/")) as f: - document = html5lib.parse(f, transport_encoding=f.info().getparam("charset")) - When using with ``urllib.request`` (Python 3), the charset from HTTP should be pass into html5lib as follows: @@ -90,7 +78,7 @@ More documentation is available at https://html5lib.readthedocs.io/. Installation ------------ -html5lib works on CPython 2.7+, CPython 3.5+ and PyPy. To install: +html5lib works on CPython 3.8+ and PyPy. To install: .. code-block:: bash diff --git a/html5lib/html5parser.py b/html5lib/html5parser.py index 8ab005ba..3fe78b6b 100644 --- a/html5lib/html5parser.py +++ b/html5lib/html5parser.py @@ -427,7 +427,7 @@ def processSpaceCharacters(self, token): def processStartTag(self, token): # Note the caching is done here rather than BoundMethodDispatcher as doing it there # requires a circular reference to the Phase, and this ends up with a significant - # (CPython 2.7, 3.8) GC cost when parsing many short inputs + # (CPython 3.8) GC cost when parsing many short inputs name = token["name"] # In Py2, using `in` is quicker in general than try/except KeyError # In Py3, `in` is quicker when there are few cache hits (typically short inputs) @@ -454,7 +454,7 @@ def startTagHtml(self, token): def processEndTag(self, token): # Note the caching is done here rather than BoundMethodDispatcher as doing it there # requires a circular reference to the Phase, and this ends up with a significant - # (CPython 2.7, 3.8) GC cost when parsing many short inputs + # (CPython 3.8) GC cost when parsing many short inputs name = token["name"] # In Py2, using `in` is quicker in general than try/except KeyError # In Py3, `in` is quicker when there are few cache hits (typically short inputs) diff --git a/setup.py b/setup.py index 5f3dc186..afab2904 100644 --- a/setup.py +++ b/setup.py @@ -63,11 +63,7 @@ def default_environment(): 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -109,7 +105,7 @@ def default_environment(): 'six>=1.9', 'webencodings>=0.5.1', ], - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + python_requires=">=3.8", extras_require={ # A conditional extra will only install these items when the extra is # requested and the condition matches. diff --git a/tox.ini b/tox.ini index fb228e96..94a78542 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,35,36,37,38,39,310,311,py,py3}-{base,optional,oldest} +envlist = py{38,39,310,311,py,py3}-{base,optional,oldest} [testenv] deps = diff --git a/toxver.py b/toxver.py index b082a345..950dc083 100755 --- a/toxver.py +++ b/toxver.py @@ -12,9 +12,6 @@ $ toxver.py pypy-3.8 base TOXENV=pypy3-base - $ toxver.py 2.7 oldest - TOXENV=py27-oldest - $ toxver.py ~3.12.0-0 optional TOXENV=py312-optional @@ -31,10 +28,6 @@ def main(argv): deps = argv[2] - if argv[1].startswith("pypy-2"): - print("TOXENV=pypy-" + deps) - return 0 - if argv[1].startswith("pypy-3"): print("TOXENV=pypy3-" + deps) return 0