dragon-ml-toolbox 19.8.1__py3-none-any.whl → 19.9.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragon-ml-toolbox
3
- Version: 19.8.1
3
+ Version: 19.9.0
4
4
  Summary: Complete pipelines and helper tools for data science and machine learning projects.
5
5
  Author-email: Karl Luigi Loza Vidaurre <luigiloza@gmail.com>
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
- dragon_ml_toolbox-19.8.1.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
2
- dragon_ml_toolbox-19.8.1.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=XBLtvGjvBf-q93a5iylHj94Lm78UzInC-3Cii01jc6I,3127
1
+ dragon_ml_toolbox-19.9.0.dist-info/licenses/LICENSE,sha256=L35WDmmLZNTlJvxF6Vy7Uy4SYNi6rCfWUqlTHpoRMoU,1081
2
+ dragon_ml_toolbox-19.9.0.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=XBLtvGjvBf-q93a5iylHj94Lm78UzInC-3Cii01jc6I,3127
3
3
  ml_tools/ETL_cleaning.py,sha256=cKXyRFaaFs_beAGDnQM54xnML671kq-yJEGjHafW-20,351
4
4
  ml_tools/ETL_engineering.py,sha256=cwh1FhtNdUHllUDvho-x3SIVj4KwG_rFQR6VYzWUg0U,898
5
5
  ml_tools/GUI_tools.py,sha256=O89rG8WQv6GY1DiphQjIsPzXFCQID6te7q_Sgt1iTkQ,294
@@ -43,7 +43,7 @@ ml_tools/ensemble_evaluation.py,sha256=P26vyS2fMV3Pm_4w2MN1z1eS7aVJzYagsyLmqC-Io
43
43
  ml_tools/ensemble_inference.py,sha256=sl_Dq9KaN0SrtZmyiVrrhWd6lSjdQangSIUUUIFvfj4,178
44
44
  ml_tools/ensemble_learning.py,sha256=BLPnpfJWCly-D75mkRP1FE5TExoWAAlAHR89KAzW9iU,336
45
45
  ml_tools/excel_handler.py,sha256=h35HMNnO44btxsTSfZXj2HiJtpRS4fdrJLbzru4heMs,453
46
- ml_tools/keys.py,sha256=WV_pgucnqdmGnBgNiS1Rt6zTodAq2xgg496f8l1Ks7k,262
46
+ ml_tools/keys.py,sha256=s9HEIAJCRw4DO7ll0yjc8u5rrSI9MOmfkR_1fKpkfy8,263
47
47
  ml_tools/math_utilities.py,sha256=53nOXlhb5taUHj4CDHsXliArEfPkOlJD7G_dJa3_iOU,321
48
48
  ml_tools/optimization_tools.py,sha256=YQZiXT86kP28NEcyLDbowGeNXHgJDm9hzl-ClNgGQXU,389
49
49
  ml_tools/path_manager.py,sha256=ion-x2W_rQjra3ChuOHwVtgXhv7LkpXP0lkBef730tk,350
@@ -99,13 +99,13 @@ ml_tools/_core/_math_utilities.py,sha256=IlXAiZgTcLtus03jJOBOyF9ZCQDf8qLGjrCHu9M
99
99
  ml_tools/_core/_models_advanced_base.py,sha256=ceW0V_CcfOnSFqHlxUhVU8-5mtQq4tFyo8TX-xVexrY,4982
100
100
  ml_tools/_core/_models_advanced_helpers.py,sha256=yrAVgYdBsNYD6Vy-pYL5__wI9Z7inOvNUngMgyuypjo,38973
101
101
  ml_tools/_core/_optimization_tools.py,sha256=2LkntNRc19uGur9u0yI-KnNX56tc63sxaRNj6W440Og,20077
102
- ml_tools/_core/_path_manager.py,sha256=ty_tTUfOMiqKfB3fL_xerWhiJRZFgxvtzM-RHR-9U5E,18504
102
+ ml_tools/_core/_path_manager.py,sha256=z4zqYqppKhgOj3ArfkKo4tieO8oNaHWUoshCQRNbd1w,20284
103
103
  ml_tools/_core/_plot_fonts.py,sha256=CjYXW2gZ9AUaGkyX8_WOXXNYs6d1PTK-nEJBrv_Zb2o,2287
104
104
  ml_tools/_core/_schema.py,sha256=TM5WVVMoKOvr_Bc2z34sU_gzKlM465PRKTgdZaEOkGY,14076
105
105
  ml_tools/_core/_script_info.py,sha256=21r83LV3RubsNZ_RTEUON6RbDf7Mh4_udweNcvdF_Fk,212
106
106
  ml_tools/_core/_serde.py,sha256=tsI4EO2Y7jrBMmbQ1pinDsPOrOg-SaPuB-Dt40q0taE,5609
107
107
  ml_tools/_core/_utilities.py,sha256=iA8fLWdhsIx4ut2Dp8M_OyU0Y3PPLgGdIklyl17x6xk,22560
108
- dragon_ml_toolbox-19.8.1.dist-info/METADATA,sha256=QLEXKbniXwhgqk14JDH56-AapVnA1xqwKI4McG1vTAk,8774
109
- dragon_ml_toolbox-19.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
- dragon_ml_toolbox-19.8.1.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
111
- dragon_ml_toolbox-19.8.1.dist-info/RECORD,,
108
+ dragon_ml_toolbox-19.9.0.dist-info/METADATA,sha256=_EtgLq25qcjnIMmFvPVOfa-xWTp176hHC_VbxFLdWno,8774
109
+ dragon_ml_toolbox-19.9.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
110
+ dragon_ml_toolbox-19.9.0.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
111
+ dragon_ml_toolbox-19.9.0.dist-info/RECORD,,
@@ -35,7 +35,8 @@ class DragonPathManager:
35
35
  def __init__(
36
36
  self,
37
37
  anchor_file: str,
38
- base_directories: Optional[List[str]] = None
38
+ base_directories: Optional[List[str]] = None,
39
+ strict_to_root: bool = True
39
40
  ):
40
41
  """
41
42
  Sets up the core paths for a project by anchoring to a specific file.
@@ -53,14 +54,16 @@ class DragonPathManager:
53
54
  where each string is the name
54
55
  of a subdirectory to register
55
56
  relative to the package root.
57
+ strict_to_root (bool): If True, checks that all registered paths are defined within the package ROOT.
56
58
  """
57
59
  resolved_anchor_path = Path(anchor_file).resolve()
58
60
  self._package_name = resolved_anchor_path.parent.name
59
61
  self._is_bundled, bundle_root = self._get_bundle_root()
60
62
  self._paths: Dict[str, Path] = {}
63
+ self._strict_to_root = strict_to_root
61
64
 
62
65
  if self._is_bundled:
63
- # In a PyInstaller bundle, the package is inside the temp _MEIPASS dir
66
+ # In a PyInstaller/Nuitka bundle, the package is inside the temp _MEIPASS dir
64
67
  package_root = Path(bundle_root) / self._package_name # type: ignore
65
68
  else:
66
69
  # In dev mode, the package root is the directory containing the anchor file.
@@ -182,17 +185,44 @@ class DragonPathManager:
182
185
  """
183
186
  Checks the status of all registered paths on the filesystem and prints a formatted report.
184
187
  """
185
- report = {}
186
- for key, path in self.items():
188
+ # 1. Gather Data and determine max widths
189
+ rows = []
190
+ max_key_len = len("Key") # Start with header width
191
+
192
+ # Sort by key for readability
193
+ for key, path in sorted(self.items()):
187
194
  if path.is_dir():
188
- report[key] = "📁 Directory"
195
+ stat_msg = "📁 Directory"
189
196
  elif path.is_file():
190
- report[key] = "📄 File"
197
+ stat_msg = "📄 File"
198
+ elif not path.exists():
199
+ stat_msg = "❌ Not Found"
191
200
  else:
192
- report[key] = " Not Found"
201
+ stat_msg = " Unknown"
202
+
203
+ rows.append((key, stat_msg, str(path)))
204
+ max_key_len = max(max_key_len, len(key))
193
205
 
194
- print("\n--- Path Status Report ---")
195
- pprint(report)
206
+ # 2. Print Header
207
+ mode_icon = "📦" if self._is_bundled else "🛠️"
208
+ mode_text = "Bundled Mode" if self._is_bundled else "Development Mode"
209
+
210
+ print(f"\n{'-'*80}")
211
+ print(f" 🐉 DragonPathManager Status Report")
212
+ print(f" Context: {mode_icon} {mode_text}")
213
+ print(f" Root: {self.ROOT}")
214
+ print(f"{'-'*80}")
215
+
216
+ # 3. Print Table Header
217
+ # {variable:<width} aligns text to the left within the padding
218
+ print(f" {'Key':<{max_key_len}} | {'Status':<12} | Path")
219
+ print(f" {'-'*max_key_len} | {'-'*12} | {'-'*40}")
220
+
221
+ # 4. Print Rows
222
+ for key, stat, p_str in rows:
223
+ print(f" {key:<{max_key_len}} | {stat:<12} | {p_str}")
224
+
225
+ print(f"{'-'*80}\n")
196
226
 
197
227
  def __repr__(self) -> str:
198
228
  """Provides a string representation of the stored paths."""
@@ -276,10 +306,22 @@ class DragonPathManager:
276
306
 
277
307
  if not isinstance(value, (str, Path)):
278
308
  _LOGGER.error(f"Cannot assign type '{type(value).__name__}' to a path. Must be str or Path.")
279
- raise TypeError
280
-
281
- # If all checks pass, treat it as a public path and store it in the _paths dictionary.
282
- self._paths[sanitized_name] = Path(value)
309
+ raise TypeError()
310
+
311
+ # Resolve the new path
312
+ new_path = Path(value).expanduser().absolute()
313
+
314
+ # --- STRICT CHECK ---
315
+ # Only check if strict mode is on
316
+ if self.__dict__.get("_strict_to_root", False) and sanitized_name != "ROOT":
317
+ root_path = self._paths.get("ROOT")
318
+ # Ensure ROOT exists and the new path is inside it
319
+ if root_path and not new_path.is_relative_to(root_path):
320
+ _LOGGER.error(f"Strict Mode Violation: '{name}' ({new_path}) is outside ROOT ({root_path})")
321
+ raise ValueError()
322
+
323
+ # Store absolute Path.
324
+ self._paths[sanitized_name] = new_path
283
325
 
284
326
 
285
327
  def make_fullpath(
ml_tools/keys.py CHANGED
@@ -1,4 +1,4 @@
1
- from _core._keys import (
1
+ from ._core._keys import (
2
2
  PyTorchInferenceKeys as InferenceKeys,
3
3
  _CheckpointCallbackKeys as CheckpointCallbackKeys,
4
4
  _FinalizedFileKeys as FinalizedFileKeys,