From 2a83a39e55c416d29d01b389ba4271d078980c47 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 29 Aug 2022 15:55:56 +0200 Subject: [PATCH] Upgrade to PyO3 0.17 --- instant-distance-py/Cargo.toml | 2 +- instant-distance-py/src/lib.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/instant-distance-py/Cargo.toml b/instant-distance-py/Cargo.toml index 9d53266..4638777 100644 --- a/instant-distance-py/Cargo.toml +++ b/instant-distance-py/Cargo.toml @@ -17,7 +17,7 @@ crate-type = ["cdylib"] [dependencies] bincode = "1.3.1" instant-distance = { version = "0.6", path = "../instant-distance", features = ["with-serde"] } -pyo3 = { version = "0.16", features = ["extension-module"] } +pyo3 = { version = "0.17.1", features = ["extension-module"] } serde = { version = "1", features = ["derive"] } serde-big-array = "0.4.1" diff --git a/instant-distance-py/src/lib.rs b/instant-distance-py/src/lib.rs index b00a8b8..a41907f 100644 --- a/instant-distance-py/src/lib.rs +++ b/instant-distance-py/src/lib.rs @@ -9,14 +9,15 @@ use std::iter::FromIterator; use instant_distance::Point; use pyo3::conversion::IntoPy; use pyo3::exceptions::{PyTypeError, PyValueError}; -use pyo3::proc_macro::{pyclass, pymethods, pymodule}; use pyo3::types::{PyList, PyModule, PyString}; +use pyo3::{pyclass, pymethods, pymodule}; use pyo3::{Py, PyAny, PyErr, PyObject, PyRef, PyRefMut, PyResult, Python}; use serde::{Deserialize, Serialize}; use serde_big_array::BigArray; #[pymodule] -fn instant_distance(_: Python, m: &PyModule) -> PyResult<()> { +#[pyo3(name = "instant_distance")] +fn instant_distance_py(_: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?;