luna-quantum 1.0.2__cp313-cp313-macosx_10_12_x86_64.whl → 1.0.3rc1__cp313-cp313-macosx_10_12_x86_64.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 luna-quantum might be problematic. Click here for more details.

luna_quantum/__init__.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from luna_quantum._core import __luna_quantum_version__
2
2
  from luna_quantum.aqm_overwrites.model import Model
3
3
  from luna_quantum.client.controllers import LunaQ, LunaSolve
4
+ from luna_quantum.config import config
4
5
  from luna_quantum.factories.luna_solve_client_factory import LunaSolveClientFactory
5
6
  from luna_quantum.factories.usecase_factory import UseCaseFactory
6
7
  from luna_quantum.solve import DefaultToken
@@ -107,6 +108,7 @@ __all__ = [
107
108
  "__version__",
108
109
  "algorithms",
109
110
  "backends",
111
+ "config",
110
112
  "constants",
111
113
  "debug_info",
112
114
  "errors",
luna_quantum/__init__.pyi CHANGED
@@ -33,6 +33,7 @@ from .utils import quicksum
33
33
  from luna_quantum._core import __luna_quantum_version__
34
34
  from luna_quantum.aqm_overwrites.model import Model
35
35
  from luna_quantum.client.controllers import LunaQ, LunaSolve
36
+ from luna_quantum.config import config
36
37
  from luna_quantum.solve import DefaultToken
37
38
  from luna_quantum.solve.parameters import algorithms, backends, constants
38
39
  from luna_quantum.util.debug_info import debug_info
@@ -73,6 +74,7 @@ __all__ = [
73
74
  "__version__",
74
75
  "algorithms",
75
76
  "backends",
77
+ "config",
76
78
  "constants",
77
79
  "debug_info",
78
80
  "errors",
Binary file
luna_quantum/config.py ADDED
@@ -0,0 +1,11 @@
1
+ from pydantic_settings import BaseSettings
2
+
3
+
4
+ class Config(BaseSettings):
5
+ """Class for all config values."""
6
+
7
+ LUNA_LOG_DEFAULT_LEVEL: str = "INFO"
8
+ LUNA_LOG_DISABLE_SPINNER: bool = False
9
+
10
+
11
+ config = Config()
@@ -3,13 +3,15 @@ from __future__ import annotations
3
3
  import logging
4
4
  from contextlib import contextmanager
5
5
  from functools import wraps
6
- from typing import TYPE_CHECKING, ClassVar, ParamSpec, TypeVar
6
+ from typing import TYPE_CHECKING, ParamSpec, TypeVar
7
7
 
8
8
  from rich.console import Console
9
9
  from rich.logging import RichHandler
10
10
  from rich.progress import Progress, SpinnerColumn, TaskID, TextColumn
11
11
  from rich.theme import Theme
12
12
 
13
+ from luna_quantum.config import config
14
+
13
15
  if TYPE_CHECKING:
14
16
  from collections.abc import Callable, Generator
15
17
 
@@ -27,7 +29,20 @@ class Logging:
27
29
  - Manage consistent logging behavior across the SDK
28
30
  """
29
31
 
30
- _log_level: ClassVar[int] = logging.INFO
32
+ @staticmethod
33
+ def is_process_bar_shown() -> bool:
34
+ """
35
+ Return whether to use a process bar for progress bars.
36
+
37
+ Returns
38
+ -------
39
+ bool
40
+ Returns whether to use a process bar for progress bars.
41
+ """
42
+ return (
43
+ not config.LUNA_LOG_DISABLE_SPINNER
44
+ and Logging.get_level() != logging.NOTSET
45
+ )
31
46
 
32
47
  @staticmethod
33
48
  def set_level(log_level: int) -> None:
@@ -38,12 +53,12 @@ class Logging:
38
53
  log_level : int
39
54
  Logging level to set (e.g., logging.DEBUG, logging.INFO)
40
55
  """
56
+ config.LUNA_LOG_DEFAULT_LEVEL = logging.getLevelName(log_level)
57
+
41
58
  for logger_name in logging.root.manager.loggerDict:
42
59
  if logger_name.startswith("luna_quantum"): # Only modify SDK loggers
43
60
  logging.getLogger(logger_name).setLevel(log_level)
44
61
 
45
- Logging._log_level = log_level
46
-
47
62
  @staticmethod
48
63
  def get_level() -> int:
49
64
  """Return the current logging level for the SDK.
@@ -54,7 +69,7 @@ class Logging:
54
69
  Current logging level as defined in the logging module
55
70
  (e.g., logging.DEBUG, logging.INFO, etc.)
56
71
  """
57
- return Logging._log_level
72
+ return logging._nameToLevel.get(config.LUNA_LOG_DEFAULT_LEVEL, logging.INFO) # noqa: SLF001 #No other way to map these log levels.
58
73
 
59
74
  @staticmethod
60
75
  def get_console() -> Console:
@@ -85,7 +100,7 @@ class Logging:
85
100
  Configured logger instance with appropriate handlers
86
101
  """
87
102
  logger = logging.getLogger(name)
88
- logger.setLevel(Logging._log_level)
103
+ logger.setLevel(Logging.get_level())
89
104
  logger.propagate = False
90
105
 
91
106
  if logger.hasHandlers():
@@ -107,7 +122,7 @@ class Logging:
107
122
  @contextmanager
108
123
  def progress_bar(
109
124
  total: int | None, desc: str = "", unit: str = "steps"
110
- ) -> Generator[tuple[Progress, TaskID], None, None]:
125
+ ) -> Generator[tuple[Progress, TaskID]]:
111
126
  """Create a progress bar using Rich as a context manager.
112
127
 
113
128
  Parameters
@@ -136,6 +151,7 @@ def progress_bar(
136
151
  )
137
152
  ),
138
153
  transient=True,
154
+ disable=not Logging.is_process_bar_shown(),
139
155
  ) as progress:
140
156
  task = progress.add_task(f"[blue]{desc}", total=total, unit=unit)
141
157
  yield progress, task # Yield both progress and task for updates
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: luna-quantum
3
- Version: 1.0.2
3
+ Version: 1.0.3rc1
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: License :: OSI Approved :: Apache Software License
6
6
  Classifier: Operating System :: OS Independent
7
7
  Classifier: Topic :: Scientific/Engineering
8
8
  Requires-Dist: httpx>=0.28.1,<0.29
9
9
  Requires-Dist: numpy>=1
10
+ Requires-Dist: pydantic-settings>=2.10.1
10
11
  Requires-Dist: pydantic[email]>=2.11.3,<3
11
12
  Requires-Dist: python-dateutil>=2.9.0,<3
12
13
  Requires-Dist: rich>=14.0.0
@@ -1,10 +1,10 @@
1
- luna_quantum-1.0.2.dist-info/METADATA,sha256=9lTewsIfCY4ToenZtDn_98Dt5nRwB9evm7As2rgKUnk,1530
2
- luna_quantum-1.0.2.dist-info/WHEEL,sha256=wSGr6OIJgwRPWZnPAVOrHij4aC8ZJCcq6TxNvrljOp4,106
3
- luna_quantum-1.0.2.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
- luna_quantum-1.0.2.dist-info/licenses/NOTICE,sha256=noPOS8eDj5XoyRO8ZrCxIOh5fSjk0RildIrrqxQlepY,588
5
- luna_quantum/__init__.py,sha256=VVqJBFKl8ET7gJmebXVnTsD33sIFfhxKm7_eB12YVkU,3170
6
- luna_quantum/__init__.pyi,sha256=dG3-NeEI8ApxHUcVq-Ov9Pa9D3Px_5yWUWkxhLsfL80,1608
7
- luna_quantum/_core.cpython-313-darwin.so,sha256=81PHvMH0N_vSasoQbgNjnzktliCw7AvcvKlgKCwrVvU,4545540
1
+ luna_quantum-1.0.3rc1.dist-info/METADATA,sha256=ZIsgDgMD7Y_SnyfZfiCZiuWYOe_vL2bYlZ62QjhYook,1574
2
+ luna_quantum-1.0.3rc1.dist-info/WHEEL,sha256=wSGr6OIJgwRPWZnPAVOrHij4aC8ZJCcq6TxNvrljOp4,106
3
+ luna_quantum-1.0.3rc1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
+ luna_quantum-1.0.3rc1.dist-info/licenses/NOTICE,sha256=noPOS8eDj5XoyRO8ZrCxIOh5fSjk0RildIrrqxQlepY,588
5
+ luna_quantum/__init__.py,sha256=RV92O-Th8ktm0S9kcpfRfECkeeORP-tbDKfpa4u1CiY,3223
6
+ luna_quantum/__init__.pyi,sha256=tcM9H4ZAKxgt8KYnFmKH5OHSJZ0zv7J8dMdYMZp6m3s,1661
7
+ luna_quantum/_core.cpython-313-darwin.so,sha256=QVkgjiynyAlSdPWtaq1kTF8yEyHOvHIV8aEgmYzx1yg,4545548
8
8
  luna_quantum/_core.pyi,sha256=7HL0LZHypfEWlrnjzk3dT0kG3K92v3FkPylQmc9EITs,105472
9
9
  luna_quantum/algorithms/__init__.py,sha256=IX9ZpzY3Do3mTgKqto5vAWwdYrZrM-RemYSf64yxefg,69
10
10
  luna_quantum/aqm_overwrites/__init__.py,sha256=rteObr5JHDnTnRime0Euq9Qy2iDIp6VMpFNHTGVNBe0,46
@@ -80,6 +80,7 @@ luna_quantum/client/schemas/wrappers/__init__.py,sha256=tfd-JKBLr-0FwVEGKJFfvY1y
80
80
  luna_quantum/client/schemas/wrappers/datetime_wrapper.py,sha256=8K2jexTarxGCgD1ukgVUW5TCroYGWXGfzDfjLcJfYlk,768
81
81
  luna_quantum/client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
82
  luna_quantum/client/utils/qpu_token_utils.py,sha256=xeWIKcBwXGSQ0INfUY3NMTu6H90T03jkT85yHs2QXmk,4768
83
+ luna_quantum/config.py,sha256=xx7DnjAvOeLUMlXvbXqQ4_EBAy53bjPYU1-QQO6I2lY,217
83
84
  luna_quantum/errors.py,sha256=yjeXB3i07LlTuuJ18IKgwsC5wmtJElN8cDwlg3JkcEs,1424
84
85
  luna_quantum/errors.pyi,sha256=daGAwiOdpgHPILYVSUy360AZQilRb-vdwh2pwAAn3CU,8900
85
86
  luna_quantum/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -250,9 +251,9 @@ luna_quantum/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
250
251
  luna_quantum/util/active_waiting.py,sha256=MkLL7UEtWh8jU1Zwd9rYqfcReYPGB7FJLUjQe2v9_Tg,3029
251
252
  luna_quantum/util/class_patcher.py,sha256=-vD_7Auh1dQTOJXOKv-4sTQ5EzH3n6I0EsHDFQ_ZPOY,5456
252
253
  luna_quantum/util/debug_info.py,sha256=UjMcmX5waYEEH51cK8REUOdjpNX0D6HWSR0ns7yQp54,1755
253
- luna_quantum/util/log_utils.py,sha256=M8Gbt0Pb2CsQsG3fGyuKeT-rl264laEGGXcPCGfBhaQ,4918
254
+ luna_quantum/util/log_utils.py,sha256=8WK0ivN3Dq3QntIYu-eGRBrGyiBoFnZkRiX_GCc-IHQ,5471
254
255
  luna_quantum/util/pretty_base.py,sha256=Vv3dYpMsydOPYFOm-0lCCuJIe-62oYkI64Zy_bahl3s,2115
255
256
  luna_quantum/util/pydantic_utils.py,sha256=nhl_SdLJVAizrtLVHvnbco84g8CdBVdVxN_jlXiv82w,1263
256
257
  luna_quantum/utils.py,sha256=pBOkGXNJXlOzxAwTJv8nCj32Q6WNeh3t6Ka3lmTgy9c,134
257
258
  luna_quantum/utils.pyi,sha256=afjDJhGiM9KmN2zqVkd6agP8JAsbwUxJBW9tEyiFrdY,1941
258
- luna_quantum-1.0.2.dist-info/RECORD,,
259
+ luna_quantum-1.0.3rc1.dist-info/RECORD,,