Skip to content

Commit f40f713

Browse files
authored
Add support for Python 3.13 and numpy 2 (#27)
* Compile as c11 instead of c99 for cpython3.13 header compatibility * Use numpy2 on python >= 3.9
1 parent 37b4e3d commit f40f713

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

.github/workflows/python-package-tox.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ name: Python package
55

66
on:
77
push:
8-
branches: [ main ]
98
pull_request:
10-
branches: [ main ]
119

1210
jobs:
13-
build:
11+
test:
1412

15-
runs-on: ubuntu-latest
1613
strategy:
1714
matrix:
18-
python: [3.5, 3.8]
15+
python: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
16+
fail-fast: false
1917

18+
runs-on: ${{ matrix.python <= '3.6' && 'ubuntu-20.04' || 'ubuntu-22.04' }}
19+
20+
name: Test on python ${{ matrix.python }} and numpy ${{ matrix.numpyversion }}
2021
steps:
21-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2223
- name: Setup Python
23-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2425
with:
2526
python-version: ${{ matrix.python }}
26-
- name: Install Tox and any other packages
27+
- name: Install Tox
2728
run: pip install tox
2829
- name: Run Tox
2930
# Run tox using the version of Python in `PATH`

.github/workflows/upload_to_pypi.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
os: [ubuntu-latest, windows-latest, macos-latest]
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717

18-
- uses: actions/setup-python@v2
18+
- uses: actions/setup-python@v5
1919
name: Install Python
2020
with:
2121
python-version: '3.x'
@@ -25,19 +25,19 @@ jobs:
2525
# available yet which can cause the build to fail. Keep going, and upload
2626
# the wheels for all of the previous versions when that happens.
2727
continue-on-error: true
28-
uses: pypa/cibuildwheel@v2.1.1
28+
uses: pypa/cibuildwheel@v2.20.0
2929

30-
- uses: actions/upload-artifact@v2
30+
- uses: actions/upload-artifact@v4
3131
with:
3232
path: ./wheelhouse/*.whl
3333

3434
build_sdist:
3535
name: Build source distribution
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3939

40-
- uses: actions/setup-python@v2
40+
- uses: actions/setup-python@v5
4141
name: Install Python
4242
with:
4343
python-version: '3.x'
@@ -48,7 +48,7 @@ jobs:
4848
- name: Build sdist
4949
run: python -m build --sdist
5050

51-
- uses: actions/upload-artifact@v2
51+
- uses: actions/upload-artifact@v4
5252
with:
5353
path: dist/*.tar.gz
5454

@@ -57,12 +57,12 @@ jobs:
5757
needs: [build_wheels, build_sdist]
5858
runs-on: ubuntu-latest
5959
steps:
60-
- uses: actions/download-artifact@v2
60+
- uses: actions/download-artifact@v4
6161
with:
6262
name: artifact
6363
path: dist
6464

65-
- uses: pypa/gh-action-pypi-publish@v1.4.2
65+
- uses: pypa/gh-action-pypi-publish@release/v1
6666
with:
6767
user: __token__
6868
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ requires = [
33
"wheel",
44
"setuptools",
55
"Cython>=0.29.2",
6-
"oldest-supported-numpy",
6+
"oldest-supported-numpy; python_version<'3.9'",
7+
"numpy>=2; python_version>='3.9'",
78
]
89
build-backend = 'setuptools.build_meta'

setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from setuptools import setup
88
from setuptools.extension import Extension
99

10-
1110
classifiers = [
1211
"Development Status :: 4 - Beta",
1312
"Programming Language :: Python :: 3",
@@ -33,7 +32,7 @@
3332
source_files,
3433
include_dirs=include_dirs,
3534
depends=depends_files,
36-
extra_compile_args=["-std=c99"],
35+
extra_compile_args=["-std=c11"],
3736
)
3837
]
3938

@@ -49,5 +48,5 @@
4948
author_email="kylebarbary@gmail.com",
5049
ext_modules=extensions,
5150
install_requires=["numpy>=1.13.3"],
52-
python_requires=">=3.5",
51+
python_requires=">=3.6",
5352
)

0 commit comments

Comments
 (0)