diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 9c25318d..ade60a1d 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -34,18 +34,17 @@ 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-* + 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 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 pytest-cov && python -m pytest -vv {package}/test - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/tests_conda.yml b/.github/workflows/tests_conda.yml index 7e7ccb20..0e0275cc 100644 --- a/.github/workflows/tests_conda.yml +++ b/.github/workflows/tests_conda.yml @@ -8,15 +8,21 @@ on: jobs: run: runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: 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,11 +37,22 @@ 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; + 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} 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: | diff --git a/pyproject.toml b/pyproject.toml index 8ad303bf..744dd8c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ [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", + "oldest-supported-numpy ; python_version < '3.9'", + "numpy>=2.0.0rc1,<3 ; python_version >= '3.9'", +] build-backend = "setuptools.build_meta" 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']