From 9fef27fdc1b62216820ab82ec42492b1c3dc5de5 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 10:48:08 -0400 Subject: [PATCH 1/7] support numpy2 --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ pyproject.toml | 9 ++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c141192..e983bb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,33 @@ jobs: - name: Check manifest run: pipx run check-manifest + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ['3.8', '3.9', '3.10', '3.11'] + numpy: ['~=1.23', '~=1.24', '~=1.26', '>=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: | + pip install .[test] + pip install numpy${{ matrix.numpy }} + + - name: Run tests + run: pytest -v + build_wheels: name: Build wheels on ${{ matrix.os }} ${{ matrix.macos_arch }} runs-on: ${{ matrix.os }} diff --git a/pyproject.toml b/pyproject.toml index 7d70ddb..08bce35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ # https://peps.python.org/pep-0517/ [build-system] -requires = ["setuptools >=61.0.0", "swig >=4.1", "oldest-supported-numpy"] +# https://numpy.org/devdocs/dev/depending_on_numpy.html#adding-a-dependency-on-numpy +requires = ["setuptools >=61.0.0", "swig >=4.1", "numpy>=2.0.0b1"] build-backend = "setuptools.build_meta" - # https://peps.python.org/pep-0621/ [project] name = "pymmcore" @@ -26,7 +26,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" From 19903f0511756efefefdc618b65e73f8adb004d7 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 10:53:13 -0400 Subject: [PATCH 2/7] try again --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e983bb0..6d9713b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,12 +27,13 @@ jobs: run: pipx run check-manifest test: - name: Test on ${{ matrix.os }} + name: Test ${{ matrix.os }} py${{ matrix.python-version }} np${{ matrix.numpy }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.10', '3.12'] numpy: ['~=1.23', '~=1.24', '~=1.26', '>=2.0.0b1'] steps: @@ -47,8 +48,9 @@ jobs: - name: Install dependencies run: | - pip install .[test] - pip install numpy${{ matrix.numpy }} + python -m pip install --upgrade pip + python -m pip install .[test] + python -m pip install numpy${{ matrix.numpy }} - name: Run tests run: pytest -v From 919913bddf4922efd3f563769a525805bde22ef1 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 10:54:49 -0400 Subject: [PATCH 3/7] try other plat --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d9713b..065f0d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.8', '3.10', '3.12'] numpy: ['~=1.23', '~=1.24', '~=1.26', '>=2.0.0b1'] @@ -56,6 +56,7 @@ jobs: 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: From 82a3c0db279fb18ef3157924b1cfc3ceaf3c9d6a Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 10:59:30 -0400 Subject: [PATCH 4/7] fix 3.8 build --- .github/workflows/ci.yml | 4 ++-- pyproject.toml | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 065f0d9..912df4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,8 +33,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.8', '3.10', '3.12'] - numpy: ['~=1.23', '~=1.24', '~=1.26', '>=2.0.0b1'] + python-version: ["3.8", "3.10", "3.12"] + numpy: ["==1.23.5", "<2.0", ">=2.0.0b1"] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 08bce35..d57dce9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,18 @@ # https://peps.python.org/pep-0517/ [build-system] -# https://numpy.org/devdocs/dev/depending_on_numpy.html#adding-a-dependency-on-numpy -requires = ["setuptools >=61.0.0", "swig >=4.1", "numpy>=2.0.0b1"] +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/ From 80e6753c76a6b8eaba2f0b431fb194bb248fc0b1 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 11:06:23 -0400 Subject: [PATCH 5/7] change pin --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 912df4e..ffcb597 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ["3.8", "3.10", "3.12"] - numpy: ["==1.23.5", "<2.0", ">=2.0.0b1"] + numpy: ["==1.23.5", "~=1.26", ">=2.0.0b1"] steps: - uses: actions/checkout@v4 From d5f48ff7792b9cfd99c45f7fe1fe315d39ec4a29 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 11:21:47 -0400 Subject: [PATCH 6/7] change matrix --- .github/workflows/ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffcb597..989cdf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,9 +32,21 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] python-version: ["3.8", "3.10", "3.12"] - numpy: ["==1.23.5", "~=1.26", ">=2.0.0b1"] + 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 From 5366d95ea354e71c10cf23d1d2c34a2275cf63e2 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 15 Mar 2024 11:32:12 -0400 Subject: [PATCH 7/7] change define --- src/pymmcore/pymmcore_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymmcore/pymmcore_swig.i b/src/pymmcore/pymmcore_swig.i index 0e8af0a..9276c08 100644 --- a/src/pymmcore/pymmcore_swig.i +++ b/src/pymmcore/pymmcore_swig.i @@ -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" %}