@@ -2,7 +2,7 @@ rust-numpy
2
2
===========
3
3
[ ![ Actions Status] ( https://github.com/PyO3/rust-numpy/workflows/CI/badge.svg )] ( https://github.com/PyO3/rust-numpy/actions )
4
4
[ ![ Crate] ( https://img.shields.io/crates/v/numpy.svg )] ( https://crates.io/crates/numpy )
5
- [ ![ Minimum rustc 1.63 ] ( https://img.shields.io/badge/rustc-1.63 +-blue.svg )] ( https://rust-lang.github.io/rfcs/2495-min-rust-version.html )
5
+ [ ![ Minimum rustc 1.74 ] ( https://img.shields.io/badge/rustc-1.74 +-blue.svg )] ( https://rust-lang.github.io/rfcs/2495-min-rust-version.html )
6
6
[ ![ Documentation] ( https://docs.rs/numpy/badge.svg )] ( https://docs.rs/numpy )
7
7
[ ![ codecov] ( https://codecov.io/gh/PyO3/rust-numpy/branch/main/graph/badge.svg )] ( https://codecov.io/gh/PyO3/rust-numpy )
8
8
@@ -13,7 +13,7 @@ Rust bindings for the NumPy C-API.
13
13
- [ Current main] ( https://pyo3.github.io/rust-numpy )
14
14
15
15
## Requirements
16
- - Rust >= 1.63 .0
16
+ - Rust >= 1.74 .0
17
17
- Basically, our MSRV follows the one of [ PyO3] ( https://github.com/PyO3/pyo3 )
18
18
- Python >= 3.7
19
19
- Python 3.6 support was dropped from 0.16
@@ -38,17 +38,17 @@ name = "rust_ext"
38
38
crate-type = [" cdylib" ]
39
39
40
40
[dependencies ]
41
- pyo3 = { version = " 0.22 " , features = [" extension-module" ] }
42
- numpy = " 0.22 "
41
+ pyo3 = { version = " 0.27 " , features = [" extension-module" ] }
42
+ numpy = " 0.27 "
43
43
```
44
44
45
45
``` rust
46
- use numpy :: ndarray :: {ArrayD , ArrayViewD , ArrayViewMutD };
47
- use numpy :: {IntoPyArray , PyArrayDyn , PyReadonlyArrayDyn , PyArrayMethods };
48
- use pyo3 :: {pymodule, types :: PyModule , PyResult , Python , Bound };
46
+ #[pyo3:: pymodule]
47
+ mod rust_ext {
48
+ use numpy :: ndarray :: {ArrayD , ArrayViewD , ArrayViewMutD };
49
+ use numpy :: {IntoPyArray , PyArrayDyn , PyReadonlyArrayDyn , PyArrayMethods };
50
+ use pyo3 :: {pyfunction, PyResult , Python , Bound };
49
51
50
- #[pymodule]
51
- fn rust_ext <'py >(_py : Python <'py >, m : & Bound <'py , PyModule >) -> PyResult <()> {
52
52
// example using immutable borrows producing a new array
53
53
fn axpy (a : f64 , x : ArrayViewD <'_ , f64 >, y : ArrayViewD <'_ , f64 >) -> ArrayD <f64 > {
54
54
a * & x + & y
@@ -60,8 +60,7 @@ fn rust_ext<'py>(_py: Python<'py>, m: &Bound<'py, PyModule>) -> PyResult<()> {
60
60
}
61
61
62
62
// wrapper of `axpy`
63
- #[pyfn(m)]
64
- #[pyo3(name = " axpy" )]
63
+ #[pyfunction(name = " axpy" )]
65
64
fn axpy_py <'py >(
66
65
py : Python <'py >,
67
66
a : f64 ,
@@ -75,14 +74,11 @@ fn rust_ext<'py>(_py: Python<'py>, m: &Bound<'py, PyModule>) -> PyResult<()> {
75
74
}
76
75
77
76
// wrapper of `mult`
78
- #[pyfn(m)]
79
- #[pyo3(name = " mult" )]
77
+ #[pyfunction(name = " mult" )]
80
78
fn mult_py <'py >(a : f64 , x : & Bound <'py , PyArrayDyn <f64 >>) {
81
79
let x = unsafe { x . as_array_mut () };
82
80
mult (a , x );
83
81
}
84
-
85
- Ok (())
86
82
}
87
83
```
88
84
@@ -93,8 +89,8 @@ fn rust_ext<'py>(_py: Python<'py>, m: &Bound<'py, PyModule>) -> PyResult<()> {
93
89
name = " numpy-test"
94
90
95
91
[dependencies ]
96
- pyo3 = { version = " 0.22 " , features = [" auto-initialize" ] }
97
- numpy = " 0.22 "
92
+ pyo3 = { version = " 0.27 " , features = [" auto-initialize" ] }
93
+ numpy = " 0.27 "
98
94
```
99
95
100
96
``` rust
@@ -132,7 +128,7 @@ on anything but that exact range. It can therefore be necessary to manually unif
132
128
For example, if you specify the following dependencies
133
129
134
130
``` toml
135
- numpy = " 0.22 "
131
+ numpy = " 0.27 "
136
132
ndarray = " 0.15"
137
133
```
138
134
0 commit comments