Skip to content

Commit

Permalink
Migrate to pyo3 0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
lan496 committed Apr 28, 2024
1 parent 82b4e3c commit 30efc8a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/spglib/moyo"

[workspace.dependencies]
nalgebra = { version = "0.32.5", features = ["serde-serialize"] }
nalgebra = { version = "0.32", features = ["serde-serialize"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
approx = "0.5.1"
approx = "0.5"
log = "0.4"

[workspace.metadata.release]
Expand Down
14 changes: 7 additions & 7 deletions moyo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ serde.workspace = true
serde_json.workspace = true
approx.workspace = true
log.workspace = true
itertools = "0.11.0"
itertools = "0.11"
thiserror = "1.0"
union-find = "0.4.2"
union-find = "0.4"
strum = "0.25"
strum_macros = "0.25"
kiddo = "4.2.0"
kiddo = "4.2"

[dev-dependencies]
rand = "0.8.5"
rstest = "0.18.2"
rand = "0.8"
rstest = "0.18"
criterion = { version = "0.4", features = ["html_reports"] }
env_logger = "0.11.3"
test-log = "0.2.15"
env_logger = "0.11"
test-log = "0.2"

[[bench]]
name = "translation_search"
Expand Down
4 changes: 2 additions & 2 deletions moyopy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ serde.workspace = true
serde_json.workspace = true
approx.workspace = true
log.workspace = true
pyo3-log = "0.9"
pyo3-log = "0.10"

[dependencies.pyo3]
version = "0.20"
pyo3 = "0.21"
# "abi3-py38" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.8
features = ["abi3-py38"]
2 changes: 1 addition & 1 deletion moyopy/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl PyStructure {
}

#[classmethod]
pub fn deserialize_json(_cls: &PyType, s: &str) -> PyResult<Self> {
pub fn deserialize_json(_cls: &Bound<'_, PyType>, s: &str) -> PyResult<Self> {
serde_json::from_str(s).map_err(|e| PyValueError::new_err(e.to_string()))
}
}
Expand Down
6 changes: 3 additions & 3 deletions moyopy/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ pub struct PySetting(Setting);
#[pymethods]
impl PySetting {
#[classmethod]
pub fn spglib(_cls: &PyType) -> PyResult<Self> {
pub fn spglib(_cls: &Bound<'_, PyType>) -> PyResult<Self> {
Ok(Self(Setting::Spglib))
}

#[classmethod]
pub fn standard(_cls: &PyType) -> PyResult<Self> {
pub fn standard(_cls: &Bound<'_, PyType>) -> PyResult<Self> {
Ok(Self(Setting::Standard))
}

#[classmethod]
pub fn hall_number(_cls: &PyType, hall_number: i32) -> PyResult<Self> {
pub fn hall_number(_cls: &Bound<'_, PyType>, hall_number: i32) -> PyResult<Self> {
Ok(Self(Setting::HallNumber(hall_number)))
}
}
Expand Down
2 changes: 1 addition & 1 deletion moyopy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fn moyopy_version() -> &'static str {
/// A Python module implemented in Rust.
#[pymodule]
#[pyo3(name = "_moyopy")]
fn moyopy(_py: Python, m: &PyModule) -> PyResult<()> {
fn moyopy(m: &Bound<'_, PyModule>) -> PyResult<()> {
pyo3_log::init();

m.add("__version__", moyopy_version())?;
Expand Down

0 comments on commit 30efc8a

Please sign in to comment.