chronist 0.1.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 (85) hide show
  1. chronist-0.1.0/LICENSE +28 -0
  2. chronist-0.1.0/PKG-INFO +393 -0
  3. chronist-0.1.0/README.md +335 -0
  4. chronist-0.1.0/chronist/__init__.py +20 -0
  5. chronist-0.1.0/chronist/blobs.py +83 -0
  6. chronist-0.1.0/chronist/cli.py +373 -0
  7. chronist-0.1.0/chronist/client/__init__.py +4 -0
  8. chronist-0.1.0/chronist/client/code.py +619 -0
  9. chronist-0.1.0/chronist/client/files.py +214 -0
  10. chronist-0.1.0/chronist/client/prune.py +173 -0
  11. chronist-0.1.0/chronist/client/run.py +484 -0
  12. chronist-0.1.0/chronist/client/rundir.py +213 -0
  13. chronist-0.1.0/chronist/client/sync.py +97 -0
  14. chronist-0.1.0/chronist/client/uploader.py +336 -0
  15. chronist-0.1.0/chronist/codec.py +40 -0
  16. chronist-0.1.0/chronist/hist.py +399 -0
  17. chronist-0.1.0/chronist/meta.py +719 -0
  18. chronist-0.1.0/chronist/query.py +444 -0
  19. chronist-0.1.0/chronist/readback.py +680 -0
  20. chronist-0.1.0/chronist/server/__init__.py +8 -0
  21. chronist-0.1.0/chronist/server/app.py +748 -0
  22. chronist-0.1.0/chronist/server/core.py +731 -0
  23. chronist-0.1.0/chronist/server/tokens.py +129 -0
  24. chronist-0.1.0/chronist/store/__init__.py +18 -0
  25. chronist-0.1.0/chronist/store/base.py +178 -0
  26. chronist-0.1.0/chronist/store/cache.py +109 -0
  27. chronist-0.1.0/chronist/store/chunked.py +679 -0
  28. chronist-0.1.0/chronist/store/hist_store.py +219 -0
  29. chronist-0.1.0/chronist/store/sqlite_rows.py +305 -0
  30. chronist-0.1.0/chronist/ui/static/api.js +99 -0
  31. chronist-0.1.0/chronist/ui/static/app.css +307 -0
  32. chronist-0.1.0/chronist/ui/static/app.js +277 -0
  33. chronist-0.1.0/chronist/ui/static/code.js +187 -0
  34. chronist-0.1.0/chronist/ui/static/drawer.js +93 -0
  35. chronist-0.1.0/chronist/ui/static/files.js +64 -0
  36. chronist-0.1.0/chronist/ui/static/histplot.js +320 -0
  37. chronist-0.1.0/chronist/ui/static/index.html +15 -0
  38. chronist-0.1.0/chronist/ui/static/plot.js +408 -0
  39. chronist-0.1.0/chronist/ui/static/query.js +100 -0
  40. chronist-0.1.0/chronist/ui/static/share.js +83 -0
  41. chronist-0.1.0/chronist/ui/static/table.js +131 -0
  42. chronist-0.1.0/chronist/ui/static/util.js +165 -0
  43. chronist-0.1.0/chronist/ui/static/vendor/LICENSE.htm +202 -0
  44. chronist-0.1.0/chronist/ui/static/vendor/LICENSE.uplot +21 -0
  45. chronist-0.1.0/chronist/ui/static/vendor/hljs/LICENSE +29 -0
  46. chronist-0.1.0/chronist/ui/static/vendor/hljs/bash.min.js +21 -0
  47. chronist-0.1.0/chronist/ui/static/vendor/hljs/c.min.js +41 -0
  48. chronist-0.1.0/chronist/ui/static/vendor/hljs/cmake.min.js +7 -0
  49. chronist-0.1.0/chronist/ui/static/vendor/hljs/core.min.js +306 -0
  50. chronist-0.1.0/chronist/ui/static/vendor/hljs/cpp.min.js +46 -0
  51. chronist-0.1.0/chronist/ui/static/vendor/hljs/diff.min.js +9 -0
  52. chronist-0.1.0/chronist/ui/static/vendor/hljs/dockerfile.min.js +8 -0
  53. chronist-0.1.0/chronist/ui/static/vendor/hljs/ini.min.js +16 -0
  54. chronist-0.1.0/chronist/ui/static/vendor/hljs/javascript.min.js +81 -0
  55. chronist-0.1.0/chronist/ui/static/vendor/hljs/json.min.js +8 -0
  56. chronist-0.1.0/chronist/ui/static/vendor/hljs/makefile.min.js +14 -0
  57. chronist-0.1.0/chronist/ui/static/vendor/hljs/markdown.min.js +32 -0
  58. chronist-0.1.0/chronist/ui/static/vendor/hljs/plaintext.min.js +3 -0
  59. chronist-0.1.0/chronist/ui/static/vendor/hljs/python.min.js +42 -0
  60. chronist-0.1.0/chronist/ui/static/vendor/hljs/rust.min.js +27 -0
  61. chronist-0.1.0/chronist/ui/static/vendor/hljs/shell.min.js +5 -0
  62. chronist-0.1.0/chronist/ui/static/vendor/hljs/xml.min.js +29 -0
  63. chronist-0.1.0/chronist/ui/static/vendor/hljs/yaml.min.js +28 -0
  64. chronist-0.1.0/chronist/ui/static/vendor/htm-preact.module.js +1 -0
  65. chronist-0.1.0/chronist/ui/static/vendor/uPlot.esm.js +6140 -0
  66. chronist-0.1.0/chronist/ui/static/vendor/uPlot.min.css +1 -0
  67. chronist-0.1.0/chronist/ui/static/widgets.js +77 -0
  68. chronist-0.1.0/chronist.egg-info/PKG-INFO +393 -0
  69. chronist-0.1.0/chronist.egg-info/SOURCES.txt +83 -0
  70. chronist-0.1.0/chronist.egg-info/dependency_links.txt +1 -0
  71. chronist-0.1.0/chronist.egg-info/entry_points.txt +2 -0
  72. chronist-0.1.0/chronist.egg-info/requires.txt +33 -0
  73. chronist-0.1.0/chronist.egg-info/top_level.txt +1 -0
  74. chronist-0.1.0/pyproject.toml +68 -0
  75. chronist-0.1.0/setup.cfg +4 -0
  76. chronist-0.1.0/tests/test_cli.py +95 -0
  77. chronist-0.1.0/tests/test_client.py +412 -0
  78. chronist-0.1.0/tests/test_code.py +461 -0
  79. chronist-0.1.0/tests/test_files.py +289 -0
  80. chronist-0.1.0/tests/test_hist.py +146 -0
  81. chronist-0.1.0/tests/test_hist_store.py +67 -0
  82. chronist-0.1.0/tests/test_query_meta.py +166 -0
  83. chronist-0.1.0/tests/test_server.py +273 -0
  84. chronist-0.1.0/tests/test_store_conformance.py +233 -0
  85. chronist-0.1.0/tests/test_store_differential.py +101 -0
chronist-0.1.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andreas Faust
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---------------------------------------------------------------------------
24
+ Bundled third-party code (chronist/ui/static/vendor/), each under its own
25
+ license, included next to it:
26
+ - uPlot (MIT) vendor/LICENSE.uplot
27
+ - htm + Preact standalone (Apache-2.0 / MIT) vendor/LICENSE.htm
28
+ - highlight.js (BSD-3-Clause) vendor/hljs/LICENSE
@@ -0,0 +1,393 @@
1
+ Metadata-Version: 2.4
2
+ Name: chronist
3
+ Version: 0.1.0
4
+ Summary: Lightweight, self-hostable experiment tracker for ML research
5
+ Author: Andreas Faust
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ASFaust/chronist
8
+ Project-URL: Repository, https://github.com/ASFaust/chronist
9
+ Project-URL: Issues, https://github.com/ASFaust/chronist/issues
10
+ Keywords: experiment tracking,machine learning,mlops,metrics,wandb,tensorboard
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: System :: Monitoring
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: chronist/ui/static/vendor/LICENSE.htm
29
+ License-File: chronist/ui/static/vendor/LICENSE.uplot
30
+ License-File: chronist/ui/static/vendor/hljs/LICENSE
31
+ Requires-Dist: numpy>=1.22
32
+ Requires-Dist: msgpack>=1.0
33
+ Requires-Dist: httpx>=0.24
34
+ Requires-Dist: starlette>=0.27
35
+ Requires-Dist: uvicorn>=0.22
36
+ Requires-Dist: pathspec>=0.10
37
+ Requires-Dist: zstandard>=0.18
38
+ Requires-Dist: tomli>=1.1; python_version < "3.11"
39
+ Provides-Extra: pandas
40
+ Requires-Dist: pandas>=1.5; extra == "pandas"
41
+ Provides-Extra: polars
42
+ Requires-Dist: polars>=0.20; extra == "polars"
43
+ Provides-Extra: export
44
+ Requires-Dist: pyarrow>=12; extra == "export"
45
+ Provides-Extra: all
46
+ Requires-Dist: pandas>=1.5; extra == "all"
47
+ Requires-Dist: polars>=0.20; extra == "all"
48
+ Requires-Dist: pyarrow>=12; extra == "all"
49
+ Provides-Extra: dev
50
+ Requires-Dist: pytest; extra == "dev"
51
+ Requires-Dist: pytest-xdist; extra == "dev"
52
+ Requires-Dist: pandas; extra == "dev"
53
+ Requires-Dist: polars; extra == "dev"
54
+ Requires-Dist: pyarrow; extra == "dev"
55
+ Requires-Dist: build; extra == "dev"
56
+ Requires-Dist: twine; extra == "dev"
57
+ Dynamic: license-file
58
+
59
+ # chronist
60
+
61
+ A lightweight, self-hostable experiment tracker for ML research: log training
62
+ runs, compare learning curves, and read data back in Python for custom plots.
63
+ One `pip install`, single user, runs on a laptop or on a small VPS.
64
+
65
+ The design rules come from problems with other tools (see [docs/SPEC.md](https://github.com/ASFaust/chronist/blob/main/docs/SPEC.md)):
66
+ the server is the **only** process that writes storage, plots are always
67
+ downsampled on the server, and the query language never evals Python.
68
+
69
+ ```
70
+ pip install chronist # extras: [pandas], [polars], [export] (pyarrow), [all]
71
+ pip install -e ".[dev]" # from a checkout, for development
72
+ ```
73
+
74
+ ## Logging
75
+
76
+ ```python
77
+ import chronist
78
+
79
+ run = chronist.init(project="bptt-free", name="lstm-seed0",
80
+ config={"model": {"arch": "lstm"}, "optim": {"lr": 3e-4}, "seed": 0},
81
+ tags=["baseline"])
82
+ for step in range(100_000):
83
+ loss = ...
84
+ run.log({"loss": loss, "train": {"acc": acc}}, step=step) # -> keys "loss", "train/acc"
85
+ run.log({"eval/return": ret}, step=step, every=1000) # optional throttling
86
+ run.finish() # or: with chronist.init(...) as run:
87
+ ```
88
+
89
+ - `log()` only appends to a local file (`$CHRONIST_DIR/runs/<uid>/`, default
90
+ `~/.chronist`) and never touches the network, so it cannot block training.
91
+ A background thread uploads batched, gzip'd msgpack chunks. If the server
92
+ is down, data stays buffered and the uploader retries with backoff.
93
+ - No server configured → offline: only local files. Upload later with
94
+ `chronist sync` (same code path as the live uploader).
95
+ - Config: `CHRONIST_URL`, `CHRONIST_TOKEN`, `CHRONIST_DIR`, `CHRONIST_PROJECT`.
96
+ - Captured automatically: git commit/branch/remote, dirty flag + diff hash
97
+ (the diff itself is kept in the run dir as `diff.patch`), command line, cwd,
98
+ hostname, Python version, start time.
99
+ - Heartbeats while running; `finish()` sets the status; an uncaught exception
100
+ marks the run `crashed`; a run that stops heartbeating is marked `crashed` by
101
+ the server (default after 180 s).
102
+ - Resume: `chronist.init(resume="<uid>")` re-attaches and continues at the next step.
103
+ Resuming from an earlier checkpoint:
104
+ `chronist.init(resume="<uid>", rewind=5000)` discards everything the run
105
+ logged at step ≥ 5000 and continues there. Without `rewind`, values at
106
+ already-logged steps are ignored (first write wins), and the client warns
107
+ the first time you log one.
108
+ - Cleanup: once a finished run is fully on the server (points, finish record,
109
+ code), its local buffer and now-unneeded local blobs are deleted, after
110
+ `finish()` or `chronist sync`. Set `CHRONIST_KEEP_LOCAL=1` to keep them;
111
+ `chronist prune` removes older ones.
112
+
113
+ ## Histograms
114
+
115
+ ```python
116
+ run.log({"weights/layer1": layer.weight}, step=t) # >1 element -> histogram (64 bins)
117
+ run.log({"grad/l1": chronist.Histogram(g, bins=128)}, step=t) # explicit
118
+ run.log({"returns": chronist.Histogram(r, raw=True)}, step=t) # exact values (<= 10k)
119
+ run.configure_histograms("weights/*", range=(-1, 1)) # fixed range + under/overflow
120
+ chronist.init(histogram_bins=32, auto_histograms=False) # run default / strict mode
121
+ ```
122
+
123
+ - Each record holds the exact stats over finite values (count, mean, std,
124
+ min, max), NaN/±Inf counts, and bin counts. The bin range is adaptive (this
125
+ step's min/max) by default, or a fixed range. Torch tensors are reduced on
126
+ their own device; only the stats and bins come back to the host.
127
+ - Bins: `Histogram(..., bins=)` > the last matching `configure_histograms`
128
+ pattern > `init(histogram_bins=)` > 64 (max 1024).
129
+ - About 300 B per record: log them every N steps (`run.log(..., every=100)`).
130
+ - Views: a heatmap (step × value) with a robust value range (0.5–99.5%
131
+ quantiles, so heavy tails don't flatten it; "full range" toggles min–max),
132
+ quantile bands, stats lines, and a single step with a slider. Over many
133
+ steps the server subsamples whole records evenly (never merges them).
134
+ - Read-back: `runs.histograms("grad/l1", max_steps=200)` (DataFrame with
135
+ `edges`/`counts` arrays), `run.histogram("grad/l1", step=5000)` (nearest step
136
+ at or before), `run.histograms(key).to_dense(rows=128)`.
137
+ - A rewind also discards histogram records.
138
+
139
+ ## Files (checkpoints, plots, outputs)
140
+
141
+ ```python
142
+ run.save_file("checkpoints/model.pt", step=t, aliases=["best"], metadata={"val_loss": 0.21})
143
+ run.save_file("plots/curve.png", kind="plot")
144
+ run.save_file("ckpt.pt", step=t, move=True) # or link=True (hard link; never modify in place)
145
+ run.save_object(model.state_dict(), name="model", step=t) # torch.save if torch is loaded, else pickle
146
+ run.configure_files("model", keep_last=3, keep_every=100_000)
147
+
148
+ r = chronist.run(42)
149
+ r.files() # name, version_id, step, kind, size, aliases, metadata
150
+ r.download("model", alias="best", dest="./ckpt/") # default alias: latest
151
+ r.load_object("model", step=200_000)
152
+ ```
153
+ ```
154
+ chronist pull <run> <name> [--alias A | --step N | --version V] [--dest DIR]
155
+ ```
156
+
157
+ - Content is captured when you call `save_file`, so overwriting `model.pt`
158
+ afterwards is fine. A background thread splits it into 8 MiB
159
+ content-addressed chunks (compressed only if that saves ≥ 5%). Identical
160
+ files and chunks are stored once.
161
+ - Uploads only send chunks the server lacks, are resumable, and run after
162
+ metrics in each upload round, so checkpoints never delay metrics.
163
+ `CHRONIST_UPLOAD_MBPS` caps the bandwidth. Offline runs upload with
164
+ `chronist sync`.
165
+ - `latest` moves automatically; other aliases move when reassigned (UI or
166
+ `PATCH .../files/<name>/aliases`). Retention keeps the newest `keep_last`
167
+ versions plus the first in each `keep_every`-step window, and aliased
168
+ versions are always kept. Dropped versions' chunks are freed by GC.
169
+ - Server limits: `--max-blob-storage 50GB` (warns at 80%; at 100% new file
170
+ uploads are refused, but metrics keep working), `--max-file-size` (default
171
+ 20 GB), `--blob-dir` to put blobs on another volume.
172
+ - Downloads verify sha256 and cache chunks in `~/.cache/chronist`
173
+ (`CHRONIST_CACHE`), so repeated or interrupted downloads only fetch what's
174
+ missing. `GET /api/files/<version>/download` serves the whole file with
175
+ HTTP Range support. Read-only share tokens can download files.
176
+ - Reverse proxies: chunk uploads are ≤ 8 MiB plus a few bytes; with nginx, set
177
+ `client_max_body_size 16m` (Caddy has no default limit).
178
+ - The UI's run drawer has a **Files** tab: versions grouped by name, aliases,
179
+ metadata, download, and for owners set/move alias and delete.
180
+
181
+ Differences from the spec in `docs/HISTOGRAMS_FILES.md`:
182
+ - Blob GC is the server's mark-and-sweep (daily, `chronist gc`) over code and
183
+ file manifests. It isn't in `MetricStore.maintain()`, and nothing deletes
184
+ blobs directly.
185
+ - Quota is checked when a file upload starts (`blobs/missing` with
186
+ `purpose: "file"`), not on every blob PUT, because blob uploads are shared
187
+ with code snapshots.
188
+ - File chunks are served via `/api/files/<version>/chunk/<i>`, not the blob
189
+ endpoint, so read-only share links work without code access.
190
+
191
+ ## Code snapshots
192
+
193
+ Every run records exactly which code ran, including uncommitted and untracked
194
+ files (details: [docs/CODE_SNAPSHOTS.md](https://github.com/ASFaust/chronist/blob/main/docs/CODE_SNAPSHOTS.md)).
195
+
196
+ ```python
197
+ chronist.init(code="auto") # default: git root, else nearest pyproject/setup.py, else the script's dir
198
+ chronist.init(code="git") # git root; error if not in a repo
199
+ chronist.init(code="../..") # relative to the entry script's directory (not the cwd)
200
+ chronist.init(code=None) # off
201
+ chronist.init(code=chronist.Code(root=2, exclude=["data/"], max_total_mb=50, env_vars=["CUDA_VISIBLE_DEVICES"]))
202
+ ```
203
+
204
+ - Precedence: the `code=` argument, then `CHRONIST_CODE`, then
205
+ `[tool.chronist] code = ".."` in `pyproject.toml` or `.chronist.toml`
206
+ (relative to that file), then auto.
207
+ - Selection: `git ls-files` (tracked + untracked-not-ignored, including
208
+ submodules), `.gitignore` via pathspec outside git, `.chronistignore`, and a
209
+ built-in deny list. Checkpoints, data, venvs and secrets like `.env`, `*.key`
210
+ and `id_rsa` are never included. Files over 1 MB, binary files, and anything
211
+ past 50 MB total are skipped, and every skip is recorded with its reason.
212
+ - Content is hashed and copied into `~/.chronist/blobs` (content-addressed,
213
+ compressed) inside `init()`, so later edits or `os.chdir` don't affect it.
214
+ Uploads send only the blobs the server lacks, so 1000 runs of the same repo
215
+ cost almost nothing.
216
+ - Also stored: the package list, Python, platform, host, GPU, torch/CUDA
217
+ versions, the command line, and git info. Env vars are recorded only if listed
218
+ in `env_vars`.
219
+ - Modules imported from outside the code root (e.g. via `sys.path.append`) are
220
+ reported at init and finish and flagged ⚠ in the UI.
221
+
222
+ ```
223
+ chronist checkout <run> [dir] # restore the tree (+ CHRONIST_RUN.json)
224
+ chronist code diff <run_a> <run_b> # changed files (unified diff) + config diff
225
+ chronist snapshot [--code ..] [--run ID]
226
+ ```
227
+ ```python
228
+ r = chronist.run(42) # or a uid
229
+ r.code.files(); r.code.read("src/model.py"); r.code.checkout("/tmp/x")
230
+ chronist.code_diff(41, 42)
231
+ ```
232
+
233
+ The UI's run drawer has a **Code** tab: a file browser with a
234
+ syntax-highlighted viewer, root/mode info, the skip report, and environment
235
+ and package lists.
236
+
237
+ ## Viewing
238
+
239
+ **Local:** `chronist ui` starts the server on `localhost:7070` (no auth) and
240
+ opens the browser. It also watches `~/.chronist` and live-syncs offline runs,
241
+ so locally you don't need `CHRONIST_URL` at all.
242
+
243
+ **Remote:** on the VPS:
244
+
245
+ ```
246
+ chronist serve --host 127.0.0.1 --port 7070 --token <write-token> --read-token <read-token>
247
+ ```
248
+
249
+ Put Caddy in front for TLS (`Caddyfile`):
250
+
251
+ ```
252
+ chronist.example.org {
253
+ reverse_proxy 127.0.0.1:7070
254
+ }
255
+ ```
256
+
257
+ Without `--token` on a non-localhost bind, the server generates a write
258
+ token, stores it in `<data>/tokens.json` and prints it. A localhost-bound
259
+ server without tokens is reachable through `ssh -L 7070:localhost:7070 vps`.
260
+
261
+ **Sharing:** the UI's **Share** button (shown to write-token holders) creates
262
+ a read-only link to the current view. **Share code as well** is off by
263
+ default. Without it, the link's token can't read code snapshots (manifests,
264
+ files, blobs, snapshot metadata) through the UI, the API or Python. Links are
265
+ listed and revocable in the same dialog and take effect immediately. CLI
266
+ equivalent: `chronist tokens --new read [--code] [--label L]`, `chronist tokens`,
267
+ `chronist tokens --revoke <id>`. A server in local no-auth mode can't share,
268
+ because anyone who can reach it sees everything.
269
+
270
+ Clients: `export CHRONIST_URL=https://chronist.example.org CHRONIST_TOKEN=<write-token>`.
271
+
272
+ ### UI
273
+
274
+ - **Run table:** query bar with autocomplete for keys and values, sortable
275
+ columns, any config key or `last(metric)` as a column, shift-click range
276
+ select, bulk tag/delete, and a run drawer (config, summary, git/command
277
+ metadata, tags, notes, rename, delete).
278
+ - **Panels:** any metrics from any runs on one plot. X axis: step, wall time,
279
+ relative time, or another metric. Group by config keys with mean ± std,
280
+ min–max, or median + IQR bands. EMA smoothing, log x/y, min/max band of each
281
+ downsampled bucket, color by config key. Drag to zoom (re-queries at finer
282
+ resolution), double-click to reset.
283
+ - **Live:** running runs stream in over SSE; panels fetch only the new tail.
284
+ - **Views:** the whole view state (project, query, selection, columns, panels,
285
+ zoom) is in the URL, so you can bookmark or share it.
286
+
287
+ With nothing selected, panels plot the first 20 matching runs. Grouped panels
288
+ aggregate over all matching runs (up to 1000).
289
+
290
+ ## Query language
291
+
292
+ ```
293
+ env = "seaquest" and model.arch = "lstm" and steps >= 20000
294
+ (optim.lr < 1e-3 or tags contains "baseline") and not model.dropout exists
295
+ last(loss) < 0.1 and status in [running, finished] and created > 2026-11-01
296
+ ```
297
+
298
+ - Fields: any flattened config key; run fields `id name status tags notes
299
+ created updated heartbeat steps`; metric summaries `last(<key>)`. Use
300
+ backticks for odd key names or keys that collide with run fields: `` `name` = "x" ``.
301
+ - Operators: `= != < <= > >=`, `in [...]`, `not in [...]`, `contains`, `exists`,
302
+ `and`, `or`, `not`, parentheses. Bare words are strings (`arch = lstm`).
303
+ - `a != x` means `not (a = x)`, so it also matches runs without `a`.
304
+
305
+ It compiles to parameterized SQL. Nothing is evaluated.
306
+
307
+ ## Reading data back
308
+
309
+ ```python
310
+ import chronist
311
+ runs = chronist.runs('env = "seaquest" and model.arch = "lstm"', project="bptt-free")
312
+ runs.config() # one row per run: id, name, status, ..., flattened config
313
+ runs.config(summary=True) # + last(<metric>) columns
314
+ df = runs.history(["loss", "return"]) # long: run_id, run, key, step, value, wall_time
315
+ df = runs.history(["loss"], max_points=2000) # downsampled: value = bucket mean, + min, max, count
316
+ ```
317
+
318
+ Returns pandas by default (`dataframe="polars"` or `"dict"` for the others).
319
+ It reads from `CHRONIST_URL` if set, otherwise directly from the local data
320
+ dir (`~/.chronist/data`, read-only, safe while a server is running). Pass
321
+ `url=` or `data_dir=` to choose. Bulk export over HTTP:
322
+ `GET /api/export?project=..&q=..&format=parquet|arrow|csv` (streamed in
323
+ 100k-point pages; server memory stays flat regardless of size). Raw reads
324
+ over HTTP are paged (≤ 250k points per response, `next_start` for the next
325
+ page); read-back handles the paging for you.
326
+
327
+ ## CLI
328
+
329
+ | command | |
330
+ |---|---|
331
+ | `chronist ui [--data DIR] [--port N] [--no-browser] [--no-watch]` | local server + UI, no auth |
332
+ | `chronist serve [--host H] [--port N] [--token T] [--read-token R] [--no-auth]` | server for remote use |
333
+ | `chronist sync [PATH...] [--url U] [--token T]` | upload offline/backlogged runs |
334
+ | `chronist tokens [--new write\|read] [--code] [--label L] [--revoke ID]` | manage server/share tokens |
335
+ | `chronist checkout <run> [dir] [--force]` | restore a run's code snapshot |
336
+ | `chronist code diff <a> <b> [--stat]` | code + config diff of two runs |
337
+ | `chronist snapshot [--code C] [--run ID]` | standalone snapshot (optionally attach to a run) |
338
+ | `chronist prune [PATH...] [--url U] [--older-than DAYS] [--dry-run]` | delete local buffers already on a server |
339
+ | `chronist gc [--url U \| --data DIR] [--vacuum]` | server: drop unreferenced blobs, vacuum (also runs daily) |
340
+
341
+ The server takes an exclusive lock on its data dir, so a second server, or
342
+ `chronist gc --data` while a server is running, refuses to start. Use
343
+ `chronist gc --url` to run GC inside the server.
344
+
345
+ ## Architecture
346
+
347
+ ```
348
+ client (training process) server (the only writer)
349
+ run.log() ─► local msgpack segments Starlette + uvicorn
350
+ │ ├─ REST /api/*, SSE /api/stream, static UI
351
+ uploader thread ─► POST /api/runs/{id}/log ──►├─ single writer thread (queue)
352
+ chronist sync ─┘ (gzip msgpack, retried) │ ├─ MetadataStore (SQLite: runs, config EAV, tags, summaries)
353
+ │ └─ MetricStore (swappable; default: ChunkedStore)
354
+ └─ readers: per-thread read-only SQLite connections (WAL)
355
+ ```
356
+
357
+ - `chronist/store/` holds the `MetricStore` protocol and backends. Every
358
+ backend must pass `tests/test_store_conformance.py`. Downsampling is the
359
+ backend's job. Buckets lie on an absolute grid (`step // width`), so runs and
360
+ zoom levels line up.
361
+ - `chronist/meta.py`: runs, flattened typed config, tags, summaries, autocomplete.
362
+ - `chronist/query.py`: query parser → SQL, completion context.
363
+ - `chronist/server/`: `core.py` (writer, events, series/grouping), `app.py` (HTTP).
364
+ - `chronist/client/`: local buffer format (`rundir.py`), uploader, `init/log/finish`, sync.
365
+ - `chronist/ui/static/`: the SPA. Preact + htm and uPlot are vendored as ES
366
+ modules, so there is no build step.
367
+
368
+ ## Development
369
+
370
+ ```
371
+ uv venv -p 3.9 .venv && uv pip install -p .venv -e ".[dev]"
372
+ .venv/bin/pytest # store conformance, query, server, client end-to-end
373
+ .venv/bin/python bench/bench_store.py --scenario 100k,grouped,1M
374
+ ```
375
+
376
+ Benchmark results are in [bench/RESULTS.md](https://github.com/ASFaust/chronist/blob/main/bench/RESULTS.md).
377
+
378
+ ## Releasing
379
+
380
+ Publishing goes to PyPI through GitHub Actions trusted publishing (no API
381
+ token):
382
+
383
+ 1. Bump `__version__` in `chronist/__init__.py`, commit, push.
384
+ 2. Create a GitHub Release with tag `v<version>` (e.g. `v0.1.0`).
385
+
386
+ `.github/workflows/publish.yml` then runs the tests (Python 3.9–3.13), builds
387
+ the sdist and wheel, checks that the tag matches the version, and uploads.
388
+ `ci.yml` runs the tests on every push and pull request.
389
+
390
+ ## License
391
+
392
+ MIT. Bundled UI libraries keep their own licenses (uPlot: MIT, htm/Preact:
393
+ Apache-2.0/MIT, highlight.js: BSD-3-Clause); see `chronist/ui/static/vendor/`.