Skip to content

Commit

Permalink
Merge pull request #114 from tlambert03/numpy2
Browse files Browse the repository at this point in the history
support numpy2.0, require `numpy>=1.23.5`, add CI test
  • Loading branch information
marktsuchida authored Apr 8, 2024
2 parents dec0ccf + 5366d95 commit f6d417e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,49 @@ jobs:
- name: Check manifest
run: pipx run check-manifest

test:
name: Test ${{ matrix.os }} py${{ matrix.python-version }} np${{ matrix.numpy }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.10", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- python-version: "3.8"
os: ubuntu-latest
numpy: "==1.23.5"
- python-version: "3.10"
os: ubuntu-latest
numpy: "~=1.26"
- python-version: "3.9"
os: windows-latest
numpy: ">=2.0.0b1"
- python-version: "3.12"
os: ubuntu-latest
numpy: ">=2.0.0b1"

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
python -m pip install numpy${{ matrix.numpy }}
- name: Run tests
run: pytest -v

build_wheels:
if: github.event_name != 'pull_request'
name: Build wheels on ${{ matrix.os }} ${{ matrix.macos_arch }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down
20 changes: 17 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# https://peps.python.org/pep-0517/
[build-system]
requires = ["setuptools >=61.0.0", "swig >=4.1", "oldest-supported-numpy"]
requires = [
"setuptools >=61.0.0",
"swig >=4.1",
# https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
"numpy==1.19.3; python_version=='3.8' and platform_machine=='aarch64' and platform_python_implementation != 'PyPy'",
"numpy==1.21.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation!='PyPy'",
"numpy==1.17.5; python_version=='3.8' and platform_machine=='s390x' and platform_python_implementation != 'PyPy'",
"numpy==1.17.3; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Windows' and platform_python_implementation != 'PyPy'",
"numpy==1.17.3; python_version=='3.8' and platform_machine not in 'arm64|aarch64|s390x|loongarch64' and platform_python_implementation != 'PyPy'",
"numpy==1.22.2; python_version=='3.8' and platform_machine!='loongarch64' and platform_python_implementation=='PyPy'",
# https://numpy.org/devdocs/dev/depending_on_numpy.html#adding-a-dependency-on-numpy
"numpy>=2.0.0b1; python_version>='3.9'",
]
build-backend = "setuptools.build_meta"


# https://peps.python.org/pep-0621/
[project]
name = "pymmcore"
Expand All @@ -26,7 +37,10 @@ classifiers = [
"Topic :: System :: Hardware :: Hardware Drivers",
"Typing :: Typed",
]
dependencies = ["numpy >=1.12.0"]
dependencies = ["numpy>=1.23.5"]

[project.optional-dependencies]
test = ["pytest"]

[project.urls]
homepage = "https://micro-manager.org"
Expand Down
2 changes: 1 addition & 1 deletion src/pymmcore/pymmcore_swig.i
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import_array();
%}

%{
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define NPY_NO_DEPRECATED_API NPY_1_23_API_VERSION
#include "numpy/arrayobject.h"
#include "string.h"
%}
Expand Down

0 comments on commit f6d417e

Please sign in to comment.