quapp-common 0.0.12.dev4__tar.gz → 0.0.12.dev6__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.dev4/quapp_common.egg-info → quapp_common-0.0.12.dev6}/PKG-INFO +13 -1
  2. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/README.md +12 -0
  3. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/pyproject.toml +1 -1
  4. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/bridge.py +1 -1
  5. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/circuit_adapter.py +5 -3
  6. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/dispatcher.py +33 -5
  7. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6/quapp_common.egg-info}/PKG-INFO +13 -1
  8. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/LICENSE +0 -0
  9. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/__init__.py +0 -0
  10. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/async_tasks/__init__.py +0 -0
  11. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/async_tasks/async_invocation_task.py +0 -0
  12. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/async_tasks/async_task.py +0 -0
  13. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/async_tasks/export_circuit_task.py +0 -0
  14. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/async_tasks/post_processing_task.py +0 -0
  15. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/__init__.py +0 -0
  16. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/backend/__init__.py +0 -0
  17. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/backend/invocation.py +0 -0
  18. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/backend/job_fetcher.py +0 -0
  19. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/backend/job_fetching.py +0 -0
  20. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/backend/job_manager.py +0 -0
  21. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/callback/__init__.py +0 -0
  22. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/callback/update_job_metadata.py +0 -0
  23. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/device/__init__.py +0 -0
  24. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/device/device_selection.py +0 -0
  25. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/component/result_serializer.py +0 -0
  26. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/config/__init__.py +0 -0
  27. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/config/logging_config.py +0 -0
  28. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/config/thread_config.py +0 -0
  29. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/__init__.py +0 -0
  30. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/async_task/__init__.py +0 -0
  31. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/async_task/circuit_export/__init__.py +0 -0
  32. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/async_task/circuit_export/backend_holder.py +0 -0
  33. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/async_task/circuit_export/circuit_holder.py +0 -0
  34. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/backend/__init__.py +0 -0
  35. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/backend/backend_information.py +0 -0
  36. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/callback/__init__.py +0 -0
  37. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/callback/callback_url.py +0 -0
  38. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/device/__init__.py +0 -0
  39. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/device/circuit_running_option.py +0 -0
  40. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/promise/__init__.py +0 -0
  41. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/promise/post_processing_promise.py +0 -0
  42. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/promise/promise.py +0 -0
  43. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/request/__init__.py +0 -0
  44. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/request/invocation_request.py +0 -0
  45. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/request/job_fetching_request.py +0 -0
  46. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/request/request.py +0 -0
  47. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/response/__init__.py +0 -0
  48. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/response/authentication.py +0 -0
  49. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/response/custom_header.py +0 -0
  50. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/data/response/job_response.py +0 -0
  51. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/__init__.py +0 -0
  52. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/base_enum.py +0 -0
  53. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/http_header.py +0 -0
  54. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/invocation_step.py +0 -0
  55. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/language.py +0 -0
  56. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/media_type.py +0 -0
  57. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/processing_unit.py +0 -0
  58. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/provider_tag.py +0 -0
  59. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/sdk.py +0 -0
  60. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/status/__init__.py +0 -0
  61. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/status/job_status.py +0 -0
  62. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/status/status_code.py +0 -0
  63. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/enum/token_type.py +0 -0
  64. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/factory/__init__.py +0 -0
  65. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/factory/device_factory.py +0 -0
  66. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/factory/handler_factory.py +0 -0
  67. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/factory/provider_factory.py +0 -0
  68. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/handler/__init__.py +0 -0
  69. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/handler/handler.py +0 -0
  70. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/__init__.py +0 -0
  71. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/device/__init__.py +0 -0
  72. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/device/custom_device.py +0 -0
  73. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/device/device.py +0 -0
  74. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/invocation.py +0 -0
  75. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/provider/__init__.py +0 -0
  76. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/model/provider/provider.py +0 -0
  77. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/util/__init__.py +0 -0
  78. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/util/file_utils.py +0 -0
  79. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/util/http_utils.py +0 -0
  80. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/util/json_parser_utils.py +0 -0
  81. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common/util/response_utils.py +0 -0
  82. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common.egg-info/SOURCES.txt +0 -0
  83. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common.egg-info/dependency_links.txt +0 -0
  84. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common.egg-info/requires.txt +0 -0
  85. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/quapp_common.egg-info/top_level.txt +0 -0
  86. {quapp_common-0.0.12.dev4 → quapp_common-0.0.12.dev6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quapp-common
3
- Version: 0.0.12.dev4
3
+ Version: 0.0.12.dev6
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)
@@ -101,6 +101,18 @@ Notes:
101
101
 
102
102
  ## Recently Changes Highlights
103
103
 
104
+ ### v0.0.12.dev6
105
+ - Fix: replace direct `from pytket.extensions.braket import ...` and
106
+ `from pytket.extensions.pyquil import ...` with `importlib.import_module()`
107
+ in `CircuitAdapter` — avoids IDE static-analysis false positives caused by
108
+ `pytket.extensions` being a namespace package populated at runtime by
109
+ separately installed `pytket-braket` / `pytket-pyquil` packages.
110
+
111
+ ### v0.0.12.dev5
112
+ - Version bump to 0.0.12.dev5.
113
+ - Refactor: update logger imports in `SubprocessBridge`, `CircuitAdapter`, and `SubprocessDispatcher`
114
+ to use relative paths (`from ..config.logging_config import logger`) for consistency across modules.
115
+
104
116
  ### v0.0.12.dev4
105
117
  - Version bumps to 0.0.12.dev4.
106
118
  - Fix: `AsyncInvocationTask._on_task_done` now properly fires the step error
@@ -64,6 +64,18 @@ Notes:
64
64
 
65
65
  ## Recently Changes Highlights
66
66
 
67
+ ### v0.0.12.dev6
68
+ - Fix: replace direct `from pytket.extensions.braket import ...` and
69
+ `from pytket.extensions.pyquil import ...` with `importlib.import_module()`
70
+ in `CircuitAdapter` — avoids IDE static-analysis false positives caused by
71
+ `pytket.extensions` being a namespace package populated at runtime by
72
+ separately installed `pytket-braket` / `pytket-pyquil` packages.
73
+
74
+ ### v0.0.12.dev5
75
+ - Version bump to 0.0.12.dev5.
76
+ - Refactor: update logger imports in `SubprocessBridge`, `CircuitAdapter`, and `SubprocessDispatcher`
77
+ to use relative paths (`from ..config.logging_config import logger`) for consistency across modules.
78
+
67
79
  ### v0.0.12.dev4
68
80
  - Version bumps to 0.0.12.dev4.
69
81
  - Fix: `AsyncInvocationTask._on_task_done` now properly fires the step error
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quapp-common"
7
- version = "0.0.12.dev4"
7
+ version = "0.0.12.dev6"
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" }]
@@ -7,10 +7,10 @@
7
7
  # bridge.py
8
8
  # Copyright © CITYNOW Co. Ltd. All rights reserved.
9
9
 
10
- from config.logging_config import logger
11
10
  from .circuit_adapter import CircuitAdapter
12
11
  from .dispatcher import SubprocessDispatcher
13
12
  from .result_serializer import ResultSerializer
13
+ from ..config.logging_config import logger
14
14
  from ..enum.language import Language
15
15
  from ..enum.sdk import Sdk
16
16
 
@@ -5,7 +5,7 @@
5
5
  # circuit_adapter.py
6
6
  # Copyright © CITYNOW Co. Ltd. All rights reserved.
7
7
 
8
- from config.logging_config import logger
8
+ from ..config.logging_config import logger
9
9
  from ..enum.sdk import Sdk
10
10
 
11
11
  logger = logger.bind(context=__name__)
@@ -48,8 +48,9 @@ class CircuitAdapter:
48
48
  return QuantumCircuit.from_qasm_str(qasm_str)
49
49
 
50
50
  elif sdk == Sdk.BRAKET:
51
+ import importlib
51
52
  from pytket.qasm import circuit_from_qasm_str
52
- from pytket.extensions.braket import tk_to_braket
53
+ tk_to_braket = importlib.import_module("pytket.extensions.braket").tk_to_braket
53
54
  return tk_to_braket(circuit_from_qasm_str(qasm_str))
54
55
 
55
56
  elif sdk == Sdk.PENNYLANE:
@@ -82,8 +83,9 @@ class CircuitAdapter:
82
83
  return _circuit
83
84
 
84
85
  elif sdk == Sdk.PYQUIL:
86
+ import importlib
85
87
  from pytket.qasm import circuit_from_qasm_str
86
- from pytket.extensions.pyquil import tk_to_pyquil
88
+ tk_to_pyquil = importlib.import_module("pytket.extensions.pyquil").tk_to_pyquil
87
89
  return tk_to_pyquil(circuit_from_qasm_str(qasm_str))
88
90
 
89
91
  elif sdk == Sdk.QIBO:
@@ -10,7 +10,7 @@ import json
10
10
  import os
11
11
  import subprocess
12
12
 
13
- from config.logging_config import logger
13
+ from ..config.logging_config import logger
14
14
  from ..enum.language import Language
15
15
 
16
16
  logger = logger.bind(context=__name__)
@@ -64,12 +64,40 @@ class SubprocessDispatcher:
64
64
  logger.debug(f"Subprocess stderr: {result.stderr[:500]}")
65
65
 
66
66
  if result.returncode != 0:
67
+ error_message = SubprocessDispatcher._extract_error_message(result)
67
68
  logger.error(
68
- f"Handler runner failed (exit={result.returncode}): {result.stderr[:500]}")
69
- raise RuntimeError(f"Handler runner failed: {result.stderr}")
69
+ f"Handler runner failed (exit={result.returncode}): {error_message[:500]}")
70
+ raise RuntimeError(f"Handler runner failed: {error_message}")
70
71
 
71
- logger.debug(f"Subprocess completed successfully, action={action}")
72
- return json.loads(result.stdout)
72
+ if not result.stdout:
73
+ raise RuntimeError("Handler runner produced no output")
74
+
75
+ try:
76
+ return json.loads(result.stdout)
77
+ except json.JSONDecodeError as exc:
78
+ raise RuntimeError(
79
+ f"Handler runner returned invalid JSON: {exc}") from exc
80
+
81
+ @staticmethod
82
+ def _extract_error_message(result) -> str:
83
+ """Extract the most meaningful error message from a failed subprocess.
84
+
85
+ Priority order:
86
+ 1. Structured JSON on stdout – {"status":"error","error":"..."}
87
+ 2. Raw stderr text
88
+ 3. Generic exit-code string
89
+ """
90
+ if result.stdout:
91
+ try:
92
+ parsed = json.loads(result.stdout)
93
+ if parsed.get('status') == 'error':
94
+ return (parsed.get('error') or parsed.get(
95
+ 'stack') or 'Unknown JS error')
96
+ except (json.JSONDecodeError, AttributeError):
97
+ pass
98
+ if result.stderr:
99
+ return result.stderr.strip()
100
+ return f"exit code {result.returncode}"
73
101
 
74
102
  @staticmethod
75
103
  def is_subprocess_language(language_str: str) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quapp-common
3
- Version: 0.0.12.dev4
3
+ Version: 0.0.12.dev6
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)
@@ -101,6 +101,18 @@ Notes:
101
101
 
102
102
  ## Recently Changes Highlights
103
103
 
104
+ ### v0.0.12.dev6
105
+ - Fix: replace direct `from pytket.extensions.braket import ...` and
106
+ `from pytket.extensions.pyquil import ...` with `importlib.import_module()`
107
+ in `CircuitAdapter` — avoids IDE static-analysis false positives caused by
108
+ `pytket.extensions` being a namespace package populated at runtime by
109
+ separately installed `pytket-braket` / `pytket-pyquil` packages.
110
+
111
+ ### v0.0.12.dev5
112
+ - Version bump to 0.0.12.dev5.
113
+ - Refactor: update logger imports in `SubprocessBridge`, `CircuitAdapter`, and `SubprocessDispatcher`
114
+ to use relative paths (`from ..config.logging_config import logger`) for consistency across modules.
115
+
104
116
  ### v0.0.12.dev4
105
117
  - Version bumps to 0.0.12.dev4.
106
118
  - Fix: `AsyncInvocationTask._on_task_done` now properly fires the step error