PyO3 / rust-numpy

PyO3-based Rust bindings of the NumPy C-API
BSD 2-Clause "Simplified" License
1.07k stars 98 forks source link

migration to pyo3 0.21 new `Bound` API #410

Closed Icxolu closed 4 months ago

Icxolu commented 4 months ago

pyo3 0.21 is on the final stretch to release, with an initial beta expected in the next few days.

This starts the migration to pyo3s new Bound API. This initial PR bumps the pyo3 version, enables the gil-refs feature (to suppress most of the deprecation warnings) and adjust the rest to compile and pass the tests again.

Note: PyTypeInfo needs to be updated to is_type_of_bound now, because otherwise pyo3s internals will not use the custom implementation, as found in https://github.com/PyO3/pyo3/issues/3929

I've prepared followups migrating different parts of the API in (hopefully) reviewable chunks. Generally I took a similar approach to pyo3 itself, leaving old API around (for easy migrations) and adding deprecation warnings where necessary.

I'll leave this as a draft until the beta release drops and rebase this than.

Icxolu commented 4 months ago

Rebased to use pyo3 0.21.0-beta, bumped examples to also use it and fixed MSRV