Skip to content

Commit 642fd5d

Browse files
authored
Merge pull request #189 from adamreichold/bump-pyo3
Bump PyO3 version to 0.14
2 parents 696c77b + 99e09b7 commit 642fd5d

File tree

13 files changed

+38
-44
lines changed

13 files changed

+38
-44
lines changed

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.13.2"
3+
version = "0.14.0"
44
authors = [
55
"Toshiki Teramura <[email protected]>",
66
"Yuji Kanagawa <[email protected]>",
@@ -19,15 +19,15 @@ libc = "0.2"
1919
num-complex = ">= 0.2, <= 0.4"
2020
num-traits = "0.2"
2121
ndarray = ">= 0.13, < 0.16"
22-
pyo3 = { version = "0.13", default-features = false }
22+
pyo3 = { version = "0.14", default-features = false }
2323

2424
[dev-dependencies]
25-
pyo3 = "0.13"
25+
pyo3 = { version = "0.14", features = ["auto-initialize"] }
2626

2727
[features]
2828
# In default setting, python version is automatically detected
2929
default = []
3030
rayon = ["ndarray/rayon"]
3131

3232
[workspace]
33-
members = ["examples/*"]
33+
members = ["examples/*"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ using [setuptools-rust](https://github.com/PyO3/setuptools-rust).
5555
name = "numpy-test"
5656

5757
[dependencies]
58-
pyo3 = "0.13"
59-
numpy = "0.13"
58+
pyo3 = "0.14"
59+
numpy = "0.14"
6060
```
6161

6262
```rust
@@ -92,11 +92,11 @@ name = "rust_ext"
9292
crate-type = ["cdylib"]
9393

9494
[dependencies]
95-
numpy = "0.13"
95+
numpy = "0.14"
9696
ndarray = "0.14"
9797

9898
[dependencies.pyo3]
99-
version = "0.13"
99+
version = "0.14"
100100
features = ["extension-module"]
101101
```
102102

examples/linalg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ ndarray = "0.15"
1515
ndarray-linalg = { git = "https://github.com/rust-ndarray/ndarray-linalg", features = ["openblas-static"] }
1616

1717
[dependencies.pyo3]
18-
version = "0.13"
18+
version = "0.14"
1919
features = ["extension-module"]

examples/linalg/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build-system]
22
build-backend = "maturin"
3+
requires = ["poetry_core>=1.0.0"]
34

45
[tool.poetry]
56
name = "numpy-linalg-example"
@@ -12,4 +13,4 @@ numpy = ">=1.18"
1213
python = ">=3.6"
1314

1415
[tool.poetry.dev-dependencies]
15-
pytest = "^6.1"
16+
pytest = "^6.1"

examples/linalg/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use pyo3::prelude::{pymodule, PyErr, PyModule, PyResult, Python};
55

66
#[pymodule]
77
fn rust_linalg(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
8-
#[pyfn(m, "inv")]
8+
#[pyfn(m)]
99
fn inv<'py>(py: Python<'py>, x: PyReadonlyArray2<'py, f64>) -> PyResult<&'py PyArray2<f64>> {
1010
let x = x
1111
.as_array()

examples/simple-extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ ndarray = "0.15.2"
1414
num-complex = "0.4.0"
1515

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

examples/simple-extension/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build-system]
22
build-backend = "maturin"
3+
requires = ["poetry_core>=1.0.0"]
34

45
[tool.poetry]
56
name = "numpy-example"

examples/simple-extension/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
2020
}
2121

2222
// wrapper of `axpy`
23-
#[pyfn(m, "axpy")]
23+
#[pyfn(m)]
24+
#[pyo3(name = "axpy")]
2425
fn axpy_py<'py>(
2526
py: Python<'py>,
2627
a: f64,
@@ -33,14 +34,16 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
3334
}
3435

3536
// wrapper of `mult`
36-
#[pyfn(m, "mult")]
37+
#[pyfn(m)]
38+
#[pyo3(name = "mult")]
3739
fn mult_py(a: f64, x: &PyArrayDyn<f64>) {
3840
let x = unsafe { x.as_array_mut() };
3941
mult(a, x);
4042
}
4143

4244
// wrapper of `conj`
43-
#[pyfn(m, "conj")]
45+
#[pyfn(m)]
46+
#[pyo3(name = "conj")]
4447
fn conj_py<'py>(py: Python<'py>, x: PyReadonlyArrayDyn<'_, c64>) -> &'py PyArrayDyn<c64> {
4548
conj(x.as_array()).into_pyarray(py)
4649
}

src/array.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ impl<T, D> type_object::PySizedLayout<PyArray<T, D>> for npyffi::PyArrayObject {
104104

105105
pyobject_native_type_info!(
106106
PyArray<T, D>,
107-
npyffi::PyArrayObject,
108107
*npyffi::PY_ARRAY_API.get_type_object(npyffi::NpyTypes::PyArray_Type),
109108
Some("numpy"),
110-
npyffi::PyArray_Check
109+
#checkfunction=npyffi::PyArray_Check
111110
; T
112111
; D
113112
);

src/dtype.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ pub struct PyArrayDescr(PyAny);
2626

2727
pyobject_native_type_core!(
2828
PyArrayDescr,
29-
PyArray_Descr,
3029
*PY_ARRAY_API.get_type_object(NpyTypes::PyArrayDescr_Type),
31-
Some("numpy"),
32-
arraydescr_check
30+
#module=Some("numpy"),
31+
#checkfunction=arraydescr_check
3332
);
3433

3534
unsafe fn arraydescr_check(op: *mut ffi::PyObject) -> c_int {

0 commit comments

Comments
 (0)