Skip to content

Commit e11cc0e

Browse files
authored
Merge pull request #111 from kngwyu/pyo3-0.8
Update pyo3 to 0.8 and bump version to 0.7
2 parents 37cf48b + 745fc05 commit e11cc0e

File tree

9 files changed

+19
-14
lines changed

9 files changed

+19
-14
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
- v0.7.0
3+
- Update PyO3 to 0.8
4+
25
- v0.6.0
36
- Update PyO3 to 0.7
47
- Drop Python2 support

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "numpy"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
authors = ["Toshiki Teramura <[email protected]>", "Yuji Kanagawa <[email protected]>"]
55
description = "Rust binding of NumPy C-API"
66
documentation = "https://rust-numpy.github.io/rust-numpy/numpy"
@@ -14,8 +14,8 @@ cfg-if = "0.1"
1414
libc = "0.2"
1515
num-complex = "0.2"
1616
num-traits = "0.2"
17-
ndarray = "0.12"
18-
pyo3 = "0.7"
17+
ndarray = ">=0.12"
18+
pyo3 = "0.8"
1919

2020
[features]
2121
# In default setting, python version is automatically detected

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ using [setuptools-rust](https://github.com/PyO3/setuptools-rust).
5656
name = "numpy-test"
5757

5858
[dependencies]
59-
pyo3 = "0.7"
60-
numpy = "0.6.0"
59+
pyo3 = "0.8"
60+
numpy = "0.7.0"
6161
```
6262

6363
```rust
@@ -98,11 +98,11 @@ name = "rust_ext"
9898
crate-type = ["cdylib"]
9999

100100
[dependencies]
101-
numpy = "0.6.0"
101+
numpy = "0.7.0"
102102
ndarray = "0.12"
103103

104104
[dependencies.pyo3]
105-
version = "0.7"
105+
version = "0.8"
106106
features = ["extension-module"]
107107
```
108108

examples/linalg/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ ndarray = "0.12"
1414
ndarray-linalg = { version = "0.10", features = ["openblas"] }
1515

1616
[dependencies.pyo3]
17-
version = "0.7"
17+
version = "0.8"
1818
features = ["extension-module"]

examples/linalg/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from setuptools_rust import RustExtension
33

44

5-
setup_requires = ['setuptools-rust>=0.6.0']
5+
setup_requires = ['setuptools-rust>=0.10.2']
66
install_requires = ['numpy']
77
test_requires = install_requires + ['pytest']
88

examples/simple-extension/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ numpy = { path = "../.." }
1313
ndarray = "0.12"
1414

1515
[dependencies.pyo3]
16-
version = "0.7"
16+
version = "0.8"
1717
features = ["extension-module"]

examples/simple-extension/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from setuptools_rust import RustExtension
33

44

5-
setup_requires = ['setuptools-rust>=0.6.0']
5+
setup_requires = ['setuptools-rust>=0.10.2']
66
install_requires = ['numpy']
77
test_requires = install_requires + ['pytest']
88

src/array.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pub fn get_array_module(py: Python<'_>) -> PyResult<&PyModule> {
102102
pyobject_native_type_convert!(
103103
PyArray<T, D>,
104104
*npyffi::PY_ARRAY_API.get_type_object(npyffi::ArrayType::PyArray_Type),
105+
Some("numpy"),
105106
npyffi::PyArray_Check,
106107
T, D
107108
);
@@ -133,8 +134,8 @@ impl<'a, T: TypeNum, D: Dimension> FromPyObject<'a> for &'a PyArray<T, D> {
133134
}
134135
}
135136

136-
impl<T, D> IntoPyObject for PyArray<T, D> {
137-
fn into_object(self, _py: Python<'_>) -> PyObject {
137+
impl<T, D> IntoPy<PyObject> for PyArray<T, D> {
138+
fn into_py(self, _py: Python<'_>) -> PyObject {
138139
self.0
139140
}
140141
}
@@ -413,7 +414,7 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> {
413414
/// # #[macro_use] extern crate ndarray; fn main() {
414415
/// use numpy::PyArray2;
415416
/// let gil = pyo3::Python::acquire_gil();
416-
/// let pyarray = PyArray2::zeros(gil.python(), [2, 2], false);
417+
/// let pyarray: &PyArray2<usize> = PyArray2::zeros(gil.python(), [2, 2], false);
417418
/// assert_eq!(pyarray.as_array(), array![[0, 0], [0, 0]]);
418419
/// # }
419420
/// ```

src/slice_box.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ impl<T> type_object::PyTypeInfo for SliceBox<T> {
2929
type Type = ();
3030
type BaseType = PyAny;
3131
const NAME: &'static str = "SliceBox";
32+
const MODULE: Option<&'static str> = Some("_rust_numpy");
3233
const DESCRIPTION: &'static str = "Memory store for PyArray using rust's Box<[T]>.";
3334
const FLAGS: usize = 0;
3435
const SIZE: usize = std::mem::size_of::<Self>();

0 commit comments

Comments
 (0)