Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 48 additions & 10 deletions .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Test
name: CI

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:

Expand All @@ -13,16 +17,16 @@ jobs:
toolchain: stable
profile: minimal
components: rustfmt, clippy
- run:
cargo fmt --all -- check
- run: |
cargo fmt --all -- --check
cargo clippy --tests
for example in examples/*; do (cd $example/; cargo clippy) || exit 1; done

build:
test:
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
max-parallel: 12
max-parallel: 16
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
platform: [
Expand All @@ -49,10 +53,44 @@ jobs:
run: cargo build --verbose
- name: Install test dependencies
run: |
python -m pip install -U pip setuptools
pip install setuptools-rust pytest pytest-benchmark tox tox-venv numpy
- name: Test
run: ci/actions/test.sh
python -m pip install --upgrade pip
pip install maturin numpy poetry
- name: Run cargo test
run: cargo test --verbose
- name: Test Examples
run: |
for example_dir in 'examples/simple-extension'; do
pushd $example_dir && \
poetry install && \
poetry run maturin develop && \
poetry run pytest && \
popd
done
shell: bash
env:
RUST_BACKTRACE: 1

linalg-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install gfortran
run: |
sudo apt install -y gfortran
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- name: Install maturin and poetry
run: pip install maturin poetry
- name: Test Examples
run: |
cd examples/linalg && \
poetry install && \
poetry run maturin develop && \
poetry run pytest
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

- Unreleased
- Bump num-complex to 0.3
- Bump ndarray to 0.14

- v0.12.1
- Fix compile error in Rust 1.39

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cfg-if = "0.1"
libc = "0.2"
num-complex = "0.3"
num-traits = "0.2"
ndarray = ">=0.13"
ndarray = "0.14"
pyo3 = ">=0.12"

[features]
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rust-numpy
===========
[![Actions Status](https://github.com/pyo3/rust-numpy/workflows/Test/badge.svg)](https://github.com/pyo3/rust-numpy/actions)
[![Actions Status](https://github.com/pyo3/rust-numpy/workflows/CI/badge.svg)](https://github.com/pyo3/rust-numpy/actions)
[![Crate](http://meritbadge.herokuapp.com/numpy)](https://crates.io/crates/numpy)
[![minimum rustc 1.39](https://img.shields.io/badge/rustc-1.39+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)

Expand Down Expand Up @@ -81,7 +81,9 @@ fn main() -> PyResult<()> {

### Write a Python module in Rust

Please see the [examples](https://github.com/PyO3/rust-numpy/examples) directory for a complete example
Please see [simple-extension](https://github.com/PyO3/rust-numpy/tree/master/examples/simple-extension)
directory for the complete example.
Also, we have an example project with [ndarray-linalg](https://github.com/PyO3/rust-numpy/tree/master/examples/linalg).

```toml
[lib]
Expand Down Expand Up @@ -139,7 +141,11 @@ fn rust_ext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
}
```

## Contribution
We need your feedback.
## Conributing
We welcome [issues](https://github.com/rust-numpy/rust-numpy/issues)
and [pull requests](https://github.com/rust-numpy/rust-numpy/pulls).

PyO3's [contrinbuting.md](https://github.com/PyO3/pyo3/blob/master/Contributing.md)
is a nice guide for starting.
Also, we have a [gitter](https://gitter.im/PyO3/Lobby) channel for communicating.

Don't hesitate to open [issues](https://github.com/rust-numpy/rust-numpy/issues)!
14 changes: 0 additions & 14 deletions ci/actions/test.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/travis/deploy.sh

This file was deleted.

16 changes: 0 additions & 16 deletions ci/travis/setup.sh

This file was deleted.

20 changes: 0 additions & 20 deletions ci/travis/test.sh

This file was deleted.

6 changes: 3 additions & 3 deletions examples/linalg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "numpy-linalg-example"
version = "0.1.0"
authors = ["kngwyu <yuji.kngw.80s.revive@gmail.com>"]
authors = ["Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>"]
edition = "2018"

[lib]
Expand All @@ -10,8 +10,8 @@ crate-type = ["cdylib"]

[dependencies]
numpy = { path = "../.." }
ndarray = ">= 0.13"
ndarray-linalg = { version = "0.12", features = ["openblas"] }
ndarray = "0.14"
ndarray-linalg = { git = "https://github.com/kngwyu/ndarray-linalg", branch = "ndarray-014", features = ["openblas-static"] }

[dependencies.pyo3]
version = "0.12"
Expand Down
9 changes: 9 additions & 0 deletions examples/linalg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# rust-numpy example extension with linalg

An example extension with [ndarray-linalg](https://github.com/rust-ndarray/ndarray-linalg).

Needs a fortran compiler (e.g., `gfortran`) for building.

See [simple-extension's README](https://github.com/PyO3/rust-numpy/blob/master/examples/simple-extension/README.md)
for introduction.

Loading