Skip to content

Commit

Permalink
Update for NumPy 2.0 and Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Sep 4, 2024
1 parent b962f13 commit 0f16fbc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cesium/featurize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion cesium/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cesium/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -26,7 +26,6 @@ classifiers = [
"Operating System :: Unix",
"Operating System :: MacOS",
]

dynamic = ["version", "dependencies"]

[project.urls]
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -7,4 +7,3 @@ toolz
gatspy>=0.3.0
cloudpickle
joblib>=0.14.1
setuptools-scm>=7.1.0

0 comments on commit 0f16fbc

Please sign in to comment.