errorbars 0.2.2__tar.gz → 0.2.4__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.
@@ -2,6 +2,46 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.2.4] - 2026-10-03
6
+
7
+ ### Security
8
+
9
+ - A model name or question id holding a terminal escape sequence was printed as it came: the
10
+ tables and the errors that list models sent it to the terminal, which obeys it (clears the
11
+ screen, retitles the window, hides the rest of the line). Each control character in text
12
+ from the data is now written as a visible escape: `m\x1b]0;title\x07`. `--json` already
13
+ escaped them.
14
+
15
+ ## [0.2.3] - 2026-10-03
16
+
17
+ ### Compatibility
18
+
19
+ - Python 3.13 and 3.14 are tested and declared. CI runs the suite on 3.14
20
+ as well, and the package's classifiers list both versions. The code is
21
+ unchanged: with the newest release of every dependency, the tests pass on
22
+ 3.14 and on 3.15's release candidate.
23
+
24
+ The rest of this release is in the web demo; the package is otherwise
25
+ unchanged.
26
+
27
+ ### Changed
28
+
29
+ - The page's fonts are served by the page itself. They came from Google Fonts,
30
+ the one request the page made to another origin; the same font files (every
31
+ subset, as Google serves them to a current browser) are now in
32
+ `web/src/fonts/`, with their SIL Open Font License texts. Nothing looks
33
+ different: screenshots before and after match. The page now loads with
34
+ every other host blocked.
35
+
36
+ ### Security
37
+
38
+ - The built page carries a Content-Security-Policy. Scripts, styles, fonts and
39
+ workers load from the page's own origin only, and `connect-src 'self'` has
40
+ the browser refuse to send what you give the page to any other host, even
41
+ for a script injected through a bug in how the page renders a file. Inline
42
+ event handlers and `eval` are not allowed. Every control was exercised
43
+ in Chromium and Firefox with a listener for policy violations: none.
44
+
5
45
  ## [0.2.2] - 2026-10-02
6
46
 
7
47
  Files and pipes as Windows and spreadsheets make them.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: errorbars
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Error bars for LLM evals: standard errors, clustering, paired comparisons, leaderboards, and power analysis.
5
5
  Project-URL: Homepage, https://antonsoo.github.io/errorbars/
6
6
  Project-URL: Repository, https://github.com/antonsoo/errorbars
@@ -16,6 +16,8 @@ Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
19
21
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
22
  Classifier: Typing :: Typed
21
23
  Requires-Python: >=3.10
@@ -123,26 +125,23 @@ errorbars summarize examples/data/reading_comprehension.csv --model tuned-70b
123
125
  ```
124
126
 
125
127
  ```
126
- summarize: tuned-70b
127
- ┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
128
- ┃ metric ┃ value ┃
129
- ┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
130
- │ n │ 200 │
131
- │ mean │ 0.6900 │
132
- │ SE │ 0.0328 │
133
- │ 95% CI │ [0.6257, 0.7543] │
134
- │ method │ clt │
135
- └────────┴──────────────────┘
136
- clustering diagnostics
137
- ┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
138
- ┃ metric ┃ value ┃
139
- ┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
140
- │ n clusters │ 40 │
141
- │ ICC │ 0.0710 │
142
- │ design effect │ 1.284 │
143
- │ clustered SE │ 0.0372 │
144
- │ clustered CI │ [0.6148, 0.7652] │
145
- └───────────────┴──────────────────┘
128
+ summarize: tuned-70b
129
+ metric value
130
+ ------ ----------------
131
+ n 200
132
+ mean 0.6900
133
+ SE 0.0328
134
+ 95% CI [0.6257, 0.7543]
135
+ method clt
136
+
137
+ clustering diagnostics
138
+ metric value
139
+ ------------- ----------------
140
+ n clusters 40
141
+ ICC 0.0710
142
+ design effect 1.284
143
+ clustered SE 0.0372
144
+ clustered CI [0.6148, 0.7652]
146
145
  ```
147
146
 
148
147
  ```bash
@@ -200,14 +199,21 @@ errorbars compare out/sshleifer__tiny-gpt2 out/hf-internal-testing__tiny-random-
200
199
  ```
201
200
 
202
201
  ```
203
- │ n (shared questions) │ 20 │
204
- │ mean(sshleifer/tiny-gpt2) │ 0.6000 │
205
- │ mean(hf-internal-testing/tiny-random-gpt2) │ 0.8000 │
206
- │ mean diff (A - B) │ -0.2000 │
207
- │ paired SE │ 0.1376 │
208
- │ 95% CI │ [-0.4881, 0.0881] │
209
- │ p-value │ 0.1625 │
210
- │ McNemar discordant (A wrong/B right, A right/B wrong) │ 6 / 2 │
202
+ compare: sshleifer/tiny-gpt2 vs hf-internal-testing/tiny-random-gpt2
203
+ metric value
204
+ ----------------------------------------------------- -----------------
205
+ n (shared questions) 20
206
+ mean(sshleifer/tiny-gpt2) 0.6000
207
+ mean(hf-internal-testing/tiny-random-gpt2) 0.8000
208
+ mean diff (A - B) -0.2000
209
+ paired SE 0.1376
210
+ 95% CI [-0.4881, 0.0881]
211
+ p-value 0.1625
212
+ correlation(A, B) 0.1021
213
+ unpaired SE (for reference) 0.1451
214
+ variance reduction from pairing 10.0%
215
+ McNemar discordant (A wrong/B right, A right/B wrong) 6 / 2
216
+ McNemar exact p-value 0.2891
211
217
  ```
212
218
 
213
219
  That is a real run, committed under `tests/fixtures/lm_eval_output/` (two tiny models, 20 COPA
@@ -85,26 +85,23 @@ errorbars summarize examples/data/reading_comprehension.csv --model tuned-70b
85
85
  ```
86
86
 
87
87
  ```
88
- summarize: tuned-70b
89
- ┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
90
- ┃ metric ┃ value ┃
91
- ┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
92
- │ n │ 200 │
93
- │ mean │ 0.6900 │
94
- │ SE │ 0.0328 │
95
- │ 95% CI │ [0.6257, 0.7543] │
96
- │ method │ clt │
97
- └────────┴──────────────────┘
98
- clustering diagnostics
99
- ┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
100
- ┃ metric ┃ value ┃
101
- ┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
102
- │ n clusters │ 40 │
103
- │ ICC │ 0.0710 │
104
- │ design effect │ 1.284 │
105
- │ clustered SE │ 0.0372 │
106
- │ clustered CI │ [0.6148, 0.7652] │
107
- └───────────────┴──────────────────┘
88
+ summarize: tuned-70b
89
+ metric value
90
+ ------ ----------------
91
+ n 200
92
+ mean 0.6900
93
+ SE 0.0328
94
+ 95% CI [0.6257, 0.7543]
95
+ method clt
96
+
97
+ clustering diagnostics
98
+ metric value
99
+ ------------- ----------------
100
+ n clusters 40
101
+ ICC 0.0710
102
+ design effect 1.284
103
+ clustered SE 0.0372
104
+ clustered CI [0.6148, 0.7652]
108
105
  ```
109
106
 
110
107
  ```bash
@@ -162,14 +159,21 @@ errorbars compare out/sshleifer__tiny-gpt2 out/hf-internal-testing__tiny-random-
162
159
  ```
163
160
 
164
161
  ```
165
- │ n (shared questions) │ 20 │
166
- │ mean(sshleifer/tiny-gpt2) │ 0.6000 │
167
- │ mean(hf-internal-testing/tiny-random-gpt2) │ 0.8000 │
168
- │ mean diff (A - B) │ -0.2000 │
169
- │ paired SE │ 0.1376 │
170
- │ 95% CI │ [-0.4881, 0.0881] │
171
- │ p-value │ 0.1625 │
172
- │ McNemar discordant (A wrong/B right, A right/B wrong) │ 6 / 2 │
162
+ compare: sshleifer/tiny-gpt2 vs hf-internal-testing/tiny-random-gpt2
163
+ metric value
164
+ ----------------------------------------------------- -----------------
165
+ n (shared questions) 20
166
+ mean(sshleifer/tiny-gpt2) 0.6000
167
+ mean(hf-internal-testing/tiny-random-gpt2) 0.8000
168
+ mean diff (A - B) -0.2000
169
+ paired SE 0.1376
170
+ 95% CI [-0.4881, 0.0881]
171
+ p-value 0.1625
172
+ correlation(A, B) 0.1021
173
+ unpaired SE (for reference) 0.1451
174
+ variance reduction from pairing 10.0%
175
+ McNemar discordant (A wrong/B right, A right/B wrong) 6 / 2
176
+ McNemar exact p-value 0.2891
173
177
  ```
174
178
 
175
179
  That is a real run, committed under `tests/fixtures/lm_eval_output/` (two tiny models, 20 COPA
@@ -32,7 +32,7 @@ include = ["/src", "/docs/*.md", "/README.md", "/CHANGELOG.md", "/LICENSE*", "/p
32
32
 
33
33
  [project]
34
34
  name = "errorbars"
35
- version = "0.2.2"
35
+ version = "0.2.4"
36
36
  description = "Error bars for LLM evals: standard errors, clustering, paired comparisons, leaderboards, and power analysis."
37
37
  dynamic = ["readme"]
38
38
  license = "MIT"
@@ -54,6 +54,8 @@ classifiers = [
54
54
  "Programming Language :: Python :: 3.10",
55
55
  "Programming Language :: Python :: 3.11",
56
56
  "Programming Language :: Python :: 3.12",
57
+ "Programming Language :: Python :: 3.13",
58
+ "Programming Language :: Python :: 3.14",
57
59
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
58
60
  "Typing :: Typed",
59
61
  ]
@@ -88,7 +90,7 @@ packages = ["src/errorbars"]
88
90
 
89
91
  [dependency-groups]
90
92
  dev = [
91
- "pytest>=8.0",
93
+ "pytest>=9.0.3",
92
94
  "pytest-cov>=5.0",
93
95
  "ruff>=0.6",
94
96
  "mypy>=1.10",
@@ -13,7 +13,7 @@ from errorbars.stats import (
13
13
  within_between_variance,
14
14
  )
15
15
 
16
- __version__ = "0.2.2"
16
+ __version__ = "0.2.4"
17
17
 
18
18
  __all__ = [
19
19
  "__version__",
@@ -12,10 +12,14 @@ terminal follows three rules, each of which the first version of this broke:
12
12
  columns wide and cuts each cell to fit, which left two models of one organisation with the
13
13
  same visible name. A pipe gets the table at its full width, and a terminal too narrow for
14
14
  it gets the long cells folded onto more lines.
15
+ - A name is printed as text. A control character in one (the ESC that starts a terminal escape
16
+ sequence) is written as a visible escape, ``\\x1b``, instead of being sent to the terminal,
17
+ where it could clear the screen, retitle the window or hide the rest of the line.
15
18
  """
16
19
 
17
20
  from __future__ import annotations
18
21
 
22
+ import re
19
23
  from dataclasses import dataclass, field
20
24
  from typing import Literal
21
25
 
@@ -27,12 +31,32 @@ try:
27
31
  except ImportError: # pragma: no cover - exercised by the test that hides rich
28
32
  HAS_RICH = False
29
33
 
30
- __all__ = ["HAS_RICH", "Output", "Table"]
34
+ __all__ = ["HAS_RICH", "Output", "Table", "visible"]
31
35
 
32
36
  Justify = Literal["left", "right"]
33
37
 
34
38
  _UNBOUNDED = 100_000
35
39
 
40
+ _CONTROL = re.compile(r"[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]")
41
+
42
+
43
+ def visible(text: str) -> str:
44
+ """``text`` with each control character (bar tab and line breaks) written as ``\\xNN``.
45
+
46
+ Model names, question ids and the values in an error come from the data, and a terminal
47
+ obeys the escape sequences in what it is given.
48
+ """
49
+ return _CONTROL.sub(lambda m: f"\\x{ord(m.group()):02x}", text)
50
+
51
+
52
+ def _visible_table(table: Table) -> Table:
53
+ return Table(
54
+ title=visible(table.title),
55
+ header_style=table.header_style,
56
+ columns=[(visible(header), justify) for header, justify in table.columns],
57
+ rows=[tuple(visible(cell) for cell in row) for row in table.rows],
58
+ )
59
+
36
60
 
37
61
  @dataclass
38
62
  class Table:
@@ -82,6 +106,7 @@ class Output:
82
106
  return Console(markup=False, emoji=False, highlight=False, width=width)
83
107
 
84
108
  def table(self, table: Table) -> None:
109
+ table = _visible_table(table)
85
110
  if not self._rich:
86
111
  if not self._first:
87
112
  print()
@@ -106,6 +131,7 @@ class Output:
106
131
  self._first = False
107
132
 
108
133
  def note(self, text: str, style: str | None = None) -> None:
134
+ text = visible(text)
109
135
  if self._rich:
110
136
  self._console().print(text, style=style)
111
137
  else:
@@ -9,7 +9,7 @@ from pathlib import Path
9
9
  from typing import Any
10
10
 
11
11
  from errorbars import __version__
12
- from errorbars._tables import Output, Table
12
+ from errorbars._tables import Output, Table, visible
13
13
  from errorbars.compare import paired_compare
14
14
  from errorbars.inputs import load_inputs
15
15
  from errorbars.io import ColumnMap, EvalData, write_csv
@@ -41,7 +41,7 @@ def _load(args: argparse.Namespace, model: str | None = None) -> EvalData:
41
41
  except ImportError as exc:
42
42
  raise SystemExit(f"error: {exc}") from exc
43
43
  for note in loaded.notes:
44
- print(f"note: {note}", file=sys.stderr)
44
+ print(f"note: {visible(note)}", file=sys.stderr)
45
45
  return loaded.data
46
46
 
47
47
 
@@ -497,6 +497,16 @@ def main(argv: list[str] | None = None) -> None:
497
497
  parser = build_parser()
498
498
  args = parser.parse_args(argv)
499
499
  _text_streams()
500
+ try:
501
+ _run(args)
502
+ except SystemExit as exc:
503
+ # The messages quote models, files and values from the data.
504
+ if isinstance(exc.code, str):
505
+ raise SystemExit(visible(exc.code)) from exc.__cause__
506
+ raise
507
+
508
+
509
+ def _run(args: argparse.Namespace) -> None:
500
510
  try:
501
511
  args.func(args)
502
512
  except UnicodeDecodeError as exc:
File without changes
File without changes
File without changes
File without changes