quapp-common 0.0.12.dev12__tar.gz → 0.0.12.dev14__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.dev12/quapp_common.egg-info → quapp_common-0.0.12.dev14}/PKG-INFO +32 -1
  2. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/README.md +31 -0
  3. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/pyproject.toml +1 -1
  4. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/circuit_adapter.py +112 -8
  5. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14/quapp_common.egg-info}/PKG-INFO +32 -1
  6. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/LICENSE +0 -0
  7. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/__init__.py +0 -0
  8. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/async_tasks/__init__.py +0 -0
  9. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/async_tasks/async_invocation_task.py +0 -0
  10. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/async_tasks/async_task.py +0 -0
  11. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/async_tasks/export_circuit_task.py +0 -0
  12. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/async_tasks/post_processing_task.py +0 -0
  13. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/__init__.py +0 -0
  14. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/backend/__init__.py +0 -0
  15. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/backend/invocation.py +0 -0
  16. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/backend/job_fetcher.py +0 -0
  17. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/backend/job_fetching.py +0 -0
  18. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/backend/job_manager.py +0 -0
  19. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/bridge.py +0 -0
  20. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/callback/__init__.py +0 -0
  21. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/callback/update_job_metadata.py +0 -0
  22. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/device/__init__.py +0 -0
  23. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/device/device_selection.py +0 -0
  24. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/dispatcher.py +0 -0
  25. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/component/result_serializer.py +0 -0
  26. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/config/__init__.py +0 -0
  27. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/config/logging_config.py +0 -0
  28. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/config/thread_config.py +0 -0
  29. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/__init__.py +0 -0
  30. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/async_task/__init__.py +0 -0
  31. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/async_task/circuit_export/__init__.py +0 -0
  32. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/async_task/circuit_export/backend_holder.py +0 -0
  33. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/async_task/circuit_export/circuit_holder.py +0 -0
  34. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/backend/__init__.py +0 -0
  35. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/backend/backend_information.py +0 -0
  36. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/callback/__init__.py +0 -0
  37. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/callback/callback_url.py +0 -0
  38. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/device/__init__.py +0 -0
  39. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/device/circuit_running_option.py +0 -0
  40. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/promise/__init__.py +0 -0
  41. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/promise/post_processing_promise.py +0 -0
  42. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/promise/promise.py +0 -0
  43. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/request/__init__.py +0 -0
  44. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/request/invocation_request.py +0 -0
  45. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/request/job_fetching_request.py +0 -0
  46. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/request/request.py +0 -0
  47. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/response/__init__.py +0 -0
  48. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/response/authentication.py +0 -0
  49. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/response/custom_header.py +0 -0
  50. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/data/response/job_response.py +0 -0
  51. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/__init__.py +0 -0
  52. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/base_enum.py +0 -0
  53. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/http_header.py +0 -0
  54. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/invocation_step.py +0 -0
  55. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/language.py +0 -0
  56. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/media_type.py +0 -0
  57. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/processing_unit.py +0 -0
  58. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/provider_tag.py +0 -0
  59. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/sdk.py +0 -0
  60. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/status/__init__.py +0 -0
  61. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/status/job_status.py +0 -0
  62. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/status/status_code.py +0 -0
  63. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/enum/token_type.py +0 -0
  64. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/factory/__init__.py +0 -0
  65. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/factory/device_factory.py +0 -0
  66. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/factory/handler_factory.py +0 -0
  67. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/factory/provider_factory.py +0 -0
  68. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/handler/__init__.py +0 -0
  69. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/handler/handler.py +0 -0
  70. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/__init__.py +0 -0
  71. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/device/__init__.py +0 -0
  72. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/device/custom_device.py +0 -0
  73. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/device/device.py +0 -0
  74. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/invocation.py +0 -0
  75. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/provider/__init__.py +0 -0
  76. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/model/provider/provider.py +0 -0
  77. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/util/__init__.py +0 -0
  78. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/util/file_utils.py +0 -0
  79. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/util/http_utils.py +0 -0
  80. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/util/json_parser_utils.py +0 -0
  81. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common/util/response_utils.py +0 -0
  82. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common.egg-info/SOURCES.txt +0 -0
  83. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common.egg-info/dependency_links.txt +0 -0
  84. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common.egg-info/requires.txt +0 -0
  85. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/quapp_common.egg-info/top_level.txt +0 -0
  86. {quapp_common-0.0.12.dev12 → quapp_common-0.0.12.dev14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quapp-common
3
- Version: 0.0.12.dev12
3
+ Version: 0.0.12.dev14
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,37 @@ Notes:
103
103
 
104
104
  ## Recently Changes Highlights
105
105
 
106
+ ### v0.0.12.dev14
107
+ - Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.PENNYLANE` now catches the
108
+ "Failed to load the qasm plugin" error raised by `qml.from_qasm` on
109
+ PennyLane versions that route QASM parsing through the IO plugin registry
110
+ and require `pennylane-qiskit` to be installed (affects both older releases
111
+ and the current latest). When the error is detected, it falls back to
112
+ parsing the QASM string via Qiskit (a hard dependency) and emitting native
113
+ PennyLane operations gate-by-gate through the new
114
+ `CircuitAdapter._qiskit_to_pennylane` helper. Supported gates: H, X, Y, Z,
115
+ S, Sdg (→ PhaseShift −π/2), T, Tdg (→ PhaseShift −π/4), CX, CZ, SWAP,
116
+ RX, RY, RZ, P/U1 (→ PhaseShift), U2, U3/U; unrecognized gates are logged
117
+ as a warning and skipped.
118
+
119
+ ### v0.0.12.dev13
120
+ - Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.PENNYLANE` now injects string
121
+ sentinels (`"Expectation"`, `"Variance"`, `"Sample"`, `"Probability"`,
122
+ `"State"`, `"MidMeasure"`) back into `pennylane.measurements` when they are
123
+ absent. PennyLane 0.37 removed `ObservableReturnTypes` from that module, but
124
+ legacy plugins such as `pennylane-rigetti` import these names at module level
125
+ and crash with `ImportError` before the device is created. The shim is
126
+ injected inside `__pre_execute`, before `PennylaneInvocation` creates the
127
+ device, so the plugin import succeeds and the removed code paths are bypassed
128
+ at runtime.
129
+
130
+ ### v0.0.12.dev12
131
+ - Feat: add `QUAPP_HPC` to `ProviderTag` enum to support the Slurm HPC
132
+ integration. Required by `quapp-hpc` so its `SlurmProvider` can register
133
+ itself in the shared `ProviderTag` namespace; without this, importing
134
+ `quapp-hpc` fails at `SlurmProvider.__init__` with `AttributeError` on the
135
+ enum lookup.
136
+
106
137
  ### v0.0.12.dev11
107
138
  - Enhance: `CircuitAdapter` now emits structured debug logs at each routing
108
139
  decision — SDK selected, QASM string length, qubit count, per-SDK adapter
@@ -64,6 +64,37 @@ Notes:
64
64
 
65
65
  ## Recently Changes Highlights
66
66
 
67
+ ### v0.0.12.dev14
68
+ - Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.PENNYLANE` now catches the
69
+ "Failed to load the qasm plugin" error raised by `qml.from_qasm` on
70
+ PennyLane versions that route QASM parsing through the IO plugin registry
71
+ and require `pennylane-qiskit` to be installed (affects both older releases
72
+ and the current latest). When the error is detected, it falls back to
73
+ parsing the QASM string via Qiskit (a hard dependency) and emitting native
74
+ PennyLane operations gate-by-gate through the new
75
+ `CircuitAdapter._qiskit_to_pennylane` helper. Supported gates: H, X, Y, Z,
76
+ S, Sdg (→ PhaseShift −π/2), T, Tdg (→ PhaseShift −π/4), CX, CZ, SWAP,
77
+ RX, RY, RZ, P/U1 (→ PhaseShift), U2, U3/U; unrecognized gates are logged
78
+ as a warning and skipped.
79
+
80
+ ### v0.0.12.dev13
81
+ - Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.PENNYLANE` now injects string
82
+ sentinels (`"Expectation"`, `"Variance"`, `"Sample"`, `"Probability"`,
83
+ `"State"`, `"MidMeasure"`) back into `pennylane.measurements` when they are
84
+ absent. PennyLane 0.37 removed `ObservableReturnTypes` from that module, but
85
+ legacy plugins such as `pennylane-rigetti` import these names at module level
86
+ and crash with `ImportError` before the device is created. The shim is
87
+ injected inside `__pre_execute`, before `PennylaneInvocation` creates the
88
+ device, so the plugin import succeeds and the removed code paths are bypassed
89
+ at runtime.
90
+
91
+ ### v0.0.12.dev12
92
+ - Feat: add `QUAPP_HPC` to `ProviderTag` enum to support the Slurm HPC
93
+ integration. Required by `quapp-hpc` so its `SlurmProvider` can register
94
+ itself in the shared `ProviderTag` namespace; without this, importing
95
+ `quapp-hpc` fails at `SlurmProvider.__init__` with `AttributeError` on the
96
+ enum lookup.
97
+
67
98
  ### v0.0.12.dev11
68
99
  - Enhance: `CircuitAdapter` now emits structured debug logs at each routing
69
100
  decision — SDK selected, QASM string length, qubit count, per-SDK adapter
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quapp-common"
7
- version = "0.0.12.dev12"
7
+ version = "0.0.12.dev14"
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" }]
@@ -64,6 +64,20 @@ class CircuitAdapter:
64
64
  elif sdk == Sdk.PENNYLANE:
65
65
  logger.debug("Converting OpenQASM via PennyLane qml.from_qasm wrapper")
66
66
  import pennylane as qml
67
+ # PennyLane 0.37 removed ObservableReturnTypes (Expectation, Variance,
68
+ # Sample, …) from pennylane.measurements. Legacy plugins such as
69
+ # pennylane-rigetti import these names at module level, so they crash
70
+ # with ImportError before the device is even created. We inject string
71
+ # sentinels back into the module here — this runs inside __pre_execute,
72
+ # which is called before PennylaneInvocation creates the device, so the
73
+ # shim is in place when `qml.device("rigetti.qvm", ...)` triggers the
74
+ # plugin import. The sentinels are never equal to new-style measurement
75
+ # objects, so the removed code paths are simply bypassed at runtime.
76
+ import pennylane.measurements as _plm
77
+ for _compat_name in ("Expectation", "Variance", "Sample", "Probability",
78
+ "State", "MidMeasure"):
79
+ if not hasattr(_plm, _compat_name):
80
+ setattr(_plm, _compat_name, _compat_name)
67
81
  # PennyLane >=0.37 treats QASM `measure` statements as mid-circuit
68
82
  # measurements returning MeasurementValue, which fails QNode
69
83
  # validation. Override with a terminal `qml.probs` over all qubits
@@ -80,17 +94,34 @@ class CircuitAdapter:
80
94
  # drop QASM's terminal measures) and then explicitly queue a
81
95
  # fresh `qml.probs` over all qubits, so the wires are visible in
82
96
  # both `QuantumTape` capture and full QNode execution.
97
+ #
98
+ # qml.from_qasm requires the pennylane-qiskit plugin in several
99
+ # PennyLane versions — both older releases (< 0.36) where it was
100
+ # plugin-only, and newer releases that re-route through the IO
101
+ # plugin registry. If the plugin is absent the call raises
102
+ # "Failed to load the qasm plugin". Fall back to parsing via
103
+ # Qiskit (a hard dependency) and emitting native PennyLane ops
104
+ # gate-by-gate.
83
105
  num_wires = CircuitAdapter._count_qasm_qubits(qasm_str)
84
106
  logger.debug(f"PennyLane: detected {num_wires} qubits; wrapping with qml.probs over all wires")
85
- base_fn = qml.from_qasm(qasm_str, measurements=[])
107
+ try:
108
+ base_fn = qml.from_qasm(qasm_str, measurements=[])
86
109
 
87
- def _circuit():
88
- base_fn()
89
- if num_wires > 0:
90
- return qml.probs(wires=list(range(num_wires)))
91
- return None
110
+ def _circuit():
111
+ base_fn()
112
+ if num_wires > 0:
113
+ return qml.probs(wires=list(range(num_wires)))
114
+ return None
92
115
 
93
- return _circuit
116
+ return _circuit
117
+ except Exception as _e:
118
+ if "qasm plugin" not in str(_e) and "pennylane-qiskit" not in str(_e):
119
+ raise
120
+ logger.warning(
121
+ f"qml.from_qasm unavailable ({_e}); "
122
+ "falling back to Qiskit bridge for PennyLane QASM conversion"
123
+ )
124
+ return CircuitAdapter._qiskit_to_pennylane(qasm_str, num_wires)
94
125
 
95
126
  elif sdk == Sdk.PYQUIL:
96
127
  logger.debug("Converting OpenQASM via pytket -> tk_to_pyquil")
@@ -128,7 +159,7 @@ class CircuitAdapter:
128
159
  def _count_qasm_qubits(qasm_str):
129
160
  """Sum qubit counts across all `qreg <name>[<n>];` declarations."""
130
161
  import re
131
- return sum(int(m) for m in re.findall(r'qreg\s+\w+\[(\d+)\]', qasm_str))
162
+ return sum(int(m) for m in re.findall(r'qreg\s+\w+\[(\d+)]', qasm_str))
132
163
 
133
164
  @staticmethod
134
165
  def _adapt_qubo(sdk, qubo_raw):
@@ -202,3 +233,76 @@ class CircuitAdapter:
202
233
 
203
234
  logger.debug(f"_qiskit_to_qulacs: conversion complete")
204
235
  return qulacs_circ
236
+
237
+ @staticmethod
238
+ def _qiskit_to_pennylane(qasm_str, num_wires):
239
+ """Parse an OpenQASM 2.0 string via Qiskit and return a PennyLane callable.
240
+
241
+ Fallback for environments where qml.from_qasm is unavailable because
242
+ pennylane-qiskit is not installed (PennyLane < 0.36).
243
+ """
244
+ import numpy as np
245
+ from qiskit import QuantumCircuit as QiskitCircuit
246
+ import pennylane as qml
247
+
248
+ qiskit_circ = QiskitCircuit.from_qasm_str(qasm_str)
249
+ qubit_map = {bit: idx for idx, bit in enumerate(qiskit_circ.qubits)}
250
+ logger.debug(
251
+ f"_qiskit_to_pennylane: num_qubits={qiskit_circ.num_qubits} "
252
+ f"num_instructions={len(qiskit_circ.data)}"
253
+ )
254
+
255
+ instructions = [
256
+ (inst.operation.name,
257
+ [qubit_map[q] for q in inst.qubits],
258
+ [float(p) for p in inst.operation.params])
259
+ for inst in qiskit_circ.data
260
+ ]
261
+
262
+ _SKIP = frozenset({'measure', 'barrier', 'reset', 'id'})
263
+
264
+ def _circuit():
265
+ for name, qubits, params in instructions:
266
+ if name in _SKIP:
267
+ continue
268
+ elif name == 'h':
269
+ qml.Hadamard(wires=qubits[0])
270
+ elif name == 'x':
271
+ qml.PauliX(wires=qubits[0])
272
+ elif name == 'y':
273
+ qml.PauliY(wires=qubits[0])
274
+ elif name == 'z':
275
+ qml.PauliZ(wires=qubits[0])
276
+ elif name == 's':
277
+ qml.S(wires=qubits[0])
278
+ elif name == 'sdg':
279
+ qml.PhaseShift(-np.pi / 2, wires=qubits[0])
280
+ elif name == 't':
281
+ qml.T(wires=qubits[0])
282
+ elif name == 'tdg':
283
+ qml.PhaseShift(-np.pi / 4, wires=qubits[0])
284
+ elif name == 'cx':
285
+ qml.CNOT(wires=qubits)
286
+ elif name == 'cz':
287
+ qml.CZ(wires=qubits)
288
+ elif name == 'swap':
289
+ qml.SWAP(wires=qubits)
290
+ elif name == 'rx':
291
+ qml.RX(params[0], wires=qubits[0])
292
+ elif name == 'ry':
293
+ qml.RY(params[0], wires=qubits[0])
294
+ elif name == 'rz':
295
+ qml.RZ(params[0], wires=qubits[0])
296
+ elif name in ('p', 'u1'):
297
+ qml.PhaseShift(params[0], wires=qubits[0])
298
+ elif name == 'u2':
299
+ qml.U2(params[0], params[1], wires=qubits[0])
300
+ elif name in ('u3', 'u'):
301
+ qml.U3(params[0], params[1], params[2], wires=qubits[0])
302
+ else:
303
+ logger.warning(f"PennyLane Qiskit bridge: unrecognized gate '{name}'; skipping")
304
+ if num_wires > 0:
305
+ return qml.probs(wires=list(range(num_wires)))
306
+ return None
307
+
308
+ return _circuit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quapp-common
3
- Version: 0.0.12.dev12
3
+ Version: 0.0.12.dev14
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,37 @@ Notes:
103
103
 
104
104
  ## Recently Changes Highlights
105
105
 
106
+ ### v0.0.12.dev14
107
+ - Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.PENNYLANE` now catches the
108
+ "Failed to load the qasm plugin" error raised by `qml.from_qasm` on
109
+ PennyLane versions that route QASM parsing through the IO plugin registry
110
+ and require `pennylane-qiskit` to be installed (affects both older releases
111
+ and the current latest). When the error is detected, it falls back to
112
+ parsing the QASM string via Qiskit (a hard dependency) and emitting native
113
+ PennyLane operations gate-by-gate through the new
114
+ `CircuitAdapter._qiskit_to_pennylane` helper. Supported gates: H, X, Y, Z,
115
+ S, Sdg (→ PhaseShift −π/2), T, Tdg (→ PhaseShift −π/4), CX, CZ, SWAP,
116
+ RX, RY, RZ, P/U1 (→ PhaseShift), U2, U3/U; unrecognized gates are logged
117
+ as a warning and skipped.
118
+
119
+ ### v0.0.12.dev13
120
+ - Fix: `CircuitAdapter._adapt_openqasm` for `Sdk.PENNYLANE` now injects string
121
+ sentinels (`"Expectation"`, `"Variance"`, `"Sample"`, `"Probability"`,
122
+ `"State"`, `"MidMeasure"`) back into `pennylane.measurements` when they are
123
+ absent. PennyLane 0.37 removed `ObservableReturnTypes` from that module, but
124
+ legacy plugins such as `pennylane-rigetti` import these names at module level
125
+ and crash with `ImportError` before the device is created. The shim is
126
+ injected inside `__pre_execute`, before `PennylaneInvocation` creates the
127
+ device, so the plugin import succeeds and the removed code paths are bypassed
128
+ at runtime.
129
+
130
+ ### v0.0.12.dev12
131
+ - Feat: add `QUAPP_HPC` to `ProviderTag` enum to support the Slurm HPC
132
+ integration. Required by `quapp-hpc` so its `SlurmProvider` can register
133
+ itself in the shared `ProviderTag` namespace; without this, importing
134
+ `quapp-hpc` fails at `SlurmProvider.__init__` with `AttributeError` on the
135
+ enum lookup.
136
+
106
137
  ### v0.0.12.dev11
107
138
  - Enhance: `CircuitAdapter` now emits structured debug logs at each routing
108
139
  decision — SDK selected, QASM string length, qubit count, per-SDK adapter