quapp-pennylane 0.0.4.dev11__tar.gz → 0.0.5.dev2__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 (37) hide show
  1. quapp_pennylane-0.0.5.dev2/PKG-INFO +162 -0
  2. quapp_pennylane-0.0.5.dev2/README.md +126 -0
  3. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/pyproject.toml +1 -1
  4. quapp_pennylane-0.0.5.dev2/quapp_pennylane/async_tasks/pennylane_circuit_export_task.py +81 -0
  5. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/device/qapp_pennylane_device.py +14 -10
  6. quapp_pennylane-0.0.5.dev2/quapp_pennylane.egg-info/PKG-INFO +162 -0
  7. quapp_pennylane-0.0.4.dev11/PKG-INFO +0 -90
  8. quapp_pennylane-0.0.4.dev11/README.md +0 -54
  9. quapp_pennylane-0.0.4.dev11/quapp_pennylane/async_tasks/pennylane_circuit_export_task.py +0 -53
  10. quapp_pennylane-0.0.4.dev11/quapp_pennylane.egg-info/PKG-INFO +0 -90
  11. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/LICENSE +0 -0
  12. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/__init__.py +0 -0
  13. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/async_tasks/__init__.py +0 -0
  14. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/component/__init__.py +0 -0
  15. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/component/backend/__init__.py +0 -0
  16. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/component/backend/pennylane_invocation.py +0 -0
  17. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/factory/__init__.py +0 -0
  18. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/factory/pennylane_device_factory.py +0 -0
  19. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/factory/pennylane_handler_factory.py +0 -0
  20. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/factory/pennylane_provider_factory.py +0 -0
  21. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/handler/__init__.py +0 -0
  22. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/handler/invocation_handler.py +0 -0
  23. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/__init__.py +0 -0
  24. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/device/__init__.py +0 -0
  25. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/device/aws_braket_device.py +0 -0
  26. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/device/ibm_quantum_device.py +0 -0
  27. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/device/pennylane_device.py +0 -0
  28. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/provider/__init__.py +0 -0
  29. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/provider/aws_braket_provider.py +0 -0
  30. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/provider/ibm_cloud_provider.py +0 -0
  31. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/provider/ibm_quantum_provider.py +0 -0
  32. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane/model/provider/qapp_pennylane_provider.py +0 -0
  33. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane.egg-info/SOURCES.txt +0 -0
  34. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane.egg-info/dependency_links.txt +0 -0
  35. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane.egg-info/requires.txt +0 -0
  36. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/quapp_pennylane.egg-info/top_level.txt +0 -0
  37. {quapp_pennylane-0.0.4.dev11 → quapp_pennylane-0.0.5.dev2}/setup.cfg +0 -0
@@ -0,0 +1,162 @@
1
+ Metadata-Version: 2.4
2
+ Name: quapp-pennylane
3
+ Version: 0.0.5.dev2
4
+ Summary: Quapp pennylane library supporting Quapp Platform for Quantum Computing
5
+ Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
6
+ License: The MIT License (MIT)
7
+ Copyright © CITYNOW Co. Ltd. All rights reserved.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ Project-URL: Homepage, https://citynow.asia/
15
+ Keywords: quapp,quapp-pennylane,pennylane,quantum
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: quapp-common==0.0.11.dev7
23
+ Requires-Dist: autoray==0.6.11
24
+ Requires-Dist: pennylane==0.37.0
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: PennyLane-Rigetti==0.36.0
27
+ Requires-Dist: PennyLane_Lightning==0.37.0
28
+ Requires-Dist: pydantic<2.0.0,>=1.7.2
29
+ Provides-Extra: dev
30
+ Requires-Dist: black; extra == "dev"
31
+ Requires-Dist: bumpver; extra == "dev"
32
+ Requires-Dist: isort; extra == "dev"
33
+ Requires-Dist: pip-tools; extra == "dev"
34
+ Requires-Dist: pytest; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # quapp-pennylane
38
+
39
+ Quapp PennyLane library supporting the Quapp Platform for Quantum Computing with
40
+ providers, devices, circuit export, invocation, and job fetching utilities.
41
+
42
+ ## Overview
43
+
44
+ `quapp-pennylane` is a Python library that integrates the Quapp Platform with
45
+ PennyLane-based quantum backends and simulators. It provides common abstractions
46
+ for providers and devices, helpers for circuit construction and export, robust job
47
+ submission and result fetching flows, and consistent job-scoped logging across
48
+ all components.
49
+
50
+ ## Features
51
+
52
+ - **Provider & device factories** — PennyLane-compatible factories for local
53
+ simulators (e.g., `default.qubit`) and vendor-backed hardware (Rigetti QVM,
54
+ AWS Braket, IBM Quantum).
55
+ - **Circuit export** — `PennylaneCircuitExportTask` with a `_PennylaneDrawableCircuit`
56
+ adapter that satisfies the `CircuitExportTask.draw()` contract using `qml.draw_mpl`.
57
+ - **Job execution** — `QAppPennylaneDevice` drives the full execution pipeline:
58
+ tape construction, device selection, QNode creation, probability histogram
59
+ generation, and timing metrics.
60
+ - **Rigetti QVM support** — dynamic device-name derivation for N-qubit QVM
61
+ topologies (`Nq-qvm`, `Nq-pyqvm`) alongside fixed 9-qubit variants.
62
+ - **Structured logging** — job-scoped, instance-bound loggers emit structured
63
+ key=value fields at every major step for traceability and debugging.
64
+ - **Compatibility shims** — `quapp_pennylane/__init__.py` patches API breaks
65
+ between `pennylane-rigetti==0.36.0` and PennyLane 0.37–0.42+ at import time
66
+ (see [Compatibility](#compatibility) below).
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install quapp-pennylane
72
+ ```
73
+
74
+ ## Requirements
75
+
76
+ | Dependency | Version |
77
+ |---|---|
78
+ | Python | ≥ 3.10 |
79
+ | quapp-common | 0.0.11.dev7 |
80
+ | pennylane | 0.37.0 |
81
+ | PennyLane-Rigetti | 0.36.0 |
82
+ | PennyLane-Lightning | 0.37.0 |
83
+ | pydantic | ≥ 1.7.2, < 2.0.0 |
84
+ | autoray | 0.6.11 |
85
+
86
+ ## Project Structure
87
+
88
+ ```
89
+ quapp_pennylane/
90
+ ├── __init__.py # Compatibility shims (loaded at import)
91
+ ├── async_tasks/
92
+ │ └── pennylane_circuit_export_task.py # PennylaneCircuitExportTask + adapter
93
+ ├── component/
94
+ │ └── backend/
95
+ │ └── pennylane_invocation.py
96
+ ├── factory/
97
+ │ ├── pennylane_device_factory.py
98
+ │ ├── pennylane_handler_factory.py
99
+ │ └── pennylane_provider_factory.py
100
+ ├── handler/
101
+ │ └── invocation_handler.py
102
+ └── model/
103
+ ├── device/
104
+ │ ├── qapp_pennylane_device.py # Core execution device
105
+ │ ├── aws_braket_device.py
106
+ │ └── ibm_quantum_device.py
107
+ └── provider/
108
+ ├── qapp_pennylane_provider.py
109
+ ├── aws_braket_provider.py
110
+ ├── ibm_cloud_provider.py
111
+ └── ibm_quantum_provider.py
112
+ ```
113
+
114
+ ## Compatibility
115
+
116
+ `quapp_pennylane/__init__.py` applies the following shims at import time so that
117
+ `pennylane-rigetti==0.36.0` works against PennyLane 0.37–0.42+:
118
+
119
+ | Symbol | Change | Shim |
120
+ |---|---|---|
121
+ | `measurements.Expectation` | Renamed to `ExpectationMP` in PennyLane 0.37+ | Alias `Expectation → ExpectationMP` |
122
+ | `operation.Tensor` | Removed in PennyLane 0.40+; replaced by `ops.Prod` | Alias `Tensor → Prod` for isinstance checks |
123
+ | `pennylane.QubitDevice` | Moved to `pennylane.devices` in PennyLane ~0.40+ | Re-export at top-level namespace |
124
+ | `pydantic.BaseModel.__config__` | Removed in Pydantic v2; `qcs-api-client<0.22.0` reads `self.__config__.env_prefix` | Inject a stub `__config__` with `env_prefix=''` onto `BaseModel` |
125
+
126
+ `pydantic` is pinned to `>=1.7.2,<2.0.0` in `pyproject.toml` to make the v1
127
+ requirement of `qcs-api-client<0.22.0` explicit and prevent pip from resolving v2.
128
+
129
+ ## Recent Changes
130
+
131
+ ### 0.0.5.dev2
132
+
133
+ - **fix(export)**: Fix `_PennylaneDrawableCircuit.draw()` — `qml.draw_mpl` requires
134
+ a `QNode`, not a bare callable; now captures the circuit into a `QuantumTape`,
135
+ derives wires, creates a `default.qubit` device, and wraps in a `QNode` before
136
+ rendering with `qml.draw_mpl`.
137
+ - **build**: Bump version to `0.0.5.dev2`.
138
+
139
+ ### 0.0.5.dev1
140
+
141
+ - **feat(device)**: Add structured key=value log fields to `QAppPennylaneDevice`
142
+ at every execution stage — initialization, tape diagnostics, device resolution,
143
+ QNode setup, execution timing, histogram generation, and finalization.
144
+ - **feat(device)**: Default shots fallback — `shots=None` or `shots=0` in
145
+ `CircuitRunningOption` falls back to 1024 with a warning instead of raising.
146
+ - **feat(export)**: Introduce `_PennylaneDrawableCircuit` adapter in
147
+ `PennylaneCircuitExportTask` to wrap PennyLane circuits for the
148
+ `CircuitExportTask.draw()` contract using `qml.draw_mpl`.
149
+ - **feat(export)**: Emit Python runtime information and duration timing in
150
+ `_transpile_circuit`.
151
+ - **fix(compat)**: Patch `pydantic.BaseModel.__config__` at import time for
152
+ Pydantic v2 environments — `qcs-api-client<0.22.0` accesses
153
+ `self.__config__.env_prefix` (a Pydantic v1 inner Config class removed in v2).
154
+ - **fix(deps)**: Pin `pydantic>=1.7.2,<2.0.0` in `pyproject.toml` to prevent
155
+ pip from resolving Pydantic v2.
156
+ - **fix(compat)**: Extend compatibility shims for `pennylane-rigetti==0.36.0`
157
+ against PennyLane 0.37–0.42+: `measurements.Expectation`, `operation.Tensor`,
158
+ and `pennylane.QubitDevice`.
159
+ - **build**: Bump version to `0.0.5.dev1`.
160
+
161
+ For detailed API references, refer to the in-code documentation or contact the
162
+ maintainers at [corp@citynow.vn](mailto:corp@citynow.vn).
@@ -0,0 +1,126 @@
1
+ # quapp-pennylane
2
+
3
+ Quapp PennyLane library supporting the Quapp Platform for Quantum Computing with
4
+ providers, devices, circuit export, invocation, and job fetching utilities.
5
+
6
+ ## Overview
7
+
8
+ `quapp-pennylane` is a Python library that integrates the Quapp Platform with
9
+ PennyLane-based quantum backends and simulators. It provides common abstractions
10
+ for providers and devices, helpers for circuit construction and export, robust job
11
+ submission and result fetching flows, and consistent job-scoped logging across
12
+ all components.
13
+
14
+ ## Features
15
+
16
+ - **Provider & device factories** — PennyLane-compatible factories for local
17
+ simulators (e.g., `default.qubit`) and vendor-backed hardware (Rigetti QVM,
18
+ AWS Braket, IBM Quantum).
19
+ - **Circuit export** — `PennylaneCircuitExportTask` with a `_PennylaneDrawableCircuit`
20
+ adapter that satisfies the `CircuitExportTask.draw()` contract using `qml.draw_mpl`.
21
+ - **Job execution** — `QAppPennylaneDevice` drives the full execution pipeline:
22
+ tape construction, device selection, QNode creation, probability histogram
23
+ generation, and timing metrics.
24
+ - **Rigetti QVM support** — dynamic device-name derivation for N-qubit QVM
25
+ topologies (`Nq-qvm`, `Nq-pyqvm`) alongside fixed 9-qubit variants.
26
+ - **Structured logging** — job-scoped, instance-bound loggers emit structured
27
+ key=value fields at every major step for traceability and debugging.
28
+ - **Compatibility shims** — `quapp_pennylane/__init__.py` patches API breaks
29
+ between `pennylane-rigetti==0.36.0` and PennyLane 0.37–0.42+ at import time
30
+ (see [Compatibility](#compatibility) below).
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install quapp-pennylane
36
+ ```
37
+
38
+ ## Requirements
39
+
40
+ | Dependency | Version |
41
+ |---|---|
42
+ | Python | ≥ 3.10 |
43
+ | quapp-common | 0.0.11.dev7 |
44
+ | pennylane | 0.37.0 |
45
+ | PennyLane-Rigetti | 0.36.0 |
46
+ | PennyLane-Lightning | 0.37.0 |
47
+ | pydantic | ≥ 1.7.2, < 2.0.0 |
48
+ | autoray | 0.6.11 |
49
+
50
+ ## Project Structure
51
+
52
+ ```
53
+ quapp_pennylane/
54
+ ├── __init__.py # Compatibility shims (loaded at import)
55
+ ├── async_tasks/
56
+ │ └── pennylane_circuit_export_task.py # PennylaneCircuitExportTask + adapter
57
+ ├── component/
58
+ │ └── backend/
59
+ │ └── pennylane_invocation.py
60
+ ├── factory/
61
+ │ ├── pennylane_device_factory.py
62
+ │ ├── pennylane_handler_factory.py
63
+ │ └── pennylane_provider_factory.py
64
+ ├── handler/
65
+ │ └── invocation_handler.py
66
+ └── model/
67
+ ├── device/
68
+ │ ├── qapp_pennylane_device.py # Core execution device
69
+ │ ├── aws_braket_device.py
70
+ │ └── ibm_quantum_device.py
71
+ └── provider/
72
+ ├── qapp_pennylane_provider.py
73
+ ├── aws_braket_provider.py
74
+ ├── ibm_cloud_provider.py
75
+ └── ibm_quantum_provider.py
76
+ ```
77
+
78
+ ## Compatibility
79
+
80
+ `quapp_pennylane/__init__.py` applies the following shims at import time so that
81
+ `pennylane-rigetti==0.36.0` works against PennyLane 0.37–0.42+:
82
+
83
+ | Symbol | Change | Shim |
84
+ |---|---|---|
85
+ | `measurements.Expectation` | Renamed to `ExpectationMP` in PennyLane 0.37+ | Alias `Expectation → ExpectationMP` |
86
+ | `operation.Tensor` | Removed in PennyLane 0.40+; replaced by `ops.Prod` | Alias `Tensor → Prod` for isinstance checks |
87
+ | `pennylane.QubitDevice` | Moved to `pennylane.devices` in PennyLane ~0.40+ | Re-export at top-level namespace |
88
+ | `pydantic.BaseModel.__config__` | Removed in Pydantic v2; `qcs-api-client<0.22.0` reads `self.__config__.env_prefix` | Inject a stub `__config__` with `env_prefix=''` onto `BaseModel` |
89
+
90
+ `pydantic` is pinned to `>=1.7.2,<2.0.0` in `pyproject.toml` to make the v1
91
+ requirement of `qcs-api-client<0.22.0` explicit and prevent pip from resolving v2.
92
+
93
+ ## Recent Changes
94
+
95
+ ### 0.0.5.dev2
96
+
97
+ - **fix(export)**: Fix `_PennylaneDrawableCircuit.draw()` — `qml.draw_mpl` requires
98
+ a `QNode`, not a bare callable; now captures the circuit into a `QuantumTape`,
99
+ derives wires, creates a `default.qubit` device, and wraps in a `QNode` before
100
+ rendering with `qml.draw_mpl`.
101
+ - **build**: Bump version to `0.0.5.dev2`.
102
+
103
+ ### 0.0.5.dev1
104
+
105
+ - **feat(device)**: Add structured key=value log fields to `QAppPennylaneDevice`
106
+ at every execution stage — initialization, tape diagnostics, device resolution,
107
+ QNode setup, execution timing, histogram generation, and finalization.
108
+ - **feat(device)**: Default shots fallback — `shots=None` or `shots=0` in
109
+ `CircuitRunningOption` falls back to 1024 with a warning instead of raising.
110
+ - **feat(export)**: Introduce `_PennylaneDrawableCircuit` adapter in
111
+ `PennylaneCircuitExportTask` to wrap PennyLane circuits for the
112
+ `CircuitExportTask.draw()` contract using `qml.draw_mpl`.
113
+ - **feat(export)**: Emit Python runtime information and duration timing in
114
+ `_transpile_circuit`.
115
+ - **fix(compat)**: Patch `pydantic.BaseModel.__config__` at import time for
116
+ Pydantic v2 environments — `qcs-api-client<0.22.0` accesses
117
+ `self.__config__.env_prefix` (a Pydantic v1 inner Config class removed in v2).
118
+ - **fix(deps)**: Pin `pydantic>=1.7.2,<2.0.0` in `pyproject.toml` to prevent
119
+ pip from resolving Pydantic v2.
120
+ - **fix(compat)**: Extend compatibility shims for `pennylane-rigetti==0.36.0`
121
+ against PennyLane 0.37–0.42+: `measurements.Expectation`, `operation.Tensor`,
122
+ and `pennylane.QubitDevice`.
123
+ - **build**: Bump version to `0.0.5.dev1`.
124
+
125
+ For detailed API references, refer to the in-code documentation or contact the
126
+ maintainers at [corp@citynow.vn](mailto:corp@citynow.vn).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quapp-pennylane"
7
- version = "0.0.4.dev11"
7
+ version = "0.0.5.dev2"
8
8
  description = "Quapp pennylane library supporting Quapp Platform for Quantum Computing"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "CITYNOW Co. Ltd. ", email = "corp@citynow.vn" }]
@@ -0,0 +1,81 @@
1
+ # Quapp Platform Project
2
+ # pennylane_circuit_export_task.py
3
+ # Copyright © CITYNOW Co. Ltd. All rights reserved.
4
+ import pennylane as qml
5
+ import sys
6
+ import time
7
+ from abc import ABC
8
+ from quapp_common.async_tasks.export_circuit_task import CircuitExportTask
9
+
10
+
11
+ class _PennylaneDrawableCircuit:
12
+ """Adapter wrapping a PennyLane circuit to satisfy CircuitExportTask's .draw() contract."""
13
+
14
+ def __init__(self, circuit):
15
+ self._circuit = circuit
16
+
17
+ def draw(self, **kwargs):
18
+ """
19
+ Generate a visual representation of a quantum circuit.
20
+
21
+ This method constructs a quantum circuit by invoking the internal `_circuit`
22
+ method and then creates a corresponding visualization using matplotlib.
23
+ QuantumTape is used to capture the quantum circuit, while the `qml.draw_mpl`
24
+ function is used to render the visualization.
25
+
26
+ :param kwargs: Optional keyword arguments to be passed to internal
27
+ operations or specific quantum circuit functionality.
28
+ :return: A matplotlib figure containing the visualization of the quantum
29
+ circuit generated.
30
+ :rtype: matplotlib.figure.Figure
31
+ """
32
+ with qml.tape.QuantumTape() as tape:
33
+ self._circuit()
34
+ wires = tape.wires.tolist() or [0]
35
+ dev = qml.device("default.qubit", wires=wires)
36
+ qnode = qml.QNode(self._circuit, dev)
37
+ fig, _ = qml.draw_mpl(qnode)()
38
+ return fig
39
+
40
+
41
+ class PennylaneCircuitExportTask(CircuitExportTask, ABC):
42
+ """
43
+ Handles the exportation of Pennylane circuits.
44
+
45
+ This class is responsible for transpiling quantum circuits using Pennylane's
46
+ framework. It provides functionality to translate circuit data into a format
47
+ that can be handled and processed efficiently. The transpilation process is
48
+ monitored and logged for debugging, performance tracking, and error handling.
49
+
50
+ :ivar circuit_data_holder: Holder object containing circuit-related data,
51
+ such as the quantum circuit to be transpiled.
52
+ :type circuit_data_holder: CircuitDataHolder
53
+ :ivar logger: Logger instance used for logging information, warnings,
54
+ debugging details, and errors during circuit export and transpilation.
55
+ :type logger: logging.Logger
56
+ """
57
+
58
+ def _transpile_circuit(self):
59
+ self.logger.info("Transpiling circuit: start")
60
+ try:
61
+ self.logger.debug(
62
+ f"Runtime | python_impl={getattr(sys.implementation, 'name', 'unknown')}"
63
+ f" | version={sys.version.split()[0]}")
64
+ except Exception as env_err:
65
+ self.logger.warning(f"Unable to log Python runtime info: {env_err}")
66
+
67
+ start = time.perf_counter()
68
+ try:
69
+ circuit = self.circuit_data_holder.circuit
70
+ if circuit is None:
71
+ raise ValueError("No circuit found in circuit_data_holder")
72
+
73
+ transpiled_circuit = _PennylaneDrawableCircuit(circuit)
74
+ self.logger.info("Transpiling circuit: completed successfully")
75
+ return transpiled_circuit
76
+ except Exception as e:
77
+ self.logger.exception(f"Transpiling circuit failed: {e}")
78
+ raise
79
+ finally:
80
+ duration = time.perf_counter() - start
81
+ self.logger.debug(f"Transpiling circuit: duration_s={duration:.6f}")
@@ -40,12 +40,16 @@ class QAppPennylaneDevice(CustomDevice):
40
40
 
41
41
  run the circuit and return the result
42
42
  """
43
- self.logger.debug(
44
- f'Creating job with {getattr(options, "shots", None)} shots')
43
+ DEFAULT_SHOTS = 1024
44
+ raw_shots = getattr(options, "shots", None)
45
+ self.logger.debug(f'Creating job with {raw_shots} shots')
46
+
47
+ # PennyLane rejects shots=0 or None; fall back to DEFAULT_SHOTS
48
+ effective_shots = raw_shots if (raw_shots is not None and raw_shots > 0) else DEFAULT_SHOTS
45
49
 
46
- if getattr(options, "shots", None) is None:
50
+ if raw_shots != effective_shots:
47
51
  self.logger.warning(
48
- "Option 'shots' is None; falling back to device or default shots")
52
+ f"Option 'shots' is {raw_shots!r}; using default shots={DEFAULT_SHOTS}")
49
53
 
50
54
  with QuantumTape() as tape:
51
55
  self.logger.debug('Entering QuantumTape context to build circuit')
@@ -92,23 +96,23 @@ class QAppPennylaneDevice(CustomDevice):
92
96
  if parts[1] in [DEVICE_TYPE_9Q_SQUARE_QVM,
93
97
  DEVICE_TYPE_9Q_SQUARE_PYQVM]:
94
98
  self.device = qml.device(device_name, device=device_type,
95
- shots=options.shots)
99
+ shots=effective_shots)
96
100
  else:
97
101
  derived_device = str(tape.num_wires) + device_type[1:]
98
102
  self.logger.debug(
99
103
  f'Derived Rigetti device name: {derived_device}')
100
104
  self.device = qml.device(device_name, device=derived_device,
101
- shots=options.shots)
105
+ shots=effective_shots)
102
106
  elif unsupported_default_qubit_autograd:
103
107
  self.logger.info(
104
108
  f'Falling back to default.qubit due to unsupported "{device_name}" with autograd')
105
109
  self.device = qml.device('default.qubit', wires=tape.wires,
106
- shots=options.shots)
110
+ shots=effective_shots)
107
111
  else:
108
112
  self.logger.info(
109
- f'Selecting device | name="{device_name}" | wires={tape.wires} | shots={getattr(options, "shots", None)}')
113
+ f'Selecting device | name="{device_name}" | wires={tape.wires} | shots={effective_shots}')
110
114
  self.device = qml.device(device_name, wires=tape.wires,
111
- shots=options.shots)
115
+ shots=effective_shots)
112
116
  except Exception as e:
113
117
  self.logger.exception(
114
118
  f'Failed to create device "{device_name}" from spec "{self.device_specification}": {e}')
@@ -180,7 +184,7 @@ class QAppPennylaneDevice(CustomDevice):
180
184
  for i, prob in enumerate(probs):
181
185
  bitstring = format(i,
182
186
  f'0{num_bits}b') if num_bits > 0 else '0'
183
- result_histogram[bitstring] = int(prob * options.shots)
187
+ result_histogram[bitstring] = int(prob * effective_shots)
184
188
  self.logger.info(
185
189
  f'Histogram generated | entries={len(result_histogram)}')
186
190
  else:
@@ -0,0 +1,162 @@
1
+ Metadata-Version: 2.4
2
+ Name: quapp-pennylane
3
+ Version: 0.0.5.dev2
4
+ Summary: Quapp pennylane library supporting Quapp Platform for Quantum Computing
5
+ Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
6
+ License: The MIT License (MIT)
7
+ Copyright © CITYNOW Co. Ltd. All rights reserved.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ Project-URL: Homepage, https://citynow.asia/
15
+ Keywords: quapp,quapp-pennylane,pennylane,quantum
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: quapp-common==0.0.11.dev7
23
+ Requires-Dist: autoray==0.6.11
24
+ Requires-Dist: pennylane==0.37.0
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: PennyLane-Rigetti==0.36.0
27
+ Requires-Dist: PennyLane_Lightning==0.37.0
28
+ Requires-Dist: pydantic<2.0.0,>=1.7.2
29
+ Provides-Extra: dev
30
+ Requires-Dist: black; extra == "dev"
31
+ Requires-Dist: bumpver; extra == "dev"
32
+ Requires-Dist: isort; extra == "dev"
33
+ Requires-Dist: pip-tools; extra == "dev"
34
+ Requires-Dist: pytest; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # quapp-pennylane
38
+
39
+ Quapp PennyLane library supporting the Quapp Platform for Quantum Computing with
40
+ providers, devices, circuit export, invocation, and job fetching utilities.
41
+
42
+ ## Overview
43
+
44
+ `quapp-pennylane` is a Python library that integrates the Quapp Platform with
45
+ PennyLane-based quantum backends and simulators. It provides common abstractions
46
+ for providers and devices, helpers for circuit construction and export, robust job
47
+ submission and result fetching flows, and consistent job-scoped logging across
48
+ all components.
49
+
50
+ ## Features
51
+
52
+ - **Provider & device factories** — PennyLane-compatible factories for local
53
+ simulators (e.g., `default.qubit`) and vendor-backed hardware (Rigetti QVM,
54
+ AWS Braket, IBM Quantum).
55
+ - **Circuit export** — `PennylaneCircuitExportTask` with a `_PennylaneDrawableCircuit`
56
+ adapter that satisfies the `CircuitExportTask.draw()` contract using `qml.draw_mpl`.
57
+ - **Job execution** — `QAppPennylaneDevice` drives the full execution pipeline:
58
+ tape construction, device selection, QNode creation, probability histogram
59
+ generation, and timing metrics.
60
+ - **Rigetti QVM support** — dynamic device-name derivation for N-qubit QVM
61
+ topologies (`Nq-qvm`, `Nq-pyqvm`) alongside fixed 9-qubit variants.
62
+ - **Structured logging** — job-scoped, instance-bound loggers emit structured
63
+ key=value fields at every major step for traceability and debugging.
64
+ - **Compatibility shims** — `quapp_pennylane/__init__.py` patches API breaks
65
+ between `pennylane-rigetti==0.36.0` and PennyLane 0.37–0.42+ at import time
66
+ (see [Compatibility](#compatibility) below).
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install quapp-pennylane
72
+ ```
73
+
74
+ ## Requirements
75
+
76
+ | Dependency | Version |
77
+ |---|---|
78
+ | Python | ≥ 3.10 |
79
+ | quapp-common | 0.0.11.dev7 |
80
+ | pennylane | 0.37.0 |
81
+ | PennyLane-Rigetti | 0.36.0 |
82
+ | PennyLane-Lightning | 0.37.0 |
83
+ | pydantic | ≥ 1.7.2, < 2.0.0 |
84
+ | autoray | 0.6.11 |
85
+
86
+ ## Project Structure
87
+
88
+ ```
89
+ quapp_pennylane/
90
+ ├── __init__.py # Compatibility shims (loaded at import)
91
+ ├── async_tasks/
92
+ │ └── pennylane_circuit_export_task.py # PennylaneCircuitExportTask + adapter
93
+ ├── component/
94
+ │ └── backend/
95
+ │ └── pennylane_invocation.py
96
+ ├── factory/
97
+ │ ├── pennylane_device_factory.py
98
+ │ ├── pennylane_handler_factory.py
99
+ │ └── pennylane_provider_factory.py
100
+ ├── handler/
101
+ │ └── invocation_handler.py
102
+ └── model/
103
+ ├── device/
104
+ │ ├── qapp_pennylane_device.py # Core execution device
105
+ │ ├── aws_braket_device.py
106
+ │ └── ibm_quantum_device.py
107
+ └── provider/
108
+ ├── qapp_pennylane_provider.py
109
+ ├── aws_braket_provider.py
110
+ ├── ibm_cloud_provider.py
111
+ └── ibm_quantum_provider.py
112
+ ```
113
+
114
+ ## Compatibility
115
+
116
+ `quapp_pennylane/__init__.py` applies the following shims at import time so that
117
+ `pennylane-rigetti==0.36.0` works against PennyLane 0.37–0.42+:
118
+
119
+ | Symbol | Change | Shim |
120
+ |---|---|---|
121
+ | `measurements.Expectation` | Renamed to `ExpectationMP` in PennyLane 0.37+ | Alias `Expectation → ExpectationMP` |
122
+ | `operation.Tensor` | Removed in PennyLane 0.40+; replaced by `ops.Prod` | Alias `Tensor → Prod` for isinstance checks |
123
+ | `pennylane.QubitDevice` | Moved to `pennylane.devices` in PennyLane ~0.40+ | Re-export at top-level namespace |
124
+ | `pydantic.BaseModel.__config__` | Removed in Pydantic v2; `qcs-api-client<0.22.0` reads `self.__config__.env_prefix` | Inject a stub `__config__` with `env_prefix=''` onto `BaseModel` |
125
+
126
+ `pydantic` is pinned to `>=1.7.2,<2.0.0` in `pyproject.toml` to make the v1
127
+ requirement of `qcs-api-client<0.22.0` explicit and prevent pip from resolving v2.
128
+
129
+ ## Recent Changes
130
+
131
+ ### 0.0.5.dev2
132
+
133
+ - **fix(export)**: Fix `_PennylaneDrawableCircuit.draw()` — `qml.draw_mpl` requires
134
+ a `QNode`, not a bare callable; now captures the circuit into a `QuantumTape`,
135
+ derives wires, creates a `default.qubit` device, and wraps in a `QNode` before
136
+ rendering with `qml.draw_mpl`.
137
+ - **build**: Bump version to `0.0.5.dev2`.
138
+
139
+ ### 0.0.5.dev1
140
+
141
+ - **feat(device)**: Add structured key=value log fields to `QAppPennylaneDevice`
142
+ at every execution stage — initialization, tape diagnostics, device resolution,
143
+ QNode setup, execution timing, histogram generation, and finalization.
144
+ - **feat(device)**: Default shots fallback — `shots=None` or `shots=0` in
145
+ `CircuitRunningOption` falls back to 1024 with a warning instead of raising.
146
+ - **feat(export)**: Introduce `_PennylaneDrawableCircuit` adapter in
147
+ `PennylaneCircuitExportTask` to wrap PennyLane circuits for the
148
+ `CircuitExportTask.draw()` contract using `qml.draw_mpl`.
149
+ - **feat(export)**: Emit Python runtime information and duration timing in
150
+ `_transpile_circuit`.
151
+ - **fix(compat)**: Patch `pydantic.BaseModel.__config__` at import time for
152
+ Pydantic v2 environments — `qcs-api-client<0.22.0` accesses
153
+ `self.__config__.env_prefix` (a Pydantic v1 inner Config class removed in v2).
154
+ - **fix(deps)**: Pin `pydantic>=1.7.2,<2.0.0` in `pyproject.toml` to prevent
155
+ pip from resolving Pydantic v2.
156
+ - **fix(compat)**: Extend compatibility shims for `pennylane-rigetti==0.36.0`
157
+ against PennyLane 0.37–0.42+: `measurements.Expectation`, `operation.Tensor`,
158
+ and `pennylane.QubitDevice`.
159
+ - **build**: Bump version to `0.0.5.dev1`.
160
+
161
+ For detailed API references, refer to the in-code documentation or contact the
162
+ maintainers at [corp@citynow.vn](mailto:corp@citynow.vn).
@@ -1,90 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: quapp-pennylane
3
- Version: 0.0.4.dev11
4
- Summary: Quapp pennylane library supporting Quapp Platform for Quantum Computing
5
- Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
6
- License: The MIT License (MIT)
7
- Copyright © CITYNOW Co. Ltd. All rights reserved.
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
- Project-URL: Homepage, https://citynow.asia/
15
- Keywords: quapp,quapp-pennylane,pennylane,quantum
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Programming Language :: Python
18
- Classifier: Programming Language :: Python :: 3
19
- Requires-Python: >=3.10
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: quapp-common==0.0.11.dev7
23
- Requires-Dist: autoray==0.6.11
24
- Requires-Dist: pennylane==0.37.0
25
- Requires-Dist: matplotlib
26
- Requires-Dist: PennyLane-Rigetti==0.36.0
27
- Requires-Dist: PennyLane_Lightning==0.37.0
28
- Requires-Dist: pydantic<2.0.0,>=1.7.2
29
- Provides-Extra: dev
30
- Requires-Dist: black; extra == "dev"
31
- Requires-Dist: bumpver; extra == "dev"
32
- Requires-Dist: isort; extra == "dev"
33
- Requires-Dist: pip-tools; extra == "dev"
34
- Requires-Dist: pytest; extra == "dev"
35
- Dynamic: license-file
36
-
37
- # quapp-pennylane
38
-
39
- Quapp PennyLane library supporting the Quapp Platform for Quantum Computing with
40
- providers, devices, circuit export, invocation, and job fetching utilities.
41
-
42
- ## Overview
43
-
44
- `quapp-pennylane` is a Python library that integrates the Quapp Platform with
45
- PennyLane-based quantum backends and simulators. It provides common abstractions
46
- for providers and devices, helpers for circuit construction/export, robust job
47
- submission and result fetching flows, and consistent, job-scoped logging across
48
- components. Recent improvements focus on cleaner and more consistent logging,
49
- better error handling, and clear separation of concerns between invocation and
50
- fetching flows.
51
-
52
- ## Features
53
-
54
- - Provider and device factories for PennyLane-compatible platforms (e.g., local
55
- simulators and vendor-backed devices exposed via PennyLane).
56
- - Circuit export utilities and helpers for building and running PennyLane
57
- circuits.
58
- - Handlers for job invocation and job result fetching with enhanced,
59
- context-rich logging.
60
- - Job-scoped, instance-bound logging for improved traceability and debugging.
61
- - Refined log levels and simplified imports to reduce noise and improve clarity.
62
-
63
- ## Installation
64
-
65
- Install via pip:
66
-
67
- ```bash
68
- pip install quapp-pennylane
69
- ```
70
-
71
- ## Recently Changes Highlights
72
-
73
- - fix: Patch `pydantic.BaseModel.__config__` at import time for Pydantic v2
74
- environments — `qcs-api-client<0.22.0` accesses `self.__config__.env_prefix`
75
- (Pydantic v1 inner Config class removed in v2); shim provides a fallback
76
- `__config__` on `BaseModel` so instance lookup resolves via class MRO instead
77
- of hitting Pydantic v2's `__getattr__` which raises `AttributeError`
78
- - fix: Pin `pydantic>=1.7.2,<2.0.0` in `pyproject.toml` — makes the Pydantic v1
79
- requirement of `qcs-api-client<0.22.0` explicit to prevent pip from resolving v2
80
- - fix: Extend compatibility shims in `quapp_pennylane/__init__.py` for
81
- `pennylane-rigetti==0.36.0` against PennyLane 0.37–0.42+:
82
- - `measurements.Expectation` — renamed to `ExpectationMP` in PennyLane 0.37+
83
- - `operation.Tensor` — removed in PennyLane 0.40+; aliased to `ops.Prod`
84
- (its functional replacement for isinstance checks)
85
- - `pennylane.QubitDevice` — moved to `pennylane.devices` in PennyLane ~0.40+;
86
- re-exported at the top-level namespace
87
- - build: Bump a version to `0.0.4.dev9`
88
-
89
- For detailed usage and API references, please refer to the in-code documentation
90
- or contact the maintainers.
@@ -1,54 +0,0 @@
1
- # quapp-pennylane
2
-
3
- Quapp PennyLane library supporting the Quapp Platform for Quantum Computing with
4
- providers, devices, circuit export, invocation, and job fetching utilities.
5
-
6
- ## Overview
7
-
8
- `quapp-pennylane` is a Python library that integrates the Quapp Platform with
9
- PennyLane-based quantum backends and simulators. It provides common abstractions
10
- for providers and devices, helpers for circuit construction/export, robust job
11
- submission and result fetching flows, and consistent, job-scoped logging across
12
- components. Recent improvements focus on cleaner and more consistent logging,
13
- better error handling, and clear separation of concerns between invocation and
14
- fetching flows.
15
-
16
- ## Features
17
-
18
- - Provider and device factories for PennyLane-compatible platforms (e.g., local
19
- simulators and vendor-backed devices exposed via PennyLane).
20
- - Circuit export utilities and helpers for building and running PennyLane
21
- circuits.
22
- - Handlers for job invocation and job result fetching with enhanced,
23
- context-rich logging.
24
- - Job-scoped, instance-bound logging for improved traceability and debugging.
25
- - Refined log levels and simplified imports to reduce noise and improve clarity.
26
-
27
- ## Installation
28
-
29
- Install via pip:
30
-
31
- ```bash
32
- pip install quapp-pennylane
33
- ```
34
-
35
- ## Recently Changes Highlights
36
-
37
- - fix: Patch `pydantic.BaseModel.__config__` at import time for Pydantic v2
38
- environments — `qcs-api-client<0.22.0` accesses `self.__config__.env_prefix`
39
- (Pydantic v1 inner Config class removed in v2); shim provides a fallback
40
- `__config__` on `BaseModel` so instance lookup resolves via class MRO instead
41
- of hitting Pydantic v2's `__getattr__` which raises `AttributeError`
42
- - fix: Pin `pydantic>=1.7.2,<2.0.0` in `pyproject.toml` — makes the Pydantic v1
43
- requirement of `qcs-api-client<0.22.0` explicit to prevent pip from resolving v2
44
- - fix: Extend compatibility shims in `quapp_pennylane/__init__.py` for
45
- `pennylane-rigetti==0.36.0` against PennyLane 0.37–0.42+:
46
- - `measurements.Expectation` — renamed to `ExpectationMP` in PennyLane 0.37+
47
- - `operation.Tensor` — removed in PennyLane 0.40+; aliased to `ops.Prod`
48
- (its functional replacement for isinstance checks)
49
- - `pennylane.QubitDevice` — moved to `pennylane.devices` in PennyLane ~0.40+;
50
- re-exported at the top-level namespace
51
- - build: Bump a version to `0.0.4.dev9`
52
-
53
- For detailed usage and API references, please refer to the in-code documentation
54
- or contact the maintainers.
@@ -1,53 +0,0 @@
1
- # Quapp Platform Project
2
- # pennylane_circuit_export_task.py
3
- # Copyright © CITYNOW Co. Ltd. All rights reserved.
4
- import sys
5
- import time
6
- from abc import ABC
7
- from io import BytesIO
8
-
9
- import pennylane as qml
10
- from quapp_common.async_tasks.export_circuit_task import CircuitExportTask
11
-
12
-
13
- class PennylaneCircuitExportTask(CircuitExportTask, ABC):
14
-
15
- def _convert(self):
16
- self.logger.debug("Preparing circuit figure...")
17
- circuit = self.circuit_data_holder.circuit
18
- circuit_figure, _ = qml.draw_mpl(circuit)()
19
- self.logger.debug("Converting circuit figure to svg file...")
20
- figure_buffer = BytesIO()
21
- circuit_figure.savefig(figure_buffer, format="svg")
22
-
23
- self.logger.debug("Circuit figure converted successfully")
24
- return figure_buffer
25
-
26
- def _transpile_circuit(self):
27
- self.logger.info("Transpiling circuit: start")
28
- try:
29
- self.logger.debug(
30
- f"Runtime | python_impl={getattr(sys.implementation, 'name', 'unknown')}"
31
- f" | version={sys.version.split()[0]}")
32
- except Exception as env_err:
33
- self.logger.warning(f"Unable to log Python runtime info: {env_err}")
34
-
35
- start = time.perf_counter()
36
- try:
37
- circuit = getattr(self, "circuit", None)
38
- if circuit is None:
39
- self.logger.warning(
40
- "No circuit found on instance; skipping transpilation")
41
- return None
42
-
43
- # TODO: Replace this placeholder with an actual transpilation step if available.
44
- transpiled_circuit = circuit
45
-
46
- self.logger.info("Transpiling circuit: completed successfully")
47
- return transpiled_circuit
48
- except Exception as e:
49
- self.logger.exception(f"Transpiling circuit failed: {e}")
50
- raise
51
- finally:
52
- duration = time.perf_counter() - start
53
- self.logger.debug(f"Transpiling circuit: duration_s={duration:.6f}")
@@ -1,90 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: quapp-pennylane
3
- Version: 0.0.4.dev11
4
- Summary: Quapp pennylane library supporting Quapp Platform for Quantum Computing
5
- Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
6
- License: The MIT License (MIT)
7
- Copyright © CITYNOW Co. Ltd. All rights reserved.
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
- Project-URL: Homepage, https://citynow.asia/
15
- Keywords: quapp,quapp-pennylane,pennylane,quantum
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Programming Language :: Python
18
- Classifier: Programming Language :: Python :: 3
19
- Requires-Python: >=3.10
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: quapp-common==0.0.11.dev7
23
- Requires-Dist: autoray==0.6.11
24
- Requires-Dist: pennylane==0.37.0
25
- Requires-Dist: matplotlib
26
- Requires-Dist: PennyLane-Rigetti==0.36.0
27
- Requires-Dist: PennyLane_Lightning==0.37.0
28
- Requires-Dist: pydantic<2.0.0,>=1.7.2
29
- Provides-Extra: dev
30
- Requires-Dist: black; extra == "dev"
31
- Requires-Dist: bumpver; extra == "dev"
32
- Requires-Dist: isort; extra == "dev"
33
- Requires-Dist: pip-tools; extra == "dev"
34
- Requires-Dist: pytest; extra == "dev"
35
- Dynamic: license-file
36
-
37
- # quapp-pennylane
38
-
39
- Quapp PennyLane library supporting the Quapp Platform for Quantum Computing with
40
- providers, devices, circuit export, invocation, and job fetching utilities.
41
-
42
- ## Overview
43
-
44
- `quapp-pennylane` is a Python library that integrates the Quapp Platform with
45
- PennyLane-based quantum backends and simulators. It provides common abstractions
46
- for providers and devices, helpers for circuit construction/export, robust job
47
- submission and result fetching flows, and consistent, job-scoped logging across
48
- components. Recent improvements focus on cleaner and more consistent logging,
49
- better error handling, and clear separation of concerns between invocation and
50
- fetching flows.
51
-
52
- ## Features
53
-
54
- - Provider and device factories for PennyLane-compatible platforms (e.g., local
55
- simulators and vendor-backed devices exposed via PennyLane).
56
- - Circuit export utilities and helpers for building and running PennyLane
57
- circuits.
58
- - Handlers for job invocation and job result fetching with enhanced,
59
- context-rich logging.
60
- - Job-scoped, instance-bound logging for improved traceability and debugging.
61
- - Refined log levels and simplified imports to reduce noise and improve clarity.
62
-
63
- ## Installation
64
-
65
- Install via pip:
66
-
67
- ```bash
68
- pip install quapp-pennylane
69
- ```
70
-
71
- ## Recently Changes Highlights
72
-
73
- - fix: Patch `pydantic.BaseModel.__config__` at import time for Pydantic v2
74
- environments — `qcs-api-client<0.22.0` accesses `self.__config__.env_prefix`
75
- (Pydantic v1 inner Config class removed in v2); shim provides a fallback
76
- `__config__` on `BaseModel` so instance lookup resolves via class MRO instead
77
- of hitting Pydantic v2's `__getattr__` which raises `AttributeError`
78
- - fix: Pin `pydantic>=1.7.2,<2.0.0` in `pyproject.toml` — makes the Pydantic v1
79
- requirement of `qcs-api-client<0.22.0` explicit to prevent pip from resolving v2
80
- - fix: Extend compatibility shims in `quapp_pennylane/__init__.py` for
81
- `pennylane-rigetti==0.36.0` against PennyLane 0.37–0.42+:
82
- - `measurements.Expectation` — renamed to `ExpectationMP` in PennyLane 0.37+
83
- - `operation.Tensor` — removed in PennyLane 0.40+; aliased to `ops.Prod`
84
- (its functional replacement for isinstance checks)
85
- - `pennylane.QubitDevice` — moved to `pennylane.devices` in PennyLane ~0.40+;
86
- re-exported at the top-level namespace
87
- - build: Bump a version to `0.0.4.dev9`
88
-
89
- For detailed usage and API references, please refer to the in-code documentation
90
- or contact the maintainers.