From 79e6d86bfeccdf09a5b15d55a66b76e5c9c35a46 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Fri, 9 Feb 2024 13:12:14 -0600 Subject: [PATCH 01/15] Add pre-releases and numpy nightly wheels to CI --- .github/workflows/tests_latest.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_latest.yml b/.github/workflows/tests_latest.yml index 89a428a7..3090bf03 100644 --- a/.github/workflows/tests_latest.yml +++ b/.github/workflows/tests_latest.yml @@ -20,9 +20,15 @@ jobs: run: | python -m pip install --upgrade pip - - name: Install cftime dependencies via pip + - name: Install unstable cftime dependencies via pip run: | - python -m pip install -r requirements-dev.txt + python -m pip install --pre -r requirements-dev.txt + # get nightly wheels for numpy + python -m pip install \ + --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ \ + --trusted-host pypi.anaconda.org \ + --no-deps --pre --upgrade \ + numpy - name: Install cftime run: | From d6b265fbd8b866e76338b108d517fcd68c046079 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Wed, 14 Feb 2024 06:56:00 -0600 Subject: [PATCH 02/15] Add experimental unstable dependencies to conda CI --- .github/workflows/tests_conda.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/tests_conda.yml b/.github/workflows/tests_conda.yml index 7e7ccb20..185e4026 100644 --- a/.github/workflows/tests_conda.yml +++ b/.github/workflows/tests_conda.yml @@ -14,9 +14,14 @@ jobs: python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] os: [windows-latest, ubuntu-latest, macos-latest] platform: [x64, x32] + experimental: [false] exclude: - os: macos-latest platform: x32 + include: + - python-version: "3.12" + os: "ubuntu-latest" + experimental: true steps: - uses: actions/checkout@v4 @@ -31,6 +36,16 @@ jobs: cython>=0.29.20 pytest pytest-cov + - + - name: Install unstable dependencies + if: matrix.experimental == true + shell: bash -l {0} + run: | + python -m pip install \ + --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ \ + --trusted-host pypi.anaconda.org \ + --no-deps --pre --upgrade \ + numpy; - name: Install cftime shell: bash -l {0} From 455d9704109ccff5b32691bb3b349a63dea5a4db Mon Sep 17 00:00:00 2001 From: David Hoese Date: Wed, 14 Feb 2024 10:34:28 -0600 Subject: [PATCH 03/15] Make unstable CI not cause overall failure --- .github/workflows/tests_conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests_conda.yml b/.github/workflows/tests_conda.yml index 185e4026..ab783b81 100644 --- a/.github/workflows/tests_conda.yml +++ b/.github/workflows/tests_conda.yml @@ -8,6 +8,7 @@ on: jobs: run: runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: From 04b8b23e119b5c104441288412296ab389bf73c6 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Wed, 14 Feb 2024 10:59:00 -0600 Subject: [PATCH 04/15] Fix typo in wheel building --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 9c25318d..c81e2bc3 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -37,7 +37,7 @@ jobs: uses: pypa/cibuildwheel@v2.15.0 env: # Skips pypy py36,37 - CIBW_SKIP: "pp* cp36-* cp37-* + CIBW_SKIP: "pp* cp36-* cp37-*" CIBW_ARCHS: ${{ matrix.arch }} CIBW_BUILD_FRONTEND: build CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 From e86fcd6936048c0d7adb4f6fa973cdaa2ca14606 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Wed, 14 Feb 2024 21:14:12 -0600 Subject: [PATCH 05/15] Fix accidental hyphen in tests_conda.yml --- .github/workflows/tests_conda.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests_conda.yml b/.github/workflows/tests_conda.yml index ab783b81..f001cd50 100644 --- a/.github/workflows/tests_conda.yml +++ b/.github/workflows/tests_conda.yml @@ -37,7 +37,6 @@ jobs: cython>=0.29.20 pytest pytest-cov - - - name: Install unstable dependencies if: matrix.experimental == true shell: bash -l {0} From 1c10a42ddba46705ce1cb5be475ebf2b5f2c919c Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 15 Feb 2024 13:45:06 -0600 Subject: [PATCH 06/15] Add explicit numpy C API initialization --- src/cftime/_cftime.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cftime/_cftime.pyx b/src/cftime/_cftime.pyx index db79e9a0..eb5ad810 100644 --- a/src/cftime/_cftime.pyx +++ b/src/cftime/_cftime.pyx @@ -7,6 +7,7 @@ from cpython.object cimport (PyObject_RichCompare, Py_LT, Py_LE, Py_EQ, from numpy cimport int64_t, int32_t import cython import numpy as np +cimport numpy as np import re import time from datetime import datetime as datetime_python @@ -14,6 +15,8 @@ from datetime import timedelta, MINYEAR, MAXYEAR import warnings from ._strptime import _strptime +np.import_array() + microsec_units = ['microseconds','microsecond', 'microsec', 'microsecs'] millisec_units = ['milliseconds', 'millisecond', 'millisec', 'millisecs', 'msec', 'msecs', 'ms'] sec_units = ['second', 'seconds', 'sec', 'secs', 's'] From 5a053f2d8615405da3c1483dcc5adc019ba12dd6 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 15 Feb 2024 13:51:12 -0600 Subject: [PATCH 07/15] Update version of cibuildwheel action --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c81e2bc3..224df152 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.16.5 env: # Skips pypy py36,37 CIBW_SKIP: "pp* cp36-* cp37-*" From 18674d77fd149c839bc79370f2778d4571023896 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 15 Feb 2024 13:58:24 -0600 Subject: [PATCH 08/15] Build with numpy 2 in CI tests --- .github/workflows/tests_conda.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_conda.yml b/.github/workflows/tests_conda.yml index f001cd50..0e0275cc 100644 --- a/.github/workflows/tests_conda.yml +++ b/.github/workflows/tests_conda.yml @@ -46,11 +46,13 @@ jobs: --trusted-host pypi.anaconda.org \ --no-deps --pre --upgrade \ numpy; + python -m pip install -v -e . --no-deps --no-build-isolation --force-reinstall - name: Install cftime + if: matrix.experimental != true shell: bash -l {0} run: | - pip install -v -e . --no-deps --force-reinstall + python -m pip install -v -e . --no-deps --force-reinstall - name: Run Tests shell: bash -l {0} From b654aa7fe297b530b32e27ab8959075c8a71f321 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 15 Feb 2024 13:58:35 -0600 Subject: [PATCH 09/15] Build wheels with numpy 2 --- .github/workflows/cibuildwheel.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 224df152..93f34b56 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -39,7 +39,6 @@ jobs: # Skips pypy py36,37 CIBW_SKIP: "pp* cp36-* cp37-*" CIBW_ARCHS: ${{ matrix.arch }} - CIBW_BUILD_FRONTEND: build CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_TEST_SKIP: "*_arm64" CIBW_TEST_REQUIRES: pytest @@ -47,6 +46,9 @@ jobs: python -c "import cftime; print(f'cftime v{cftime.__version__}')" && python -m pip install -r {package}/requirements-dev.txt && python -m pytest -vv {package}/test + # below only for building against unstable numpy + CIBW_BUILD_FRONTEND: "build; args: --no-isolation" + CIBW_BEFORE_BUILD: "pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython setuptools versioneer" - uses: actions/upload-artifact@v3 with: From 89eb31f64b9863a4771ed8100fc7d215fe25ff3f Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 15 Feb 2024 18:46:27 -0600 Subject: [PATCH 10/15] See if python 3.8 is the problem --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 93f34b56..32be78e0 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -37,7 +37,7 @@ jobs: uses: pypa/cibuildwheel@v2.16.5 env: # Skips pypy py36,37 - CIBW_SKIP: "pp* cp36-* cp37-*" + CIBW_SKIP: "pp* cp36-* cp37-* cp38-*" CIBW_ARCHS: ${{ matrix.arch }} CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_TEST_SKIP: "*_arm64" From 67e292dac776ac95a7cfa1f7755ef2b1d83d857b Mon Sep 17 00:00:00 2001 From: David Hoese Date: Fri, 16 Feb 2024 10:08:26 -0600 Subject: [PATCH 11/15] Remove deprecated oldest-supported-numpy usage --- .github/workflows/cibuildwheel.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 32be78e0..93f34b56 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -37,7 +37,7 @@ jobs: uses: pypa/cibuildwheel@v2.16.5 env: # Skips pypy py36,37 - CIBW_SKIP: "pp* cp36-* cp37-* cp38-*" + CIBW_SKIP: "pp* cp36-* cp37-*" CIBW_ARCHS: ${{ matrix.arch }} CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_TEST_SKIP: "*_arm64" diff --git a/pyproject.toml b/pyproject.toml index 8ad303bf..270c5d4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=41.2", "cython>=0.29.20", "wheel", "oldest-supported-numpy; python_version<'3.12.0.rc1'", "numpy>=1.26.0b1; python_version>='3.12.0.rc1'"] +requires = ["setuptools>=41.2", "cython>=0.29.20", "wheel", "numpy>=1.26.0b1"] build-backend = "setuptools.build_meta" From 52cfb8122e8540f7264f6417e54106a4cb47f4e9 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Fri, 12 Apr 2024 10:39:40 -0500 Subject: [PATCH 12/15] Build using numpy 2.0rc1 --- .github/workflows/cibuildwheel.yml | 3 --- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 93f34b56..18780073 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -46,9 +46,6 @@ jobs: python -c "import cftime; print(f'cftime v{cftime.__version__}')" && python -m pip install -r {package}/requirements-dev.txt && python -m pytest -vv {package}/test - # below only for building against unstable numpy - CIBW_BUILD_FRONTEND: "build; args: --no-isolation" - CIBW_BEFORE_BUILD: "pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython setuptools versioneer" - uses: actions/upload-artifact@v3 with: diff --git a/pyproject.toml b/pyproject.toml index 270c5d4f..c5535bc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=41.2", "cython>=0.29.20", "wheel", "numpy>=1.26.0b1"] +requires = ["setuptools>=41.2", "cython>=0.29.20", "wheel", "numpy>=2.0.0rc1,<3"] build-backend = "setuptools.build_meta" From b3428ec4b2dfed00101cc2a8216262a826999cfd Mon Sep 17 00:00:00 2001 From: David Hoese Date: Tue, 16 Apr 2024 21:04:39 -0500 Subject: [PATCH 13/15] Fix building for python <3.9 --- pyproject.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c5535bc5..744dd8c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ [build-system] -requires = ["setuptools>=41.2", "cython>=0.29.20", "wheel", "numpy>=2.0.0rc1,<3"] +requires = [ + "setuptools>=41.2", + "cython>=0.29.20", + "wheel", + "oldest-supported-numpy ; python_version < '3.9'", + "numpy>=2.0.0rc1,<3 ; python_version >= '3.9'", +] build-backend = "setuptools.build_meta" From f79b7b6ce444d2a118e870155c985d0606fa3b96 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 18 Apr 2024 12:37:22 -0500 Subject: [PATCH 14/15] Install fewer dependencies on wheel testing --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 18780073..626a9fc3 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -44,7 +44,7 @@ jobs: CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: > python -c "import cftime; print(f'cftime v{cftime.__version__}')" && - python -m pip install -r {package}/requirements-dev.txt && + python -m pip install check-manifest cython pytest && python -m pytest -vv {package}/test - uses: actions/upload-artifact@v3 From 5abfac2fbfebc5301bba36d11e4b1b0dba91fb21 Mon Sep 17 00:00:00 2001 From: David Hoese Date: Thu, 18 Apr 2024 14:16:06 -0500 Subject: [PATCH 15/15] Add missing pytest-cov dependency to wheel testing --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 626a9fc3..ade60a1d 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -44,7 +44,7 @@ jobs: CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: > python -c "import cftime; print(f'cftime v{cftime.__version__}')" && - python -m pip install check-manifest cython pytest && + python -m pip install check-manifest cython pytest pytest-cov && python -m pytest -vv {package}/test - uses: actions/upload-artifact@v3