Skip to content

Commit

Permalink
Add support for Python 3.13 and numpy 2 (#27)
Browse files Browse the repository at this point in the history
* Compile as c11 instead of c99 for cpython3.13 header compatibility

* Use numpy2 on python >= 3.9
  • Loading branch information
lukeshingles authored Dec 15, 2024
1 parent 37b4e3d commit f40f713
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/python-package-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ name: Python package

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
test:

runs-on: ubuntu-latest
strategy:
matrix:
python: [3.5, 3.8]
python: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false

runs-on: ${{ matrix.python <= '3.6' && 'ubuntu-20.04' || 'ubuntu-22.04' }}

name: Test on python ${{ matrix.python }} and numpy ${{ matrix.numpyversion }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Tox and any other packages
- name: Install Tox
run: pip install tox
- name: Run Tox
# Run tox using the version of Python in `PATH`
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/upload_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Build sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz

Expand All @@ -57,12 +57,12 @@ jobs:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.4.2
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = [
"wheel",
"setuptools",
"Cython>=0.29.2",
"oldest-supported-numpy",
"oldest-supported-numpy; python_version<'3.9'",
"numpy>=2; python_version>='3.9'",
]
build-backend = 'setuptools.build_meta'
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from setuptools import setup
from setuptools.extension import Extension


classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
Expand All @@ -33,7 +32,7 @@
source_files,
include_dirs=include_dirs,
depends=depends_files,
extra_compile_args=["-std=c99"],
extra_compile_args=["-std=c11"],
)
]

Expand All @@ -49,5 +48,5 @@
author_email="[email protected]",
ext_modules=extensions,
install_requires=["numpy>=1.13.3"],
python_requires=">=3.5",
python_requires=">=3.6",
)

0 comments on commit f40f713

Please sign in to comment.