From 26e30439cb7aff689d6e8291fb7988a83bb6482f Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Fri, 26 Jul 2024 22:41:18 +0200 Subject: [PATCH 1/3] Drops support for Python 3.7 --- .github/workflows/quality-checks.yml | 1 - ROADMAP.md | 2 +- _delb/names.py | 3 ++- _delb/plugins/https_loader.py | 3 ++- _delb/typing.py | 5 ----- _delb/xpath/ast.py | 11 ++--------- _delb/xpath/parser.py | 3 ++- _delb/xpath/tokenizer.py | 3 +-- pyproject.toml | 3 +-- 9 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index be8a207d..113fe80e 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -27,7 +27,6 @@ jobs: strategy: matrix: python-version: - - 3.7 # 2023-06-27 - 3.8 # 2024-10 - 3.9 # 2025-10 - "3.10" # 2026-10 diff --git a/ROADMAP.md b/ROADMAP.md index 8ee7b2db..3436463f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -26,7 +26,7 @@ ## 0.7 -- drop support for Python 3.7 & 3.8 +- drop support for Python 3.8 - a native implementation of the data model - add a node type for CDATA - provide means to build a wheel with *mypyc* diff --git a/_delb/names.py b/_delb/names.py index 0bdf58a7..b8750899 100644 --- a/_delb/names.py +++ b/_delb/names.py @@ -20,7 +20,8 @@ from typing import TYPE_CHECKING, Iterator, Optional if TYPE_CHECKING: - from _delb.typing import Final, NamespaceDeclarations + from typing import Final + from _delb.typing import NamespaceDeclarations XML_NAMESPACE: Final = "http://www.w3.org/XML/1998/namespace" XMLNS_NAMESPACE: Final = "http://www.w3.org/2000/xmlns/" diff --git a/_delb/plugins/https_loader.py b/_delb/plugins/https_loader.py index 63b8dcfe..4010c6b5 100644 --- a/_delb/plugins/https_loader.py +++ b/_delb/plugins/https_loader.py @@ -31,8 +31,9 @@ if TYPE_CHECKING: from collections.abc import Iterator from types import SimpleNamespace + from typing import Final - from _delb.typing import Final, LoaderResult + from _delb.typing import LoaderResult try: diff --git a/_delb/typing.py b/_delb/typing.py index 6624964c..2ea598ac 100644 --- a/_delb/typing.py +++ b/_delb/typing.py @@ -34,10 +34,6 @@ from _delb.nodes import NodeBase, _TagDefinition -if sys.version_info < (3, 8): # DROPWITH Python 3.7 - from typing_extensions import Final -else: - from typing import Final if sys.version_info < (3, 11): # DROPWITH Python 3.10 from typing_extensions import Self @@ -56,7 +52,6 @@ __all__ = ( "Filter", - "Final", "Loader", "LoaderConstraint", "LoaderResult", diff --git a/_delb/xpath/ast.py b/_delb/xpath/ast.py index 28bbfb7f..1c1bcfeb 100644 --- a/_delb/xpath/ast.py +++ b/_delb/xpath/ast.py @@ -17,9 +17,8 @@ import inspect import operator -import sys from collections.abc import Callable, Iterable, Iterator, Sequence -from functools import wraps +from functools import cached_property, wraps from textwrap import indent from typing import TYPE_CHECKING, cast, Any, NamedTuple, Optional @@ -28,17 +27,11 @@ from _delb.plugins import plugin_manager as _plugin_manager from _delb.utils import _is_node_of_type -# REMOVE when support for Python 3.7 is dropped -if sys.version_info < (3, 8): - cached_property = property -else: - from functools import cached_property - if TYPE_CHECKING: + from typing import Final from _delb.names import Namespaces from _delb.nodes import NodeBase, ProcessingInstructionNode, TagNode - from _delb.typing import Final xpath_functions: Final = _plugin_manager.xpath_functions diff --git a/_delb/xpath/parser.py b/_delb/xpath/parser.py index 4bb36b9a..6ccca907 100644 --- a/_delb/xpath/parser.py +++ b/_delb/xpath/parser.py @@ -43,7 +43,8 @@ from _delb.xpath.tokenizer import COMPLEMENTING_TOKEN_TYPES, TokenType, tokenize, Token if TYPE_CHECKING: - from _delb.typing import Final, TypeAlias + from typing import Final + from _delb.typing import TypeAlias TokenPattern: TypeAlias = Sequence[Union[TokenType, None]] # noqa: SIM907 diff --git a/_delb/xpath/tokenizer.py b/_delb/xpath/tokenizer.py index 8d8f846b..539a6982 100644 --- a/_delb/xpath/tokenizer.py +++ b/_delb/xpath/tokenizer.py @@ -24,8 +24,7 @@ if TYPE_CHECKING: from collections.abc import Sequence - - from _delb.typing import Final + from typing import Final # constants & data structures diff --git a/pyproject.toml b/pyproject.toml index 4ced73fb..eb72eac4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,14 +13,13 @@ authors = [ ] license = "AGPL-3.0-or-later" readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Natural Language :: English", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From da1912684e797fd1a8f19f7ccc3de78584e25073 Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Fri, 26 Jul 2024 22:41:58 +0200 Subject: [PATCH 2/3] GH Actions: Generally uses Python 3.12 --- .github/workflows/linkcheck.yml | 2 +- .github/workflows/quality-checks.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index a36bf31e..3be4a5d8 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - run: pip install hatch - run: hatch run docs:linkcheck diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 113fe80e..8d80b357 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -57,7 +57,7 @@ jobs: ref: ${{ inputs.ref || github.ref }} - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - uses: extractions/setup-just@v2 - run: pip install hatch - run: just ${{ matrix.target }} From 9a4854d79bef08613f7e280eae1a6f1092f85be7 Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Fri, 26 Jul 2024 22:42:51 +0200 Subject: [PATCH 3/3] linting: Disables a defunc flake8 plugin that isn't too important --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eb72eac4..013c052c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -156,7 +156,8 @@ dependencies = [ "flake8-pyprojecttoml", "flake8-pytest-style", "flake8-use-fstring", - "flake8-use-pathlib", + # FIXME? this needs an update (uses pkg_resources), but isn't pressing + # "flake8-use-pathlib", "flake8-rst-docstrings", "flake8-simplify", "flake8-sphinx-links",