qoro-divi 0.3.2b0__py3-none-any.whl → 0.3.3__py3-none-any.whl

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.

Potentially problematic release.


This version of qoro-divi might be problematic. Click here for more details.

divi/reporter.py CHANGED
@@ -1,3 +1,7 @@
1
+ # SPDX-FileCopyrightText: 2025 Qoro Quantum Ltd <divi@qoroquantum.de>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  import logging
2
6
  from abc import ABC, abstractmethod
3
7
  from queue import Queue
@@ -25,25 +29,34 @@ class ProgressReporter(ABC):
25
29
  class QueueProgressReporter(ProgressReporter):
26
30
  """Reports progress by putting structured dictionaries onto a Queue."""
27
31
 
28
- def __init__(self, job_id: str, progress_queue: Queue):
32
+ def __init__(
33
+ self, job_id: str, progress_queue: Queue, has_final_computation: bool = False
34
+ ):
29
35
  self._job_id = job_id
30
36
  self._queue = progress_queue
37
+ self.has_final_computation = has_final_computation
31
38
 
32
39
  def update(self, **kwargs):
33
40
  payload = {"job_id": self._job_id, "progress": 1}
34
41
  self._queue.put(payload)
35
42
 
36
43
  def info(self, message: str, **kwargs):
37
- payload = {"job_id": self._job_id, "progress": 0}
44
+ payload = {"job_id": self._job_id, "progress": 0, "message": message}
45
+
46
+ # Determine if this message indicates the job is truly finished.
47
+ is_final_step = "Computed Final Solution" in message or (
48
+ "Finished Optimization" in message and not self.has_final_computation
49
+ )
38
50
 
39
- if "Finished Optimization" in message or "Computed Final Solution" in message:
51
+ if is_final_step:
40
52
  payload["final_status"] = "Success"
41
53
  elif "poll_attempt" in kwargs:
54
+ # For polling, remove the message key so the last message persists.
55
+ del payload["message"]
42
56
  payload["poll_attempt"] = kwargs["poll_attempt"]
43
57
  payload["max_retries"] = kwargs["max_retries"]
44
- payload["service_job_id"] = kwargs.get("service_job_id")
45
- else:
46
- payload["message"] = message
58
+ payload["service_job_id"] = kwargs["service_job_id"]
59
+ payload["job_status"] = kwargs["job_status"]
47
60
 
48
61
  self._queue.put(payload)
49
62
 
@@ -51,6 +64,10 @@ class QueueProgressReporter(ProgressReporter):
51
64
  class LoggingProgressReporter(ProgressReporter):
52
65
  """Reports progress by logging messages to the console."""
53
66
 
67
+ # Define ANSI color codes
68
+ CYAN = "\033[36m"
69
+ RESET = "\033[0m"
70
+
54
71
  def update(self, **kwargs):
55
72
  # You can decide how to format the update for logging
56
73
  logger.info(f"Finished Iteration #{kwargs['iteration']}\r\n")
@@ -59,7 +76,7 @@ class LoggingProgressReporter(ProgressReporter):
59
76
  # A special check for iteration updates to mimic old behavior
60
77
  if "poll_attempt" in kwargs:
61
78
  logger.info(
62
- rf"Polling Job {kwargs['job_service_id'].split('-')[0]}: {kwargs['poll_attempt']} / {kwargs['max_retries']} retries\r",
79
+ f"Job {self.CYAN}{kwargs['service_job_id'].split('-')[0]}{self.RESET} is {kwargs['job_status']}. Polling attempt {kwargs['poll_attempt']} / {kwargs['max_retries']}\r",
63
80
  extra={"append": True},
64
81
  )
65
82
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qoro-divi
3
- Version: 0.3.2b0
3
+ Version: 0.3.3
4
4
  Summary: A Python library to automate generating, parallelizing, and executing quantum programs.
5
5
  Author: Ahmed Darwish
6
6
  Author-email: ahmed@qoroquantum.de
@@ -21,7 +21,7 @@ Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
21
21
  Requires-Dist: qiskit (<2.0)
22
22
  Requires-Dist: qiskit-aer (>=0.17.1,<0.18.0)
23
23
  Requires-Dist: qiskit-ibm-runtime (>=0.37,<0.38)
24
- Requires-Dist: qiskit-optimization (>=0.6.1,<0.7.0)
24
+ Requires-Dist: qiskit-optimization[cplex] (>=0.7.0,<0.8.0)
25
25
  Requires-Dist: requests (>=2.32.4,<3.0.0)
26
26
  Requires-Dist: rich (>=14.0.0,<15.0.0)
27
27
  Requires-Dist: scikit-learn (>=1.7.0,<2.0.0)
@@ -1,12 +1,12 @@
1
1
  divi/__init__.py,sha256=WNAlzdjio0M5la_NTGk4-0AFqItI6HEBExRs6ck9j0Y,203
2
- divi/_pbar.py,sha256=M6FQByH63bWwzsKtedW49Hm7hFsnb1X5AlFfCZFSvuU,2019
2
+ divi/_pbar.py,sha256=I8AWI93mpcJXIXTIvsa3JghazO65Pmrq-bW2bJTf2Ik,2131
3
3
  divi/circuits.py,sha256=OKcwTMXIvCIjvpLvdeQBWGYElcVUNNyA3z8yXnxUXeo,4476
4
- divi/exp/cirq/__init__.py,sha256=4wd5rEiNgsPVSK8uLYdJMf54B1ITdtKfMJtdnRpfwTE,350
4
+ divi/exp/cirq/__init__.py,sha256=6NjP3TlQn_oNkg8VrKvEIoYQxB5Bx0mLLFOT3SXReTc,371
5
5
  divi/exp/cirq/_lexer.py,sha256=x5UArrnN_JEyiq7E02ikq0wdmqZ2vEQ3_FADL1LIhQI,3187
6
6
  divi/exp/cirq/_parser.py,sha256=z_bSn4m03-sfRlN8eL99Mo4LnjY-zmR-Xt6UrjzstZc,29279
7
7
  divi/exp/cirq/_qasm_export.py,sha256=8C5xLYvIIkQTWWAAYo7ZjwtQjvYXNSflbf5UyUx6YUE,1024
8
8
  divi/exp/cirq/_qasm_import.py,sha256=HbehrgfLl3iDdRyWr4o26Bek3ZpN-_dvNVSexl5-aVE,969
9
- divi/exp/cirq/_validator.py,sha256=nYbJdT_0hCVUgZA0YiKZ8G1oDgwmcqEiy-LZH41EgUw,20481
9
+ divi/exp/cirq/_validator.py,sha256=552fiXRpiuXc6aoNNXjnv6SWWCAdBAKieQEOTfCQy1s,20484
10
10
  divi/exp/cirq/exception.py,sha256=w1w2vSubOGMRmyKBFqXejxfeIAzkPZ6V7gSrDX_ap4A,765
11
11
  divi/exp/scipy/_cobyla.py,sha256=cnCf5AsOM8JWIMiujuUbWMNOgmUr3ZET9y04hUyumHs,10937
12
12
  divi/exp/scipy/pyprima/LICENCE.txt,sha256=mXN5ssG_U6OR0v0yldznW_PJTtKNZIgu3jDRtRjLDdY,1533
@@ -40,23 +40,23 @@ divi/interfaces.py,sha256=P-8lekQIGwbhHv4ewfMFtKYIjmQHu7nmscwAmxsx72U,594
40
40
  divi/parallel_simulator.py,sha256=2JCwmootXLtDplplEqtykKc8HiYe6G0zKWemIb-IIdE,8947
41
41
  divi/qasm.py,sha256=lfWky4E9qetotVo8BII58svutVVZEV14BntoC14bo40,7384
42
42
  divi/qem.py,sha256=o6rMPUcxLuCBitBb8-QcxveUiKZVsP3HMamxyVFLi6M,6805
43
- divi/qlogger.py,sha256=VaCnw-u8VkR7JukjOp39r0V89wO-SSpDj5l50ejnHUg,3801
44
- divi/qoro_service.py,sha256=sv94S_xdY4k4YYSK3PgX4sgvgldFMkjJ3wtQO1a_2Yc,13557
45
- divi/qprog/__init__.py,sha256=quz1zEdrY71TuNVXUHq9u92sORgPmmNq8y6ozMiYnTI,507
46
- divi/qprog/_graph_partitioning.py,sha256=ZVDKc5--YB9EmuA7Qsyc0Rc5P-eojWpglO-XqoMmbZk,23620
47
- divi/qprog/_qaoa.py,sha256=FCO3s0mA6rlrymqUjvpfY640DoLLIFP8tqi8z7UAamM,16129
48
- divi/qprog/_qubo_partitioning.py,sha256=7MxeUfZ5PDkfzPprcXh_1omdvUuCK_I4qh1915XAVhk,7388
49
- divi/qprog/_vqe.py,sha256=0MNSZA9wb6CKhLIT5SpM_J2ncW-p1frKBp8k0ipOYwQ,9985
50
- divi/qprog/_vqe_sweep.py,sha256=lTWPG7vwtVS91Piqc5-_tlhglO8RFkMhlatCTz-8PZg,17214
51
- divi/qprog/batch.py,sha256=UWiDsABFWNggvR136jBnTg6r5OUuHHh3nOCGL1keAy8,9654
52
- divi/qprog/optimizers.py,sha256=l19zIyt1l0IhUbLofEXlwE9XnsILk7ANlwACi3KKN4w,2034
53
- divi/qprog/quantum_program.py,sha256=hJ5uraX9ZNicfoJu3X0aAe8KTJUzndgX5GyoHZ1GOB8,16921
43
+ divi/qlogger.py,sha256=TcZMaNZXDHguKJGLD6t2bEmP25rkRQVaSS8FLs9U-lI,3822
44
+ divi/qoro_service.py,sha256=CASWEE6ySlFeQ6pHeOZJUUuwnldEVsPakn_4jTFPnX0,14087
45
+ divi/qprog/__init__.py,sha256=av3I0i3VldwblycfQjcXcJHGVY1m05rnsZ0R5iGMCwk,546
46
+ divi/qprog/_graph_partitioning.py,sha256=cYeHQ2VJAeOzooO43dPfWdXjRZPF_UmHR_H2D7VIpnU,23666
47
+ divi/qprog/_qaoa.py,sha256=Cq1AnaS386iGEv8OiHhSkyGkMG1MwfX3_mq2jBXavgI,15950
48
+ divi/qprog/_qubo_partitioning.py,sha256=h2QPDm1pzNYzsrvw0WZ04fb-nOzj8xFqf5YZqOU5FHk,7470
49
+ divi/qprog/_vqe.py,sha256=21KVvf40UGwxuJQ0OJ1YuiFctvEVbJRklilpxgopnkA,10069
50
+ divi/qprog/_vqe_sweep.py,sha256=T5tXVOENn4VlzwUxSR0SGbv1EWVRdy4H9m1M_sLElCk,17286
51
+ divi/qprog/batch.py,sha256=jxeOO5xFecCCmA82GDAtg3mA8PeW_c5O5ooqEcb2-Bg,10093
52
+ divi/qprog/optimizers.py,sha256=sbOxd9VgMroZn1llN5wyIMLEM-a4x_YKJpt34ApaKX8,6453
53
+ divi/qprog/quantum_program.py,sha256=D2L1zjvW_G3O0oNgty3Y_QhIGrJz0V4rzcz6VSoXFME,14779
54
54
  divi/qpu_system.py,sha256=teVeG18ukyzMFgbPSr4BLx4MJUHVK382RqZMOy2voFk,374
55
- divi/reporter.py,sha256=inR-a1QBhdw96pFBdRGBxhWI-Jmoxy1iWiAH4gLiXrQ,2329
55
+ divi/reporter.py,sha256=AgB2Mno1sIXF-VhOi8i-LGuWG5FMG1HelMw5cMc84HM,2977
56
56
  divi/utils.py,sha256=EEyGakoz33AvU0Rq7iijL8AULMg4FGcGBtmOlpSw-tY,3603
57
- qoro_divi-0.3.2b0.dist-info/LICENSE,sha256=NS4JlQrgNwg1bvB3kE5shE-P4cJgnntgl-kClbOpG_Q,10760
58
- qoro_divi-0.3.2b0.dist-info/LICENSES/.license-header,sha256=2jN_xtJscqP8LG-NaveY2KHUkfRCC543Y_XjOyKEfWY,105
59
- qoro_divi-0.3.2b0.dist-info/LICENSES/Apache-2.0.txt,sha256=yoILHpvVuguUBpk8UwMnzJbcHUUyst9iGNNuEwUtWVc,10270
60
- qoro_divi-0.3.2b0.dist-info/METADATA,sha256=gEOZ_q1nlexh4yGU8cZx1dY5w7pM24VrDQz_VH1tpOk,2423
61
- qoro_divi-0.3.2b0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
62
- qoro_divi-0.3.2b0.dist-info/RECORD,,
57
+ qoro_divi-0.3.3.dist-info/LICENSE,sha256=NS4JlQrgNwg1bvB3kE5shE-P4cJgnntgl-kClbOpG_Q,10760
58
+ qoro_divi-0.3.3.dist-info/LICENSES/.license-header,sha256=2jN_xtJscqP8LG-NaveY2KHUkfRCC543Y_XjOyKEfWY,105
59
+ qoro_divi-0.3.3.dist-info/LICENSES/Apache-2.0.txt,sha256=yoILHpvVuguUBpk8UwMnzJbcHUUyst9iGNNuEwUtWVc,10270
60
+ qoro_divi-0.3.3.dist-info/METADATA,sha256=txN4vgtVVbI_PuH1vtN70jRHY21S7WL35Bj1eFOxgBA,2428
61
+ qoro_divi-0.3.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
62
+ qoro_divi-0.3.3.dist-info/RECORD,,