Skip to content

Commit 3356e81

Browse files
fix: the Python matrix and classifiers cover the whole supported range (#25)
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.
1 parent d9d0a6f commit 3356e81

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Copier will prompt for:
2424
| `author_name` | Author full name | `Alex Shalaev` |
2525
| `author_email` | Author email | `you@example.com` |
2626
| `github_org` | GitHub org or username | `bedrock-python` |
27-
| `python_min_version` | Minimum Python version | `3.11` |
27+
| `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` |
2828
| `initial_version` | Initial version | `0.0.0` |
2929

3030
## After generation

‎copier.yml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,23 @@ github_org:
2929
help: "GitHub organization or username"
3030
default: "bedrock-python"
3131

32+
# The newest Python a render declares and runs its unit tests on. Not asked:
33+
# raise it here once the libraries move to a new release.
34+
python_max_version:
35+
type: str
36+
default: "3.14"
37+
when: false
38+
3239
python_min_version:
3340
type: str
34-
help: "Minimum Python version"
41+
help: "Minimum Python version (3.10 to {{ python_max_version }})"
3542
default: "3.11"
43+
validator: >-
44+
{%- set minor = python_min_version.split(".")[-1] -%}
45+
{%- if not python_min_version.startswith("3.") or not minor.isdigit()
46+
or minor | int < 10 or minor | int > python_max_version.split(".")[-1] | int -%}
47+
Use a 3.x version from 3.10 to {{ python_max_version }}
48+
{%- endif -%}
3649
3750
initial_version:
3851
type: str

‎template/.github/workflows/ci.yml.jinja‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
python-version: ["{{ python_min_version }}", "3.12", "3.13"]
28+
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 %}]
2929
steps:
3030
- uses: actions/checkout@v7
3131
- uses: astral-sh/setup-uv@v7
@@ -34,7 +34,7 @@ jobs:
3434
- run: uv sync --group dev --all-extras
3535
- run: uv run pytest -m unit --cov={{ package_name }} --cov-report=xml --cov-fail-under=90
3636
- uses: codecov/codecov-action@v6
37-
if: matrix.python-version == '3.12'
37+
if: matrix.python-version == '{{ python_max_version }}'
3838
with:
3939
token: ${% raw %}{{ secrets.CODECOV_TOKEN }}{% endraw %}
4040
files: coverage.xml

‎template/pyproject.toml.jinja‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ classifiers = [
1212
"Intended Audience :: Developers",
1313
"License :: OSI Approved :: Apache Software License",
1414
"Programming Language :: Python :: 3",
15-
"Programming Language :: Python :: {{ python_min_version }}",
15+
{%- for minor in range(python_min_version.split(".")[1] | int, python_max_version.split(".")[1] | int + 1) %}
16+
"Programming Language :: Python :: 3.{{ minor }}",
17+
{%- endfor %}
1618
"Topic :: Software Development :: Libraries :: Python Modules",
1719
"Typing :: Typed",
1820
]

0 commit comments

Comments
 (0)