Skip to content

Commit

Permalink
Update to Pyo3 0.21 (#556)
Browse files Browse the repository at this point in the history
* wip

* almost there

* save before mass replace

* save before mass replace

* it compiles

* Update qoqo to pyo3 0.21

* format test like the others

* version, dependencies and changelog

* toml patch

* git patch

* clippy

* compatibility test patch

* remove useless binds

* from_bound_pyany

* cargo clippy

* use bound

* toml

* unstable features fix

* cargo clippy

* remove patches

* remove useless lines

* remove empty line

* PR review

* pr review

* rm unused import

* cargo update

* compatibility
  • Loading branch information
dberthault authored May 15, 2024
1 parent ecfe6ac commit 75641f5
Show file tree
Hide file tree
Showing 84 changed files with 6,486 additions and 6,188 deletions.
17 changes: 10 additions & 7 deletions .compatibility_tests/compatibility_test_1_0/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "compatibility_test_1_0"
version ="1.11.0"
version = "1.12.0"
authors = ["HQS Quantum Simulations <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -19,12 +19,15 @@ publish = false
[workspace]

[dependencies]
test_roqoqo_1_0 = {package = "roqoqo", version="=1.0.0"}
test_roqoqo_derive_1_0 = {package = "roqoqo-derive", version="=1.0.0"}
qoqo_calculator = { version="1.1" }
roqoqo = {version="1.11.0", path="../../roqoqo", features=["serialize", "overrotate"]}
bincode = {version="1.3"}
test_roqoqo_1_0 = { package = "roqoqo", version = "=1.0.0" }
test_roqoqo_derive_1_0 = { package = "roqoqo-derive", version = "=1.0.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.12.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
bincode = { version = "1.3" }
ndarray = "0.15"

[dev-dependencies]
test-case = "3.0"
test-case = "3.0"
15 changes: 9 additions & 6 deletions .compatibility_tests/compatibility_test_1_10/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "compatibility_test_1_10"
version ="1.11.0"
version = "1.12.0"
authors = ["HQS Quantum Simulations <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -19,11 +19,14 @@ publish = false
[workspace]

[dependencies]
test_roqoqo_1_10 = {package = "roqoqo", version="=1.10.0"}
test_roqoqo_derive_1_10 = {package = "roqoqo-derive", version="=1.10.0"}
qoqo_calculator = { version="1.1" }
roqoqo = {version="1.11.0", path="../../roqoqo", features=["serialize", "overrotate"]}
bincode = {version="1.3"}
test_roqoqo_1_10 = { package = "roqoqo", version = "=1.10.0" }
test_roqoqo_derive_1_10 = { package = "roqoqo-derive", version = "=1.10.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.12.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
bincode = { version = "1.3" }
ndarray = "0.15"

[dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ use test_roqoqo_1_10;
#[test_case(test_roqoqo_1_10::operations::EchoCrossResonance::new(0, 1).into(); "EchoCrossResonance")]
#[test_case(test_roqoqo_1_10::operations::PragmaAnnotatedOp::new(test_roqoqo_1_10::operations::PauliX::new(0).into(), "test".to_string()).into(); "PragmaAnnotatedOp")]
// Operations from 1.9 - nothing was added
// Operations from 1.10
// Operations from 1.10
// QuantumRabi, LongitudinalCoupling, JaynesCummings, SingleExcitationLoad, SingleExcitationStore and CZQubitResonator were all added
// as unstable, but have been added as stable in 1.11
// Operations from 1.11 - uncomment for next unittests
// ApplyConstantSpinHamiltonian and ApplyTimeDependentHamiltonian are unstable in 1.11
// #[test_case(test_roqoqo_1_10::operations::QuantumRabi::new(0, 1, 0.1.into()).into(); "QuantumRabi")]
// #[test_case(test_roqoqo_1_10::operations::LongitudinalCoupling::new(0, 1, 0.1.into()).into(); "LongitudinalCoupling")]
// #[test_case(test_roqoqo_1_10::operations::JaynesCummings::new(0, 1, 0.1.into()).into(); "JaynesCummings")]
Expand Down Expand Up @@ -165,28 +166,3 @@ fn test_device_compat() {
);
assert_eq!(test_deserialisation, comparsion_device);
}

// Operations from 1.11
// use struqture;
// use struqture::prelude::*;
// fn create_apply_constant_spin_hamiltonian() -> test_roqoqo_1_10::operations::ApplyConstantSpinHamiltonian
// {
// let pp = struqture::spins::PauliProduct::new().z(0);
// let mut hamiltonian = struqture::spins::SpinHamiltonian::new();
// hamiltonian
// .add_operator_product(pp.clone(), 1.0.into())
// .unwrap();
// return test_roqoqo_1_10::operations::ApplyConstantSpinHamiltonian::new(hamiltonian, 1.0.into());
// }

// fn create_apply_timedependent_spin_hamiltonian() -> test_roqoqo_1_10::operations::ApplyTimeDependentSpinHamiltonian
// {
// let pp = struqture::spins::PauliProduct::new().z(0);
// let mut hamiltonian = struqture::spins::SpinHamiltonian::new();
// hamiltonian
// .add_operator_product(pp.clone(), "omega".into())
// .unwrap();
// let mut values = HashMap::new();
// values.insert("omega".to_string(), vec![1.0]);
// return test_roqoqo_1_10::operations::ApplyTimeDependentSpinHamiltonian::new(hamiltonian, vec![1.0], values.clone());
// }
34 changes: 34 additions & 0 deletions .compatibility_tests/compatibility_test_1_11/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "compatibility_test_1_11"
version = "1.12.0"
authors = ["HQS Quantum Simulations <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
rust-version = "1.56"
categories = ["science", "simulation"]
homepage = "https://github.com/HQSquantumsimulations/qoqo"
repository = "https://github.com/HQSquantumsimulations/qoqo"
documentation = "https://docs.rs/roqoqo/"
readme = "../README.md"
description = "Compatibility tests for roqoqo"
include = ["src*", "build.rs", "LICENSE", "README.md"]
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]

[dependencies]
test_roqoqo_1_11 = { package = "roqoqo", version = "=1.11.0" }
test_roqoqo_derive_1_11 = { package = "roqoqo-derive", version = "=1.11.0" }
qoqo_calculator = { version = "1.2" }
roqoqo = { version = "1.12.0", path = "../../roqoqo", features = [
"serialize",
"overrotate",
] }
struqture = { version = "1.7" }
bincode = { version = "1.3" }
ndarray = "0.15"

[dev-dependencies]
test-case = "3.0"
14 changes: 14 additions & 0 deletions .compatibility_tests/compatibility_test_1_11/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
Loading

0 comments on commit 75641f5

Please sign in to comment.