Skip to content

Commit

Permalink
Merge pull request #96 from kngwyu/release0.6
Browse files Browse the repository at this point in the history
Update PyO3 to 0.7 and release 0.6
  • Loading branch information
kngwyu committed May 26, 2019
2 parents 6aa50ed + 9dfbf2c commit 8de3443
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ cache:

matrix:
include:
- python: "2.7"
env: FEATURES=python2
- python: "3.5"
env: FEATURES=python3
- python: "3.6"
Expand Down
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "numpy"
version = "0.5.0"
version = "0.6.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,13 +14,11 @@ libc = "0.2"
num-complex = "0.2"
num-traits = "0.2"
ndarray = "0.12"
pyo3 = "0.6"
pyo3 = "0.7"

[features]
# In default setting, python version is automatically detected
default = []
# Use this feature when building python2 binding.
python2 = ["pyo3/python2"]
# Use this feature when building python3 binding.
# This is no longer needed but setuptools-rust assumes this feature
python3 = ["pyo3/python3"]

12 changes: 8 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.6.0"
numpy = "0.5.0"
pyo3 = "0.7"
numpy = "0.6.0"
```

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

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

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

Expand Down Expand Up @@ -160,6 +160,10 @@ We need your feedback.
Don't hesitate to open [issues](https://github.com/rust-numpy/rust-numpy/issues)!

## Version
- v0.6.0
- Update PyO3 to 0.7
- Drop Python2 support

- v0.5.0
- Update PyO3 to 0.6

Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
environment:
TARGET: x86_64-pc-windows-msvc
matrix:
- PYTHON: "C:/Python27-x64"
FEATURES: python2
- PYTHON: "C:/Python35-x64"
FEATURES: python3
- PYTHON: "C:/Python36-x64"
Expand Down
2 changes: 0 additions & 2 deletions examples/linalg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
rust_extensions=[RustExtension(
'rust_linalg.rust_linalg',
'./Cargo.toml',
rustc_flags=['--cfg=Py_{}'.format(PYTHON_MAJOR_VERSION)],
features=['numpy/python{}'.format(PYTHON_MAJOR_VERSION)],
)],
install_requires=install_requires,
setup_requires=setup_requires,
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 @@ -12,5 +12,5 @@ numpy = { path = "../.." }
ndarray = "0.12"

[dependencies.pyo3]
version = "0.6"
version = "0.7"
features = ["extension-module"]
2 changes: 0 additions & 2 deletions examples/simple-extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
rust_extensions=[RustExtension(
'rust_ext.rust_ext',
'./Cargo.toml',
rustc_flags=['--cfg=Py_{}'.format(PYTHON_MAJOR_VERSION)],
features=['numpy/python{}'.format(PYTHON_MAJOR_VERSION)],
)],
install_requires=install_requires,
setup_requires=setup_requires,
Expand Down
7 changes: 1 addition & 6 deletions src/npyffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@
use pyo3::ffi;
use std::ffi::CString;
use std::os::raw::c_void;
use std::ptr::null_mut;

fn get_numpy_api(module: &str, capsule: &str) -> *const *const c_void {
let module = CString::new(module).unwrap();
let capsule = CString::new(capsule).unwrap();
#[cfg(feature = "python2")]
unsafe fn get_capsule(capsule: *mut ffi::PyObject) -> *const *const c_void {
ffi::PyCObject_AsVoidPtr(capsule) as *const *const c_void
}
#[cfg(not(feature = "python2"))]
unsafe fn get_capsule(capsule: *mut ffi::PyObject) -> *const *const c_void {
use std::ptr::null_mut;
ffi::PyCapsule_GetPointer(capsule, null_mut()) as *const *const c_void
}
unsafe {
Expand Down

0 comments on commit 8de3443

Please sign in to comment.