gsml 1.0.0__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 (42) hide show
  1. gsml-1.0.0/PKG-INFO +49 -0
  2. gsml-1.0.0/gsml/__init__.py +35 -0
  3. gsml-1.0.0/gsml/_compat.py +118 -0
  4. gsml-1.0.0/gsml/bench.py +870 -0
  5. gsml-1.0.0/gsml/cli.py +219 -0
  6. gsml-1.0.0/gsml/config.py +706 -0
  7. gsml-1.0.0/gsml/data.py +742 -0
  8. gsml-1.0.0/gsml/db.py +472 -0
  9. gsml-1.0.0/gsml/dispatch.py +470 -0
  10. gsml-1.0.0/gsml/dtypes.py +338 -0
  11. gsml-1.0.0/gsml/enums.py +77 -0
  12. gsml-1.0.0/gsml/log.py +458 -0
  13. gsml-1.0.0/gsml/metric.py +451 -0
  14. gsml-1.0.0/gsml/plan.py +350 -0
  15. gsml-1.0.0/gsml/prompt.py +805 -0
  16. gsml-1.0.0/gsml/testing.py +707 -0
  17. gsml-1.0.0/gsml/track.py +671 -0
  18. gsml-1.0.0/gsml/tracker.py +761 -0
  19. gsml-1.0.0/gsml/tune.py +1639 -0
  20. gsml-1.0.0/gsml/util.py +422 -0
  21. gsml-1.0.0/gsml.egg-info/PKG-INFO +49 -0
  22. gsml-1.0.0/gsml.egg-info/SOURCES.txt +40 -0
  23. gsml-1.0.0/gsml.egg-info/dependency_links.txt +1 -0
  24. gsml-1.0.0/gsml.egg-info/entry_points.txt +2 -0
  25. gsml-1.0.0/gsml.egg-info/requires.txt +39 -0
  26. gsml-1.0.0/gsml.egg-info/top_level.txt +1 -0
  27. gsml-1.0.0/pyproject.toml +67 -0
  28. gsml-1.0.0/setup.cfg +4 -0
  29. gsml-1.0.0/tests/test_bench.py +113 -0
  30. gsml-1.0.0/tests/test_config.py +218 -0
  31. gsml-1.0.0/tests/test_data_store.py +198 -0
  32. gsml-1.0.0/tests/test_db.py +254 -0
  33. gsml-1.0.0/tests/test_dispatch.py +238 -0
  34. gsml-1.0.0/tests/test_integration_bench.py +245 -0
  35. gsml-1.0.0/tests/test_integration_track.py +232 -0
  36. gsml-1.0.0/tests/test_integration_tune.py +386 -0
  37. gsml-1.0.0/tests/test_log.py +191 -0
  38. gsml-1.0.0/tests/test_plan.py +317 -0
  39. gsml-1.0.0/tests/test_track.py +275 -0
  40. gsml-1.0.0/tests/test_tracker.py +140 -0
  41. gsml-1.0.0/tests/test_tune.py +160 -0
  42. gsml-1.0.0/tests/test_util.py +357 -0
gsml-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: gsml
3
+ Version: 1.0.0
4
+ Summary: General Scientific ML toolkit
5
+ Author-email: Dennis Liu <dennisl@udel.edu>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ByteDennis/gsml
8
+ Project-URL: Repository, https://github.com/ByteDennis/gsml
9
+ Project-URL: Issues, https://github.com/ByteDennis/gsml/issues
10
+ Keywords: mlops,sqlite
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: springs>=1.13.0
19
+ Requires-Dist: omegaconf>=2.3.0
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: tqdm>=4.60.0
22
+ Requires-Dist: loguru>=0.7.0
23
+ Requires-Dist: numpy>=1.24.0
24
+ Provides-Extra: torch
25
+ Requires-Dist: torch>=2.0.0; extra == "torch"
26
+ Provides-Extra: sklearn
27
+ Requires-Dist: scikit-learn>=1.0.0; extra == "sklearn"
28
+ Requires-Dist: joblib>=1.0.0; extra == "sklearn"
29
+ Provides-Extra: tune
30
+ Requires-Dist: optuna>=3.0.0; extra == "tune"
31
+ Requires-Dist: pandas>=2.0.0; extra == "tune"
32
+ Requires-Dist: requests>=2.28.0; extra == "tune"
33
+ Provides-Extra: bench
34
+ Requires-Dist: pandas>=2.0.0; extra == "bench"
35
+ Provides-Extra: wandb
36
+ Requires-Dist: wandb>=0.15.0; extra == "wandb"
37
+ Provides-Extra: all
38
+ Requires-Dist: torch>=2.0.0; extra == "all"
39
+ Requires-Dist: scikit-learn>=1.0.0; extra == "all"
40
+ Requires-Dist: joblib>=1.0.0; extra == "all"
41
+ Requires-Dist: optuna>=3.0.0; extra == "all"
42
+ Requires-Dist: pandas>=2.0.0; extra == "all"
43
+ Requires-Dist: requests>=2.28.0; extra == "all"
44
+ Requires-Dist: wandb>=0.15.0; extra == "all"
45
+ Provides-Extra: dev
46
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
47
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
48
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
49
+ Requires-Dist: build>=1.0.0; extra == "dev"
@@ -0,0 +1,35 @@
1
+ # ruff: noqa: F403 F405
2
+ """
3
+ gsml — lightweight experiment tracking and ML infrastructure.
4
+
5
+ Public API re-exports all submodule contents for convenient access:
6
+ import gsml as lib
7
+ lib.Tracker(...)
8
+ lib.METRIC_REGISTRY[...]
9
+ """
10
+
11
+ from .track import Track, tracked
12
+
13
+ # Re-export all submodule contents for `import gsml as lib` usage
14
+ from .config import *
15
+ from .db import *
16
+ from .dispatch import *
17
+ from .log import *
18
+ from .util import *
19
+ from .plan import *
20
+ from .enums import *
21
+ from .dtypes import *
22
+ from .tracker import *
23
+ from .metric import *
24
+ from .prompt import *
25
+ from .data import *
26
+ from .testing import *
27
+
28
+ # bench and tune have heavy deps (pandas, numpy, optuna) — lazy import submodules
29
+ # but eagerly re-export their contents for lib.X access
30
+ from .bench import *
31
+ from .tune import *
32
+
33
+ __all__ = ["Track", "tracked"]
34
+
35
+ __version__ = "1.0.0"
@@ -0,0 +1,118 @@
1
+ """Optional dependency guards for gsml.
2
+
3
+ Provides lazy imports that give clear error messages when optional
4
+ packages are not installed, instead of crashing at import time.
5
+
6
+ Usage:
7
+ from gsml._compat import torch, require
8
+ require("torch") # raises ImportError with install instructions if missing
9
+ torch.cuda.is_available() # works normally if installed
10
+ """
11
+
12
+ import importlib
13
+ from types import ModuleType
14
+
15
+
16
+ class _MissingModule:
17
+ """Proxy object that raises ImportError on any attribute access."""
18
+
19
+ def __init__(self, name: str, package: str, extra: str):
20
+ self._name = name
21
+ self._package = package
22
+ self._extra = extra
23
+
24
+ def _raise(self):
25
+ raise ImportError(
26
+ f"{self._package} is required but not installed. "
27
+ f"Install it with: pip install gsml[{self._extra}]"
28
+ )
29
+
30
+ def __getattr__(self, item):
31
+ if item.startswith("_"):
32
+ return object.__getattribute__(self, item)
33
+ self._raise()
34
+
35
+ def __call__(self, *args, **kwargs):
36
+ self._raise()
37
+
38
+ def __bool__(self):
39
+ return False
40
+
41
+ def __repr__(self):
42
+ return f"<MissingModule: {self._name} (pip install gsml[{self._extra}])>"
43
+
44
+
45
+ def _lazy_import(module_name: str, package: str, extra: str) -> ModuleType:
46
+ """Import a module, returning a proxy if not installed."""
47
+ try:
48
+ return importlib.import_module(module_name)
49
+ except ImportError:
50
+ return _MissingModule(module_name, package, extra)
51
+
52
+
53
+ def has_torch() -> bool:
54
+ """Check if PyTorch is available."""
55
+ try:
56
+ import torch # noqa: F811
57
+ return True
58
+ except ImportError:
59
+ return False
60
+
61
+
62
+ def has_sklearn() -> bool:
63
+ """Check if scikit-learn is available."""
64
+ try:
65
+ import sklearn # noqa: F811
66
+ return True
67
+ except ImportError:
68
+ return False
69
+
70
+
71
+ def has_optuna() -> bool:
72
+ """Check if Optuna is available."""
73
+ try:
74
+ import optuna # noqa: F811
75
+ return True
76
+ except ImportError:
77
+ return False
78
+
79
+
80
+ def has_pandas() -> bool:
81
+ """Check if pandas is available."""
82
+ try:
83
+ import pandas # noqa: F811
84
+ return True
85
+ except ImportError:
86
+ return False
87
+
88
+
89
+ def require(module_name: str):
90
+ """Require a module, raising ImportError with instructions if missing."""
91
+ extras = {
92
+ "torch": "torch",
93
+ "sklearn": "sklearn",
94
+ "scikit-learn": "sklearn",
95
+ "optuna": "tune",
96
+ "pandas": "bench",
97
+ "joblib": "sklearn",
98
+ "wandb": "wandb",
99
+ "requests": "tune",
100
+ }
101
+ extra = extras.get(module_name, "all")
102
+ package = module_name
103
+ try:
104
+ importlib.import_module(module_name)
105
+ except ImportError:
106
+ raise ImportError(
107
+ f"{package} is required but not installed. "
108
+ f"Install it with: pip install gsml[{extra}]"
109
+ )
110
+
111
+
112
+ # Lazy singletons — safe to import at module level
113
+ torch = _lazy_import("torch", "torch", "torch")
114
+ sklearn = _lazy_import("sklearn", "scikit-learn", "sklearn")
115
+ optuna = _lazy_import("optuna", "optuna", "tune")
116
+ pandas = _lazy_import("pandas", "pandas", "bench")
117
+ joblib = _lazy_import("joblib", "joblib", "sklearn")
118
+ wandb = _lazy_import("wandb", "wandb", "wandb")