Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .github/scripts/python-matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "cibuildwheel>=4.2.0",
# ]
# ///

import json
import os
import re
import shutil
import subprocess


cibuildwheel = shutil.which('cibuildwheel')
if not cibuildwheel:
raise RuntimeError

output = subprocess.check_output( # noqa: S603
[
cibuildwheel,
'--platform',
'linux',
'--archs',
'x86_64',
'--print-build-identifiers',
],
shell=False,
text=True,
cwd='targets/ptfkit-py',
)

version_re = re.compile(r'cp(\d)(\d+)(t?)-')
versions = set()

for identifier in output.split():
if match := version_re.match(identifier):
major, minor, free_threaded = match.groups()
version = f'{major}.{minor}'
if free_threaded:
version += free_threaded
versions.add(version)

version_matrix = json.dumps({'python-version': sorted(versions)})
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: # noqa: PTH123
f.write(f'matrix={version_matrix}\n')
23 changes: 21 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ on:
- main

jobs:
resolve-python:
name: Resolve supported Python versions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true

- name: Create test matrix
id: matrix
run: uv run --script .github/scripts/python-matrix.py

code-quality:
name: Code Quality
runs-on: ubuntu-latest
Expand Down Expand Up @@ -126,18 +144,19 @@ jobs:

pytest:
name: Tests Python ${{ matrix.python-version }}
needs: resolve-python
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12', '3.13', '3.14', '3.14t']
matrix: ${{ fromJSON(needs.resolve-python.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install uv
uses: astral-sh/setup-uv@v10.0.1
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![CI](https://img.shields.io/github/actions/workflow/status/AgroDT/ptfkit/pr.yaml?branch=main)](https://github.com/AgroDT/ptfkit/actions/workflows/pr.yaml)
[![Documentation](https://img.shields.io/github/actions/workflow/status/AgroDT/ptfkit/deploy-docs.yaml?label=docs)](https://agrodt.github.io/ptfkit/)
[![PyPI version](https://img.shields.io/pypi/v/ptfkit)](https://pypi.org/project/ptfkit/)
[![Python versions](https://img.shields.io/pypi/pyversions/ptfkit)](https://pypi.org/project/ptfkit/)
[![crates.io version](https://img.shields.io/crates/v/ptfkit)](https://crates.io/crates/ptfkit)
[![License](https://img.shields.io/github/license/AgroDT/ptfkit)](https://github.com/AgroDT/ptfkit/blob/main/LICENSE)

Expand Down
2 changes: 1 addition & 1 deletion targets/ptfkit-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ calculation to native NumPy ufuncs.

## Installation

Python 3.11 or newer is required.
Supported Python versions are declared in the package metadata.

```shell
pip install ptfkit
Expand Down
11 changes: 6 additions & 5 deletions targets/ptfkit-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: C",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Programming Language :: Python :: Free Threading",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Hydrology",
"Topic :: Scientific/Engineering",
]
Expand Down
Loading
Loading