From 1223306174101864ef88cb7822558742fdbaebe9 Mon Sep 17 00:00:00 2001 From: Seyon Sivarajah Date: Fri, 29 Nov 2024 14:58:11 +0000 Subject: [PATCH] feat: update to pyo3 23 (allow free-threaded python) (#102) --- Cargo.lock | 56 ++++++++++++++++++++-------------------- Cargo.toml | 4 +-- src/pytket.rs | 2 +- tests/missing_optypes.rs | 4 +-- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dee413c..2b2bcdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,9 +169,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -206,15 +206,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "memchr" @@ -251,9 +251,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "proc-macro-crate" @@ -266,18 +266,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.22.5" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d922163ba1f79c04bc49073ba7b32fd5a8d3b76a87c955921234b8e77333c51" +checksum = "f54b3d09cbdd1f8c20650b28e7b09e338881482f4aa908a5f61a00c98fba2690" dependencies = [ "cfg-if", "indoc", @@ -293,9 +293,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.5" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc38c5feeb496c8321091edf3d63e9a6829eab4b863b4a6a65f26f3e9cc6b179" +checksum = "3015cf985888fe66cfb63ce0e321c603706cd541b7aec7ddd35c281390af45d8" dependencies = [ "once_cell", "target-lexicon", @@ -303,9 +303,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.5" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94845622d88ae274d2729fcefc850e63d7a3ddff5e3ce11bd88486db9f1d357d" +checksum = "6fca7cd8fd809b5ac4eefb89c1f98f7a7651d3739dfb341ca6980090f554c270" dependencies = [ "libc", "pyo3-build-config", @@ -313,9 +313,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.5" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e655aad15e09b94ffdb3ce3d217acf652e26bbc37697ef012f5e5e348c716e5e" +checksum = "34e657fa5379a79151b6ff5328d9216a84f55dc93b17b08e7c3609a969b73aa0" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -325,9 +325,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.5" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1e3f09eecd94618f60a455a23def79f79eba4dc561a97324bf9ac8c6df30ce" +checksum = "295548d5ffd95fd1981d2d3cf4458831b21d60af046b729b6fd143b0ba7aee2f" dependencies = [ "heck", "proc-macro2", @@ -338,9 +338,9 @@ dependencies = [ [[package]] name = "pythonize" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcf491425978bd889015d5430f6473d91bdfa2097262f1e731aadcf6c2113e" +checksum = "91a6ee7a084f913f98d70cdc3ebec07e852b735ae3059a1500db2661265da9ff" dependencies = [ "pyo3", "serde", @@ -369,9 +369,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -512,9 +512,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -562,9 +562,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-xid" diff --git a/Cargo.toml b/Cargo.toml index 3bdd3ce..a5720ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,8 +41,8 @@ path = "tests/lib.rs" [workspace.dependencies] derive_more = "1.0.0" itertools = "0.13.0" -pyo3 = "0.22.2" -pythonize = "0.22.0" +pyo3 = "0.23.2" +pythonize = "0.23.0" rstest = "0.23.0" serde = "1.0" serde_json = "1.0" diff --git a/src/pytket.rs b/src/pytket.rs index 02a1640..38d58ed 100644 --- a/src/pytket.rs +++ b/src/pytket.rs @@ -21,7 +21,7 @@ impl SerialCircuit { /// Convert a `SerialCircuit` to a `pytket.Circuit`. pub fn to_tket1<'py>(&self, py: Python<'py>) -> PyResult> { let dict = pythonize(py, self).unwrap(); - let circ_module = PyModule::import_bound(py, "pytket.circuit")?; + let circ_module = PyModule::import(py, "pytket.circuit")?; circ_module .getattr("Circuit")? diff --git a/tests/missing_optypes.rs b/tests/missing_optypes.rs index 01dfa24..475aab1 100644 --- a/tests/missing_optypes.rs +++ b/tests/missing_optypes.rs @@ -39,7 +39,7 @@ fn missing_optypes() -> PyResult<()> { pyo3::prepare_freethreaded_python(); Python::with_gil(|py| { - let Ok(pytket) = PyModule::import_bound(py, "pytket") else { + let Ok(pytket) = PyModule::import(py, "pytket") else { panic!("Failed to import `pytket`. Make sure the python library is installed."); }; let py_enum = pytket.getattr("OpType")?; @@ -67,7 +67,7 @@ fn missing_classical_optypes() -> PyResult<()> { pyo3::prepare_freethreaded_python(); Python::with_gil(|py| { - let Ok(pytket) = PyModule::import_bound(py, "pytket") else { + let Ok(pytket) = PyModule::import(py, "pytket") else { panic!("Failed to import `pytket`. Make sure the python library is installed."); }; let py_enum = pytket.getattr("circuit")?.getattr("ClOp")?;