Skip to content

bump MSRV to match PyO3 #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2025
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
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ jobs:
with:
python-version: "3.12"
- name: Install Rust
uses: dtolnay/rust-toolchain@1.63
uses: dtolnay/rust-toolchain@1.74
- uses: Swatinem/rust-cache@v2
with:
workspaces: examples/simple
Expand All @@ -273,8 +273,6 @@ jobs:
run: |
import toml
cargo_toml = toml.load("Cargo.toml")
cargo_toml["dependencies"]["ndarray"] = "0.15.6"
cargo_toml["dependencies"]["once_cell"] = "1.20.3"
with open("Cargo.toml", "w") as f:
toml.dump(cargo_toml, f)
working-directory: examples/simple
Expand All @@ -289,10 +287,6 @@ jobs:
cargo_lock = toml.load("Cargo.lock")
for pkg in cargo_lock["package"]:
pkg_id = pkg["name"] + ":" + pkg["version"]
if pkg["name"] == "ndarray" and pkg["version"] != "0.15.6":
subprocess.run(["cargo", "update", "--package", pkg_id, "--precise", "0.15.6"], check=True)
elif pkg["name"] == "once_cell" and pkg["version"] != "1.20.3":
subprocess.run(["cargo", "update", "--package", pkg_id, "--precise", "1.20.3"], check=True)
working-directory: examples/simple
shell: python
- name: Test example
Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Changelog
- v0.26.0
- bump MSRV to 1.74, matching PyO3 ([#504](https://github.com/PyO3/rust-numpy/pull/504))

- v0.25.0,
- Bump PyO3 dependency to v0.25.0. ([#492](https://github.com/PyO3/rust-numpy/pull/492))

- v0.24.0
- Bump PyO3 dependency to v0.24.0. ([#483](https://github.com/PyO3/rust-numpy/pull/483)
- Support Python 3.13t "free-threaded" Python. ([#471](https://github.com/PyO3/rust-numpy/pull/471)
- Bump PyO3 dependency to v0.24.0. ([#483](https://github.com/PyO3/rust-numpy/pull/483))
- Support Python 3.13t "free-threaded" Python. ([#471](https://github.com/PyO3/rust-numpy/pull/471))

- v0.23.0
- Drop support for PyPy 3.7 and 3.8. ([#470](https://github.com/PyO3/rust-numpy/pull/470))
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.63"
rust-version = "1.74"
repository = "https://github.com/PyO3/rust-numpy"
categories = ["api-bindings", "development-tools::ffi", "science"]
keywords = ["python", "numpy", "ffi", "pyo3"]
Expand Down
2 changes: 2 additions & 0 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> {
/// or concurrently modified by Python or other native code.
///
/// Please consider the safe alternative [`PyReadwriteArray::as_slice_mut`].
#[allow(clippy::mut_from_ref)]
unsafe fn as_slice_mut(&self) -> Result<&mut [T], NotContiguousError>
where
T: Element,
Expand Down Expand Up @@ -821,6 +822,7 @@ pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> {
/// assert_eq!(unsafe { *pyarray.get([1, 0, 3]).unwrap() }, 42);
/// });
/// ```
#[allow(clippy::mut_from_ref)]
unsafe fn get_mut(&self, index: impl NpyIndex<Dim = D>) -> Option<&mut T>
where
T: Element,
Expand Down
4 changes: 2 additions & 2 deletions src/borrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ mod tests {
let shared = array.readonly();

assert_eq!(
format!("{:?}", shared),
format!("{shared:?}"),
"PyReadonlyArray<f64, ndarray::dimension::dim::Dim<[usize; 3]>>"
);
}
Expand All @@ -683,7 +683,7 @@ mod tests {
let exclusive = array.readwrite();

assert_eq!(
format!("{:?}", exclusive),
format!("{exclusive:?}"),
"PyReadwriteArray<f64, ndarray::dimension::dim::Dim<[usize; 3]>>"
);
}
Expand Down
7 changes: 3 additions & 4 deletions src/borrow/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ fn insert_shared<'py>(py: Python<'py>) -> PyResult<*const Shared> {
let version = unsafe { *capsule.pointer().cast::<u64>() };
if version < 1 {
return Err(PyTypeError::new_err(format!(
"Version {} of borrow checking API is not supported by this version of rust-numpy",
version
"Version {version} of borrow checking API is not supported by this version of rust-numpy"
)));
}

Expand All @@ -175,7 +174,7 @@ pub fn acquire<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<(), Bo
match rc {
0 => Ok(()),
-1 => Err(BorrowError::AlreadyBorrowed),
rc => panic!("Unexpected return code {} from borrow checking API", rc),
rc => panic!("Unexpected return code {rc} from borrow checking API"),
}
}

Expand All @@ -188,7 +187,7 @@ pub fn acquire_mut<'py>(py: Python<'py>, array: *mut PyArrayObject) -> Result<()
0 => Ok(()),
-1 => Err(BorrowError::AlreadyBorrowed),
-2 => Err(BorrowError::NotWriteable),
rc => panic!("Unexpected return code {} from borrow checking API", rc),
rc => panic!("Unexpected return code {rc} from borrow checking API"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/dtype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ fn npy_int_type_lookup<T, T0, T1, T2>(npy_types: [NPY_TYPES; 3]) -> NPY_TYPES {
x if x == size_of::<T0>() => npy_types[0],
x if x == size_of::<T1>() => npy_types[1],
x if x == size_of::<T2>() => npy_types[2],
_ => panic!("Unable to match integer type descriptor: {:?}", npy_types),
_ => panic!("Unable to match integer type descriptor: {npy_types:?}"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/npyffi/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) fn mod_name(py: Python<'_>) -> PyResult<&'static str> {
MOD_NAME
.get_or_try_init(py, || {
let numpy_core = numpy_core_name(py)?;
Ok(format!("{}.multiarray", numpy_core))
Ok(format!("{numpy_core}.multiarray"))
})
.map(String::as_str)
}
Expand Down
2 changes: 1 addition & 1 deletion src/npyffi/ufunc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn mod_name(py: Python<'_>) -> PyResult<&'static str> {
MOD_NAME
.get_or_try_init(py, || {
let numpy_core = super::array::numpy_core_name(py)?;
Ok(format!("{}.umath", numpy_core))
Ok(format!("{numpy_core}.umath"))
})
.map(String::as_str)
}
Expand Down
Loading