diff --git a/Cargo.lock b/Cargo.lock index 7a61cdff..7e5a2258 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -733,9 +733,9 @@ dependencies = [ [[package]] name = "numpy" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb929bc0da91a4d85ed6c0a84deaa53d411abfb387fc271124f91bf6b89f14e" +checksum = "b94caae805f998a07d33af06e6a3891e38556051b8045c615470a71590e13e78" dependencies = [ "libc", "ndarray", @@ -828,9 +828,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.22.6" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884" +checksum = "e484fd2c8b4cb67ab05a318f1fd6fa8f199fcc30819f08f07d200809dba26c15" dependencies = [ "cfg-if", "indoc", @@ -846,9 +846,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.6" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38" +checksum = "dc0e0469a84f208e20044b98965e1561028180219e35352a2afaf2b942beff3b" dependencies = [ "once_cell", "target-lexicon", @@ -856,9 +856,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.6" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636" +checksum = "eb1547a7f9966f6f1a0f0227564a9945fe36b90da5a93b3933fc3dc03fae372d" dependencies = [ "libc", "pyo3-build-config", @@ -866,9 +866,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.6" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453" +checksum = "fdb6da8ec6fa5cedd1626c886fc8749bdcbb09424a86461eb8cdf096b7c33257" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -878,9 +878,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.6" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe" +checksum = "38a385202ff5a92791168b1136afae5059d3ac118457bb7bc304c197c2d33e7d" dependencies = [ "heck", "proc-macro2", @@ -1032,9 +1032,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" diff --git a/Cargo.toml b/Cargo.toml index cb433dc7..3fb994c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,9 +33,9 @@ nom = "7.1.3" num = "0.4.1" num-derive = "0.4.2" num-traits = "0.2.19" -numpy = "0.22.1" +numpy = "0.23.0" proptest = "1.4.0" -pyo3 = "0.22.6" +pyo3 = "0.23.3" quick-xml = { version = "0.31.0", features = ["serde", "serialize"] } regex = "1.10.4" rstest = "0.23.0" diff --git a/crates/lox-orbits/src/python.rs b/crates/lox-orbits/src/python.rs index c3949083..8549cb19 100644 --- a/crates/lox-orbits/src/python.rs +++ b/crates/lox-orbits/src/python.rs @@ -14,7 +14,7 @@ use pyo3::{ exceptions::PyValueError, pyclass, pyfunction, pymethods, types::{PyAnyMethods, PyList}, - Bound, PyAny, PyErr, PyResult, Python, ToPyObject, + Bound, IntoPyObjectExt, PyAny, PyErr, PyResult, Python, }; use python::PyOrigin; use sgp4::Elements; @@ -70,7 +70,7 @@ pub fn find_events( Ok(crate::events::find_events( |t| { func.call((t,), None) - .unwrap_or(f64::NAN.to_object(py).into_bound(py)) + .unwrap_or(f64::NAN.into_bound_py_any(py).unwrap()) .extract() .unwrap_or(f64::NAN) }, @@ -95,7 +95,7 @@ pub fn find_windows( Ok(crate::events::find_windows( |t| { func.call((t,), None) - .unwrap_or(f64::NAN.to_object(py).into_bound(py)) + .unwrap_or(f64::NAN.into_bound_py_any(py).unwrap()) .extract() .unwrap_or(f64::NAN) }, @@ -187,12 +187,12 @@ impl PyState { fn position<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1> { let pos = self.0.position().to_array(); - PyArray1::from_slice_bound(py, &pos) + PyArray1::from_slice(py, &pos) } fn velocity<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1> { let vel = self.0.velocity().to_array(); - PyArray1::from_slice_bound(py, &vel) + PyArray1::from_slice(py, &vel) } #[pyo3(signature = (frame, provider=None))] @@ -205,7 +205,7 @@ impl PyState { Some(provider) => { self.0 .reference_frame() - .try_rotation(&frame.0, self.0.time(), &provider.borrow().0) + .try_rotation(&frame.0, self.0.time(), provider.get()) } None => self.0.reference_frame().try_rotation( &frame.0, @@ -258,7 +258,7 @@ impl PyState { } let rot = self.0.try_rotation_lvlh().map_err(PyValueError::new_err)?; let rot: Vec> = rot.to_cols_array_2d().iter().map(|v| v.to_vec()).collect(); - Ok(PyArray2::from_vec2_bound(py, &rot)?) + Ok(PyArray2::from_vec2(py, &rot)?) } fn to_ground_location(&self) -> PyResult { @@ -407,7 +407,7 @@ impl PyTrajectory { } fn to_numpy<'py>(&self, py: Python<'py>) -> PyResult>> { - Ok(PyArray2::from_vec2_bound(py, &self.0.to_vec())?) + Ok(PyArray2::from_vec2(py, &self.0.to_vec())?) } fn states(&self) -> Vec { @@ -420,7 +420,7 @@ impl PyTrajectory { .find_events(|s| { func.call((PyState(s),), None) // FIXME: Bad idea - .unwrap_or(f64::NAN.to_object(py).into_bound(py)) + .unwrap_or(f64::NAN.into_bound_py_any(py).unwrap()) .extract() .unwrap_or(f64::NAN) }) @@ -435,7 +435,7 @@ impl PyTrajectory { .find_windows(|s| { func.call((PyState(s),), None) // FIXME: Bad idea - .unwrap_or(f64::NAN.to_object(py).into_bound(py)) + .unwrap_or(f64::NAN.into_bound_py_any(py).unwrap()) .extract() .unwrap_or(f64::NAN) }) @@ -605,7 +605,7 @@ impl PyGroundLocation { fn rotation_to_topocentric<'py>(&self, py: Python<'py>) -> PyResult>> { let rot = self.0.rotation_to_topocentric(); let rot: Vec> = rot.to_cols_array_2d().iter().map(|v| v.to_vec()).collect(); - Ok(PyArray2::from_vec2_bound(py, &rot)?) + Ok(PyArray2::from_vec2(py, &rot)?) } fn longitude(&self) -> f64 { @@ -643,22 +643,10 @@ impl PyGroundPropagator { steps: &Bound<'py, PyAny>, ) -> PyResult> { if let Ok(time) = steps.extract::() { - return Ok(Bound::new( - py, - PyState(self.0.propagate_dyn(time).map_err(PyValueError::new_err)?), - )? - .into_any()); + return Ok(Bound::new(py, PyState(self.0.propagate_dyn(time)?))?.into_any()); } if let Ok(steps) = steps.extract::>() { - return Ok(Bound::new( - py, - PyTrajectory( - self.0 - .propagate_all_dyn(steps) - .map_err(PyValueError::new_err)?, - ), - )? - .into_any()); + return Ok(Bound::new(py, PyTrajectory(self.0.propagate_all_dyn(steps)?))?.into_any()); } Err(PyValueError::new_err("invalid time delta(s)")) } diff --git a/crates/lox-orbits/src/states.rs b/crates/lox-orbits/src/states.rs index ea9ac519..78f23302 100644 --- a/crates/lox-orbits/src/states.rs +++ b/crates/lox-orbits/src/states.rs @@ -22,8 +22,8 @@ use thiserror::Error; use crate::anomalies::{eccentric_to_true, hyperbolic_to_true}; use crate::elements::{is_circular, is_equatorial, DynKeplerian, Keplerian, KeplerianElements}; use crate::frames::{ - BodyFixed, CoordinateSystem, DynFrame, FrameTransformationProvider, Icrf, - NoOpFrameTransformationProvider, ReferenceFrame, TryRotateTo, TryToFrame, + BodyFixed, CoordinateSystem, DynFrame, FrameTransformationProvider, Icrf, ReferenceFrame, + TryToFrame, }; use crate::ground::{DynGroundLocation, GroundLocation}; diff --git a/crates/lox-space/pyproject.toml b/crates/lox-space/pyproject.toml index d0691e38..867d5811 100644 --- a/crates/lox-space/pyproject.toml +++ b/crates/lox-space/pyproject.toml @@ -7,7 +7,7 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [ - "numpy < 2" + "numpy >= 1.16.0" ] dynamic = ["version"] diff --git a/crates/lox-time/src/python/deltas.rs b/crates/lox-time/src/python/deltas.rs index 3ffe3cd8..bf0f4cbe 100644 --- a/crates/lox-time/src/python/deltas.rs +++ b/crates/lox-time/src/python/deltas.rs @@ -147,7 +147,7 @@ mod tests { #[test] fn test_pytimedelta_constructors() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let td = PyTimeDelta::from_seconds(&cls, 123); assert_eq!(td.to_decimal_seconds(), 123.0); let td = PyTimeDelta::from_minutes(&cls, 2.0).unwrap(); diff --git a/crates/lox-time/src/python/time.rs b/crates/lox-time/src/python/time.rs index 164ca5b8..d40c725e 100644 --- a/crates/lox-time/src/python/time.rs +++ b/crates/lox-time/src/python/time.rs @@ -586,7 +586,7 @@ mod tests { fn test_pytime_ops_invalid_rhs() { Python::with_gil(|py| { let t1 = PyTime::new("TAI", 2000, 1, 1, 0, 0, 1.0).unwrap(); - let invalid = PyDict::new_bound(py); + let invalid = PyDict::new(py); t1.__sub__(py, &invalid).unwrap(); }); } @@ -626,7 +626,7 @@ mod tests { #[test] fn test_pytime_from_iso() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let expected = PyTime::new("TAI", 2000, 1, 1, 0, 0, 0.0).unwrap(); let actual = PyTime::from_iso(&cls, "2000-01-01T00:00:00 TAI", None).unwrap(); assert_eq!(actual, expected); @@ -641,7 +641,7 @@ mod tests { #[should_panic(expected = "invalid ISO")] fn test_pytime_from_iso_invalid() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let _ = PyTime::from_iso(&cls, "2000-01-01X00:00:00 TAI", None).unwrap(); }) } @@ -650,7 +650,7 @@ mod tests { #[should_panic(expected = "invalid time scale")] fn test_pytime_from_iso_invalid_scale() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let _ = PyTime::from_iso(&cls, "2000-01-01T00:00:00 UTC", None).unwrap(); }) } @@ -659,7 +659,7 @@ mod tests { #[should_panic(expected = "invalid time scale")] fn test_pytime_from_iso_invalid_scale_arg() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let _ = PyTime::from_iso(&cls, "2000-01-01T00:00:00 TAI", Some("UTC")).unwrap(); }) } @@ -667,7 +667,7 @@ mod tests { #[test] fn test_pytime_julian_date() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let time = PyTime::from_julian_date(&cls, "TAI", 0.0, "j2000").unwrap(); assert_eq!(time.julian_date("j2000", "seconds").unwrap(), 0.0); assert_eq!(time.julian_date("j2000", "days").unwrap(), 0.0); @@ -701,7 +701,7 @@ mod tests { #[test] fn test_pytime_from_two_part_julian_date() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let expected = PyTime::new("TAI", 2024, 7, 11, 8, 2, 14.0).unwrap(); let (jd1, jd2) = expected.two_part_julian_date(); let actual = PyTime::from_two_part_julian_date(&cls, "TAI", jd1, jd2).unwrap(); @@ -712,7 +712,7 @@ mod tests { #[test] fn test_pytime_from_day_of_year() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let expected = PyTime::new("TAI", 2024, 12, 31, 0, 0, 0.0).unwrap(); let actual = PyTime::from_day_of_year(&cls, "TAI", 2024, 366, 0, 0, 0.0).unwrap(); assert_eq!(actual, expected); diff --git a/crates/lox-time/src/python/utc.rs b/crates/lox-time/src/python/utc.rs index 2a59615c..f1873f12 100644 --- a/crates/lox-time/src/python/utc.rs +++ b/crates/lox-time/src/python/utc.rs @@ -180,7 +180,7 @@ mod tests { #[test] fn test_pytime_from_iso() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let expected = PyUtc::new(2000, 1, 1, 0, 0, 0.0).unwrap(); let actual = PyUtc::from_iso(&cls, "2000-01-01T00:00:00 UTC").unwrap(); assert_eq!(actual, expected); @@ -195,7 +195,7 @@ mod tests { #[should_panic(expected = "invalid ISO")] fn test_pytime_from_iso_invalid() { Python::with_gil(|py| { - let cls = PyType::new_bound::(py); + let cls = PyType::new::(py); let _ = PyUtc::from_iso(&cls, "2000-01-01X00:00:00 UTC").unwrap(); }) }