Skip to content

Commit 7121433

Browse files
committed
Move the secion on ndarray to after the examples which is what most new users would like to see first.
1 parent 2a0733d commit 7121433

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

README.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Rust bindings for the NumPy C-API.
1010
- [Latest release](https://docs.rs/numpy)
1111
- [Current main](https://pyo3.github.io/rust-numpy)
1212

13-
1413
## Requirements
1514
- Rust >= 1.41.1
1615
- Basically, our MSRV follows the one of [PyO3](https://github.com/PyO3/pyo3)
@@ -23,36 +22,8 @@ Rust bindings for the NumPy C-API.
2322
- [numpy](https://numpy.org/) installed in your Python environments (e.g., via `pip install numpy`)
2423
- We recommend `numpy >= 1.16.0`, though older versions may work
2524

26-
27-
## Dependency on ndarray
28-
29-
This crate uses types from `ndarray` in its public API. `ndarray` is re-exported
30-
in the crate root so that you do not need to specify it as a direct dependency.
31-
32-
Furthermore, this crate is compatible with multiple versions of `ndarray` and therefore depends
33-
on a range of semver-incompatible versions, currently `>= 0.13, < 0.16`. Cargo does not
34-
automatically choose a single version of `ndarray` by itself if you depend directly or indirectly
35-
on anything but that exact range. It can therefore be necessary to manually unify these dependencies.
36-
37-
For example, if you specify the following dependencies
38-
39-
```toml
40-
numpy = "0.15"
41-
ndarray = "0.13"
42-
```
43-
44-
this will currently depend on both version `0.13.1` and `0.15.3` of `ndarray` by default
45-
even though `0.13.1` is within the range `>= 0.13, < 0.16`. To fix this, you can run
46-
47-
```sh
48-
cargo update ---package ndarray:0.15.3 --precise 0.13.1
49-
```
50-
51-
to achieve a single dependency on version `0.13.1` of `ndarray`.
52-
5325
## Example
5426

55-
5627
### Execute a Python program from Rust and get results
5728

5829
``` toml
@@ -146,6 +117,32 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
146117
}
147118
```
148119

120+
## Dependency on ndarray
121+
122+
This crate uses types from `ndarray` in its public API. `ndarray` is re-exported
123+
in the crate root so that you do not need to specify it as a direct dependency.
124+
125+
Furthermore, this crate is compatible with multiple versions of `ndarray` and therefore depends
126+
on a range of semver-incompatible versions, currently `>= 0.13, < 0.16`. Cargo does not
127+
automatically choose a single version of `ndarray` by itself if you depend directly or indirectly
128+
on anything but that exact range. It can therefore be necessary to manually unify these dependencies.
129+
130+
For example, if you specify the following dependencies
131+
132+
```toml
133+
numpy = "0.15"
134+
ndarray = "0.13"
135+
```
136+
137+
this will currently depend on both version `0.13.1` and `0.15.3` of `ndarray` by default
138+
even though `0.13.1` is within the range `>= 0.13, < 0.16`. To fix this, you can run
139+
140+
```sh
141+
cargo update ---package ndarray:0.15.3 --precise 0.13.1
142+
```
143+
144+
to achieve a single dependency on version `0.13.1` of `ndarray`.
145+
149146
## Contributing
150147
We welcome [issues](https://github.com/PyO3/rust-numpy/issues)
151148
and [pull requests](https://github.com/PyO3/rust-numpy/pulls).

0 commit comments

Comments
 (0)