From 8d7d09cd185b9fffcaa2ad2d38e1bd77b3a15c96 Mon Sep 17 00:00:00 2001 From: Alexey Shalaev <75322386+AlexeyShalaev@users.noreply.github.com> Date: Sun, 18 Oct 2026 01:06:18 +0400 Subject: [PATCH] fix: the Python matrix and classifiers cover the whole supported range The unit-test matrix was [min, "3.12", "3.13"]: a render with 3.12 as its minimum tested 3.12 twice, one with 3.14 tested two versions below its own floor, and nothing ran on 3.14. The classifiers named only the minimum, and coverage was uploaded from 3.12 alone, so a render with a higher minimum uploaded none. Both lists now run from python_min_version to python_max_version, a hidden copier.yml value (3.14) raised in one place. Coverage goes up from the newest version. python_min_version is validated: a 3.x from 3.10 to python_max_version. --- README.md | 2 +- copier.yml | 15 ++++++++++++++- template/.github/workflows/ci.yml.jinja | 4 ++-- template/pyproject.toml.jinja | 4 +++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index af20222..d35fcc7 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Copier will prompt for: | `author_name` | Author full name | `Alex Shalaev` | | `author_email` | Author email | `you@example.com` | | `github_org` | GitHub org or username | `bedrock-python` | -| `python_min_version` | Minimum Python version | `3.11` | +| `python_min_version` | Minimum Python version, 3.10 to 3.14. The unit-test matrix and the classifiers run from it to the newest version (`python_max_version` in `copier.yml`) | `3.11` | | `initial_version` | Initial version | `0.0.0` | ## After generation diff --git a/copier.yml b/copier.yml index 95500bd..15b9300 100644 --- a/copier.yml +++ b/copier.yml @@ -29,10 +29,23 @@ github_org: help: "GitHub organization or username" default: "bedrock-python" +# The newest Python a render declares and runs its unit tests on. Not asked: +# raise it here once the libraries move to a new release. +python_max_version: + type: str + default: "3.14" + when: false + python_min_version: type: str - help: "Minimum Python version" + help: "Minimum Python version (3.10 to {{ python_max_version }})" default: "3.11" + validator: >- + {%- set minor = python_min_version.split(".")[-1] -%} + {%- if not python_min_version.startswith("3.") or not minor.isdigit() + or minor | int < 10 or minor | int > python_max_version.split(".")[-1] | int -%} + Use a 3.x version from 3.10 to {{ python_max_version }} + {%- endif -%} initial_version: type: str diff --git a/template/.github/workflows/ci.yml.jinja b/template/.github/workflows/ci.yml.jinja index cd15e68..9c79953 100644 --- a/template/.github/workflows/ci.yml.jinja +++ b/template/.github/workflows/ci.yml.jinja @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["{{ python_min_version }}", "3.12", "3.13"] + python-version: [{% for minor in range(python_min_version.split(".")[1] | int, python_max_version.split(".")[1] | int + 1) %}"3.{{ minor }}"{{ ", " if not loop.last }}{% endfor %}] steps: - uses: actions/checkout@v7 - uses: astral-sh/setup-uv@v7 @@ -34,7 +34,7 @@ jobs: - run: uv sync --group dev --all-extras - run: uv run pytest -m unit --cov={{ package_name }} --cov-report=xml --cov-fail-under=90 - uses: codecov/codecov-action@v6 - if: matrix.python-version == '3.12' + if: matrix.python-version == '{{ python_max_version }}' with: token: ${% raw %}{{ secrets.CODECOV_TOKEN }}{% endraw %} files: coverage.xml diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 6e7be8c..0f8ca5f 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -12,7 +12,9 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: {{ python_min_version }}", +{%- for minor in range(python_min_version.split(".")[1] | int, python_max_version.split(".")[1] | int + 1) %} + "Programming Language :: Python :: 3.{{ minor }}", +{%- endfor %} "Topic :: Software Development :: Libraries :: Python Modules", "Typing :: Typed", ]