Skip to content

Commit 637e90b

Browse files
committed
Drop support for EOL Python 2.7 and 3.5
1 parent 2f25bf2 commit 637e90b

File tree

13 files changed

+17
-50
lines changed

13 files changed

+17
-50
lines changed

.appveyor.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ environment:
33
global:
44
PATH: "C:\\Python27\\Scripts\\;%PATH%"
55
matrix:
6-
- TOXENV: py27-base
7-
- TOXENV: py27-optional
8-
- TOXENV: py35-base
9-
- TOXENV: py35-optional
106
- TOXENV: py36-base
117
- TOXENV: py36-optional
128
- TOXENV: py37-base

.github/workflows/python-tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python: [2.7, 3.5, 3.6, 3.7, 3.8, pypy-2.7, pypy3]
10+
python: [3.6, 3.7, 3.8, pypy3]
1111
steps:
1212
- uses: actions/checkout@v2
1313
with:

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
language: python
22
python:
33
- "pypy3"
4-
- "pypy"
4+
- "3.9"
55
- "3.8"
66
- "3.7"
77
- "3.6"
8-
- "3.5"
9-
- "2.7"
10-
- "3.9-dev"
118

129
cache: pip
1310

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ More documentation is available at https://html5lib.readthedocs.io/.
9191
Installation
9292
------------
9393

94-
html5lib works on CPython 2.7+, CPython 3.5+ and PyPy. To install:
94+
html5lib works on CPython 3.6+ and PyPy3. To install:
9595

9696
.. code-block:: bash
9797

html5lib/_trie/_base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
from __future__ import absolute_import, division, unicode_literals
22

3-
try:
4-
from collections.abc import Mapping
5-
except ImportError: # Python 2.7
6-
from collections import Mapping
3+
from collections.abc import Mapping
74

85

96
class Trie(Mapping):

html5lib/_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
from types import ModuleType
44

5-
try:
6-
from collections.abc import Mapping
7-
except ImportError:
8-
from collections import Mapping
5+
from collections.abc import Mapping
96

107
from six import text_type, PY3
118

html5lib/tests/support.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ def convertData(data):
150150
def errorMessage(input, expected, actual):
151151
msg = ("Input:\n%s\nExpected:\n%s\nReceived\n%s\n" %
152152
(repr(input), repr(expected), repr(actual)))
153-
if sys.version_info[0] == 2:
154-
msg = msg.encode("ascii", "backslashreplace")
155153
return msg
156154

157155

html5lib/treebuilders/dom.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
from __future__ import absolute_import, division, unicode_literals
22

33

4-
try:
5-
from collections.abc import MutableMapping
6-
except ImportError: # Python 2.7
7-
from collections import MutableMapping
4+
from collections.abc import MutableMapping
85
from xml.dom import minidom, Node
96
import weakref
107

html5lib/treebuilders/etree_lxml.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@
1414

1515
import warnings
1616
import re
17-
import sys
1817

19-
try:
20-
from collections.abc import MutableMapping
21-
except ImportError:
22-
from collections import MutableMapping
18+
from collections.abc import MutableMapping
2319

2420
from . import base
2521
from ..constants import DataLossWarning
@@ -89,7 +85,7 @@ def serializeElement(element, indent=0):
8985
next_element = next_element.getnext()
9086
elif isinstance(element, str) or isinstance(element, bytes):
9187
# Text in a fragment
92-
assert isinstance(element, str) or sys.version_info[0] == 2
88+
assert isinstance(element, str)
9389
rv.append("|%s\"%s\"" % (' ' * indent, element))
9490
else:
9591
# Fragment case

parse.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def parse():
3636
pass
3737
elif f == '-':
3838
f = sys.stdin
39-
if sys.version_info[0] >= 3:
40-
encoding = None
39+
encoding = None
4140
else:
4241
try:
4342
# Try opening from file system
@@ -135,11 +134,7 @@ def printOutput(parser, document, opts):
135134
kwargs["sanitize"] = True
136135

137136
tokens = treewalkers.getTreeWalker(opts.treebuilder)(document)
138-
if sys.version_info[0] >= 3:
139-
encoding = None
140-
else:
141-
encoding = "utf-8"
142-
for text in serializer.HTMLSerializer(**kwargs).serialize(tokens, encoding=encoding):
137+
for text in serializer.HTMLSerializer(**kwargs).serialize(tokens, encoding=None):
143138
sys.stdout.write(text)
144139
if not text.endswith('\n'):
145140
sys.stdout.write('\n')

requirements-test.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
tox>=3.15.1,<4
44
flake8>=3.8.1,<3.9
5-
pytest>=4.6.10,<5 ; python_version < '3'
6-
pytest>=5.4.2,<7 ; python_version >= '3'
5+
pytest>=5.4.2,<7
76
coverage>=5.1,<6
87
pytest-expect>=1.1.0,<2
9-
mock>=3.0.5,<4 ; python_version < '3.6'
10-
mock>=4.0.2,<5 ; python_version >= '3.6'
8+
mock>=4.0.2,<5

setup.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import ast
44
import codecs
5-
import sys
65

76
from os.path import join, dirname
87
from setuptools import setup, find_packages, __version__ as setuptools_version
@@ -18,8 +17,7 @@
1817

1918
# _markerlib.default_environment() obtains its data from _VARS
2019
# and wraps it in another dict, but _markerlib_evaluate writes
21-
# to the dict while it is iterating the keys, causing an error
22-
# on Python 3 only.
20+
# to the dict while it is iterating the keys, causing an error.
2321
# Replace _markerlib.default_environment to return a custom dict
2422
# that has all the necessary markers, and ignores any writes.
2523

@@ -32,7 +30,7 @@ def pop(self, i=-1):
3230
return self[i]
3331

3432

35-
if _markerlib and sys.version_info[0] == 3:
33+
if _markerlib:
3634
env = _markerlib.markers._VARS
3735
for key in list(env.keys()):
3836
new_key = key.replace('.', '_')
@@ -63,13 +61,11 @@ def default_environment():
6361
'License :: OSI Approved :: MIT License',
6462
'Operating System :: OS Independent',
6563
'Programming Language :: Python',
66-
'Programming Language :: Python :: 2',
67-
'Programming Language :: Python :: 2.7',
6864
'Programming Language :: Python :: 3',
69-
'Programming Language :: Python :: 3.5',
7065
'Programming Language :: Python :: 3.6',
7166
'Programming Language :: Python :: 3.7',
7267
'Programming Language :: Python :: 3.8',
68+
'Programming Language :: Python :: 3 :: Only',
7369
'Programming Language :: Python :: Implementation :: CPython',
7470
'Programming Language :: Python :: Implementation :: PyPy',
7571
'Topic :: Software Development :: Libraries :: Python Modules',
@@ -107,7 +103,7 @@ def default_environment():
107103
'six>=1.9',
108104
'webencodings',
109105
],
110-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
106+
python_requires=">=3.6",
111107
extras_require={
112108
# A conditional extra will only install these items when the extra is
113109
# requested and the condition matches.

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{27,35,36,37,38,py,py3}-{base,six19,optional}
2+
envlist = py{36,37,38,py3}-{base,six19,optional}
33

44
[testenv]
55
deps =

0 commit comments

Comments
 (0)