From 5e3dc2d563c33820a1c51d944caf0d617ef8dd44 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 12:42:07 +0100 Subject: [PATCH 1/6] Added Python 3.14 support --- .github/workflows/unit-tests.yaml | 4 ++-- docs/source/whats_new.rst | 1 + docs/source/whats_new/development.rst | 5 +++++ pyproject.toml | 1 + sonar-project.properties | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 docs/source/whats_new/development.rst diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 9172014..81eca37 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v3 @@ -27,4 +27,4 @@ jobs: python -m pip install -r requirements-tests.txt --no-deps - name: Run tests run: | - python -m unittest discover . + python -m unittest --verbose diff --git a/docs/source/whats_new.rst b/docs/source/whats_new.rst index 274f243..0810947 100644 --- a/docs/source/whats_new.rst +++ b/docs/source/whats_new.rst @@ -4,4 +4,5 @@ What's New .. toctree:: :glob: + whats_new/development whats_new/* diff --git a/docs/source/whats_new/development.rst b/docs/source/whats_new/development.rst new file mode 100644 index 0000000..55b23a0 --- /dev/null +++ b/docs/source/whats_new/development.rst @@ -0,0 +1,5 @@ +Development +=========== + + +* Added Python 3.14 support. diff --git a/pyproject.toml b/pyproject.toml index 58e11ae..01e8cd8 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", "Topic :: Software Development", "Typing :: Typed", ] diff --git a/sonar-project.properties b/sonar-project.properties index a9a93d2..df018d6 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.projectDescription="Static analysis for the Concourse Tools Python library sonar.sources=concoursetools sonar.tests=tests -sonar.python.version=3.9,3.10,3.11,3.12,3.13 +sonar.python.version=3.9,3.10,3.11,3.12,3.13,3.14 sonar.coverage.exclusions=docs/**/*,tests/**/*,coverage.xml,concoursetools/colour.py,concoursetools/typing.py,**/__init__.py,**/__main__.py sonar.python.coverage.reportPaths=coverage.xml From 3491e644c2d22577a8ab8e1256770a1957c278cc Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 13:11:54 +0100 Subject: [PATCH 2/6] Specified beta for Python 3.14 --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 81eca37..9961fd7 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-beta"] steps: - uses: actions/checkout@v3 From 881951a7d84db3f3bbe02b2ad52778a8997ae044 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 13:21:45 +0100 Subject: [PATCH 3/6] Even more explicit version name for Python 3.14 --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 9961fd7..c593076 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-beta"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-beta.1"] steps: - uses: actions/checkout@v3 From cf7d12a625b509ef9c7fdefe088c69b71e5a2559 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 14:23:06 +0100 Subject: [PATCH 4/6] _build_test_resource_docker_image now specifies the tag to be the exact semver of the Python version being used. --- tests/test_resource.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_resource.py b/tests/test_resource.py index 9931c0a..377b9a2 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -3,6 +3,7 @@ import random import shutil import string +import sys from tempfile import TemporaryDirectory from unittest import SkipTest, TestCase @@ -728,7 +729,12 @@ def _build_test_resource_docker_image() -> str: except FileNotFoundError: pass - cli_commands.dockerfile(str(temp_dir), resource_file="concourse.py", class_name=TestResource.__name__, dev=True) + # This pins the tag to the exact version of Python we're using, including alpha/beta + # '3.14.0b1 (main, May 9 2025, 23:49:24) [GCC 12.2.0]' + # ^^^^^^^^ + tag, *_ = sys.version.split() + cli_commands.dockerfile(str(temp_dir), resource_file="concourse.py", class_name=TestResource.__name__, + tag=tag, dev=True) stdout, _ = run_command("docker", ["build", ".", "-q"], cwd=temp_dir) sha1_hash = stdout.strip() From 0545220131081035cacce05fccf1fe801a8464ee Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 14:44:26 +0100 Subject: [PATCH 5/6] Use inspect.get_annotations for use cases where possible --- concoursetools/version.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/concoursetools/version.py b/concoursetools/version.py index d79ab34..36b5607 100644 --- a/concoursetools/version.py +++ b/concoursetools/version.py @@ -13,6 +13,7 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum +import inspect from typing import Any, ClassVar, TypeVar, cast, get_type_hints from concoursetools.typing import TypedVersionT, VersionConfig, VersionT @@ -262,9 +263,13 @@ class TypedVersion(Version): def __init_subclass__(cls) -> None: try: - annotations = vars(cls)["__annotations__"] # avoid MRO lookup - except KeyError: - annotations = {} + annotations = inspect.get_annotations(cls) + except AttributeError: + # Function isn't available in Python 3.9, so use the old code until EOL + try: + annotations = vars(cls)["__annotations__"] # avoid MRO lookup + except KeyError: + annotations = {} if len(annotations) == 0: raise TypeError("Can't instantiate dataclass TypedVersion without any fields") From e45e52c5335791679739cdee13efee5e65d52144 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Wed, 4 Jun 2025 09:46:00 +0100 Subject: [PATCH 6/6] Updated Python3.14 version in tests to the 2nd beta release --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 9d45e9c..ec55d1f 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-beta.1"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-beta.2"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }}