PyO3/rust-numpy

DeprecationWarning: `numpy.core.multiarray` is deprecated and has been renamed to `numpy._core.multiarray`.

kahojyun opened this issue · 1 comments

I tried using the newest numpy crate from git which has added numpy 2 support, but calling function using PyArrayLike2 produced the following DeprecationWarning:

DeprecationWarning: numpy.core.multiarray is deprecated and has been renamed to numpy._core.multiarray. The numpy._core namespace contains private NumPy internals and its use is discouraged, as NumPy internals can change without warning in any release. In practice, most real-world usage of numpy.core is to access functionality in the public NumPy API. If that is the case, use the public NumPy API. If not, you are using NumPy internals. If you would still like to access an internal attribute, use numpy._core.multiarray.asarray.

Cargo dependency:

numpy = { git = "https://github.com/PyO3/rust-numpy.git", rev = "ca3299f" }

Test function:

#[pyfunction]
fn calculate(arr: PyArrayLike2<f64>) -> f64 {
    arr.as_array().iter().sum()
}