ml-dash 0.6.2rc1__py3-none-any.whl → 0.6.4__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.
- ml_dash/__init__.py +36 -64
- ml_dash/auth/token_storage.py +267 -226
- ml_dash/auto_start.py +28 -15
- ml_dash/cli.py +16 -2
- ml_dash/cli_commands/api.py +174 -0
- ml_dash/cli_commands/download.py +773 -666
- ml_dash/cli_commands/list.py +164 -14
- ml_dash/cli_commands/login.py +190 -183
- ml_dash/cli_commands/profile.py +92 -0
- ml_dash/cli_commands/upload.py +1312 -1141
- ml_dash/client.py +335 -82
- ml_dash/config.py +119 -119
- ml_dash/experiment.py +1293 -1033
- ml_dash/files.py +339 -224
- ml_dash/log.py +7 -7
- ml_dash/metric.py +359 -100
- ml_dash/params.py +6 -6
- ml_dash/remote_auto_start.py +20 -17
- ml_dash/run.py +211 -65
- ml_dash/snowflake.py +173 -0
- ml_dash/storage.py +1051 -1081
- {ml_dash-0.6.2rc1.dist-info → ml_dash-0.6.4.dist-info}/METADATA +12 -14
- ml_dash-0.6.4.dist-info/RECORD +33 -0
- {ml_dash-0.6.2rc1.dist-info → ml_dash-0.6.4.dist-info}/WHEEL +1 -1
- ml_dash-0.6.2rc1.dist-info/RECORD +0 -30
- {ml_dash-0.6.2rc1.dist-info → ml_dash-0.6.4.dist-info}/entry_points.txt +0 -0
ml_dash/config.py
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
1
|
"""Configuration file management for ML-Dash CLI."""
|
|
2
2
|
|
|
3
|
-
from pathlib import Path
|
|
4
3
|
import json
|
|
5
|
-
from
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class Config:
|
|
9
|
+
"""
|
|
10
|
+
Manages ML-Dash CLI configuration file.
|
|
11
|
+
|
|
12
|
+
Configuration is stored in ~/.dash/config.json with structure:
|
|
13
|
+
{
|
|
14
|
+
"remote_url": "https://api.dash.ml",
|
|
15
|
+
"api_key": "token",
|
|
16
|
+
"default_batch_size": 100
|
|
17
|
+
}
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
DEFAULT_CONFIG_DIR = Path.home() / ".dash"
|
|
21
|
+
CONFIG_FILE = "config.json"
|
|
22
|
+
|
|
23
|
+
def __init__(self, config_dir: Optional[Path] = None):
|
|
9
24
|
"""
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Configuration is stored in ~/.ml-dash/config.json with structure:
|
|
13
|
-
{
|
|
14
|
-
"remote_url": "https://api.dash.ml",
|
|
15
|
-
"api_key": "token",
|
|
16
|
-
"default_batch_size": 100
|
|
17
|
-
}
|
|
18
|
-
"""
|
|
25
|
+
Initialize config manager.
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
self.config_path
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"""Load config from file."""
|
|
36
|
-
if self.config_path.exists():
|
|
37
|
-
try:
|
|
38
|
-
with open(self.config_path, "r") as f:
|
|
39
|
-
return json.load(f)
|
|
40
|
-
except (json.JSONDecodeError, IOError):
|
|
41
|
-
# If config is corrupted, return empty dict
|
|
42
|
-
return {}
|
|
27
|
+
Args:
|
|
28
|
+
config_dir: Config directory path (defaults to ~/.dash)
|
|
29
|
+
"""
|
|
30
|
+
self.config_dir = config_dir or self.DEFAULT_CONFIG_DIR
|
|
31
|
+
self.config_path = self.config_dir / self.CONFIG_FILE
|
|
32
|
+
self._data = self._load()
|
|
33
|
+
|
|
34
|
+
def _load(self) -> Dict[str, Any]:
|
|
35
|
+
"""Load config from file."""
|
|
36
|
+
if self.config_path.exists():
|
|
37
|
+
try:
|
|
38
|
+
with open(self.config_path, "r") as f:
|
|
39
|
+
return json.load(f)
|
|
40
|
+
except (json.JSONDecodeError, IOError):
|
|
41
|
+
# If config is corrupted, return empty dict
|
|
43
42
|
return {}
|
|
43
|
+
return {}
|
|
44
|
+
|
|
45
|
+
def save(self):
|
|
46
|
+
"""Save config to file."""
|
|
47
|
+
self.config_dir.mkdir(parents=True, exist_ok=True)
|
|
48
|
+
with open(self.config_path, "w") as f:
|
|
49
|
+
json.dump(self._data, f, indent=2)
|
|
50
|
+
|
|
51
|
+
def get(self, key: str, default: Any = None) -> Any:
|
|
52
|
+
"""
|
|
53
|
+
Get config value.
|
|
44
54
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
@property
|
|
122
|
-
def device_secret(self) -> Optional[str]:
|
|
123
|
-
"""Get device secret for OAuth device flow."""
|
|
124
|
-
return self.get("device_secret")
|
|
125
|
-
|
|
126
|
-
@device_secret.setter
|
|
127
|
-
def device_secret(self, secret: str):
|
|
128
|
-
"""Set device secret."""
|
|
129
|
-
self.set("device_secret", secret)
|
|
55
|
+
Args:
|
|
56
|
+
key: Config key
|
|
57
|
+
default: Default value if key not found
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
Config value or default
|
|
61
|
+
"""
|
|
62
|
+
return self._data.get(key, default)
|
|
63
|
+
|
|
64
|
+
def set(self, key: str, value: Any):
|
|
65
|
+
"""
|
|
66
|
+
Set config value and save.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
key: Config key
|
|
70
|
+
value: Config value
|
|
71
|
+
"""
|
|
72
|
+
self._data[key] = value
|
|
73
|
+
self.save()
|
|
74
|
+
|
|
75
|
+
def delete(self, key: str):
|
|
76
|
+
"""
|
|
77
|
+
Delete config key and save.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
key: Config key to delete
|
|
81
|
+
"""
|
|
82
|
+
if key in self._data:
|
|
83
|
+
del self._data[key]
|
|
84
|
+
self.save()
|
|
85
|
+
|
|
86
|
+
def clear(self):
|
|
87
|
+
"""Clear all config and save."""
|
|
88
|
+
self._data = {}
|
|
89
|
+
self.save()
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def remote_url(self) -> Optional[str]:
|
|
93
|
+
"""Get default remote URL."""
|
|
94
|
+
return self.get("remote_url", "https://api.dash.ml")
|
|
95
|
+
|
|
96
|
+
@remote_url.setter
|
|
97
|
+
def remote_url(self, url: str):
|
|
98
|
+
"""Set default remote URL."""
|
|
99
|
+
self.set("remote_url", url)
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def api_key(self) -> Optional[str]:
|
|
103
|
+
"""Get default API key."""
|
|
104
|
+
return self.get("api_key")
|
|
105
|
+
|
|
106
|
+
@api_key.setter
|
|
107
|
+
def api_key(self, key: str):
|
|
108
|
+
"""Set default API key."""
|
|
109
|
+
self.set("api_key", key)
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def batch_size(self) -> int:
|
|
113
|
+
"""Get default batch size for uploads."""
|
|
114
|
+
return self.get("default_batch_size", 100)
|
|
115
|
+
|
|
116
|
+
@batch_size.setter
|
|
117
|
+
def batch_size(self, size: int):
|
|
118
|
+
"""Set default batch size."""
|
|
119
|
+
self.set("default_batch_size", size)
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def device_secret(self) -> Optional[str]:
|
|
123
|
+
"""Get device secret for OAuth device flow."""
|
|
124
|
+
return self.get("device_secret")
|
|
125
|
+
|
|
126
|
+
@device_secret.setter
|
|
127
|
+
def device_secret(self, secret: str):
|
|
128
|
+
"""Set device secret."""
|
|
129
|
+
self.set("device_secret", secret)
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
# Global config instance
|