From 0f16fbc163b70217a4ebabc554d5a0321280f4cf Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 4 Sep 2024 12:44:30 -0700 Subject: [PATCH 1/3] Update for NumPy 2.0 and Python 3.13 --- cesium/featurize.py | 4 ++-- cesium/time_series.py | 2 +- cesium/util.py | 2 +- pyproject.toml | 3 +-- requirements.txt | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cesium/featurize.py b/cesium/featurize.py index 1cba967a..9055aeef 100644 --- a/cesium/featurize.py +++ b/cesium/featurize.py @@ -452,8 +452,8 @@ def save_featureset(fset, path, **kwargs): kwargs[k] = [] # Bypass savez to allow for `allow_pickle` keyword - # See https://github.com/numpy/numpy/pull/5770 - np.lib.npyio._savez(path, [], kwargs, compress=True, allow_pickle=False) + # See also https://github.com/numpy/numpy/pull/27335 + np.lib._npyio_impl._savez(path, [], kwargs, compress=True, allow_pickle=False) def load_featureset(path): diff --git a/cesium/time_series.py b/cesium/time_series.py index a53263ac..c949b3af 100644 --- a/cesium/time_series.py +++ b/cesium/time_series.py @@ -76,7 +76,7 @@ def _make_array_if_possible(x): of arrays to (p, n) arrays. """ try: - x = np.asfarray(x).squeeze() + x = np.asarray(x, dtype=float).squeeze() except ValueError: pass return x diff --git a/cesium/util.py b/cesium/util.py index acf68cdb..b98422ba 100644 --- a/cesium/util.py +++ b/cesium/util.py @@ -88,7 +88,7 @@ def extract_time_series( x for x in archive.getmembers() if not x.name.startswith((".", "/")) ] extracted_names = [x.name for x in members_to_extract] - archive.extractall(path=extract_dir, members=members_to_extract) + archive.extractall(path=extract_dir, members=members_to_extract, filter="data") all_paths = [os.path.join(extract_dir, f) for f in extracted_names] elif zipfile.is_zipfile(data_path): archive = zipfile.ZipFile(data_path) diff --git a/pyproject.toml b/pyproject.toml index e85317cb..6eaae69d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "setuptools_scm", "numpy", "Cython>=0.25"] +requires = ["setuptools", "setuptools_scm", "numpy>=2.0,<3.0", "Cython>=3.0"] build-backend = "setuptools.build_meta" [project] @@ -26,7 +26,6 @@ classifiers = [ "Operating System :: Unix", "Operating System :: MacOS", ] - dynamic = ["version", "dependencies"] [project.urls] diff --git a/requirements.txt b/requirements.txt index bdf141b1..018756b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy>=1.14.3 +numpy>=2.0,<3.0 scipy>=0.16.0 scikit-learn>=0.22.1 pandas>=0.17.0 @@ -7,4 +7,3 @@ toolz gatspy>=0.3.0 cloudpickle joblib>=0.14.1 -setuptools-scm>=7.1.0 From 60bacf4972d215bd64311dfea06a85e6362dfc7d Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 4 Sep 2024 12:58:53 -0700 Subject: [PATCH 2/3] Only test on Python >= 3.10 --- .github/workflows/tests.yml | 5 ++--- .github/workflows/wheel_tests_and_release.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ce5578d9..fc345b23 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/setup-python@v1 with: - python-version: "3.8" + python-version: "3.10" - uses: actions/cache@v2 with: @@ -33,9 +33,8 @@ jobs: - name: Install dependencies & configure cesium run: | pip install --upgrade pip - pip install wheel numpy requests six python-dateutil pytest pytest-cov mock coverage + pip install wheel numpy cython requests six python-dateutil pytest pytest-cov mock coverage make install - pip install cython==0.29.23 python setup.py build_ext -i pip install -e . diff --git a/.github/workflows/wheel_tests_and_release.yml b/.github/workflows/wheel_tests_and_release.yml index 959d1d7c..56b8b7b5 100644 --- a/.github/workflows/wheel_tests_and_release.yml +++ b/.github/workflows/wheel_tests_and_release.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"] + cibw_python: ["cp310-*", "cp311-*", "cp312-*"] cibw_manylinux: [manylinux2014] cibw_arch: ["x86_64"] steps: From ea06de37449c3f5ddfb949c7f523e3a2bf3ac940 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Wed, 4 Sep 2024 13:02:34 -0700 Subject: [PATCH 3/3] Install setuptools_scm before build --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fc345b23..71f2533a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: - name: Install dependencies & configure cesium run: | pip install --upgrade pip - pip install wheel numpy cython requests six python-dateutil pytest pytest-cov mock coverage + pip install wheel setuptools_scm numpy cython requests six python-dateutil pytest pytest-cov mock coverage make install python setup.py build_ext -i pip install -e .