Skip to content

Commit

Permalink
only support pythons that are not EOL (https://endoflife.date/python)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mic92 committed Sep 9, 2024
1 parent 1e14175 commit 526753b
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 69 deletions.
29 changes: 0 additions & 29 deletions .appveyor.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/python-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 2 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions html5lib/_trie/_base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

try:
from collections.abc import Mapping
except ImportError: # Python 2.7
from collections.abc import Mapping
from collections.abc import Mapping


class Trie(Mapping):
Expand Down
4 changes: 2 additions & 2 deletions html5lib/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions html5lib/treebuilders/dom.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@


try:
from collections.abc import MutableMapping
except ImportError: # Python 2.7
from collections.abc import MutableMapping
from collections.abc import MutableMapping
from xml.dom import minidom, Node
import weakref

Expand Down
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
7 changes: 0 additions & 7 deletions toxver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 526753b

Please sign in to comment.