qoqo_qiskit_devices/lib.rs
1// Copyright © 2023-2025 HQS Quantum Simulations GmbH. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4// in compliance with the License. You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software distributed under the
9// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
10// express or implied. See the License for the specific language governing permissions and
11// limitations under the License.
12
13//! # qoqo_qiskit_devices
14//!
15//! Qiskit devices' interface for qoqo.
16//!
17//! Collection of IBM's qiskit devices interfaces implementing qoqo's Device trait.
18
19use pyo3::prelude::*;
20use pyo3::types::PyDict;
21use pyo3::wrap_pymodule;
22
23pub mod devices;
24pub use devices::*;
25
26/// IBM python interface
27///
28/// Provides the devices that are used to execute quantum program on the IBM backend.
29#[pymodule]
30fn qoqo_qiskit_devices(_py: Python, module: &Bound<PyModule>) -> PyResult<()> {
31 let wrapper = wrap_pymodule!(devices::ibm_devices);
32 module.add_wrapped(wrapper)?;
33
34 let system = PyModule::import(_py, "sys")?;
35 let binding = system.getattr("modules")?;
36 let system_modules: &Bound<PyDict> = binding.downcast()?;
37 system_modules.set_item(
38 "qoqo_qiskit_devices.devices",
39 module.getattr("ibm_devices")?,
40 )?;
41 Ok(())
42}