Skip to content

Commit f8ccfe1

Browse files
committed
Extend README to cover handling non-unified dependencies on semver-incompatible ndarray versions.
1 parent 3257fd9 commit f8ccfe1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,32 @@ You can also automatically specify python version in `setup.py`,
4545
using [setuptools-rust](https://github.com/PyO3/setuptools-rust).
4646

4747

48+
## Dependency on ndarray
49+
50+
This crate uses types from `ndarray` in its public API. `ndarray` is re-exported
51+
in the crate root so that you do not need to specify it as a direct dependency.
52+
53+
Furthermore, this crate is compatible multiple versions of `ndarray` and therefore depends
54+
on a range of semver-incompatible versions, currently `>= 0.13, < 0.16`. Cargo does not
55+
automatically choose a single version of `ndarray` by itself if you depend directly or indirectly
56+
on anything but that exact range. It can therefore be necessary to manually unify these dependencies.
57+
58+
For example, if you specify the following dependencies
59+
60+
```toml
61+
numpy = "0.14"
62+
ndarray = "0.13"
63+
```
64+
65+
this will currently depend on both version `0.13.1` and `0.15.3` of `ndarray` by default
66+
even though `0.13.1` is within the range `>= 0.13, < 0.16`. To fix this, you can run
67+
68+
```sh
69+
cargo update ---package ndarray:0.15.3 --precise 0.13.1
70+
```
71+
72+
to achieve a single dependency on version `0.13.1` of `ndarray`.
73+
4874
## Example
4975

5076

0 commit comments

Comments
 (0)