quapp-common 0.0.12.dev7__tar.gz → 0.0.12.dev9__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.
Files changed (86) hide show
  1. {quapp_common-0.0.12.dev7/quapp_common.egg-info → quapp_common-0.0.12.dev9}/PKG-INFO +23 -1
  2. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/README.md +20 -0
  3. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/pyproject.toml +4 -2
  4. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/circuit_adapter.py +61 -0
  5. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9/quapp_common.egg-info}/PKG-INFO +23 -1
  6. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common.egg-info/requires.txt +2 -0
  7. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/LICENSE +0 -0
  8. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/__init__.py +0 -0
  9. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/async_tasks/__init__.py +0 -0
  10. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/async_tasks/async_invocation_task.py +0 -0
  11. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/async_tasks/async_task.py +0 -0
  12. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/async_tasks/export_circuit_task.py +0 -0
  13. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/async_tasks/post_processing_task.py +0 -0
  14. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/__init__.py +0 -0
  15. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/backend/__init__.py +0 -0
  16. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/backend/invocation.py +0 -0
  17. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/backend/job_fetcher.py +0 -0
  18. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/backend/job_fetching.py +0 -0
  19. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/backend/job_manager.py +0 -0
  20. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/bridge.py +0 -0
  21. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/callback/__init__.py +0 -0
  22. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/callback/update_job_metadata.py +0 -0
  23. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/device/__init__.py +0 -0
  24. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/device/device_selection.py +0 -0
  25. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/dispatcher.py +0 -0
  26. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/component/result_serializer.py +0 -0
  27. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/config/__init__.py +0 -0
  28. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/config/logging_config.py +0 -0
  29. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/config/thread_config.py +0 -0
  30. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/__init__.py +0 -0
  31. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/async_task/__init__.py +0 -0
  32. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/async_task/circuit_export/__init__.py +0 -0
  33. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/async_task/circuit_export/backend_holder.py +0 -0
  34. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/async_task/circuit_export/circuit_holder.py +0 -0
  35. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/backend/__init__.py +0 -0
  36. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/backend/backend_information.py +0 -0
  37. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/callback/__init__.py +0 -0
  38. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/callback/callback_url.py +0 -0
  39. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/device/__init__.py +0 -0
  40. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/device/circuit_running_option.py +0 -0
  41. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/promise/__init__.py +0 -0
  42. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/promise/post_processing_promise.py +0 -0
  43. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/promise/promise.py +0 -0
  44. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/request/__init__.py +0 -0
  45. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/request/invocation_request.py +0 -0
  46. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/request/job_fetching_request.py +0 -0
  47. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/request/request.py +0 -0
  48. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/response/__init__.py +0 -0
  49. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/response/authentication.py +0 -0
  50. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/response/custom_header.py +0 -0
  51. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/data/response/job_response.py +0 -0
  52. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/__init__.py +0 -0
  53. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/base_enum.py +0 -0
  54. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/http_header.py +0 -0
  55. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/invocation_step.py +0 -0
  56. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/language.py +0 -0
  57. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/media_type.py +0 -0
  58. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/processing_unit.py +0 -0
  59. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/provider_tag.py +0 -0
  60. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/sdk.py +0 -0
  61. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/status/__init__.py +0 -0
  62. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/status/job_status.py +0 -0
  63. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/status/status_code.py +0 -0
  64. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/enum/token_type.py +0 -0
  65. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/factory/__init__.py +0 -0
  66. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/factory/device_factory.py +0 -0
  67. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/factory/handler_factory.py +0 -0
  68. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/factory/provider_factory.py +0 -0
  69. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/handler/__init__.py +0 -0
  70. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/handler/handler.py +0 -0
  71. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/__init__.py +0 -0
  72. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/device/__init__.py +0 -0
  73. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/device/custom_device.py +0 -0
  74. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/device/device.py +0 -0
  75. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/invocation.py +0 -0
  76. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/provider/__init__.py +0 -0
  77. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/model/provider/provider.py +0 -0
  78. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/util/__init__.py +0 -0
  79. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/util/file_utils.py +0 -0
  80. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/util/http_utils.py +0 -0
  81. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/util/json_parser_utils.py +0 -0
  82. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common/util/response_utils.py +0 -0
  83. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common.egg-info/SOURCES.txt +0 -0
  84. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common.egg-info/dependency_links.txt +0 -0
  85. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/quapp_common.egg-info/top_level.txt +0 -0
  86. {quapp_common-0.0.12.dev7 → quapp_common-0.0.12.dev9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quapp-common
3
- Version: 0.0.12.dev7
3
+ Version: 0.0.12.dev9
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)
@@ -27,6 +27,8 @@ Requires-Dist: pylatexenc
27
27
  Requires-Dist: starlette
28
28
  Requires-Dist: qibo
29
29
  Requires-Dist: dimod
30
+ Requires-Dist: qulacs
31
+ Requires-Dist: qiskit
30
32
  Provides-Extra: dev
31
33
  Requires-Dist: black; extra == "dev"
32
34
  Requires-Dist: bumpver; extra == "dev"
@@ -101,6 +103,26 @@ Notes:
101
103
 
102
104
  ## Recently Changes Highlights
103
105
 
106
+ ### v0.0.12.dev9
107
+ - Fix: `QulacsInvocation._get_qubit_amount` now handles OpenQASM string input —
108
+ when a JS job submits an OpenQASM 2.0 string circuit, the method parses the
109
+ `qreg` declaration to extract the qubit count instead of raising
110
+ `"Invalid circuit type!"`.
111
+
112
+ ### v0.0.12.dev8
113
+ - Add `Sdk.QULACS` support in `CircuitAdapter._adapt_openqasm` with a
114
+ two-stage fallback strategy:
115
+ 1. **Qiskit bridge** (preferred): parse OpenQASM with
116
+ `QiskitCircuit.from_qasm_str`, then convert gate-by-gate to a
117
+ `qulacs.QuantumCircuit` via the new `CircuitAdapter._qiskit_to_qulacs`
118
+ helper. Fixed gates (H, X, Y, Z, S, Sdg, T, Tdg, CX, CZ, SWAP) use
119
+ named qulacs methods; parametric and unrecognized gates fall back to
120
+ `qulacs.gate.DenseMatrix` with `gate.to_matrix()`.
121
+ 2. **Raw pass-through** (fallback): if qiskit is not installed or
122
+ conversion raises any exception, the raw OpenQASM string is returned
123
+ as-is (same approach as `Sdk.CUDA_QUANTUM`) and a warning is logged.
124
+ - Add `qulacs` as a direct dependency in `pyproject.toml`.
125
+
104
126
  ### v0.0.12.dev7
105
127
  - Fix: remove `Sdk.CU_QUANTUM` from the CUDA-Q branch in `CircuitAdapter._adapt_openqasm` —
106
128
  `CU_QUANTUM` is not a member of the `Sdk` enum; the only valid CUDA-Q value is
@@ -64,6 +64,26 @@ Notes:
64
64
 
65
65
  ## Recently Changes Highlights
66
66
 
67
+ ### v0.0.12.dev9
68
+ - Fix: `QulacsInvocation._get_qubit_amount` now handles OpenQASM string input —
69
+ when a JS job submits an OpenQASM 2.0 string circuit, the method parses the
70
+ `qreg` declaration to extract the qubit count instead of raising
71
+ `"Invalid circuit type!"`.
72
+
73
+ ### v0.0.12.dev8
74
+ - Add `Sdk.QULACS` support in `CircuitAdapter._adapt_openqasm` with a
75
+ two-stage fallback strategy:
76
+ 1. **Qiskit bridge** (preferred): parse OpenQASM with
77
+ `QiskitCircuit.from_qasm_str`, then convert gate-by-gate to a
78
+ `qulacs.QuantumCircuit` via the new `CircuitAdapter._qiskit_to_qulacs`
79
+ helper. Fixed gates (H, X, Y, Z, S, Sdg, T, Tdg, CX, CZ, SWAP) use
80
+ named qulacs methods; parametric and unrecognized gates fall back to
81
+ `qulacs.gate.DenseMatrix` with `gate.to_matrix()`.
82
+ 2. **Raw pass-through** (fallback): if qiskit is not installed or
83
+ conversion raises any exception, the raw OpenQASM string is returned
84
+ as-is (same approach as `Sdk.CUDA_QUANTUM`) and a warning is logged.
85
+ - Add `qulacs` as a direct dependency in `pyproject.toml`.
86
+
67
87
  ### v0.0.12.dev7
68
88
  - Fix: remove `Sdk.CU_QUANTUM` from the CUDA-Q branch in `CircuitAdapter._adapt_openqasm` —
69
89
  `CU_QUANTUM` is not a member of the `Sdk` enum; the only valid CUDA-Q value is
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quapp-common"
7
- version = "0.0.12.dev7"
7
+ version = "0.0.12.dev9"
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" }]
@@ -23,7 +23,9 @@ dependencies = [
23
23
  "pylatexenc",
24
24
  "starlette",
25
25
  "qibo",
26
- "dimod"
26
+ "dimod",
27
+ "qulacs",
28
+ "qiskit"
27
29
  ]
28
30
  requires-python = ">=3.7"
29
31
 
@@ -92,6 +92,18 @@ class CircuitAdapter:
92
92
  from qibo.models import Circuit
93
93
  return Circuit.from_qasm(qasm_str)
94
94
 
95
+ elif sdk == Sdk.QULACS:
96
+ # Try the Qiskit bridge first; fall back to raw pass-through if
97
+ # qiskit is not installed or the conversion fails.
98
+ try:
99
+ from qiskit import QuantumCircuit as QiskitCircuit
100
+ return CircuitAdapter._qiskit_to_qulacs(
101
+ QiskitCircuit.from_qasm_str(qasm_str)
102
+ )
103
+ except Exception as e:
104
+ logger.warning(f"Qiskit bridge failed for Qulacs ({e}); falling back to raw OpenQASM pass-through")
105
+ return qasm_str
106
+
95
107
  elif sdk == Sdk.CUDA_QUANTUM:
96
108
  # CUDA-Q accepts OpenQASM directly via kernel builder
97
109
  return qasm_str
@@ -123,3 +135,52 @@ class CircuitAdapter:
123
135
 
124
136
  from dimod import BinaryQuadraticModel
125
137
  return BinaryQuadraticModel.from_qubo(qubo_dict)
138
+
139
+ @staticmethod
140
+ def _qiskit_to_qulacs(qiskit_circ):
141
+ """Convert a Qiskit QuantumCircuit to a qulacs QuantumCircuit.
142
+
143
+ Fixed gates are mapped via named qulacs methods; parametric and
144
+ unrecognized gates fall back to DenseMatrix (unitary passthrough).
145
+ Measurement, barrier, reset, and identity instructions are skipped.
146
+ """
147
+ from qulacs import QuantumCircuit as QulacsCirucit
148
+ from qulacs.gate import DenseMatrix
149
+
150
+ n = qiskit_circ.num_qubits
151
+ qulacs_circ = QulacsCirucit(n)
152
+ qubit_map = {bit: idx for idx, bit in enumerate(qiskit_circ.qubits)}
153
+
154
+ _SINGLE = {
155
+ 'h': 'add_H_gate', 'x': 'add_X_gate',
156
+ 'y': 'add_Y_gate', 'z': 'add_Z_gate',
157
+ 's': 'add_S_gate', 'sdg': 'add_Sdag_gate',
158
+ 't': 'add_T_gate', 'tdg': 'add_Tdag_gate',
159
+ }
160
+ _TWO = {
161
+ 'cx': 'add_CNOT_gate',
162
+ 'cz': 'add_CZ_gate',
163
+ 'swap': 'add_SWAP_gate',
164
+ }
165
+ _SKIP = {'measure', 'barrier', 'reset', 'id'}
166
+
167
+ for inst in qiskit_circ.data:
168
+ gate = inst.operation
169
+ qubits = [qubit_map[q] for q in inst.qubits]
170
+ name = gate.name
171
+
172
+ if name in _SKIP:
173
+ continue
174
+ elif name in _SINGLE:
175
+ getattr(qulacs_circ, _SINGLE[name])(qubits[0])
176
+ elif name in _TWO:
177
+ getattr(qulacs_circ, _TWO[name])(qubits[0], qubits[1])
178
+ else:
179
+ # Parametric gates (rx, ry, rz, u*, p, ...) and any
180
+ # unrecognized gate: extract the unitary and apply it
181
+ # as a DenseMatrix. Single-qubit gates have no ordering
182
+ # ambiguity; multi-qubit gates are passed with qulacs'
183
+ # index order matching Qiskit's instruction qubit order.
184
+ qulacs_circ.add_gate(DenseMatrix(qubits, gate.to_matrix()))
185
+
186
+ return qulacs_circ
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quapp-common
3
- Version: 0.0.12.dev7
3
+ Version: 0.0.12.dev9
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)
@@ -27,6 +27,8 @@ Requires-Dist: pylatexenc
27
27
  Requires-Dist: starlette
28
28
  Requires-Dist: qibo
29
29
  Requires-Dist: dimod
30
+ Requires-Dist: qulacs
31
+ Requires-Dist: qiskit
30
32
  Provides-Extra: dev
31
33
  Requires-Dist: black; extra == "dev"
32
34
  Requires-Dist: bumpver; extra == "dev"
@@ -101,6 +103,26 @@ Notes:
101
103
 
102
104
  ## Recently Changes Highlights
103
105
 
106
+ ### v0.0.12.dev9
107
+ - Fix: `QulacsInvocation._get_qubit_amount` now handles OpenQASM string input —
108
+ when a JS job submits an OpenQASM 2.0 string circuit, the method parses the
109
+ `qreg` declaration to extract the qubit count instead of raising
110
+ `"Invalid circuit type!"`.
111
+
112
+ ### v0.0.12.dev8
113
+ - Add `Sdk.QULACS` support in `CircuitAdapter._adapt_openqasm` with a
114
+ two-stage fallback strategy:
115
+ 1. **Qiskit bridge** (preferred): parse OpenQASM with
116
+ `QiskitCircuit.from_qasm_str`, then convert gate-by-gate to a
117
+ `qulacs.QuantumCircuit` via the new `CircuitAdapter._qiskit_to_qulacs`
118
+ helper. Fixed gates (H, X, Y, Z, S, Sdg, T, Tdg, CX, CZ, SWAP) use
119
+ named qulacs methods; parametric and unrecognized gates fall back to
120
+ `qulacs.gate.DenseMatrix` with `gate.to_matrix()`.
121
+ 2. **Raw pass-through** (fallback): if qiskit is not installed or
122
+ conversion raises any exception, the raw OpenQASM string is returned
123
+ as-is (same approach as `Sdk.CUDA_QUANTUM`) and a warning is logged.
124
+ - Add `qulacs` as a direct dependency in `pyproject.toml`.
125
+
104
126
  ### v0.0.12.dev7
105
127
  - Fix: remove `Sdk.CU_QUANTUM` from the CUDA-Q branch in `CircuitAdapter._adapt_openqasm` —
106
128
  `CU_QUANTUM` is not a member of the `Sdk` enum; the only valid CUDA-Q value is
@@ -6,6 +6,8 @@ pylatexenc
6
6
  starlette
7
7
  qibo
8
8
  dimod
9
+ qulacs
10
+ qiskit
9
11
 
10
12
  [dev]
11
13
  black