Skip to content

Commit 0747447

Browse files
committed
Updated to latest PyO3 version, fixed deprecation, updated README and examples.
1 parent edec058 commit 0747447

7 files changed

Lines changed: 18 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fix PyArray_DTypeMeta definition when Py_LIMITED_API is disabled ([#532](https://github.com/PyO3/rust-numpy/pull/532))
55
- The NumPy C API binding has been updated to target the ABI v2, while maintaining runtime compatibility with NumPy v1 targeting the API v1.15. The higher interface is unchanged. ([#537](https://github.com/PyO3/rust-numpy/pull/537))
66
- Fix `is_exact_type_of` / `cast_exact` to use `PyArray_CheckExact` instead of `PyArray_Check`, correctly rejecting subclasses of `ndarray`. ([#550](https://github.com/PyO3/rust-numpy/pull/550))
7+
- Bump PyO3 dependency to v0.29.0. Fix `PyCapsule::new_with_destructor` to use `PyCapsule::new_with_value_and_destructor`. ([#553](https://github.com/PyO3/rust-numpy/pull/553))
78

89
- v0.28.0
910
- Fix mismatched behavior between `PyArrayLike1` and `PyArrayLike2` when used with floats ([#520](https://github.com/PyO3/rust-numpy/pull/520))

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "numpy"
3-
version = "0.28.0"
3+
version = "0.29.0"
44
authors = [
55
"The rust-numpy Project Developers",
66
"PyO3 Project and Contributors <https://github.com/PyO3>",
@@ -28,16 +28,16 @@ num-complex = ">= 0.2, < 0.5"
2828
num-integer = "0.1"
2929
num-traits = "0.2"
3030
ndarray = ">= 0.15, <=0.17"
31-
pyo3 = { version = "0.28.0", default-features = false, features = ["macros"] }
31+
pyo3 = { version = "0.29.0", default-features = false, features = ["macros"] }
3232
rustc-hash = "2.0"
3333

3434
[dev-dependencies]
35-
pyo3 = { version = "0.28.0", default-features = false, features = ["auto-initialize"]}
35+
pyo3 = { version = "0.29.0", default-features = false, features = ["auto-initialize"]}
3636
nalgebra = { version = ">=0.30, <0.35", default-features = false, features = ["std"] }
3737
criterion = "0.8.2"
3838

3939
[build-dependencies]
40-
pyo3-build-config = { version = "0.28", features = ["resolve-config"]}
40+
pyo3-build-config = { version = "0.29", features = ["resolve-config"]}
4141

4242
[[bench]]
4343
name = "array"

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Rust bindings for the NumPy C-API.
1515
## Requirements
1616
- Rust >= 1.83.0
1717
- Basically, our MSRV follows the one of [PyO3](https://github.com/PyO3/pyo3)
18-
- Python >= 3.7
19-
- Python 3.6 support was dropped from 0.16
18+
- Python >= 3.8
19+
- Python 3.7 support was dropped from 0.29
2020
- Some Rust libraries
2121
- [ndarray](https://github.com/rust-ndarray/ndarray) for Rust-side matrix library
2222
- [PyO3](https://github.com/PyO3/pyo3) for Python bindings
@@ -38,8 +38,8 @@ name = "rust_ext"
3838
crate-type = ["cdylib"]
3939

4040
[dependencies]
41-
pyo3 = { version = "0.27" }
42-
numpy = "0.27"
41+
pyo3 = { version = "0.29" }
42+
numpy = "0.29"
4343
```
4444

4545
```rust
@@ -89,8 +89,8 @@ mod rust_ext {
8989
name = "numpy-test"
9090

9191
[dependencies]
92-
pyo3 = { version = "0.27", features = ["auto-initialize"] }
93-
numpy = "0.27"
92+
pyo3 = { version = "0.29", features = ["auto-initialize"] }
93+
numpy = "0.29"
9494
```
9595

9696
```rust
@@ -128,7 +128,7 @@ on anything but that exact range. It can therefore be necessary to manually unif
128128
For example, if you specify the following dependencies
129129

130130
```toml
131-
numpy = "0.27"
131+
numpy = "0.29"
132132
ndarray = "0.15"
133133
```
134134

examples/linalg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rust_linalg"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.28.0" }
12+
pyo3 = { version = "0.29.0" }
1313
numpy = { path = "../.." }
1414
ndarray-linalg = { version = "0.14.1", features = ["openblas-system"] }
1515

examples/parallel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rust_parallel"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.28.0", features = ["multiple-pymethods"] }
12+
pyo3 = { version = "0.29.0", features = ["multiple-pymethods"] }
1313
numpy = { path = "../.." }
1414
ndarray = { version = "0.17", features = ["rayon", "blas"] }
1515
blas-src = { version = "0.8", features = ["openblas"] }

examples/simple/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "rust_ext"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.28.0", features = ["abi3-py37"] }
12+
pyo3 = { version = "0.29.0", features = ["abi3-py38"] }
1313
numpy = { path = "../.." }
1414

1515
[workspace]

src/borrow/shared.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::hash_map::Entry;
2-
use std::ffi::{c_char, c_int, c_void, CString};
2+
use std::ffi::{c_char, c_int, c_void};
33
use std::mem::forget;
44
use std::ptr::NonNull;
55
use std::slice::from_raw_parts;
@@ -135,10 +135,10 @@ fn insert_shared<'py>(py: Python<'py>) -> PyResult<NonNull<Shared>> {
135135
release_mut: release_mut_shared,
136136
};
137137

138-
let capsule = PyCapsule::new_with_destructor(
138+
let capsule = PyCapsule::new_with_value_and_destructor(
139139
py,
140140
shared,
141-
Some(CString::new("_RUST_NUMPY_BORROW_CHECKING_API").unwrap()),
141+
c"_RUST_NUMPY_BORROW_CHECKING_API",
142142
|shared, _ctx| {
143143
// SAFETY: `shared.flags` was initialized using `Box::into_raw`.
144144
let _ = unsafe { Box::from_raw(shared.flags as *mut BorrowFlags) };

0 commit comments

Comments
 (0)