Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
"BSD 2-Clause",
"Other"
],
"minimum_python_version": [
"3.11",
"3.12",
"3.13",
"3.14"
],
"supported_python_versions": "3.12, 3.13, 3.14",
"use_compiled_extensions": "n",
"enable_dynamic_dev_versions": "n",
"include_example_code": "n",
Expand All @@ -49,6 +44,7 @@
"documentation_url": "Documentation URL, optional",
"changelog_url": "URL to the changelog, optional",
"issue_tracker_url": "URL to the issue tracker, optional",
"matrix_room_id": "A room ID to enable matrix notifications in the CI workflow."
"matrix_room_id": "A room ID to enable matrix notifications in the CI workflow.",
"supported_python_versions": "Comma-separated list of Python versions to test (e.g. '3.12, 3.13, 3.14'). The first sets the install floor; the last is used for devdeps and the cruft-update runner."
}
}
4 changes: 2 additions & 2 deletions docs/new_package_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ These options have no default (or a placeholder default) and must be answered wh
* ``license`` -- The SPDX license for the package.
Choices: ``BSD 3-Clause`` (default), ``GNU GPL v3+``, ``Apache Software License 2.0``, ``BSD 2-Clause``, ``Other``.
The corresponding license text is copied to ``licenses/LICENSE.rst``.
* ``minimum_python_version`` -- The minimum supported Python version, written to ``requires-python`` in ``pyproject.toml`` and used in CI and tox configuration.
Choices: ``3.11`` (default), ``3.12``, ``3.13``, ``3.14``.
* ``supported_python_versions`` -- Comma-separated list of Python versions to test (e.g. ``3.12, 3.13, 3.14``).
The first entry is the lowest supported version for the package.

Optional features
^^^^^^^^^^^^^^^^^
Expand Down
29 changes: 17 additions & 12 deletions {{ cookiecutter.package_name }}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Main CI Workflow {%- set default_python = '3.13' %}
# Main CI Workflow
{%- set pys = cookiecutter.supported_python_versions.split(',') | map('trim') | list %}
{%- set default_python = pys[-2] %}
{%- set cp_tags = pys | map('replace', '.', '') | join(',') %}
name: CI

on:
Expand Down Expand Up @@ -40,7 +43,7 @@ jobs:
coverage: codecov-oidc
toxdeps: tox-pypi-filter
envs: |
- linux: py313
- linux: py{{ default_python | replace('.', '') }}
Comment on lines -43 to +46

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this job is ran again below in test?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, don't think I care.


sdist_verify:
runs-on: ubuntu-latest
Expand All @@ -67,11 +70,13 @@ jobs:
toxdeps: tox-pypi-filter
posargs: -n auto
envs: |
- linux: py314
- windows: py312
- macos: py312
- linux: py312-oldestdeps
- linux: py314-devdeps
{%- for v in pys[1:] %}
- linux: py{{ v | replace('.', '') }}
{%- endfor %}
- windows: py{{ pys | first | replace('.', '') }}
- macos: py{{ pys[1] | replace('.', '') }}
- linux: py{{ pys | first | replace('.', '') }}-oldestdeps
- linux: py{{ pys | last | replace('.', '') }}-devdeps
Comment on lines +73 to +79

@Cadair Cadair Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out it was reasonably hard to encode my gut instinct about what the [platform, version] matrix should be in jinja code.

As currently written we test the two oldest pythons on windows & macos and the newer ones on linux. Given the SPEC 0 rotation we should generally have 3 or maybe 4 supported Pythons. I think the latest one should be linux as it's more likely to work [compile quickly] when a version is very new.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this actually makes it clearer what combinations run, I think it could be doc'd quickly the specific combinations we run.


docs:
needs: [core]
Expand Down Expand Up @@ -99,7 +104,7 @@ jobs:
toxdeps: tox-pypi-filter
coverage: codecov-oidc
envs: |
{% endfor -%}
{% endfor -%}
{%- endif %}

build_dists:
Expand All @@ -117,10 +122,10 @@ jobs:
with:
sdist: true
targets: |
- cp3{12,13,14}-manylinux*_x86_64
- cp3{12,13,14}-macosx_x86_64
- cp3{12,13,14}-macosx_arm64
- cp3{12,13,14}-win_amd64
- cp{{ '{' ~ cp_tags ~ '}' }}-manylinux*_x86_64
- cp{{ '{' ~ cp_tags ~ '}' }}-macosx_x86_64
- cp{{ '{' ~ cp_tags ~ '}' }}-macosx_arm64
- cp{{ '{' ~ cp_tags ~ '}' }}-win_amd64
{%- else %}
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@1285b95e32c783cfa40eb2ffbd6ca4cd023fb884 # v3.2.2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.14"
python-version: "{{ cookiecutter.supported_python_versions.split(',') | last | trim }}"

- name: Install Cruft
run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1
Expand Down
3 changes: 2 additions & 1 deletion {{ cookiecutter.package_name }}/.rtd-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: {{ cookiecutter.package_name }}
channels:
- conda-forge
dependencies:
- python={{ cookiecutter.minimum_python_version }}
{%- set pys = cookiecutter.supported_python_versions.split(',') | map('trim') | list %}
- python={{ pys[-2] }}
- pip
- graphviz!=2.42.*,!=2.43.*
2 changes: 1 addition & 1 deletion {{ cookiecutter.package_name }}/.ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target-version = "py{{ cookiecutter.minimum_python_version | replace(".", "")}}"
target-version = "py{{ cookiecutter.supported_python_versions.split(',') | first | trim | replace(".", "")}}"
line-length = 120
exclude = [
".git,",
Expand Down
9 changes: 8 additions & 1 deletion {{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ build-backend = "setuptools.build_meta"
[project]
name = "{{ cookiecutter.module_name }}"
description = "{{ cookiecutter.short_description }}"
requires-python = ">={{ cookiecutter.minimum_python_version }}"
requires-python = ">={{ cookiecutter.supported_python_versions.split(',') | first | trim }}"
readme = { file = "README.rst", content-type = "text/x-rst" }
license-files = ["licenses/LICENSE.rst"]
classifiers = [
{%- for v in cookiecutter.supported_python_versions.split(',') %}
"Programming Language :: Python :: {{ v | trim }}",
{%- endfor %}
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
]
{%- if cookiecutter.author_name and cookiecutter.author_email %}
authors = [
{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}" },
Expand Down
8 changes: 5 additions & 3 deletions {{ cookiecutter.package_name }}/tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{%- set pys = cookiecutter.supported_python_versions.split(',') | map('trim') | list %}
{%- set py_tags = pys | map('replace', '.', '') | join(',') -%}
[tox]
min_version = 4.0
requires =
tox-pypi-filter>=0.14
envlist =
py{312,313,314}
py314-devdeps
py312-oldestdeps
py{{ '{' ~ py_tags ~ '}' }}
py{{ pys | last | replace('.', '') }}-devdeps
py{{ pys | first | replace('.', '') }}-oldestdeps
codestyle
build_docs

Expand Down
Loading