From f40f71351138771f7e4459e75bd7c3b4e9e66102 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Sun, 15 Dec 2024 15:30:37 +0100 Subject: [PATCH] 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 --- .github/workflows/python-package-tox.yml | 17 +++++++++-------- .github/workflows/upload_to_pypi.yml | 18 +++++++++--------- pyproject.toml | 3 ++- setup.py | 5 ++--- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/python-package-tox.yml b/.github/workflows/python-package-tox.yml index 56261ac..d7bfac0 100644 --- a/.github/workflows/python-package-tox.yml +++ b/.github/workflows/python-package-tox.yml @@ -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` diff --git a/.github/workflows/upload_to_pypi.yml b/.github/workflows/upload_to_pypi.yml index 7e3ac75..e6ee04f 100644 --- a/.github/workflows/upload_to_pypi.yml +++ b/.github/workflows/upload_to_pypi.yml @@ -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' @@ -25,9 +25,9 @@ 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 @@ -35,9 +35,9 @@ jobs: 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' @@ -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 @@ -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 }} diff --git a/pyproject.toml b/pyproject.toml index c7e559c..4d11fc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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' diff --git a/setup.py b/setup.py index bc80ae8..97bfa29 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,6 @@ from setuptools import setup from setuptools.extension import Extension - classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", @@ -33,7 +32,7 @@ source_files, include_dirs=include_dirs, depends=depends_files, - extra_compile_args=["-std=c99"], + extra_compile_args=["-std=c11"], ) ] @@ -49,5 +48,5 @@ author_email="kylebarbary@gmail.com", ext_modules=extensions, install_requires=["numpy>=1.13.3"], - python_requires=">=3.5", + python_requires=">=3.6", )