Skip to content

Commit 0475327

Browse files
authored
Add Python 3.12 and PyPy 3.10 support. (#283)
* Add Python 3.12 and PyPy 3.10 support. * Also use 3.12 in publish. * Silence flake8 E231 for ::. * Remove pkg_resources usage from tests.
1 parent 7989199 commit 0475327

File tree

7 files changed

+22
-18
lines changed

7 files changed

+22
-18
lines changed

.github/workflows/checks.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ jobs:
88
fail-fast: false
99
matrix:
1010
include:
11-
- python-version: "3.11"
11+
- python-version: "3.12"
1212
env:
1313
TOXENV: security
14-
- python-version: "3.11"
14+
- python-version: "3.12"
1515
env:
1616
TOXENV: flake8
17-
- python-version: "3.11"
17+
- python-version: "3.12"
1818
env:
1919
TOXENV: pylint
2020
- python-version: "3.11" # Keep in sync with .readthedocs.yml
2121
env:
2222
TOXENV: docs
23-
- python-version: "3.11"
23+
- python-version: "3.12"
2424
env:
2525
TOXENV: typing
26-
- python-version: "3.11"
26+
- python-version: "3.12"
2727
env:
2828
TOXENV: black
29-
- python-version: "3.11"
29+
- python-version: "3.12"
3030
env:
3131
TOXENV: twinecheck
3232

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111

12-
- name: Set up Python 3.10
12+
- name: Set up Python 3.12
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: "3.10"
15+
python-version: "3.12"
1616

1717
- name: Check Tag
1818
id: check-release-tag

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ jobs:
2020
- python-version: "3.11"
2121
env:
2222
TOXENV: py
23-
- python-version: pypy3.9
23+
- python-version: "3.12"
24+
env:
25+
TOXENV: py
26+
- python-version: pypy3.10
2427
env:
2528
TOXENV: pypy3
2629

2730
steps:
2831
- uses: actions/checkout@v4
2932

3033
- name: Install system libraries
31-
if: contains(matrix.python-version, 'pypy3.9')
34+
if: contains(matrix.python-version, 'pypy')
3235
run: |
3336
sudo apt-get update
3437
sudo apt-get install libxml2-dev libxslt-dev

parsel/csstranslator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ def xpath_pseudo_element(
100100
method = getattr(self, method_name, None)
101101
if not method:
102102
raise ExpressionError(
103-
f"The functional pseudo-element ::{pseudo_element.name}() is unknown"
103+
f"The functional pseudo-element ::{pseudo_element.name}() is unknown" # noqa: E231
104104
)
105105
xpath = method(xpath, pseudo_element)
106106
else:
107107
method_name = f"xpath_{pseudo_element.replace('-', '_')}_simple_pseudo_element"
108108
method = getattr(self, method_name, None)
109109
if not method:
110110
raise ExpressionError(
111-
f"The pseudo-element ::{pseudo_element} is unknown"
111+
f"The pseudo-element ::{pseudo_element} is unknown" # noqa: E231
112112
)
113113
xpath = method(xpath)
114114
return xpath
@@ -119,7 +119,7 @@ def xpath_attr_functional_pseudo_element(
119119
"""Support selecting attribute values using ::attr() pseudo-element"""
120120
if function.argument_types() not in (["STRING"], ["IDENT"]):
121121
raise ExpressionError(
122-
f"Expected a single string or ident for ::attr(), got {function.arguments!r}"
122+
f"Expected a single string or ident for ::attr(), got {function.arguments!r}" # noqa: E231
123123
)
124124
return XPathExpr.from_xpath(
125125
xpath, attribute=function.arguments[0].value

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"Programming Language :: Python :: 3.9",
4949
"Programming Language :: Python :: 3.10",
5050
"Programming Language :: Python :: 3.11",
51+
"Programming Language :: Python :: 3.12",
5152
"Programming Language :: Python :: Implementation :: CPython",
5253
"Programming Language :: Python :: Implementation :: PyPy",
5354
],

tests/test_selector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from lxml import etree
1111
from lxml.html import HtmlElement
12-
from pkg_resources import parse_version
12+
from packaging.version import Version
1313

1414
from parsel import Selector, SelectorList
1515
from parsel.selector import (
@@ -1115,8 +1115,8 @@ def test_remove_root_element_selector(self) -> None:
11151115
self.assertEqual(sel.get(), "<html></html>")
11161116

11171117
def test_deep_nesting(self) -> None:
1118-
lxml_version = parse_version(etree.__version__)
1119-
lxml_huge_tree_version = parse_version("4.2")
1118+
lxml_version = Version(etree.__version__)
1119+
lxml_huge_tree_version = Version("4.2")
11201120

11211121
content = """
11221122
<html>

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = security,flake8,typing,pylint,black,docs,twinecheck,py37,py38,py39,py310,pypy3.9
2+
envlist = security,flake8,typing,pylint,black,docs,twinecheck,py38,py39,py310,py311,py312,pypy3.9,pypy3.10
33

44
[testenv]
55
usedevelop = True
@@ -35,7 +35,7 @@ commands =
3535
[testenv:pylint]
3636
deps =
3737
{[testenv]deps}
38-
pylint==2.15.4
38+
pylint==3.0.0
3939
commands =
4040
pylint docs parsel tests setup.py
4141

0 commit comments

Comments
 (0)