Skip to content

Commit

Permalink
Merge pull request #111 from kngwyu/pyo3-0.8
Browse files Browse the repository at this point in the history
Update pyo3 to 0.8 and bump version to 0.7
  • Loading branch information
kngwyu committed Sep 7, 2019
2 parents 37cf48b + 745fc05 commit e11cc0e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
- v0.7.0
- Update PyO3 to 0.8

- v0.6.0
- Update PyO3 to 0.7
- Drop Python2 support
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "numpy"
version = "0.6.0"
version = "0.7.0"
authors = ["Toshiki Teramura <[email protected]>", "Yuji Kanagawa <[email protected]>"]
description = "Rust binding of NumPy C-API"
documentation = "https://rust-numpy.github.io/rust-numpy/numpy"
Expand All @@ -14,8 +14,8 @@ cfg-if = "0.1"
libc = "0.2"
num-complex = "0.2"
num-traits = "0.2"
ndarray = "0.12"
pyo3 = "0.7"
ndarray = ">=0.12"
pyo3 = "0.8"

[features]
# In default setting, python version is automatically detected
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ using [setuptools-rust](https://github.com/PyO3/setuptools-rust).
name = "numpy-test"

[dependencies]
pyo3 = "0.7"
numpy = "0.6.0"
pyo3 = "0.8"
numpy = "0.7.0"
```

```rust
Expand Down Expand Up @@ -98,11 +98,11 @@ name = "rust_ext"
crate-type = ["cdylib"]

[dependencies]
numpy = "0.6.0"
numpy = "0.7.0"
ndarray = "0.12"

[dependencies.pyo3]
version = "0.7"
version = "0.8"
features = ["extension-module"]
```

Expand Down
2 changes: 1 addition & 1 deletion examples/linalg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ ndarray = "0.12"
ndarray-linalg = { version = "0.10", features = ["openblas"] }

[dependencies.pyo3]
version = "0.7"
version = "0.8"
features = ["extension-module"]
2 changes: 1 addition & 1 deletion examples/linalg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools_rust import RustExtension


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

Expand Down
2 changes: 1 addition & 1 deletion examples/simple-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ numpy = { path = "../.." }
ndarray = "0.12"

[dependencies.pyo3]
version = "0.7"
version = "0.8"
features = ["extension-module"]
2 changes: 1 addition & 1 deletion examples/simple-extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools_rust import RustExtension


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

Expand Down
7 changes: 4 additions & 3 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub fn get_array_module(py: Python<'_>) -> PyResult<&PyModule> {
pyobject_native_type_convert!(
PyArray<T, D>,
*npyffi::PY_ARRAY_API.get_type_object(npyffi::ArrayType::PyArray_Type),
Some("numpy"),
npyffi::PyArray_Check,
T, D
);
Expand Down Expand Up @@ -133,8 +134,8 @@ impl<'a, T: TypeNum, D: Dimension> FromPyObject<'a> for &'a PyArray<T, D> {
}
}

impl<T, D> IntoPyObject for PyArray<T, D> {
fn into_object(self, _py: Python<'_>) -> PyObject {
impl<T, D> IntoPy<PyObject> for PyArray<T, D> {
fn into_py(self, _py: Python<'_>) -> PyObject {
self.0
}
}
Expand Down Expand Up @@ -413,7 +414,7 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> {
/// # #[macro_use] extern crate ndarray; fn main() {
/// use numpy::PyArray2;
/// let gil = pyo3::Python::acquire_gil();
/// let pyarray = PyArray2::zeros(gil.python(), [2, 2], false);
/// let pyarray: &PyArray2<usize> = PyArray2::zeros(gil.python(), [2, 2], false);
/// assert_eq!(pyarray.as_array(), array![[0, 0], [0, 0]]);
/// # }
/// ```
Expand Down
1 change: 1 addition & 0 deletions src/slice_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl<T> type_object::PyTypeInfo for SliceBox<T> {
type Type = ();
type BaseType = PyAny;
const NAME: &'static str = "SliceBox";
const MODULE: Option<&'static str> = Some("_rust_numpy");
const DESCRIPTION: &'static str = "Memory store for PyArray using rust's Box<[T]>.";
const FLAGS: usize = 0;
const SIZE: usize = std::mem::size_of::<Self>();
Expand Down

0 comments on commit e11cc0e

Please sign in to comment.