From 9415c473ff5ce8a7b2470c64203b27f9db9987a9 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Tue, 26 Aug 2025 16:57:51 -0500 Subject: [PATCH 1/5] tests: fix pathlib.PurePosixPath repr on py3.14 ``` fish for i in python3.{9,10,11,12,13,14} echo -n "$i " $i -c 'import pathlib; print(repr(pathlib.PurePosixPath))' end ``` ``` python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 ``` --- tests/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 768bd83..08809e2 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -124,7 +124,7 @@ def test_printr(obj, expects, capsys): assert re.match(expects, stdout[0]) -if sys.version_info >= (3, 13): +if sys.version_info[:2] == (3, 13): pure_posix_path_expected = "" else: pure_posix_path_expected = "" From de6666297dd534d6e8f658bd9e7ea9cd95a6285a Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Tue, 26 Aug 2025 17:04:47 -0500 Subject: [PATCH 2/5] words: fix alphabet_sort exception handling for py3.14 As of https://github.com/python/cpython/pull/121395, the format of the list.index exception has changed and parsing it like this no longer works. Relying on implementation details like this is always risky, so this solution should be more future-proof. --- domdf_python_tools/words.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/domdf_python_tools/words.py b/domdf_python_tools/words.py index 40967f2..ad2e5fe 100644 --- a/domdf_python_tools/words.py +++ b/domdf_python_tools/words.py @@ -171,14 +171,13 @@ def alpha_sort( alphabet_ = list(alphabet) - try: - return sorted(iterable, key=lambda attr: [alphabet_.index(letter) for letter in attr], reverse=reverse) - except ValueError as e: - m = re.match(r"'(.*)' is not in list", str(e)) - if m: - raise ValueError(f"The character {m.group(1)!r} was not found in the alphabet.") from None - else: # pragma: no cover - raise e + def _alphabet_index(letter: str) -> int: + try: + return alphabet_.index(letter) + except ValueError: + raise ValueError(f"The character {letter!r} was not found in the alphabet.") from None + + return sorted(iterable, key=lambda attr: [_alphabet_index(letter) for letter in attr], reverse=reverse) class Font(Dict[str, str]): From 5ab8bd47d90fe5289f4c363b915704242e0e256e Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Thu, 11 Dec 2025 18:56:05 +0000 Subject: [PATCH 3/5] Skip pathlib.PurePath for from_uri test in Python 3.13 --- tests/test_paths.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_paths.py b/tests/test_paths.py index 22e411b..1e42ec6 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -20,7 +20,7 @@ # 3rd party import pytest from coincidence.regressions import AdvancedDataRegressionFixture -from coincidence.selectors import not_pypy, not_windows, only_windows +from coincidence.selectors import not_pypy, not_windows, only_windows, max_version # this package from domdf_python_tools import paths @@ -925,7 +925,11 @@ def test_sort_paths(): @pytest.mark.parametrize("path", _from_uri_paths) -@pytest.mark.parametrize("left_type", [pathlib.PurePath, pathlib.Path, PathPlus]) +@pytest.mark.parametrize("left_type", [ + pytest.param(pathlib.PurePath, marks=max_version((3, 13))), + pathlib.Path, + PathPlus, + ]) def test_pathplus_from_uri(path: str, left_type: Type): assert PathPlus.from_uri(left_type(path).as_uri()).as_posix() == path From 4e24efeee86ab13b29f0b4e1f27639a1584ebf2b Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Thu, 11 Dec 2025 18:56:49 +0000 Subject: [PATCH 4/5] Configure testing on Python 3.14 --- .github/workflows/python_ci.yml | 3 ++- .github/workflows/python_ci_linux.yml | 3 ++- .github/workflows/python_ci_macos.yml | 3 ++- pyproject.toml | 3 ++- repo_helper.yml | 1 + tox.ini | 2 ++ 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 03f5a31..a1e0828 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: "windows-2022" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' strategy: fail-fast: False @@ -35,6 +35,7 @@ jobs: - {python-version: "3.11", testenvs: "py311,build", experimental: False} - {python-version: "3.12", testenvs: "py312,build", experimental: False} - {python-version: "3.13", testenvs: "py313,build", experimental: False} + - {python-version: "3.14", testenvs: "py314,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38", experimental: False} - {python-version: "pypy-3.9-v7.3.15", testenvs: "pypy39", experimental: True} diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index 05f968a..4696b8e 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -23,7 +23,7 @@ jobs: runs-on: "ubuntu-22.04" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' strategy: fail-fast: False @@ -36,6 +36,7 @@ jobs: - {python-version: "3.11", testenvs: "py311,build", experimental: False} - {python-version: "3.12", testenvs: "py312,build", experimental: False} - {python-version: "3.13", testenvs: "py313,build", experimental: False} + - {python-version: "3.14", testenvs: "py314,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38,build", experimental: False} - {python-version: "pypy-3.9", testenvs: "pypy39,build", experimental: True} diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index 2afbc2b..b4e7cbd 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -22,7 +22,7 @@ jobs: runs-on: "macos-${{ matrix.config.os-ver }}" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' strategy: fail-fast: False @@ -35,6 +35,7 @@ jobs: - {python-version: "3.11", os-ver: "14", testenvs: "py311,build", experimental: False} - {python-version: "3.12", os-ver: "14", testenvs: "py312,build", experimental: False} - {python-version: "3.13", os-ver: "14", testenvs: "py313,build", experimental: False} + - {python-version: "3.14", os-ver: "14", testenvs: "py314,build", experimental: False} - {python-version: "pypy-3.7", os-ver: "15-intel", testenvs: "pypy37,build", experimental: False} - {python-version: "pypy-3.8", os-ver: "14", testenvs: "pypy38,build", experimental: False} - {python-version: "pypy-3.9", os-ver: "14", testenvs: "pypy39,build", experimental: True} diff --git a/pyproject.toml b/pyproject.toml index 163c55c..b1bdb9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", @@ -142,7 +143,7 @@ base-classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", "Typing :: Typed", ] -python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13",] +python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14",] python-implementations = [ "CPython", "PyPy",] platforms = [ "Windows", "macOS", "Linux",] license-key = "MIT" diff --git a/repo_helper.yml b/repo_helper.yml index 61f9a3f..dafed9a 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -25,6 +25,7 @@ python_versions: "3.11": "3.12": "3.13": + "3.14": pypy37: pypy38: pypy39: diff --git a/tox.ini b/tox.ini index 24cfcdc..3422d70 100644 --- a/tox.ini +++ b/tox.ini @@ -29,6 +29,7 @@ envlist = py311 py312 py313 + py314 pypy37 pypy38 pypy39 @@ -52,6 +53,7 @@ test = py311 py312 py313 + py314 pypy37 pypy38 pypy39 From 7cf4530b38b18b9ddc548e101be3707b14fa2a5d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:57:18 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_paths.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_paths.py b/tests/test_paths.py index 1e42ec6..7567941 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -20,7 +20,7 @@ # 3rd party import pytest from coincidence.regressions import AdvancedDataRegressionFixture -from coincidence.selectors import not_pypy, not_windows, only_windows, max_version +from coincidence.selectors import max_version, not_pypy, not_windows, only_windows # this package from domdf_python_tools import paths @@ -925,11 +925,13 @@ def test_sort_paths(): @pytest.mark.parametrize("path", _from_uri_paths) -@pytest.mark.parametrize("left_type", [ - pytest.param(pathlib.PurePath, marks=max_version((3, 13))), - pathlib.Path, - PathPlus, - ]) +@pytest.mark.parametrize( + "left_type", [ + pytest.param(pathlib.PurePath, marks=max_version((3, 13))), + pathlib.Path, + PathPlus, + ] + ) def test_pathplus_from_uri(path: str, left_type: Type): assert PathPlus.from_uri(left_type(path).as_uri()).as_posix() == path