Migrating to v0.25.0: QRMI QuantumResources can now be created from a configuration map#
Up through v0.24.x, every QuantumResource implementation could only be
constructed one way: by reading a fixed set of process environment variables
with the new() constructor.
This release adds a second, purely additive construction path: building a
resource directly from an explicit, in-memory config map instead of the
environment variables. Every existing constructor in the bindings (new() /
qrmi_resource_new() / QuantumResource(resource_id, resource_type) /
qrmi.new()) is completely unaffected, no existing code needs to change.
What’s new#
Language |
What’s new |
|---|---|
Rust |
|
C |
New function
|
Python |
New static method
|
Lua |
New function |
Keys by resource type#
Each resource type’s from_config accepts the same keys as its new()’s
environment variables, minus only the eventual {backend_name}_ prefix.
Every key also accepts its fully-lowercased form as a fallback
(e.g. qrmi_ibm_qs_endpoint works alongside QRMI_IBM_QS_ENDPOINT).
See each type’s new()/from_config() rustdoc for the authoritative,
per-resource key list: qrmi::ibm::IBMQuantumSystem,
qrmi::ibm::IBMQiskitRuntimeService, qrmi::ibm::IBMQuantumComputeService,
qrmi::pasqal::PasqalCloud, qrmi::pasqal::PasqalLocal,
qrmi::alice_bob::AliceBobFelis, qrmi::iqm::IQMServer.
How to migrate#
No migration is required for existing code. This release only adds a new way to construct a resource, it doesn’t change or deprecate the old one. To start using it:
Rust — Call
T::from_config(resource_id, config)instead ofT::new(resource_id):use qrmi::ibm::IBMQuantumComputeService; use std::collections::HashMap; let config = HashMap::from([ ("QRMI_IBM_QCS_ENDPOINT".to_string(), "...".to_string()), ("QRMI_IBM_QCS_IAM_ENDPOINT".to_string(), "...".to_string()), ("QRMI_IBM_QCS_IAM_APIKEY".to_string(), "...".to_string()), ("QRMI_IBM_QCS_SERVICE_CRN".to_string(), "...".to_string()), ]); let qrmi = IBMQuantumComputeService::from_config("ibm_kingston", config)?;
C — Call the new
qrmi_resource_new_from_config()instead ofqrmi_resource_new(), building aQrmiConfigMapthe same way you’d build any otherQrmiEnvironmentVariables-shaped value:QrmiKeyValue variables[] = { {(char *)"QRMI_WARDEN_URL", (char *)"http://localhost:8006"}, {(char *)"QRMI_JOB_ID", (char *)"1"}, {(char *)"QRMI_JOB_UID", (char *)"1000"}, }; QrmiConfigMap config = { .variables = variables, .length = 3 }; QrmiQuantumResource *qrmi = qrmi_resource_new_from_config( "PASQAL_LOCAL", QRMI_RESOURCE_TYPE_PASQAL_LOCAL, &config);
As with
qrmi_resource_new(), the returned handle must be released withqrmi_resource_free()once it’s no longer needed.Python — Call the new
QuantumResource.from_config()static method instead of theQuantumResource(resource_id, resource_type)constructor:from qrmi import QuantumResource, ResourceType qrmi = QuantumResource.from_config( "ibm_kingston", ResourceType.IBMQuantumComputeService, { "QRMI_IBM_QCS_ENDPOINT": "...", "QRMI_IBM_QCS_IAM_ENDPOINT": "...", "QRMI_IBM_QCS_IAM_APIKEY": "...", "QRMI_IBM_QCS_SERVICE_CRN": "...", }, )
Lua — Call the new
qrmi.new_from_config()instead ofqrmi.new(), passing a plain Lua table (string keys/values).local resource, err = qrmi.new_from_config("ibm_kingston", "ibm-quantum-compute-service", { QRMI_IBM_QCS_ENDPOINT = "...", QRMI_IBM_QCS_IAM_ENDPOINT = "...", QRMI_IBM_QCS_IAM_APIKEY = "...", QRMI_IBM_QCS_SERVICE_CRN = "...", })