quapp-common 0.0.12.dev10__tar.gz → 0.0.12.dev11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {quapp_common-0.0.12.dev10/quapp_common.egg-info → quapp_common-0.0.12.dev11}/PKG-INFO +13 -1
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/README.md +12 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/pyproject.toml +1 -1
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/bridge.py +25 -11
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/circuit_adapter.py +22 -6
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11/quapp_common.egg-info}/PKG-INFO +13 -1
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/LICENSE +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/async_invocation_task.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/async_task.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/export_circuit_task.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/post_processing_task.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/invocation.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/job_fetcher.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/job_fetching.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/job_manager.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/callback/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/callback/update_job_metadata.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/device/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/device/device_selection.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/dispatcher.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/result_serializer.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/config/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/config/logging_config.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/config/thread_config.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/async_task/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/async_task/circuit_export/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/async_task/circuit_export/backend_holder.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/async_task/circuit_export/circuit_holder.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/backend/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/backend/backend_information.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/callback/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/callback/callback_url.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/device/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/device/circuit_running_option.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/promise/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/promise/post_processing_promise.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/promise/promise.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/request/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/request/invocation_request.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/request/job_fetching_request.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/request/request.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/authentication.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/custom_header.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/job_response.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/base_enum.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/http_header.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/invocation_step.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/language.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/media_type.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/processing_unit.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/provider_tag.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/sdk.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/status/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/status/job_status.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/status/status_code.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/token_type.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/device_factory.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/handler_factory.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/provider_factory.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/handler/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/handler/handler.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/device/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/device/custom_device.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/device/device.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/invocation.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/provider/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/provider/provider.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/util/__init__.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/util/file_utils.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/util/http_utils.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/util/json_parser_utils.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/util/response_utils.py +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common.egg-info/SOURCES.txt +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common.egg-info/dependency_links.txt +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common.egg-info/requires.txt +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common.egg-info/top_level.txt +0 -0
- {quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quapp-common
|
|
3
|
-
Version: 0.0.12.
|
|
3
|
+
Version: 0.0.12.dev11
|
|
4
4
|
Summary: Quapp common library supporting Quapp Platform for Quantum Computing
|
|
5
5
|
Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -103,6 +103,18 @@ Notes:
|
|
|
103
103
|
|
|
104
104
|
## Recently Changes Highlights
|
|
105
105
|
|
|
106
|
+
### v0.0.12.dev11
|
|
107
|
+
- Enhance: `CircuitAdapter` now emits structured debug logs at each routing
|
|
108
|
+
decision — SDK selected, QASM string length, qubit count, per-SDK adapter
|
|
109
|
+
chosen, `tk_to_braket` return type (tuple vs bare Circuit), DenseMatrix
|
|
110
|
+
fallback for unrecognized/parametric gates in `_qiskit_to_qulacs`, and QUBO
|
|
111
|
+
entry counts before and after parsing.
|
|
112
|
+
- Enhance: `SubprocessBridge` now emits debug logs on initialisation
|
|
113
|
+
(`language`, `sdk`), `processing()` (input keys, JS status, adapted circuit
|
|
114
|
+
type), and `post_processing()` (job-result type, serialised keys, JS status,
|
|
115
|
+
result type); subprocess failures are additionally promoted to `logger.error`
|
|
116
|
+
before the `RuntimeError` is raised.
|
|
117
|
+
|
|
106
118
|
### v0.0.12.dev10
|
|
107
119
|
- Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.BRAKET` now handles the
|
|
108
120
|
breaking API change in `pytket-braket >= 0.35`, where `tk_to_braket` returns
|
|
@@ -64,6 +64,18 @@ Notes:
|
|
|
64
64
|
|
|
65
65
|
## Recently Changes Highlights
|
|
66
66
|
|
|
67
|
+
### v0.0.12.dev11
|
|
68
|
+
- Enhance: `CircuitAdapter` now emits structured debug logs at each routing
|
|
69
|
+
decision — SDK selected, QASM string length, qubit count, per-SDK adapter
|
|
70
|
+
chosen, `tk_to_braket` return type (tuple vs bare Circuit), DenseMatrix
|
|
71
|
+
fallback for unrecognized/parametric gates in `_qiskit_to_qulacs`, and QUBO
|
|
72
|
+
entry counts before and after parsing.
|
|
73
|
+
- Enhance: `SubprocessBridge` now emits debug logs on initialisation
|
|
74
|
+
(`language`, `sdk`), `processing()` (input keys, JS status, adapted circuit
|
|
75
|
+
type), and `post_processing()` (job-result type, serialised keys, JS status,
|
|
76
|
+
result type); subprocess failures are additionally promoted to `logger.error`
|
|
77
|
+
before the `RuntimeError` is raised.
|
|
78
|
+
|
|
67
79
|
### v0.0.12.dev10
|
|
68
80
|
- Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.BRAKET` now handles the
|
|
69
81
|
breaking API change in `pytket-braket >= 0.35`, where `tk_to_braket` returns
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quapp-common"
|
|
7
|
-
version = "0.0.12.
|
|
7
|
+
version = "0.0.12.dev11"
|
|
8
8
|
description = "Quapp common library supporting Quapp Platform for Quantum Computing"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "CITYNOW Co. Ltd. ", email = "corp@citynow.vn" }]
|
|
@@ -30,6 +30,7 @@ class SubprocessBridge:
|
|
|
30
30
|
def __init__(self, language: Language, sdk: Sdk):
|
|
31
31
|
self.language = language
|
|
32
32
|
self.sdk = sdk
|
|
33
|
+
logger.debug(f"SubprocessBridge initialized | language={language.value} | sdk={sdk}")
|
|
33
34
|
|
|
34
35
|
def processing(self, invocation_input: dict):
|
|
35
36
|
"""Call JS handler's processing() and convert a result to a native circuit.
|
|
@@ -43,24 +44,31 @@ class SubprocessBridge:
|
|
|
43
44
|
Raises:
|
|
44
45
|
RuntimeError: If the JS subprocess returns an error status.
|
|
45
46
|
"""
|
|
46
|
-
logger.info(
|
|
47
|
-
|
|
47
|
+
logger.info(f"SubprocessBridge.processing: dispatching to {self.language.value} | sdk={self.sdk}")
|
|
48
|
+
logger.debug(f"SubprocessBridge.processing: input_keys={list(invocation_input.keys())}")
|
|
48
49
|
|
|
49
50
|
result = SubprocessDispatcher.dispatch(self.language, {
|
|
50
51
|
"action": "processing",
|
|
51
52
|
"input" : invocation_input
|
|
52
53
|
})
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
status = result.get("status")
|
|
56
|
+
logger.debug(f"SubprocessBridge.processing: JS status={status}")
|
|
57
|
+
|
|
58
|
+
if status == "error":
|
|
59
|
+
logger.error(f"SubprocessBridge.processing: JS error={result.get('error')}")
|
|
55
60
|
raise RuntimeError(f"JS processing failed: {result.get('error')}")
|
|
56
61
|
|
|
57
62
|
payload = result.get("result")
|
|
58
63
|
if payload is None:
|
|
59
64
|
raise RuntimeError("JS processing returned no 'result' field")
|
|
60
|
-
logger.debug(
|
|
61
|
-
f"SubprocessBridge.processing: JS returned format={payload.get('format')}")
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
fmt = payload.get("format")
|
|
67
|
+
logger.debug(f"SubprocessBridge.processing: JS returned format={fmt}; adapting for sdk={self.sdk}")
|
|
68
|
+
|
|
69
|
+
circuit = CircuitAdapter.adapt(self.sdk, payload)
|
|
70
|
+
logger.info(f"SubprocessBridge.processing: circuit adapted successfully | type={type(circuit).__name__}")
|
|
71
|
+
return circuit
|
|
64
72
|
|
|
65
73
|
def post_processing(self, job_result):
|
|
66
74
|
"""Serialize a job result, send to JS handler's postProcessing(), return a result.
|
|
@@ -74,21 +82,27 @@ class SubprocessBridge:
|
|
|
74
82
|
Raises:
|
|
75
83
|
RuntimeError: If the JS subprocess returns an error status.
|
|
76
84
|
"""
|
|
77
|
-
logger.info(
|
|
78
|
-
|
|
85
|
+
logger.info(f"SubprocessBridge.post_processing: dispatching to {self.language.value}")
|
|
86
|
+
logger.debug(f"SubprocessBridge.post_processing: job_result type={type(job_result).__name__}")
|
|
79
87
|
|
|
80
88
|
serialized = ResultSerializer.serialize(job_result)
|
|
89
|
+
logger.debug(f"SubprocessBridge.post_processing: serialized result keys={list(serialized.keys()) if isinstance(serialized, dict) else type(serialized).__name__}")
|
|
81
90
|
|
|
82
91
|
result = SubprocessDispatcher.dispatch(self.language, {
|
|
83
92
|
"action" : "post_processing",
|
|
84
93
|
"job_result": serialized
|
|
85
94
|
})
|
|
86
95
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
status = result.get("status")
|
|
97
|
+
logger.debug(f"SubprocessBridge.post_processing: JS status={status}")
|
|
98
|
+
|
|
99
|
+
if status == "error":
|
|
100
|
+
logger.error(f"SubprocessBridge.post_processing: JS error={result.get('error')}")
|
|
101
|
+
raise RuntimeError(f"JS post_processing failed: {result.get('error')}")
|
|
90
102
|
|
|
91
103
|
payload = result.get("result")
|
|
92
104
|
if payload is None:
|
|
93
105
|
raise RuntimeError("JS post_processing returned no 'result' field")
|
|
106
|
+
|
|
107
|
+
logger.info(f"SubprocessBridge.post_processing: completed successfully | result type={type(payload).__name__}")
|
|
94
108
|
return payload
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/circuit_adapter.py
RENAMED
|
@@ -24,6 +24,7 @@ class CircuitAdapter:
|
|
|
24
24
|
def adapt(sdk: Sdk, result: dict):
|
|
25
25
|
"""Route to the appropriate adapter based on the 'format' field."""
|
|
26
26
|
fmt = result.get("format")
|
|
27
|
+
logger.debug(f"adapt() called | sdk={sdk} | format={fmt}")
|
|
27
28
|
if fmt == "openqasm":
|
|
28
29
|
circuit = result.get("circuit")
|
|
29
30
|
if circuit is None:
|
|
@@ -35,27 +36,33 @@ class CircuitAdapter:
|
|
|
35
36
|
raise ValueError("Missing 'qubo' field in qubo response")
|
|
36
37
|
return CircuitAdapter._adapt_qubo(sdk, qubo)
|
|
37
38
|
elif fmt == "json":
|
|
39
|
+
logger.debug("Returning raw JSON data pass-through")
|
|
38
40
|
return result.get("data")
|
|
39
41
|
raise ValueError(f"Unsupported circuit interchange format: {fmt}")
|
|
40
42
|
|
|
41
43
|
@staticmethod
|
|
42
44
|
def _adapt_openqasm(sdk, qasm_str):
|
|
43
45
|
"""Convert an OpenQASM 2.0 string to a native SDK circuit object."""
|
|
44
|
-
logger.debug(f"Adapting OpenQASM circuit for SDK: {sdk}")
|
|
46
|
+
logger.debug(f"Adapting OpenQASM circuit for SDK: {sdk} | qasm_length={len(qasm_str)}")
|
|
45
47
|
|
|
46
48
|
if sdk == Sdk.QISKIT:
|
|
49
|
+
logger.debug("Converting OpenQASM via Qiskit QuantumCircuit.from_qasm_str")
|
|
47
50
|
from qiskit import QuantumCircuit
|
|
48
51
|
return QuantumCircuit.from_qasm_str(qasm_str)
|
|
49
52
|
|
|
50
53
|
elif sdk == Sdk.BRAKET:
|
|
54
|
+
logger.debug("Converting OpenQASM via pytket -> tk_to_braket")
|
|
51
55
|
import importlib
|
|
52
56
|
from pytket.qasm import circuit_from_qasm_str
|
|
53
57
|
tk_to_braket = importlib.import_module("pytket.extensions.braket").tk_to_braket
|
|
54
58
|
result = tk_to_braket(circuit_from_qasm_str(qasm_str))
|
|
55
59
|
# tk_to_braket returns (Circuit, n_shots) in pytket-braket >= 0.35
|
|
56
|
-
|
|
60
|
+
is_tuple = isinstance(result, tuple)
|
|
61
|
+
logger.debug(f"tk_to_braket returned tuple={is_tuple}; unpacking index 0" if is_tuple else "tk_to_braket returned Circuit directly")
|
|
62
|
+
return result[0] if is_tuple else result
|
|
57
63
|
|
|
58
64
|
elif sdk == Sdk.PENNYLANE:
|
|
65
|
+
logger.debug("Converting OpenQASM via PennyLane qml.from_qasm wrapper")
|
|
59
66
|
import pennylane as qml
|
|
60
67
|
# PennyLane >=0.37 treats QASM `measure` statements as mid-circuit
|
|
61
68
|
# measurements returning MeasurementValue, which fails QNode
|
|
@@ -74,6 +81,7 @@ class CircuitAdapter:
|
|
|
74
81
|
# fresh `qml.probs` over all qubits, so the wires are visible in
|
|
75
82
|
# both `QuantumTape` capture and full QNode execution.
|
|
76
83
|
num_wires = CircuitAdapter._count_qasm_qubits(qasm_str)
|
|
84
|
+
logger.debug(f"PennyLane: detected {num_wires} qubits; wrapping with qml.probs over all wires")
|
|
77
85
|
base_fn = qml.from_qasm(qasm_str, measurements=[])
|
|
78
86
|
|
|
79
87
|
def _circuit():
|
|
@@ -85,28 +93,32 @@ class CircuitAdapter:
|
|
|
85
93
|
return _circuit
|
|
86
94
|
|
|
87
95
|
elif sdk == Sdk.PYQUIL:
|
|
96
|
+
logger.debug("Converting OpenQASM via pytket -> tk_to_pyquil")
|
|
88
97
|
import importlib
|
|
89
98
|
from pytket.qasm import circuit_from_qasm_str
|
|
90
99
|
tk_to_pyquil = importlib.import_module("pytket.extensions.pyquil").tk_to_pyquil
|
|
91
100
|
return tk_to_pyquil(circuit_from_qasm_str(qasm_str))
|
|
92
101
|
|
|
93
102
|
elif sdk == Sdk.QIBO:
|
|
103
|
+
logger.debug("Converting OpenQASM via Qibo Circuit.from_qasm")
|
|
94
104
|
from qibo.models import Circuit
|
|
95
105
|
return Circuit.from_qasm(qasm_str)
|
|
96
106
|
|
|
97
107
|
elif sdk == Sdk.QULACS:
|
|
108
|
+
logger.debug("Converting OpenQASM for Qulacs via Qiskit bridge")
|
|
98
109
|
# Try the Qiskit bridge first; fall back to raw pass-through if
|
|
99
110
|
# qiskit is not installed or the conversion fails.
|
|
100
111
|
try:
|
|
101
112
|
from qiskit import QuantumCircuit as QiskitCircuit
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
113
|
+
qiskit_circ = QiskitCircuit.from_qasm_str(qasm_str)
|
|
114
|
+
logger.debug(f"Qiskit parsed circuit: num_qubits={qiskit_circ.num_qubits} num_gates={len(qiskit_circ.data)}")
|
|
115
|
+
return CircuitAdapter._qiskit_to_qulacs(qiskit_circ)
|
|
105
116
|
except Exception as e:
|
|
106
117
|
logger.warning(f"Qiskit bridge failed for Qulacs ({e}); falling back to raw OpenQASM pass-through")
|
|
107
118
|
return qasm_str
|
|
108
119
|
|
|
109
120
|
elif sdk == Sdk.CUDA_QUANTUM:
|
|
121
|
+
logger.debug("CUDA-Q: passing OpenQASM string through directly")
|
|
110
122
|
# CUDA-Q accepts OpenQASM directly via kernel builder
|
|
111
123
|
return qasm_str
|
|
112
124
|
|
|
@@ -125,7 +137,7 @@ class CircuitAdapter:
|
|
|
125
137
|
JS returns keys like "x0,x1" as strings. We parse them into tuple keys
|
|
126
138
|
for dimod's from_qubo() method.
|
|
127
139
|
"""
|
|
128
|
-
logger.debug(f"Adapting QUBO for SDK: {sdk}")
|
|
140
|
+
logger.debug(f"Adapting QUBO for SDK: {sdk} | num_entries={len(qubo_raw)}")
|
|
129
141
|
|
|
130
142
|
qubo_dict = {}
|
|
131
143
|
for key, val in qubo_raw.items():
|
|
@@ -135,6 +147,7 @@ class CircuitAdapter:
|
|
|
135
147
|
else:
|
|
136
148
|
qubo_dict[(key, key)] = val
|
|
137
149
|
|
|
150
|
+
logger.debug(f"QUBO parsed: {len(qubo_dict)} entries -> BinaryQuadraticModel")
|
|
138
151
|
from dimod import BinaryQuadraticModel
|
|
139
152
|
return BinaryQuadraticModel.from_qubo(qubo_dict)
|
|
140
153
|
|
|
@@ -150,6 +163,7 @@ class CircuitAdapter:
|
|
|
150
163
|
from qulacs.gate import DenseMatrix
|
|
151
164
|
|
|
152
165
|
n = qiskit_circ.num_qubits
|
|
166
|
+
logger.debug(f"_qiskit_to_qulacs: num_qubits={n} num_instructions={len(qiskit_circ.data)}")
|
|
153
167
|
qulacs_circ = QulacsCirucit(n)
|
|
154
168
|
qubit_map = {bit: idx for idx, bit in enumerate(qiskit_circ.qubits)}
|
|
155
169
|
|
|
@@ -183,6 +197,8 @@ class CircuitAdapter:
|
|
|
183
197
|
# as a DenseMatrix. Single-qubit gates have no ordering
|
|
184
198
|
# ambiguity; multi-qubit gates are passed with qulacs'
|
|
185
199
|
# index order matching Qiskit's instruction qubit order.
|
|
200
|
+
logger.debug(f"Gate '{name}' not in named map; converting via DenseMatrix on qubits={qubits}")
|
|
186
201
|
qulacs_circ.add_gate(DenseMatrix(qubits, gate.to_matrix()))
|
|
187
202
|
|
|
203
|
+
logger.debug(f"_qiskit_to_qulacs: conversion complete")
|
|
188
204
|
return qulacs_circ
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quapp-common
|
|
3
|
-
Version: 0.0.12.
|
|
3
|
+
Version: 0.0.12.dev11
|
|
4
4
|
Summary: Quapp common library supporting Quapp Platform for Quantum Computing
|
|
5
5
|
Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
|
|
6
6
|
License: The MIT License (MIT)
|
|
@@ -103,6 +103,18 @@ Notes:
|
|
|
103
103
|
|
|
104
104
|
## Recently Changes Highlights
|
|
105
105
|
|
|
106
|
+
### v0.0.12.dev11
|
|
107
|
+
- Enhance: `CircuitAdapter` now emits structured debug logs at each routing
|
|
108
|
+
decision — SDK selected, QASM string length, qubit count, per-SDK adapter
|
|
109
|
+
chosen, `tk_to_braket` return type (tuple vs bare Circuit), DenseMatrix
|
|
110
|
+
fallback for unrecognized/parametric gates in `_qiskit_to_qulacs`, and QUBO
|
|
111
|
+
entry counts before and after parsing.
|
|
112
|
+
- Enhance: `SubprocessBridge` now emits debug logs on initialisation
|
|
113
|
+
(`language`, `sdk`), `processing()` (input keys, JS status, adapted circuit
|
|
114
|
+
type), and `post_processing()` (job-result type, serialised keys, JS status,
|
|
115
|
+
result type); subprocess failures are additionally promoted to `logger.error`
|
|
116
|
+
before the `RuntimeError` is raised.
|
|
117
|
+
|
|
106
118
|
### v0.0.12.dev10
|
|
107
119
|
- Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.BRAKET` now handles the
|
|
108
120
|
breaking API change in `pytket-braket >= 0.35`, where `tk_to_braket` returns
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/async_tasks/async_task.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/__init__.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/backend/invocation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/callback/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/device/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/dispatcher.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/component/result_serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/config/logging_config.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/config/thread_config.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/async_task/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/backend/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/callback/__init__.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/callback/callback_url.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/device/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/promise/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/promise/promise.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/request/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/request/request.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/__init__.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/authentication.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/custom_header.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/data/response/job_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/invocation_step.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/processing_unit.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/status/__init__.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/status/job_status.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/enum/status/status_code.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/device_factory.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/handler_factory.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/factory/provider_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/device/__init__.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/device/custom_device.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/provider/__init__.py
RENAMED
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/model/provider/provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common/util/json_parser_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quapp_common-0.0.12.dev10 → quapp_common-0.0.12.dev11}/quapp_common.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|