Skip to content

Commit

Permalink
bump MSRV to 1.63
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Oct 4, 2024
1 parent f397117 commit 8e0dc6d
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 46 deletions.
102 changes: 61 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ concurrency:
cancel-in-progress: true

jobs:

lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -32,20 +31,48 @@ jobs:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
platform: [
{ os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" },
{ os: "macOS-13", python-architecture: "x64", rust-target: "x86_64-apple-darwin" },
{ os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc" },
]
platform:
[
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
},
{
os: "macOS-13",
python-architecture: "x64",
rust-target: "x86_64-apple-darwin",
},
{
os: "windows-latest",
python-architecture: "x64",
rust-target: "x86_64-pc-windows-msvc",
},
]
include:
# Older versions of CPython are not available for AArch64.
- python-version: 3.12
platform: { os: "macOS-latest", python-architecture: "arm64", rust-target: "aarch64-apple-darwin" }
platform:
{
os: "macOS-latest",
python-architecture: "arm64",
rust-target: "aarch64-apple-darwin",
}
# NumPy does not provide pre-built wheels for PyPy on macOS and Windows
- python-version: pypy-3.7
platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
platform:
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
}
- python-version: pypy-3.8
platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
platform:
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -57,20 +84,10 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.rust-target }}
- name: Install toml
run: pip install toml
- name: Edit Cargo.toml and enable new resolver
run: |
import toml
cargo_toml = toml.load("Cargo.toml")
cargo_toml["package"]["resolver"] = "2"
with open("Cargo.toml", "w") as f:
toml.dump(cargo_toml, f)
shell: python
- name: Test
run: |
pip install "numpy" ml_dtypes
cargo test --all-features
pip install "numpy" ml_dtypes
cargo test --all-features
# Not on PyPy, because no embedding API
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
- name: Test example
Expand All @@ -90,11 +107,24 @@ jobs:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
platform: [
{ os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" },
{ os: "macOS-13", python-architecture: "x64", rust-target: "x86_64-apple-darwin" },
{ os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc" },
]
platform:
[
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
},
{
os: "macOS-13",
python-architecture: "x64",
rust-target: "x86_64-apple-darwin",
},
{
os: "windows-latest",
python-architecture: "x64",
rust-target: "x86_64-pc-windows-msvc",
},
]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -106,16 +136,6 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.rust-target }}
- name: Install toml
run: pip install toml
- name: Edit Cargo.toml and enable new resolver
run: |
import toml
cargo_toml = toml.load("Cargo.toml")
cargo_toml["package"]["resolver"] = "2"
with open("Cargo.toml", "w") as f:
toml.dump(cargo_toml, f)
shell: python
- name: Test
run: |
pip install "numpy<2" ml_dtypes
Expand Down Expand Up @@ -149,8 +169,8 @@ jobs:
continue-on-error: true
- uses: taiki-e/install-action@valgrind
- run: |
pip install "numpy" ml_dtypes
cargo test --all-features --release
pip install "numpy" ml_dtypes
cargo test --all-features --release
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: valgrind --leak-check=no --error-exitcode=1
Expand All @@ -164,8 +184,8 @@ jobs:
continue-on-error: true
- uses: taiki-e/install-action@cargo-careful
- run: |
pip install "numpy" ml_dtypes
cargo careful test --all-features
pip install "numpy" ml_dtypes
cargo careful test --all-features
check-msrv:
runs-on: ubuntu-latest
Expand All @@ -176,7 +196,7 @@ jobs:
with:
python-version: 3.8
- name: Install Rust
uses: dtolnay/rust-toolchain@1.56.0
uses: dtolnay/rust-toolchain@1.63
- uses: Swatinem/rust-cache@v2
with:
workspaces: examples/simple
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

- Unreleased
- Bump MSRV to 1.63. ([#450](https://github.com/PyO3/rust-numpy/pull/450))
- Add `permute` and `transpose` methods for changing the order of axes of a `PyArray`. ([#428](https://github.com/PyO3/rust-numpy/pull/428))
- Add support for NumPy v2 which had a number of changes to the [C API](https://numpy.org/devdocs/numpy_2_0_migration_guide.html#c-api-changes). ([#442](https://github.com/PyO3/rust-numpy/pull/442))

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = [
description = "PyO3-based Rust bindings of the NumPy C-API"
documentation = "https://docs.rs/numpy"
edition = "2021"
rust-version = "1.56"
rust-version = "1.63"
repository = "https://github.com/PyO3/rust-numpy"
categories = ["api-bindings", "development-tools::ffi", "science"]
keywords = ["python", "numpy", "ffi", "pyo3"]
Expand Down
5 changes: 1 addition & 4 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,7 @@ impl<T, D> IntoPy<PyObject> for PyArray<T, D> {

impl<'py, T: Element, D: Dimension> FromPyObject<'py> for &'py PyArray<T, D> {
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
#[allow(clippy::map_clone)] // due to MSRV
PyArray::extract(ob)
.map(Clone::clone)
.map(Bound::into_gil_ref)
PyArray::extract(ob).cloned().map(Bound::into_gil_ref)
}
}

Expand Down

0 comments on commit 8e0dc6d

Please sign in to comment.