From a559a8dbfabb36fa22e51ed093affd02c33c48aa Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sat, 8 Nov 2025 00:13:50 +0500 Subject: [PATCH 1/3] Drop Python 3.9. --- .github/workflows/tests-macos.yml | 2 +- .github/workflows/tests-ubuntu.yml | 2 +- .github/workflows/tests-windows.yml | 2 +- cssselect/parser.py | 8 ++++---- pyproject.toml | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests-macos.yml b/.github/workflows/tests-macos.yml index 9d43f12..1b94391 100644 --- a/.github/workflows/tests-macos.yml +++ b/.github/workflows/tests-macos.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/tests-ubuntu.yml b/.github/workflows/tests-ubuntu.yml index 85db82d..0f40077 100644 --- a/.github/workflows/tests-ubuntu.yml +++ b/.github/workflows/tests-ubuntu.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2", "pypy3.11"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2", "pypy3.11"] steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/tests-windows.yml b/.github/workflows/tests-windows.yml index d4139b7..bd6ff1e 100644 --- a/.github/workflows/tests-windows.yml +++ b/.github/workflows/tests-windows.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] steps: - uses: actions/checkout@v5 diff --git a/cssselect/parser.py b/cssselect/parser.py index 6cbe5d2..f969769 100644 --- a/cssselect/parser.py +++ b/cssselect/parser.py @@ -16,7 +16,7 @@ import operator import re import sys -from typing import TYPE_CHECKING, Literal, Optional, Protocol, Union, cast, overload +from typing import TYPE_CHECKING, Literal, Protocol, TypeAlias, Union, cast, overload if TYPE_CHECKING: from collections.abc import Iterable, Iterator, Sequence @@ -46,7 +46,7 @@ class SelectorSyntaxError(SelectorError, SyntaxError): #### Parsed objects -Tree = Union[ +Tree: TypeAlias = Union[ "Element", "Hash", "Class", @@ -59,7 +59,7 @@ class SelectorSyntaxError(SelectorError, SyntaxError): "SpecificityAdjustment", "CombinedSelector", ] -PseudoElement = Union["FunctionalPseudoElement", str] +PseudoElement: TypeAlias = Union["FunctionalPseudoElement", str] class Selector: @@ -831,7 +831,7 @@ def parse_series(tokens: Iterable[Token]) -> tuple[int, int]: #### Token objects -class Token(tuple[str, Optional[str]]): # noqa: SLOT001 +class Token(tuple[str, str | None]): # noqa: SLOT001 @overload def __new__( cls, diff --git a/pyproject.toml b/pyproject.toml index 8506c66..d4d2126 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,12 +10,11 @@ description = "cssselect parses CSS3 Selectors and translates them to XPath 1.0" readme = "README.rst" authors = [{ name = "Ian Bicking", email = "ianb@colorstudy.com" }] maintainers = [{ name = "Paul Tremberth", email = "paul.tremberth@gmail.com" }] -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", From 4dc56dee6ce281d61f889983237e213e44c6d443 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sat, 8 Nov 2025 00:14:58 +0500 Subject: [PATCH 2/3] Cleanup 3.14 RC. --- .github/workflows/checks.yml | 6 +++--- .github/workflows/publish.yml | 2 +- .github/workflows/tests-macos.yml | 2 +- .github/workflows/tests-ubuntu.yml | 4 ++-- .github/workflows/tests-windows.yml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index be003f5..53b1962 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,16 +8,16 @@ jobs: fail-fast: false matrix: include: - - python-version: 3.13 + - python-version: 3.14 env: TOXENV: pylint - python-version: 3.13 # Keep in sync with .readthedocs.yml env: TOXENV: docs - - python-version: 3.13 + - python-version: 3.14 env: TOXENV: typing - - python-version: 3.13 + - python-version: 3.14 env: TOXENV: twinecheck diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3faf4ab..4609175 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version: 3.13 + python-version: 3.14 - name: Build run: | diff --git a/.github/workflows/tests-macos.yml b/.github/workflows/tests-macos.yml index 1b94391..be68aac 100644 --- a/.github/workflows/tests-macos.yml +++ b/.github/workflows/tests-macos.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/tests-ubuntu.yml b/.github/workflows/tests-ubuntu.yml index 0f40077..1ab66c2 100644 --- a/.github/workflows/tests-ubuntu.yml +++ b/.github/workflows/tests-ubuntu.yml @@ -7,13 +7,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2", "pypy3.11"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"] steps: - uses: actions/checkout@v5 - name: Install system libraries - if: contains(matrix.python-version, 'pypy') || contains(matrix.python-version, '3.14.0-rc') + if: contains(matrix.python-version, 'pypy') run: | sudo apt-get update sudo apt-get install libxml2-dev libxslt-dev diff --git a/.github/workflows/tests-windows.yml b/.github/workflows/tests-windows.yml index bd6ff1e..44dc63e 100644 --- a/.github/workflows/tests-windows.yml +++ b/.github/workflows/tests-windows.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14.0-rc.2"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v5 From ffa494c087d671e22cd31816258a7fc1e41b3297 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sat, 8 Nov 2025 00:19:35 +0500 Subject: [PATCH 3/3] Bump tool versions. --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 1 - tox.ini | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 461b7cf..e553d0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.0 + rev: v0.14.4 hooks: - id: ruff-check args: [ --fix ] @@ -10,7 +10,7 @@ repos: hooks: - id: blacken-docs additional_dependencies: - - black==25.1.0 + - black==25.9.0 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index d4d2126..6b89b39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,6 @@ exclude_also = [ "def __repr__", "if sys.version_info", "if __name__ == '__main__':", - "if TYPE_CHECKING:", ] [tool.pylint.MASTER] diff --git a/tox.ini b/tox.ini index 452a364..949a297 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = pre-commit,pylint,py,docs,typing [testenv] deps = lxml>=4.4 - pytest-cov>=2.8 + pytest-cov>=7.0.0 pytest>=5.4 sybil commands = @@ -15,7 +15,7 @@ commands = [testenv:pylint] deps = {[testenv]deps} - pylint==3.3.8 + pylint==4.0.2 commands = pylint {posargs: cssselect tests docs} @@ -29,7 +29,7 @@ commands = [testenv:typing] deps = {[testenv]deps} - mypy==1.18.1 + mypy==1.18.2 types-lxml==2025.8.25 commands = mypy --strict {posargs: cssselect tests}