From 6f9a28fd733637f7556e8de4241205d1ee90d5be Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 16 Jun 2024 12:18:32 +0100 Subject: [PATCH 1/2] Test against np2 --- .github/workflows/build_sdist.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_sdist.yml b/.github/workflows/build_sdist.yml index c565ee7e..6dd7b759 100644 --- a/.github/workflows/build_sdist.yml +++ b/.github/workflows/build_sdist.yml @@ -61,7 +61,10 @@ jobs: set -x pip install --upgrade pip + pip install "numpy==2.0.0rc2" + python -c "import numpy; print(f'{numpy.__version__ = }')" pip install dist/scikit_surprise-1.1.4.tar.gz -v + python -c "import numpy; print(f'{numpy.__version__ = }')" - name: Pip freeze run: | From 5749ce5221c213da722e591c0ab1d8876f5a2c0b Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 16 Jun 2024 12:25:32 +0100 Subject: [PATCH 2/2] Add numpy.import_array() --- surprise/prediction_algorithms/co_clustering.pyx | 1 + surprise/prediction_algorithms/matrix_factorization.pyx | 1 + surprise/prediction_algorithms/optimize_baselines.pyx | 1 + surprise/prediction_algorithms/slope_one.pyx | 1 + surprise/similarities.pyx | 1 + 5 files changed, 5 insertions(+) diff --git a/surprise/prediction_algorithms/co_clustering.pyx b/surprise/prediction_algorithms/co_clustering.pyx index 5fc87ba6..1b8172bc 100644 --- a/surprise/prediction_algorithms/co_clustering.pyx +++ b/surprise/prediction_algorithms/co_clustering.pyx @@ -6,6 +6,7 @@ the :mod:`co_clustering` module includes the :class:`CoClustering` algorithm. cimport numpy as np # noqa +np.import_array() # noqa import numpy as np from .algo_base import AlgoBase diff --git a/surprise/prediction_algorithms/matrix_factorization.pyx b/surprise/prediction_algorithms/matrix_factorization.pyx index 1857befb..5301dba5 100644 --- a/surprise/prediction_algorithms/matrix_factorization.pyx +++ b/surprise/prediction_algorithms/matrix_factorization.pyx @@ -4,6 +4,7 @@ factorization. """ cimport numpy as np # noqa +np.import_array() # noqa import numpy as np from libc.math cimport sqrt diff --git a/surprise/prediction_algorithms/optimize_baselines.pyx b/surprise/prediction_algorithms/optimize_baselines.pyx index 3a8f4151..dc4b9e50 100644 --- a/surprise/prediction_algorithms/optimize_baselines.pyx +++ b/surprise/prediction_algorithms/optimize_baselines.pyx @@ -7,6 +7,7 @@ gradient descent and alternating least squares. cimport numpy as np # noqa +np.import_array() # noqa import numpy as np diff --git a/surprise/prediction_algorithms/slope_one.pyx b/surprise/prediction_algorithms/slope_one.pyx index 313ba5cd..5b574b30 100644 --- a/surprise/prediction_algorithms/slope_one.pyx +++ b/surprise/prediction_algorithms/slope_one.pyx @@ -6,6 +6,7 @@ the :mod:`slope_one` module includes the :class:`SlopeOne` algorithm. cimport numpy as np # noqa +np.import_array() # noqa import numpy as np from .algo_base import AlgoBase diff --git a/surprise/similarities.pyx b/surprise/similarities.pyx index 35e0c14d..10b96d16 100644 --- a/surprise/similarities.pyx +++ b/surprise/similarities.pyx @@ -17,6 +17,7 @@ Available similarity measures: cimport numpy as np # noqa +np.import_array() # noqa import numpy as np from libc.math cimport sqrt