GeezerVison is showing github.com — Update to PyO3 v0.23 (#262) · feos-org/feos@283fde2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/documentation.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | - name: Setup python | 16 | 16 | uses: actions/setup-python@v5 | 17 | 17 | with: | 18 | | - python-version: 3.9 | | 18 | + python-version: 3.11 | 19 | 19 | - name: Install pandoc | 20 | 20 | run: sudo apt-get install -y pandoc | 21 | 21 | - name: Install python dependencies | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/release.yml +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 | - uses: actions/checkout@v4 | 12 | 12 | - uses: actions/setup-python@v5 | 13 | 13 | with: | 14 | | - python-version: 3.9 | | 14 | + python-version: 3.11 | 15 | 15 | - name: Build Wheels | 16 | 16 | uses: PyO3/maturin-action@v1 | 17 | 17 | with: | @@ -25,12 +25,12 @@ jobs: | 25 | 25 | path: dist | 26 | 26 |
| 27 | 27 | macos-x86_64: | 28 | | - runs-on: macos-12 | | 28 | + runs-on: macos-14 | 29 | 29 | steps: | 30 | 30 | - uses: actions/checkout@v4 | 31 | 31 | - uses: actions/setup-python@v5 | 32 | 32 | with: | 33 | | - python-version: 3.9 | | 33 | + python-version: 3.11 | 34 | 34 | architecture: x64 | 35 | 35 | - name: Build wheels - x86_64 | 36 | 36 | uses: PyO3/maturin-action@v1 | | 48 | 48 | - uses: actions/checkout@v4 | 49 | 49 | - uses: actions/setup-python@v5 | 50 | 50 | with: | 51 | | - python-version: 3.9 | | 51 | + python-version: 3.11 | 52 | 52 | architecture: arm64 | 53 | 53 | - name: Build wheels - aarch64 | 54 | 54 | uses: PyO3/maturin-action@v1 | | 69 | 69 | - uses: actions/checkout@v4 | 70 | 70 | - uses: actions/setup-python@v5 | 71 | 71 | with: | 72 | | - python-version: 3.9 | | 72 | + python-version: 3.11 | 73 | 73 | architecture: ${{ matrix.target }} | 74 | 74 | - name: Build wheels | 75 | 75 | uses: PyO3/maturin-action@v1 | | 94 | 94 | merge-multiple: true | 95 | 95 | - uses: actions/setup-python@v5 | 96 | 96 | with: | 97 | | - python-version: 3.9 | | 97 | + python-version: 3.11 | 98 | 98 | - name: Publish to PyPi | 99 | 99 | env: | 100 | 100 | TWINE_USERNAME: __token__ | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/wheels.yml +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 | - uses: actions/checkout@v4 | 12 | 12 | - uses: actions/setup-python@v5 | 13 | 13 | with: | 14 | | - python-version: 3.9 | | 14 | + python-version: 3.11 | 15 | 15 | - name: Build Wheels | 16 | 16 | uses: PyO3/maturin-action@v1 | 17 | 17 | with: | @@ -24,12 +24,12 @@ jobs: | 24 | 24 | name: wheel-linux-x86_64 | 25 | 25 | path: dist | 26 | 26 | macos-x86_64: | 27 | | - runs-on: macos-12 | | 27 | + runs-on: macos-14 | 28 | 28 | steps: | 29 | 29 | - uses: actions/checkout@v4 | 30 | 30 | - uses: actions/setup-python@v5 | 31 | 31 | with: | 32 | | - python-version: 3.9 | | 32 | + python-version: 3.11 | 33 | 33 | architecture: x64 | 34 | 34 | - name: Build wheels - x86_64 | 35 | 35 | uses: PyO3/maturin-action@v1 | | 47 | 47 | - uses: actions/checkout@v4 | 48 | 48 | - uses: actions/setup-python@v5 | 49 | 49 | with: | 50 | | - python-version: 3.9 | | 50 | + python-version: 3.11 | 51 | 51 | architecture: arm64 | 52 | 52 | - name: Build wheels - aarch64 | 53 | 53 | uses: PyO3/maturin-action@v1 | | 65 | 65 | - uses: actions/checkout@v4 | 66 | 66 | - uses: actions/setup-python@v5 | 67 | 67 | with: | 68 | | - python-version: 3.9 | | 68 | + python-version: 3.11 | 69 | 69 | architecture: x64 | 70 | 70 | - name: Build wheels | 71 | 71 | uses: PyO3/maturin-action@v1 | |
Collapse file Copy file name to clipboardExpand all lines: Cargo.toml +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,15 +30,15 @@ members = ["feos-core", "feos-dft", "feos-derive"] | 30 | 30 | crate-type = ["rlib", "cdylib"] | 31 | 31 |
| 32 | 32 | [dependencies] | 33 | | -quantity = "0.9" | 34 | | -num-dual = "0.10" | | 33 | +quantity = "0.10" | | 34 | +num-dual = "0.11" | 35 | 35 | feos-core = { version = "0.7", path = "feos-core" } | 36 | 36 | feos-dft = { version = "0.7", path = "feos-dft", optional = true } | 37 | 37 | feos-derive = { version = "0.5", path = "feos-derive" } | 38 | | -numpy = { version = "0.22", optional = true } | | 38 | +numpy = { version = "0.23", optional = true } | 39 | 39 | ndarray = { version = "0.16", features = ["approx"] } | 40 | 40 | petgraph = { version = "0.6", optional = true } | 41 | | -thiserror = "1.0" | | 41 | +thiserror = "2.0" | 42 | 42 | conv = "0.3" | 43 | 43 | num-traits = "0.2" | 44 | 44 | serde = "1.0" | @@ -50,8 +50,8 @@ itertools = "0.13" | 50 | 50 | typenum = "1.16" | 51 | 51 |
| 52 | 52 | [dependencies.pyo3] | 53 | | -version = "0.22" | 54 | | -features = ["extension-module", "abi3", "abi3-py37"] | | 53 | +version = "0.23" | | 54 | +features = ["extension-module", "abi3", "abi3-py39"] | 55 | 55 | optional = true | 56 | 56 |
| 57 | 57 | [dev-dependencies] | |
Collapse file Copy file name to clipboardExpand all lines: feos-core/Cargo.toml +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,18 +26,18 @@ rustdoc-args = ["--html-in-header", "./docs-header.html"] | 26 | 26 | features = ["rayon"] | 27 | 27 |
| 28 | 28 | [dependencies] | 29 | | -quantity = { version = "0.9", features = ["approx", "ndarray"] } | 30 | | -num-dual = { version = "0.10", features = ["linalg"] } | | 29 | +quantity = { version = "0.10", features = ["approx", "ndarray"] } | | 30 | +num-dual = { version = "0.11", features = ["linalg"] } | 31 | 31 | ndarray = { version = "0.16", features = ["serde", "approx"] } | 32 | 32 | nalgebra = "0.33" | 33 | 33 | num-traits = "0.2" | 34 | | -thiserror = "1.0" | | 34 | +thiserror = "2.0" | 35 | 35 | serde = { version = "1.0", features = ["derive"] } | 36 | 36 | serde_json = "1.0" | 37 | 37 | indexmap = "2.0" | 38 | 38 | conv = "0.3" | 39 | | -numpy = { version = "0.22", optional = true } | 40 | | -pyo3 = { version = "0.22", features = ["multiple-pymethods"], optional = true } | | 39 | +numpy = { version = "0.23", optional = true } | | 40 | +pyo3 = { version = "0.23", features = ["multiple-pymethods"], optional = true } | 41 | 41 | rayon = { version = "1.5", optional = true } | 42 | 42 | typenum = "1.16" | 43 | 43 | approx = "0.5" | |
Collapse file Copy file name to clipboardExpand all lines: feos-core/src/python/parameter/fragmentation.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -113,7 +113,7 @@ fn fragment_molecule( | 113 | 113 | smiles: &str, | 114 | 114 | smarts: Vec<PySmartsRecord>, | 115 | 115 | ) -> PyResult<(Vec<String>, Vec<[usize; 2]>)> { | 116 | | - let chem = py.import_bound("rdkit.Chem")?; | | 116 | + let chem = py.import("rdkit.Chem")?; | 117 | 117 | let mol = chem.call_method1("MolFromSmiles", (smiles,))?; | 118 | 118 | let atoms = mol.call_method0("GetNumHeavyAtoms")?.extract::<usize>()?; | 119 | 119 |
| @@ -155,7 +155,7 @@ fn fragment_molecule( | 155 | 155 | .for_each(|(_, m)| m.retain(|m| !(m.len() == 1 && large_segments.contains(&m[0])))); | 156 | 156 |
| 157 | 157 | let bonds = mol.call_method0("GetBonds")?; | 158 | | - let builtins = py.import_bound("builtins")?; | | 158 | + let builtins = py.import("builtins")?; | 159 | 159 | let bonds = builtins | 160 | 160 | .call_method1("list", (bonds,))? | 161 | 161 | .extract::<Vec<Bound<'_, PyAny>>>()?; | |
Collapse file Copy file name to clipboardExpand all lines: feos-core/src/python/parameter/mod.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -272,7 +272,7 @@ macro_rules! impl_binary_record { | 272 | 272 | #[expect(irrefutable_let_patterns)] | 273 | 273 | fn get_model_record<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { | 274 | 274 | Ok(if let Ok(mr) = f64::try_from(self.0.model_record.clone()) { | 275 | | - pyo3::types::PyFloat::new_bound(py, mr).into_any() | | 275 | + pyo3::types::PyFloat::new(py, mr).into_any() | 276 | 276 | } else { | 277 | 277 | Bound::new(py, $py_model_record(self.0.model_record.clone()))?.into_any() | 278 | 278 | }) | @@ -744,7 +744,7 @@ macro_rules! impl_parameter { | 744 | 744 | self.0 | 745 | 745 | .records() | 746 | 746 | .1 | 747 | | - .map(|r| r.mapv(|r| f64::try_from(r).unwrap()).view().to_pyarray_bound(py)) | | 747 | + .map(|r| r.mapv(|r| f64::try_from(r).unwrap()).view().to_pyarray(py)) | 748 | 748 | } | 749 | 749 | } | 750 | 750 | }; | |
Collapse file Copy file name to clipboardExpand all lines: feos-core/src/python/state.rs +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -558,7 +558,7 @@ macro_rules! impl_state { | 558 | 558 | /// ------- | 559 | 559 | /// numpy.ndarray | 560 | 560 | fn ln_phi<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1<f64>> { | 561 | | - self.0.ln_phi().into_pyarray_bound(py) | | 561 | + self.0.ln_phi().into_pyarray(py) | 562 | 562 | } | 563 | 563 |
| 564 | 564 | /// Return logarithmic fugacity coefficient of all components treated as | @@ -568,7 +568,7 @@ macro_rules! impl_state { | 568 | 568 | /// ------- | 569 | 569 | /// numpy.ndarray | 570 | 570 | fn ln_phi_pure_liquid<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyArray1<f64>>> { | 571 | | - Ok(self.0.ln_phi_pure_liquid()?.into_pyarray_bound(py)) | | 571 | + Ok(self.0.ln_phi_pure_liquid()?.into_pyarray(py)) | 572 | 572 | } | 573 | 573 |
| 574 | 574 | /// Return logarithmic symmetric activity coefficient. | @@ -577,7 +577,7 @@ macro_rules! impl_state { | 577 | 577 | /// ------- | 578 | 578 | /// numpy.ndarray | 579 | 579 | fn ln_symmetric_activity_coefficient<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyArray1<f64>>> { | 580 | | - Ok(self.0.ln_symmetric_activity_coefficient()?.into_pyarray_bound(py)) | | 580 | + Ok(self.0.ln_symmetric_activity_coefficient()?.into_pyarray(py)) | 581 | 581 | } | 582 | 582 |
| 583 | 583 | /// Return Henry's law constant of every solute (x_i=0) for a given solvent (x_i>0). | @@ -650,7 +650,7 @@ macro_rules! impl_state { | 650 | 650 | /// ------- | 651 | 651 | /// numpy.ndarray | 652 | 652 | fn thermodynamic_factor<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray2<f64>> { | 653 | | - self.0.thermodynamic_factor().into_pyarray_bound(py) | | 653 | + self.0.thermodynamic_factor().into_pyarray(py) | 654 | 654 | } | 655 | 655 |
| 656 | 656 | /// Return molar isochoric heat capacity. | @@ -1021,7 +1021,7 @@ macro_rules! impl_state { | 1021 | 1021 | /// ------- | 1022 | 1022 | /// numpy.ndarray[Float64] | 1023 | 1023 | fn massfracs<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1<f64>> { | 1024 | | - self.0.massfracs().into_pyarray_bound(py) | | 1024 | + self.0.massfracs().into_pyarray(py) | 1025 | 1025 | } | 1026 | 1026 |
| 1027 | 1027 | /// Return mass specific Helmholtz energy. | @@ -1168,7 +1168,7 @@ macro_rules! impl_state { | 1168 | 1168 |
| 1169 | 1169 | #[getter] | 1170 | 1170 | fn get_molefracs<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1<f64>> { | 1171 | | - self.0.molefracs.to_pyarray_bound(py) | | 1171 | + self.0.molefracs.to_pyarray(py) | 1172 | 1172 | } | 1173 | 1173 |
| 1174 | 1174 | fn _repr_markdown_(&self) -> String { | @@ -1318,7 +1318,7 @@ macro_rules! impl_state { | 1318 | 1318 |
| 1319 | 1319 | #[getter] | 1320 | 1320 | fn get_compressibility<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray1<f64>> { | 1321 | | - StateVec::from(self).compressibility().into_pyarray_bound(py) | | 1321 | + StateVec::from(self).compressibility().into_pyarray(py) | 1322 | 1322 | } | 1323 | 1323 |
| 1324 | 1324 | #[getter] | @@ -1333,7 +1333,7 @@ macro_rules! impl_state { | 1333 | 1333 |
| 1334 | 1334 | #[getter] | 1335 | 1335 | fn get_molefracs<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray2<f64>> { | 1336 | | - StateVec::from(self).molefracs().into_pyarray_bound(py) | | 1336 | + StateVec::from(self).molefracs().into_pyarray(py) | 1337 | 1337 | } | 1338 | 1338 |
| 1339 | 1339 | #[getter] | @@ -1343,7 +1343,7 @@ macro_rules! impl_state { | 1343 | 1343 |
| 1344 | 1344 | #[getter] | 1345 | 1345 | fn get_massfracs<'py>(&self, py: Python<'py>) -> Option<Bound<'py, PyArray2<f64>>> { | 1346 | | - self.0[0].eos.residual.has_molar_weight().then(|| StateVec::from(self).massfracs().into_pyarray_bound(py)) | | 1346 | + self.0[0].eos.residual.has_molar_weight().then(|| StateVec::from(self).massfracs().into_pyarray(py)) | 1347 | 1347 | } | 1348 | 1348 |
| 1349 | 1349 | /// Returns selected properties of a StateVec as dictionary. | |
Collapse file Copy file name to clipboardExpand all lines: feos-core/src/python/user_defined.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -170,7 +170,7 @@ macro_rules! impl_residual { | 170 | 170 | let py_result = self | 171 | 171 | .0 | 172 | 172 | .bind(py) | 173 | | - .call_method1("max_density", (moles.to_owned().into_pyarray_bound(py),)) | | 173 | + .call_method1("max_density", (moles.to_owned().into_pyarray(py),)) | 174 | 174 | .unwrap(); | 175 | 175 | py_result.extract().unwrap() | 176 | 176 | }) | |
Collapse file Copy file name to clipboardExpand all lines: feos-core/src/state/builder.rs +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -70,7 +70,7 @@ pub struct StateBuilder<'a, E, const IG: bool> { | 70 | 70 | initial_temperature: Option<Temperature>, | 71 | 71 | } | 72 | 72 |
| 73 | | -impl<'a, E: Residual> StateBuilder<'a, E, false> { | | 73 | +impl<E: Residual> StateBuilder<'_, E, false> { | 74 | 74 | /// Create a new `StateBuilder` for the given equation of state. | 75 | 75 | pub fn new(eos: &Arc<E>) -> Self { | 76 | 76 | StateBuilder { | @@ -211,7 +211,7 @@ impl<'a, E: Residual + IdealGas, const IG: bool> StateBuilder<'a, E, IG> { | 211 | 211 | } | 212 | 212 | } | 213 | 213 |
| 214 | | -impl<'a, E: Residual> StateBuilder<'a, E, false> { | | 214 | +impl<E: Residual> StateBuilder<'_, E, false> { | 215 | 215 | /// Try to build the state with the given inputs. | 216 | 216 | pub fn build(self) -> EosResult<State<E>> { | 217 | 217 | State::new( | @@ -229,7 +229,7 @@ impl<'a, E: Residual> StateBuilder<'a, E, false> { | 229 | 229 | } | 230 | 230 | } | 231 | 231 |
| 232 | | -impl<'a, E: Residual + IdealGas> StateBuilder<'a, E, true> { | | 232 | +impl<E: Residual + IdealGas> StateBuilder<'_, E, true> { | 233 | 233 | /// Try to build the state with the given inputs. | 234 | 234 | pub fn build(self) -> EosResult<State<E>> { | 235 | 235 | State::new_full( | @@ -251,7 +251,7 @@ impl<'a, E: Residual + IdealGas> StateBuilder<'a, E, true> { | 251 | 251 | } | 252 | 252 | } | 253 | 253 |
| 254 | | -impl<'a, E, const IG: bool> Clone for StateBuilder<'a, E, IG> { | | 254 | +impl<E, const IG: bool> Clone for StateBuilder<'_, E, IG> { | 255 | 255 | fn clone(&self) -> Self { | 256 | 256 | Self { | 257 | 257 | eos: self.eos.clone(), | |
|