ml-dash 0.6.3__tar.gz → 0.6.10__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 (39) hide show
  1. {ml_dash-0.6.3 → ml_dash-0.6.10}/PKG-INFO +81 -5
  2. {ml_dash-0.6.3 → ml_dash-0.6.10}/README.md +80 -4
  3. {ml_dash-0.6.3 → ml_dash-0.6.10}/pyproject.toml +4 -1
  4. ml_dash-0.6.10/src/ml_dash/__init__.py +105 -0
  5. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auth/token_storage.py +0 -9
  6. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auto_start.py +19 -7
  7. ml_dash-0.6.10/src/ml_dash/buffer.py +735 -0
  8. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli.py +7 -1
  9. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/api.py +10 -1
  10. ml_dash-0.6.10/src/ml_dash/cli_commands/create.py +145 -0
  11. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/download.py +196 -2
  12. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/list.py +164 -1
  13. ml_dash-0.6.10/src/ml_dash/cli_commands/profile.py +219 -0
  14. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/upload.py +171 -6
  15. ml_dash-0.6.10/src/ml_dash/client.py +1988 -0
  16. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/experiment.py +526 -432
  17. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/files.py +228 -70
  18. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/run.py +93 -4
  19. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/storage.py +403 -2
  20. ml_dash-0.6.10/src/ml_dash/track.py +263 -0
  21. ml_dash-0.6.3/src/ml_dash/__init__.py +0 -59
  22. ml_dash-0.6.3/src/ml_dash/cli_commands/profile.py +0 -92
  23. ml_dash-0.6.3/src/ml_dash/client.py +0 -1076
  24. {ml_dash-0.6.3 → ml_dash-0.6.10}/LICENSE +0 -0
  25. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auth/__init__.py +0 -0
  26. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auth/constants.py +0 -0
  27. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auth/device_flow.py +0 -0
  28. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auth/device_secret.py +0 -0
  29. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/auth/exceptions.py +0 -0
  30. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/__init__.py +0 -0
  31. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/login.py +0 -0
  32. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/cli_commands/logout.py +0 -0
  33. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/config.py +0 -0
  34. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/log.py +0 -0
  35. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/metric.py +0 -0
  36. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/params.py +0 -0
  37. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/py.typed +0 -0
  38. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/remote_auto_start.py +0 -0
  39. {ml_dash-0.6.3 → ml_dash-0.6.10}/src/ml_dash/snowflake.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ml-dash
3
- Version: 0.6.3
3
+ Version: 0.6.10
4
4
  Summary: ML experiment tracking and data storage
5
5
  Keywords: machine-learning,experiment-tracking,mlops,data-storage
6
6
  Author: Ge Yang, Tom Tao
@@ -68,10 +68,11 @@ Description-Content-Type: text/markdown
68
68
 
69
69
  # ML-Dash
70
70
 
71
- A simple and flexible SDK for ML experiment tracking and data storage.
71
+ A simple and flexible SDK for ML experiment tracking and data storage with background buffering for high-performance training.
72
72
 
73
73
  ## Features
74
74
 
75
+ ### Core Features
75
76
  - **Three Usage Styles**: Pre-configured singleton (dxp), context manager, or direct instantiation
76
77
  - **Dual Operation Modes**: Remote (API server) or local (filesystem)
77
78
  - **OAuth2 Authentication**: Secure device flow authentication for CLI and SDK
@@ -82,6 +83,13 @@ A simple and flexible SDK for ML experiment tracking and data storage.
82
83
  - **Rich Metadata**: Tags, bindrs, descriptions, and custom metadata support
83
84
  - **Simple API**: Minimal configuration, maximum flexibility
84
85
 
86
+ ### Performance Features (New in 0.6.7)
87
+ - **Background Buffering**: Non-blocking I/O operations eliminate training interruptions
88
+ - **Automatic Batching**: Time-based (5s) and size-based (100 items) flush triggers
89
+ - **Track API**: Time-series data tracking for robotics, RL, and sequential experiments
90
+ - **Numpy Image Support**: Direct saving of numpy arrays as PNG/JPEG images
91
+ - **Parallel Uploads**: ThreadPoolExecutor for efficient file uploads
92
+
85
93
  ## Installation
86
94
 
87
95
  <table>
@@ -93,14 +101,14 @@ A simple and flexible SDK for ML experiment tracking and data storage.
93
101
  <td>
94
102
 
95
103
  ```bash
96
- uv add ml-dash==0.6.2rc1
104
+ uv add ml-dash
97
105
  ```
98
106
 
99
107
  </td>
100
108
  <td>
101
109
 
102
110
  ```bash
103
- pip install ml-dash==0.6.2rc1
111
+ pip install ml-dash
104
112
  ```
105
113
 
106
114
  </td>
@@ -159,7 +167,75 @@ with Experiment(
159
167
 
160
168
  ```
161
169
 
162
- See [docs/getting-started.md](docs/getting-started.md) for more examples.
170
+ ## New Features in 0.6.7
171
+
172
+ ### 🚀 Background Buffering (Non-blocking I/O)
173
+
174
+ All write operations are now buffered and executed in background threads:
175
+
176
+ ```python
177
+ with Experiment("my-project/exp").run as experiment:
178
+ for i in range(10000):
179
+ # Non-blocking! Returns immediately
180
+ experiment.log(f"Step {i}")
181
+ experiment.metrics("train").log(loss=loss, accuracy=acc)
182
+ experiment.files("frames").save_image(frame, to=f"frame_{i}.jpg")
183
+
184
+ # All data automatically flushed when context exits
185
+ ```
186
+
187
+ Configure buffering via environment variables:
188
+ ```bash
189
+ export ML_DASH_BUFFER_ENABLED=true
190
+ export ML_DASH_FLUSH_INTERVAL=5.0
191
+ export ML_DASH_LOG_BATCH_SIZE=100
192
+ ```
193
+
194
+ ### 📊 Track API (Time-Series Data)
195
+
196
+ Perfect for robotics, RL, and sequential experiments:
197
+
198
+ ```python
199
+ with Experiment("robotics/training").run as experiment:
200
+ for step in range(1000):
201
+ # Track robot position over time
202
+ experiment.track("robot/position").append({
203
+ "step": step,
204
+ "x": position[0],
205
+ "y": position[1],
206
+ "z": position[2]
207
+ })
208
+
209
+ # Track control signals
210
+ experiment.track("robot/control").append({
211
+ "step": step,
212
+ "motor1": ctrl[0],
213
+ "motor2": ctrl[1]
214
+ })
215
+ ```
216
+
217
+ ### 🖼️ Numpy Image Support
218
+
219
+ Save numpy arrays directly as images (PNG/JPEG):
220
+
221
+ ```python
222
+ import numpy as np
223
+
224
+ with Experiment("vision/training").run as experiment:
225
+ # From MuJoCo, OpenCV, PIL, etc.
226
+ pixels = renderer.render() # numpy array
227
+
228
+ # Save as PNG (lossless)
229
+ experiment.files("frames").save_image(pixels, to="frame.png")
230
+
231
+ # Save as JPEG with quality control
232
+ experiment.files("frames").save_image(pixels, to="frame.jpg", quality=85)
233
+
234
+ # Auto-detection also works
235
+ experiment.files("frames").save(pixels, to="frame.jpg")
236
+ ```
237
+
238
+ See [CHANGELOG.md](CHANGELOG.md) for complete release notes.
163
239
 
164
240
  ## Development Setup
165
241
 
@@ -1,9 +1,10 @@
1
1
  # ML-Dash
2
2
 
3
- A simple and flexible SDK for ML experiment tracking and data storage.
3
+ A simple and flexible SDK for ML experiment tracking and data storage with background buffering for high-performance training.
4
4
 
5
5
  ## Features
6
6
 
7
+ ### Core Features
7
8
  - **Three Usage Styles**: Pre-configured singleton (dxp), context manager, or direct instantiation
8
9
  - **Dual Operation Modes**: Remote (API server) or local (filesystem)
9
10
  - **OAuth2 Authentication**: Secure device flow authentication for CLI and SDK
@@ -14,6 +15,13 @@ A simple and flexible SDK for ML experiment tracking and data storage.
14
15
  - **Rich Metadata**: Tags, bindrs, descriptions, and custom metadata support
15
16
  - **Simple API**: Minimal configuration, maximum flexibility
16
17
 
18
+ ### Performance Features (New in 0.6.7)
19
+ - **Background Buffering**: Non-blocking I/O operations eliminate training interruptions
20
+ - **Automatic Batching**: Time-based (5s) and size-based (100 items) flush triggers
21
+ - **Track API**: Time-series data tracking for robotics, RL, and sequential experiments
22
+ - **Numpy Image Support**: Direct saving of numpy arrays as PNG/JPEG images
23
+ - **Parallel Uploads**: ThreadPoolExecutor for efficient file uploads
24
+
17
25
  ## Installation
18
26
 
19
27
  <table>
@@ -25,14 +33,14 @@ A simple and flexible SDK for ML experiment tracking and data storage.
25
33
  <td>
26
34
 
27
35
  ```bash
28
- uv add ml-dash==0.6.2rc1
36
+ uv add ml-dash
29
37
  ```
30
38
 
31
39
  </td>
32
40
  <td>
33
41
 
34
42
  ```bash
35
- pip install ml-dash==0.6.2rc1
43
+ pip install ml-dash
36
44
  ```
37
45
 
38
46
  </td>
@@ -91,7 +99,75 @@ with Experiment(
91
99
 
92
100
  ```
93
101
 
94
- See [docs/getting-started.md](docs/getting-started.md) for more examples.
102
+ ## New Features in 0.6.7
103
+
104
+ ### 🚀 Background Buffering (Non-blocking I/O)
105
+
106
+ All write operations are now buffered and executed in background threads:
107
+
108
+ ```python
109
+ with Experiment("my-project/exp").run as experiment:
110
+ for i in range(10000):
111
+ # Non-blocking! Returns immediately
112
+ experiment.log(f"Step {i}")
113
+ experiment.metrics("train").log(loss=loss, accuracy=acc)
114
+ experiment.files("frames").save_image(frame, to=f"frame_{i}.jpg")
115
+
116
+ # All data automatically flushed when context exits
117
+ ```
118
+
119
+ Configure buffering via environment variables:
120
+ ```bash
121
+ export ML_DASH_BUFFER_ENABLED=true
122
+ export ML_DASH_FLUSH_INTERVAL=5.0
123
+ export ML_DASH_LOG_BATCH_SIZE=100
124
+ ```
125
+
126
+ ### 📊 Track API (Time-Series Data)
127
+
128
+ Perfect for robotics, RL, and sequential experiments:
129
+
130
+ ```python
131
+ with Experiment("robotics/training").run as experiment:
132
+ for step in range(1000):
133
+ # Track robot position over time
134
+ experiment.track("robot/position").append({
135
+ "step": step,
136
+ "x": position[0],
137
+ "y": position[1],
138
+ "z": position[2]
139
+ })
140
+
141
+ # Track control signals
142
+ experiment.track("robot/control").append({
143
+ "step": step,
144
+ "motor1": ctrl[0],
145
+ "motor2": ctrl[1]
146
+ })
147
+ ```
148
+
149
+ ### 🖼️ Numpy Image Support
150
+
151
+ Save numpy arrays directly as images (PNG/JPEG):
152
+
153
+ ```python
154
+ import numpy as np
155
+
156
+ with Experiment("vision/training").run as experiment:
157
+ # From MuJoCo, OpenCV, PIL, etc.
158
+ pixels = renderer.render() # numpy array
159
+
160
+ # Save as PNG (lossless)
161
+ experiment.files("frames").save_image(pixels, to="frame.png")
162
+
163
+ # Save as JPEG with quality control
164
+ experiment.files("frames").save_image(pixels, to="frame.jpg", quality=85)
165
+
166
+ # Auto-detection also works
167
+ experiment.files("frames").save(pixels, to="frame.jpg")
168
+ ```
169
+
170
+ See [CHANGELOG.md](CHANGELOG.md) for complete release notes.
95
171
 
96
172
  ## Development Setup
97
173
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ml-dash"
3
- version = "0.6.3"
3
+ version = "0.6.10"
4
4
  description = "ML experiment tracking and data storage"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
@@ -60,6 +60,9 @@ dev = [
60
60
  "mypy>=1.9.0",
61
61
  ]
62
62
 
63
+ [tool.ruff]
64
+ indent-width = 2
65
+
63
66
  [tool.uv]
64
67
 
65
68
  [build-system]
@@ -0,0 +1,105 @@
1
+ """
2
+ ML-Dash Python SDK
3
+
4
+ A simple and flexible SDK for ML experiment metricing and data storage.
5
+
6
+ Prefix format: {owner}/{project}/path.../[name]
7
+ - owner: First segment (e.g., your username)
8
+ - project: Second segment (e.g., project name)
9
+ - path: Remaining segments form the folder structure
10
+ - name: Derived from last segment (may be a seed/id)
11
+
12
+ Usage:
13
+
14
+ from ml_dash import Experiment
15
+
16
+ # Local mode - explicit configuration
17
+ with Experiment(
18
+ prefix="ge/my-project/experiments/exp1",
19
+ dash_root=".dash"
20
+ ).run as exp:
21
+ exp.log("Training started")
22
+ exp.params.set(lr=0.001)
23
+ exp.metrics("train").log(loss=0.5, step=0)
24
+
25
+ # Default: Remote mode (defaults to https://api.dash.ml)
26
+ with Experiment(prefix="ge/my-project/experiments/exp1").run as exp:
27
+ exp.log("Training started")
28
+ exp.params.set(lr=0.001)
29
+ exp.metrics("train").log(loss=0.5, step=0)
30
+
31
+ # Decorator style
32
+ from ml_dash import ml_dash_experiment
33
+
34
+ @ml_dash_experiment(prefix="ge/my-project/experiments/exp1")
35
+ def train_model(exp):
36
+ exp.log("Training started")
37
+ """
38
+
39
+ from .client import RemoteClient, userinfo
40
+ from .experiment import Experiment, OperationMode, ml_dash_experiment
41
+ from .log import LogBuilder, LogLevel
42
+ from .params import ParametersBuilder
43
+ from .run import RUN
44
+ from .storage import LocalStorage
45
+
46
+ __version__ = "0.6.10"
47
+
48
+ # Minimum version required - blocks older versions
49
+ MINIMUM_REQUIRED_VERSION = "0.6.10"
50
+
51
+
52
+ def _check_version_compatibility():
53
+ """
54
+ Enforce minimum version requirement.
55
+
56
+ Raises ImportError if installed version is below minimum required version.
57
+ This ensures users have the latest features (userinfo, namespace auto-detection, etc.)
58
+ """
59
+ try:
60
+ from packaging import version
61
+ except ImportError:
62
+ # If packaging is not available, skip check
63
+ # (unlikely since it's a common dependency)
64
+ return
65
+
66
+ current = version.parse(__version__)
67
+ minimum = version.parse(MINIMUM_REQUIRED_VERSION)
68
+
69
+ if current < minimum:
70
+ raise ImportError(
71
+ f"\n"
72
+ f"{'=' * 80}\n"
73
+ f"ERROR: ml-dash version {__version__} is too old!\n"
74
+ f"{'=' * 80}\n"
75
+ f"\n"
76
+ f"This version of ml-dash ({__version__}) is no longer supported.\n"
77
+ f"Minimum required version: {MINIMUM_REQUIRED_VERSION}\n"
78
+ f"\n"
79
+ f"Please upgrade to the latest version:\n"
80
+ f"\n"
81
+ f" pip install --upgrade ml-dash\n"
82
+ f"\n"
83
+ f"Or install specific version:\n"
84
+ f"\n"
85
+ f" pip install ml-dash>={MINIMUM_REQUIRED_VERSION}\n"
86
+ f"\n"
87
+ f"{'=' * 80}\n"
88
+ )
89
+
90
+
91
+ # Enforce version check on import
92
+ _check_version_compatibility()
93
+
94
+ __all__ = [
95
+ "Experiment",
96
+ "ml_dash_experiment",
97
+ "OperationMode",
98
+ "RemoteClient",
99
+ "LocalStorage",
100
+ "LogLevel",
101
+ "LogBuilder",
102
+ "ParametersBuilder",
103
+ "RUN",
104
+ "userinfo",
105
+ ]
@@ -292,12 +292,3 @@ def decode_jwt_payload(token: str) -> dict:
292
292
  return {}
293
293
 
294
294
 
295
- def get_jwt_user():
296
- # Load token
297
- storage = get_token_storage()
298
- token = storage.load("ml-dash-token")
299
-
300
- if token:
301
- user = decode_jwt_payload(token)
302
- return user
303
- return None
@@ -31,21 +31,33 @@ import atexit
31
31
  # Token is auto-loaded from storage when first used
32
32
  # If not authenticated, operations will fail with AuthenticationError
33
33
  # Prefix format: {owner}/{project}/path...
34
- # Using getpass to get current user as owner for local convenience
35
34
  import getpass
36
35
  from datetime import datetime
37
36
 
38
- from .auth.token_storage import get_jwt_user
39
37
  from .experiment import Experiment
40
38
 
41
- _user = get_jwt_user()
42
- # Fallback to system username if not authenticated
43
- _username = _user["username"] if _user else getpass.getuser()
39
+ # Get username for dxp namespace
40
+ # Note: We use userinfo for fresh data (recommended approach)
41
+ # Falls back to system username if not authenticated
42
+ try:
43
+ from .client import userinfo
44
+ _username = userinfo.username or getpass.getuser()
45
+ except Exception:
46
+ # If userinfo fails (e.g., no network), fall back to system user
47
+ _username = getpass.getuser()
48
+
44
49
  _now = datetime.now()
45
50
 
51
+ # Create pre-configured singleton experiment in REMOTE mode
52
+ # - dash_url=True: Use default remote server (https://api.dash.ml)
53
+ # - dash_root=None: Remote-only mode (no local storage)
54
+ # - user: Uses authenticated username from userinfo (fresh from server)
55
+ # - Token is auto-loaded from storage when first used
56
+ # - If not authenticated, operations will fail with AuthenticationError
46
57
  dxp = Experiment(
47
- prefix=f"{_username}/scratch/{_now:%Y-%m-%d/%H%M%S}",
48
- dash_url="https://api.dash.ml",
58
+ user=_username, # Use authenticated username for namespace
59
+ dash_url=True, # Use remote API (https://api.dash.ml)
60
+ dash_root=None, # Remote-only mode (no local .dash/)
49
61
  )
50
62
 
51
63