mqt.core.qdmi.driver¶
Register, discover, and open QDMI devices through MQT Core.
Module Contents¶
- class DeviceDefinition(device_id: str, library_path: str | PathLike, prefix: str, *, base_url: str | None = None, token: str | None = None, auth_file: str | PathLike | None = None, auth_url: str | None = None, username: str | None = None, password: str | None = None, device_config: str | None = None, device_config_file: str | PathLike | None = None, custom1: str | None = None, custom2: str | None = None, custom3: str | None = None, custom4: str | None = None, custom5: str | None = None)¶
A stable QDMI device registration that can be stored before loading.
- register_device(definition: DeviceDefinition, *, replace: bool = False) None¶
Register a QDMI device definition without loading its library.
- Parameters:
definition – Definition to validate and store.
replace – Replace an existing definition if it has not been opened.
- Raises:
ValueError – If the definition is invalid or its ID is already registered.
RuntimeError – If replacing an already opened ID.
- register_device_if_absent(definition: DeviceDefinition) bool¶
Register a valid QDMI device definition if its ID is absent.
Existing and explicitly disabled IDs are not inserted. Invalid definitions still raise.
- Parameters:
definition – Definition to validate and store.
- Returns:
Whether the definition was inserted.
- Return type:
- Raises:
ValueError – If the definition is invalid.
- registered_device_ids() list[str]¶
Return registered, enabled QDMI device IDs in registration order.
This includes devices registered at runtime and does not load native device libraries or expose their definitions.
- open_device(device_id: str, *, base_url: str | None = None, token: str | None = None, auth_file: str | PathLike | None = None, auth_url: str | None = None, username: str | None = None, password: str | None = None, device_config: str | None = None, device_config_file: str | PathLike | None = None, custom1: str | None = None, custom2: str | None = None, custom3: str | None = None, custom4: str | None = None, custom5: str | None = None) Device¶
Open a registered QDMI device by stable ID.
Every call creates a fresh device session while keeping the stable registration unchanged. Opening the device loads trusted native device code.
- Parameters:
device_id – Stable ID of a registered device.
base_url – Optional base URL override for the device API endpoint.
token – Optional authentication token override.
auth_file – Optional authentication-file override.
auth_url – Optional authentication server URL override.
username – Optional authentication username override.
password – Optional authentication password override.
device_config – Optional inline JSON device-description override.
device_config_file – Optional device-description JSON file override.
custom1 – Optional custom configuration parameter 1 override.
custom2 – Optional custom configuration parameter 2 override.
custom3 – Optional custom configuration parameter 3 override.
custom4 – Optional custom configuration parameter 4 override.
custom5 – Optional custom configuration parameter 5 override.
- Returns:
The opened device, ready for direct backend construction.
- Return type:
- Raises:
IndexError – If the ID is not registered.
RuntimeError – If the device library cannot be loaded or initialized.