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", ]