zenofevals 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anuj Sadani
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.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: zenofevals
3
+ Version: 0.1.0
4
+ Summary: The Zen of Evals: principles for measuring whether an AI system actually works. Printed on import.
5
+ Author-email: Anuj Sadani <anuj.sadani3@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/asadani/zenofevals
8
+ Project-URL: Issues, https://github.com/asadani/zenofevals/issues
9
+ Project-URL: Changelog, https://github.com/asadani/zenofevals/blob/main/CHANGELOG.md
10
+ Keywords: evals,LLM evaluation,AI testing,benchmarks,LLM-as-judge,Zen
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Topic :: Software Development
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Dynamic: license-file
20
+
21
+ # zenofevals
22
+
23
+ [![CI](https://github.com/asadani/zenofevals/actions/workflows/ci.yml/badge.svg)](https://github.com/asadani/zenofevals/actions/workflows/ci.yml)
24
+ [![PyPI](https://img.shields.io/pypi/v/zenofevals)](https://pypi.org/project/zenofevals/)
25
+
26
+ ### The Zen of Evals: principles for measuring whether an AI system actually works.
27
+
28
+ Every change to a prompt, model or tool is a guess until an eval says otherwise. These principles cover how to define, build, run and interpret evals.
29
+
30
+ `import this` gave Python a shared mindset. `import zenofevals` does the same for this corner of AI engineering: 13 short principles you can remember, cite by number and argue about.
31
+
32
+ ```bash
33
+ pip install zenofevals # or: uv pip install zenofevals / uv add zenofevals
34
+ uvx zenofevals --random # run the CLI without installing (uv)
35
+ ```
36
+
37
+ ```python
38
+ >>> import zenofevals
39
+ The Zen of Evals, by Anuj Sadani
40
+
41
+ 1. Know what good looks like before you measure it.
42
+ 2. Your users' tasks are better than someone else's benchmark.
43
+ ...
44
+ ```
45
+
46
+ ---
47
+
48
+ ## The principles
49
+
50
+ Numbers are stable across releases, so "see principle 3" in a review always means the same thing.
51
+
52
+ ### Define
53
+ 1. Know what good looks like before you measure it.
54
+ 2. Your users' tasks are better than someone else's benchmark.
55
+ 3. Blend the scores and you blend away the failures.
56
+
57
+ ### Build
58
+ 4. Real is better than synthetic, though synthetic fills the gaps.
59
+ 5. Every failure is a test case waiting to be written.
60
+ 6. Let code grade what code can.
61
+ 7. An eval you trained on is a memory test.
62
+
63
+ ### Run
64
+ 8. If it could move the score, rerun the evals.
65
+ 9. One run finds a case; many runs find a pattern.
66
+ 10. Quality without cost and latency is half a measure.
67
+
68
+ ### Interpret
69
+ 11. Grade the grader.
70
+ 12. Averages hide what transcripts reveal.
71
+ 13. A saturated eval can guard, but it can't guide.
72
+
73
+ Every principle comes with an explanation and a concrete do/don't example: `zenofevals --examples`.
74
+
75
+ ---
76
+
77
+ ## Usage
78
+
79
+ ### On import
80
+
81
+ ```python
82
+ import zenofevals # prints the principles
83
+ from zenofevals import verbose # prints them with explanations
84
+ ```
85
+
86
+ Set `ZENOFEVALS_QUIET=1` to import without printing.
87
+
88
+ ### Command line
89
+
90
+ ```bash
91
+ zenofevals # the principles
92
+ zenofevals --verbose # with explanations
93
+ zenofevals --examples # with a do/don't example for each
94
+ zenofevals --themes # grouped by theme
95
+ zenofevals -n 3 # one principle in full
96
+ zenofevals --random # one at random: a daily reminder for your shell profile
97
+ zenofevals --checklist # Markdown checklist for PRs and agent instructions
98
+ zenofevals --json # machine-readable
99
+ ```
100
+
101
+ `python -m zenofevals` works the same way.
102
+
103
+ ### As data
104
+
105
+ ```python
106
+ import os; os.environ["ZENOFEVALS_QUIET"] = "1"
107
+ import zenofevals
108
+
109
+ zenofevals.get(3).text # "Blend the scores and you blend away the failures."
110
+ zenofevals.by_theme("define") # list of Principle objects
111
+ [p.text for p in zenofevals.PRINCIPLES]
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Putting it into your workflow
117
+
118
+ A slogan is not a process. The principles help most where decisions are made:
119
+
120
+ - **Pull requests.** Paste `zenofevals --checklist` into `.github/pull_request_template.md`. Reviewers can then point to a principle by number.
121
+ - **Coding agents.** Add the checklist (or `zenofevals --themes`) to `AGENTS.md`, `CLAUDE.md` or your editor's rules file, so your agent works by the same standard you review by.
122
+ - **Onboarding.** `zenofevals --examples` is a short read for anyone new to the team's approach.
123
+
124
+ ---
125
+
126
+ ## What this is, and isn't
127
+
128
+ - It **is** a compact, opinionated philosophy and a shared vocabulary for teams.
129
+ - It **isn't** a linter, a framework or a replacement for engineering judgment.
130
+ - It's **vendor-neutral**: no principle depends on a particular model, framework or vendor.
131
+
132
+ ---
133
+
134
+ ## Contributing
135
+
136
+ The principles should evolve through discussion, not by decree. Propose a new principle, a rewording or a better example by opening an issue. See [CONTRIBUTING.md](CONTRIBUTING.md).
137
+
138
+ ## License
139
+
140
+ [MIT](LICENSE)
@@ -0,0 +1,120 @@
1
+ # zenofevals
2
+
3
+ [![CI](https://github.com/asadani/zenofevals/actions/workflows/ci.yml/badge.svg)](https://github.com/asadani/zenofevals/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/zenofevals)](https://pypi.org/project/zenofevals/)
5
+
6
+ ### The Zen of Evals: principles for measuring whether an AI system actually works.
7
+
8
+ Every change to a prompt, model or tool is a guess until an eval says otherwise. These principles cover how to define, build, run and interpret evals.
9
+
10
+ `import this` gave Python a shared mindset. `import zenofevals` does the same for this corner of AI engineering: 13 short principles you can remember, cite by number and argue about.
11
+
12
+ ```bash
13
+ pip install zenofevals # or: uv pip install zenofevals / uv add zenofevals
14
+ uvx zenofevals --random # run the CLI without installing (uv)
15
+ ```
16
+
17
+ ```python
18
+ >>> import zenofevals
19
+ The Zen of Evals, by Anuj Sadani
20
+
21
+ 1. Know what good looks like before you measure it.
22
+ 2. Your users' tasks are better than someone else's benchmark.
23
+ ...
24
+ ```
25
+
26
+ ---
27
+
28
+ ## The principles
29
+
30
+ Numbers are stable across releases, so "see principle 3" in a review always means the same thing.
31
+
32
+ ### Define
33
+ 1. Know what good looks like before you measure it.
34
+ 2. Your users' tasks are better than someone else's benchmark.
35
+ 3. Blend the scores and you blend away the failures.
36
+
37
+ ### Build
38
+ 4. Real is better than synthetic, though synthetic fills the gaps.
39
+ 5. Every failure is a test case waiting to be written.
40
+ 6. Let code grade what code can.
41
+ 7. An eval you trained on is a memory test.
42
+
43
+ ### Run
44
+ 8. If it could move the score, rerun the evals.
45
+ 9. One run finds a case; many runs find a pattern.
46
+ 10. Quality without cost and latency is half a measure.
47
+
48
+ ### Interpret
49
+ 11. Grade the grader.
50
+ 12. Averages hide what transcripts reveal.
51
+ 13. A saturated eval can guard, but it can't guide.
52
+
53
+ Every principle comes with an explanation and a concrete do/don't example: `zenofevals --examples`.
54
+
55
+ ---
56
+
57
+ ## Usage
58
+
59
+ ### On import
60
+
61
+ ```python
62
+ import zenofevals # prints the principles
63
+ from zenofevals import verbose # prints them with explanations
64
+ ```
65
+
66
+ Set `ZENOFEVALS_QUIET=1` to import without printing.
67
+
68
+ ### Command line
69
+
70
+ ```bash
71
+ zenofevals # the principles
72
+ zenofevals --verbose # with explanations
73
+ zenofevals --examples # with a do/don't example for each
74
+ zenofevals --themes # grouped by theme
75
+ zenofevals -n 3 # one principle in full
76
+ zenofevals --random # one at random: a daily reminder for your shell profile
77
+ zenofevals --checklist # Markdown checklist for PRs and agent instructions
78
+ zenofevals --json # machine-readable
79
+ ```
80
+
81
+ `python -m zenofevals` works the same way.
82
+
83
+ ### As data
84
+
85
+ ```python
86
+ import os; os.environ["ZENOFEVALS_QUIET"] = "1"
87
+ import zenofevals
88
+
89
+ zenofevals.get(3).text # "Blend the scores and you blend away the failures."
90
+ zenofevals.by_theme("define") # list of Principle objects
91
+ [p.text for p in zenofevals.PRINCIPLES]
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Putting it into your workflow
97
+
98
+ A slogan is not a process. The principles help most where decisions are made:
99
+
100
+ - **Pull requests.** Paste `zenofevals --checklist` into `.github/pull_request_template.md`. Reviewers can then point to a principle by number.
101
+ - **Coding agents.** Add the checklist (or `zenofevals --themes`) to `AGENTS.md`, `CLAUDE.md` or your editor's rules file, so your agent works by the same standard you review by.
102
+ - **Onboarding.** `zenofevals --examples` is a short read for anyone new to the team's approach.
103
+
104
+ ---
105
+
106
+ ## What this is, and isn't
107
+
108
+ - It **is** a compact, opinionated philosophy and a shared vocabulary for teams.
109
+ - It **isn't** a linter, a framework or a replacement for engineering judgment.
110
+ - It's **vendor-neutral**: no principle depends on a particular model, framework or vendor.
111
+
112
+ ---
113
+
114
+ ## Contributing
115
+
116
+ The principles should evolve through discussion, not by decree. Propose a new principle, a rewording or a better example by opening an issue. See [CONTRIBUTING.md](CONTRIBUTING.md).
117
+
118
+ ## License
119
+
120
+ [MIT](LICENSE)
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "zenofevals"
7
+ version = "0.1.0"
8
+ authors = [
9
+ {name = "Anuj Sadani", email = "anuj.sadani3@gmail.com"}
10
+ ]
11
+ description = "The Zen of Evals: principles for measuring whether an AI system actually works. Printed on import."
12
+ readme = "README.md"
13
+ license = "MIT"
14
+ license-files = ["LICENSE"]
15
+ requires-python = ">=3.10"
16
+ keywords = ["evals", "LLM evaluation", "AI testing", "benchmarks", "LLM-as-judge", "Zen"]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "Programming Language :: Python :: 3",
21
+ "Operating System :: OS Independent",
22
+ "Topic :: Software Development",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/asadani/zenofevals"
27
+ Issues = "https://github.com/asadani/zenofevals/issues"
28
+ Changelog = "https://github.com/asadani/zenofevals/blob/main/CHANGELOG.md"
29
+
30
+ [project.scripts]
31
+ zenofevals = "zenofevals.__main__:main"
32
+
33
+ [tool.setuptools]
34
+ packages = ["zenofevals"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,109 @@
1
+ import contextlib
2
+ import importlib
3
+ import io
4
+ import json
5
+ import os
6
+ import subprocess
7
+ import sys
8
+ import unittest
9
+
10
+ os.environ["ZENOFEVALS_QUIET"] = "1"
11
+
12
+ import zenofevals # noqa: E402
13
+ from zenofevals import render # noqa: E402
14
+ from zenofevals.__main__ import main # noqa: E402
15
+
16
+ ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
+ N = len(zenofevals.PRINCIPLES)
18
+
19
+
20
+ def run_cli(*args):
21
+ buf = io.StringIO()
22
+ with contextlib.redirect_stdout(buf):
23
+ main(list(args))
24
+ return buf.getvalue()
25
+
26
+
27
+ def run_py(args, quiet):
28
+ env = dict(os.environ)
29
+ env.pop("ZENOFEVALS_QUIET", None)
30
+ if quiet:
31
+ env["ZENOFEVALS_QUIET"] = "1"
32
+ return subprocess.run(
33
+ [sys.executable] + args, cwd=ROOT, env=env,
34
+ capture_output=True, text=True, encoding="utf-8", check=True,
35
+ ).stdout
36
+
37
+
38
+ class TestData(unittest.TestCase):
39
+ def test_stable_numbers(self):
40
+ self.assertEqual([p.number for p in zenofevals.PRINCIPLES], list(range(1, N + 1)))
41
+
42
+ def test_every_principle_complete_and_themed(self):
43
+ for p in zenofevals.PRINCIPLES:
44
+ self.assertIn(p.theme, zenofevals.THEMES)
45
+ for field in (p.text, p.explanation, p.do, p.dont):
46
+ self.assertTrue(field.strip(), p.number)
47
+
48
+ def test_every_theme_used(self):
49
+ for theme in zenofevals.THEMES:
50
+ self.assertTrue(zenofevals.by_theme(theme))
51
+
52
+ def test_texts_are_unique(self):
53
+ texts = [p.text for p in zenofevals.PRINCIPLES]
54
+ self.assertEqual(len(texts), len(set(texts)))
55
+
56
+ def test_lookup(self):
57
+ self.assertEqual(zenofevals.get(1).number, 1)
58
+ with self.assertRaises(KeyError):
59
+ zenofevals.get(N + 1)
60
+ with self.assertRaises(ValueError):
61
+ zenofevals.by_theme("vibes")
62
+
63
+ def test_version_matches_pyproject(self):
64
+ with open(os.path.join(ROOT, "pyproject.toml"), encoding="utf-8") as f:
65
+ self.assertIn('version = "%s"' % zenofevals.__version__, f.read())
66
+
67
+
68
+ class TestImportSideEffect(unittest.TestCase):
69
+ def test_import_prints_like_import_this(self):
70
+ self.assertIn("1. " + zenofevals.PRINCIPLES[0].text, run_py(["-c", "import zenofevals"], quiet=False))
71
+
72
+ def test_quiet_env_silences_import(self):
73
+ self.assertEqual(run_py(["-c", "import zenofevals"], quiet=True), "")
74
+
75
+ def test_python_dash_m_prints_once(self):
76
+ out = run_py(["-m", "zenofevals", "--themes"], quiet=False)
77
+ self.assertIn("by theme", out)
78
+ self.assertNotIn("\n1. " + zenofevals.PRINCIPLES[0].text, out)
79
+
80
+ def test_verbose_module(self):
81
+ mod = importlib.import_module("zenofevals.verbose")
82
+ self.assertIn("Verbose Edition", mod.VERBOSE_ZEN)
83
+
84
+
85
+ class TestCLI(unittest.TestCase):
86
+ def test_default_is_concise(self):
87
+ self.assertEqual(run_cli().rstrip("\n"), render.concise().rstrip("\n"))
88
+
89
+ def test_examples_include_do_and_dont(self):
90
+ out = run_cli("--examples")
91
+ self.assertEqual(out.count("Do:"), N)
92
+ self.assertEqual(out.count("Don't:"), N)
93
+
94
+ def test_checklist_is_markdown(self):
95
+ self.assertEqual(run_cli("--checklist").count("- [ ]"), N)
96
+
97
+ def test_json_round_trips(self):
98
+ self.assertEqual(len(json.loads(run_cli("--json"))["principles"]), N)
99
+
100
+ def test_single_principle(self):
101
+ self.assertTrue(run_cli("-n", "1").startswith("1. "))
102
+
103
+ def test_bad_number_exits(self):
104
+ with self.assertRaises(SystemExit), contextlib.redirect_stderr(io.StringIO()):
105
+ run_cli("-n", str(N + 50))
106
+
107
+
108
+ if __name__ == "__main__":
109
+ unittest.main()
@@ -0,0 +1,32 @@
1
+ """The Zen of Evals. Like ``import this``, importing prints the principles.
2
+
3
+ Set the environment variable ZENOFEVALS_QUIET=1 to import without printing,
4
+ e.g. when using ``zenofevals.PRINCIPLES`` as data.
5
+ """
6
+
7
+ import os
8
+ import sys
9
+
10
+ from .principles import PRINCIPLES, THEMES, Principle, by_theme, get
11
+ from .render import concise as _concise
12
+
13
+ __version__ = "0.1.0"
14
+ __author__ = "Anuj Sadani"
15
+ __all__ = ["PRINCIPLES", "THEMES", "Principle", "by_theme", "get", "ZEN_CONCISE"]
16
+
17
+ ZEN_CONCISE = _concise()
18
+
19
+
20
+ def _running_cli() -> bool:
21
+ # `zenofevals ...` console script, or `python -m zenofevals ...`: the CLI prints instead.
22
+ if os.path.basename(sys.argv[0] or "").split(".")[0] == "zenofevals":
23
+ return True
24
+ orig = sys.orig_argv
25
+ if "-m" in orig:
26
+ i = orig.index("-m")
27
+ return i + 1 < len(orig) and orig[i + 1] == "zenofevals"
28
+ return False
29
+
30
+
31
+ if not os.environ.get("ZENOFEVALS_QUIET") and not _running_cli():
32
+ print(ZEN_CONCISE)
@@ -0,0 +1,48 @@
1
+ """Command line: ``zenofevals`` or ``python -m zenofevals``."""
2
+
3
+ import argparse
4
+ import random
5
+ import sys
6
+
7
+ from . import __version__
8
+ from . import render
9
+ from .principles import PRINCIPLES, get
10
+
11
+
12
+ def main(argv=None) -> int:
13
+ parser = argparse.ArgumentParser(prog="zenofevals", description="The Zen of Evals.")
14
+ mode = parser.add_mutually_exclusive_group()
15
+ mode.add_argument("-v", "--verbose", action="store_true", help="principles with explanations")
16
+ mode.add_argument("-e", "--examples", action="store_true", help="verbose, plus a do/don't example for each")
17
+ mode.add_argument("-t", "--themes", action="store_true", help="grouped by theme: define, build, run, interpret")
18
+ mode.add_argument("-n", "--number", type=int, metavar="N", help="show one principle in full (1-%d)" % len(PRINCIPLES))
19
+ mode.add_argument("-r", "--random", action="store_true", help="one random principle, e.g. for a daily reminder")
20
+ mode.add_argument("--checklist", action="store_true", help="Markdown checklist for PR templates or AGENTS.md")
21
+ mode.add_argument("--json", action="store_true", help="machine-readable output")
22
+ parser.add_argument("--version", action="version", version="zenofevals " + __version__)
23
+ args = parser.parse_args(argv)
24
+
25
+ if args.verbose:
26
+ out = render.verbose()
27
+ elif args.examples:
28
+ out = render.verbose(examples=True)
29
+ elif args.themes:
30
+ out = render.themed()
31
+ elif args.checklist:
32
+ out = render.checklist()
33
+ elif args.json:
34
+ out = render.as_json()
35
+ elif args.number is not None or args.random:
36
+ try:
37
+ p = random.choice(PRINCIPLES) if args.random else get(args.number)
38
+ except KeyError:
39
+ parser.error("principle number must be 1-%d" % len(PRINCIPLES))
40
+ out = "%d. %s\n %s\n Do: %s\n Don't: %s" % (p.number, p.text, p.explanation, p.do, p.dont)
41
+ else:
42
+ out = render.concise()
43
+ print(out)
44
+ return 0
45
+
46
+
47
+ if __name__ == "__main__":
48
+ sys.exit(main())
@@ -0,0 +1,131 @@
1
+ """The principles as structured data."""
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Dict, List, Tuple
5
+
6
+ THEMES: Dict[str, str] = {
7
+ 'define': 'Define',
8
+ 'build': 'Build',
9
+ 'run': 'Run',
10
+ 'interpret': 'Interpret',
11
+ }
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class Principle:
16
+ number: int
17
+ text: str
18
+ explanation: str
19
+ theme: str
20
+ do: str
21
+ dont: str
22
+
23
+
24
+ PRINCIPLES: Tuple[Principle, ...] = (
25
+ Principle(
26
+ 1, 'Know what good looks like before you measure it.',
27
+ 'Write down what a correct, useful output looks like before you build or tune. Without it, every result looks "pretty good".',
28
+ 'define',
29
+ do='Write acceptance criteria and a handful of graded examples first.',
30
+ dont='Decide what counts as success after seeing the outputs.',
31
+ ),
32
+ Principle(
33
+ 2, "Your users' tasks are better than someone else's benchmark.",
34
+ "Public benchmarks measure someone else's problem. Build evals from the tasks your users actually bring.",
35
+ 'define',
36
+ do='Sample real, anonymized requests into your eval set.',
37
+ dont='Choose a model on leaderboard rank alone.',
38
+ ),
39
+ Principle(
40
+ 3, 'Blend the scores and you blend away the failures.',
41
+ 'A single average hides trade-offs: a system can get more helpful and less safe while its score stays flat. Track completion, correctness, safety and refusals separately.',
42
+ 'define',
43
+ do='Report task success and harmful-output rate as separate numbers.',
44
+ dont='Ship because a single "quality score" went up 2%.',
45
+ ),
46
+ Principle(
47
+ 4, 'Real is better than synthetic, though synthetic fills the gaps.',
48
+ "Real cases capture the mess users bring; synthetic cases cover rare and risky situations you haven't seen yet. Start real, then fill the gaps on purpose.",
49
+ 'build',
50
+ do="Start from real cases, then generate edge cases for scenarios you're missing.",
51
+ dont='Build the whole set from model-generated questions.',
52
+ ),
53
+ Principle(
54
+ 5, 'Every failure is a test case waiting to be written.',
55
+ "When something goes wrong in production, add it to the eval set so it can't quietly come back.",
56
+ 'build',
57
+ do='Turn each bug report into a regression case.',
58
+ dont='Patch the prompt and move on without a test.',
59
+ ),
60
+ Principle(
61
+ 6, 'Let code grade what code can.',
62
+ "Exact checks—does it parse, does the test pass, does the number match—are cheap, fast and reliable. Use model graders only for judgments code can't make, and validate them.",
63
+ 'build',
64
+ do='Check JSON validity and field values with code.',
65
+ dont='Ask a model whether the JSON is valid.',
66
+ ),
67
+ Principle(
68
+ 7, 'An eval you trained on is a memory test.',
69
+ 'If eval cases leak into prompts, few-shot examples or fine-tuning data, the score measures recall, not ability. Keep a held-out set that nothing is tuned on.',
70
+ 'build',
71
+ do='Keep a locked test set apart from the examples you iterate on.',
72
+ dont='Paste failing eval cases into the prompt as examples and celebrate the gain.',
73
+ ),
74
+ Principle(
75
+ 8, 'If it could move the score, rerun the evals.',
76
+ 'Prompts, models, tools, retrieval data and parameters all change behavior. Rerun the relevant evals whenever one of them changes.',
77
+ 'run',
78
+ do='Run evals in CI on every prompt or model change.',
79
+ dont='Upgrade the model version on a Friday without re-running anything.',
80
+ ),
81
+ Principle(
82
+ 9, 'One run finds a case; many runs find a pattern.',
83
+ "A single run can reveal a bug, but model outputs vary, so it can't show reliability. Repeat runs and report the spread, not just the best result.",
84
+ 'run',
85
+ do='Run each case several times and report the pass rate with its spread.',
86
+ dont='Compare two prompts on one run each.',
87
+ ),
88
+ Principle(
89
+ 10, 'Quality without cost and latency is half a measure.',
90
+ "A better answer that's ten times slower or more expensive may be a worse product. Measure cost and latency next to quality.",
91
+ 'run',
92
+ do='Report accuracy, cost per task and p95 latency together.',
93
+ dont='Switch to a model that gains 1% accuracy at triple the cost without noticing.',
94
+ ),
95
+ Principle(
96
+ 11, 'Grade the grader.',
97
+ 'Model graders have biases—toward length, style and outputs like their own. Check their judgments against human labels before you trust them.',
98
+ 'interpret',
99
+ do='Have humans grade a sample and measure agreement with the model grader.',
100
+ dont='Trust a judge model because its scores look reasonable.',
101
+ ),
102
+ Principle(
103
+ 12, 'Averages hide what transcripts reveal.',
104
+ 'Read actual outputs—failures and a sample of passes—and break scores down by kind of task. The average can rise while an important slice gets worse.',
105
+ 'interpret',
106
+ do='Read a sample of transcripts every release and slice scores by category.',
107
+ dont='Look only at the dashboard number.',
108
+ ),
109
+ Principle(
110
+ 13, "A saturated eval can guard, but it can't guide.",
111
+ 'When everything passes, an eval still catches regressions but no longer shows how to improve. Keep it as a guard and add harder cases to lead the way.',
112
+ 'interpret',
113
+ do='Keep the saturated suite in CI and build a harder one.',
114
+ dont='Mistake 100% on an easy suite for a finished system.',
115
+ ),
116
+ )
117
+
118
+
119
+ def by_theme(theme: str) -> List[Principle]:
120
+ """Return the principles in one theme (define, build, run, interpret)."""
121
+ if theme not in THEMES:
122
+ raise ValueError("unknown theme %r; choose from %s" % (theme, ", ".join(THEMES)))
123
+ return [p for p in PRINCIPLES if p.theme == theme]
124
+
125
+
126
+ def get(number: int) -> Principle:
127
+ """Return a principle by its stable number."""
128
+ for p in PRINCIPLES:
129
+ if p.number == number:
130
+ return p
131
+ raise KeyError(number)
@@ -0,0 +1,53 @@
1
+ """Turn the principles into text: concise, verbose, by theme, checklist, JSON."""
2
+
3
+ import json
4
+ from dataclasses import asdict
5
+
6
+ from .principles import PRINCIPLES, THEMES, by_theme
7
+
8
+ TITLE = "The Zen of Evals, by Anuj Sadani"
9
+
10
+
11
+ def concise() -> str:
12
+ lines = [TITLE, ""]
13
+ lines += ["%d. %s" % (p.number, p.text) for p in PRINCIPLES]
14
+ return "\n".join(lines) + "\n"
15
+
16
+
17
+ def verbose(examples: bool = False) -> str:
18
+ lines = ["The Zen of Evals (Verbose Edition)", "by Anuj Sadani", ""]
19
+ for p in PRINCIPLES:
20
+ pad = " " * (len(str(p.number)) + 2)
21
+ lines.append("%d. %s" % (p.number, p.text))
22
+ lines.append("%s— %s" % (pad, p.explanation))
23
+ if examples:
24
+ lines.append("%sDo: %s" % (pad, p.do))
25
+ lines.append("%sDon't: %s" % (pad, p.dont))
26
+ lines.append("")
27
+ return "\n".join(lines)
28
+
29
+
30
+ def themed() -> str:
31
+ lines = [TITLE + " — by theme", ""]
32
+ for key, name in THEMES.items():
33
+ lines.append(name)
34
+ lines += [" %d. %s" % (p.number, p.text) for p in by_theme(key)]
35
+ lines.append("")
36
+ return "\n".join(lines)
37
+
38
+
39
+ def checklist() -> str:
40
+ """Markdown checklist for PR templates, AGENTS.md or CLAUDE.md."""
41
+ lines = ["## Eval review checklist (Zen of Evals)", ""]
42
+ for key, name in THEMES.items():
43
+ lines.append("### " + name)
44
+ lines += ["- [ ] %s _(#%d)_" % (p.do, p.number) for p in by_theme(key)]
45
+ lines.append("")
46
+ return "\n".join(lines)
47
+
48
+
49
+ def as_json() -> str:
50
+ return json.dumps(
51
+ {"themes": THEMES, "principles": [asdict(p) for p in PRINCIPLES]},
52
+ ensure_ascii=False, indent=2,
53
+ )
@@ -0,0 +1,10 @@
1
+ """``from zenofevals import verbose`` prints the verbose edition."""
2
+
3
+ import os
4
+
5
+ from .render import verbose as _verbose
6
+
7
+ VERBOSE_ZEN = _verbose()
8
+
9
+ if not os.environ.get("ZENOFEVALS_QUIET"):
10
+ print(VERBOSE_ZEN)
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: zenofevals
3
+ Version: 0.1.0
4
+ Summary: The Zen of Evals: principles for measuring whether an AI system actually works. Printed on import.
5
+ Author-email: Anuj Sadani <anuj.sadani3@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/asadani/zenofevals
8
+ Project-URL: Issues, https://github.com/asadani/zenofevals/issues
9
+ Project-URL: Changelog, https://github.com/asadani/zenofevals/blob/main/CHANGELOG.md
10
+ Keywords: evals,LLM evaluation,AI testing,benchmarks,LLM-as-judge,Zen
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Topic :: Software Development
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Dynamic: license-file
20
+
21
+ # zenofevals
22
+
23
+ [![CI](https://github.com/asadani/zenofevals/actions/workflows/ci.yml/badge.svg)](https://github.com/asadani/zenofevals/actions/workflows/ci.yml)
24
+ [![PyPI](https://img.shields.io/pypi/v/zenofevals)](https://pypi.org/project/zenofevals/)
25
+
26
+ ### The Zen of Evals: principles for measuring whether an AI system actually works.
27
+
28
+ Every change to a prompt, model or tool is a guess until an eval says otherwise. These principles cover how to define, build, run and interpret evals.
29
+
30
+ `import this` gave Python a shared mindset. `import zenofevals` does the same for this corner of AI engineering: 13 short principles you can remember, cite by number and argue about.
31
+
32
+ ```bash
33
+ pip install zenofevals # or: uv pip install zenofevals / uv add zenofevals
34
+ uvx zenofevals --random # run the CLI without installing (uv)
35
+ ```
36
+
37
+ ```python
38
+ >>> import zenofevals
39
+ The Zen of Evals, by Anuj Sadani
40
+
41
+ 1. Know what good looks like before you measure it.
42
+ 2. Your users' tasks are better than someone else's benchmark.
43
+ ...
44
+ ```
45
+
46
+ ---
47
+
48
+ ## The principles
49
+
50
+ Numbers are stable across releases, so "see principle 3" in a review always means the same thing.
51
+
52
+ ### Define
53
+ 1. Know what good looks like before you measure it.
54
+ 2. Your users' tasks are better than someone else's benchmark.
55
+ 3. Blend the scores and you blend away the failures.
56
+
57
+ ### Build
58
+ 4. Real is better than synthetic, though synthetic fills the gaps.
59
+ 5. Every failure is a test case waiting to be written.
60
+ 6. Let code grade what code can.
61
+ 7. An eval you trained on is a memory test.
62
+
63
+ ### Run
64
+ 8. If it could move the score, rerun the evals.
65
+ 9. One run finds a case; many runs find a pattern.
66
+ 10. Quality without cost and latency is half a measure.
67
+
68
+ ### Interpret
69
+ 11. Grade the grader.
70
+ 12. Averages hide what transcripts reveal.
71
+ 13. A saturated eval can guard, but it can't guide.
72
+
73
+ Every principle comes with an explanation and a concrete do/don't example: `zenofevals --examples`.
74
+
75
+ ---
76
+
77
+ ## Usage
78
+
79
+ ### On import
80
+
81
+ ```python
82
+ import zenofevals # prints the principles
83
+ from zenofevals import verbose # prints them with explanations
84
+ ```
85
+
86
+ Set `ZENOFEVALS_QUIET=1` to import without printing.
87
+
88
+ ### Command line
89
+
90
+ ```bash
91
+ zenofevals # the principles
92
+ zenofevals --verbose # with explanations
93
+ zenofevals --examples # with a do/don't example for each
94
+ zenofevals --themes # grouped by theme
95
+ zenofevals -n 3 # one principle in full
96
+ zenofevals --random # one at random: a daily reminder for your shell profile
97
+ zenofevals --checklist # Markdown checklist for PRs and agent instructions
98
+ zenofevals --json # machine-readable
99
+ ```
100
+
101
+ `python -m zenofevals` works the same way.
102
+
103
+ ### As data
104
+
105
+ ```python
106
+ import os; os.environ["ZENOFEVALS_QUIET"] = "1"
107
+ import zenofevals
108
+
109
+ zenofevals.get(3).text # "Blend the scores and you blend away the failures."
110
+ zenofevals.by_theme("define") # list of Principle objects
111
+ [p.text for p in zenofevals.PRINCIPLES]
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Putting it into your workflow
117
+
118
+ A slogan is not a process. The principles help most where decisions are made:
119
+
120
+ - **Pull requests.** Paste `zenofevals --checklist` into `.github/pull_request_template.md`. Reviewers can then point to a principle by number.
121
+ - **Coding agents.** Add the checklist (or `zenofevals --themes`) to `AGENTS.md`, `CLAUDE.md` or your editor's rules file, so your agent works by the same standard you review by.
122
+ - **Onboarding.** `zenofevals --examples` is a short read for anyone new to the team's approach.
123
+
124
+ ---
125
+
126
+ ## What this is, and isn't
127
+
128
+ - It **is** a compact, opinionated philosophy and a shared vocabulary for teams.
129
+ - It **isn't** a linter, a framework or a replacement for engineering judgment.
130
+ - It's **vendor-neutral**: no principle depends on a particular model, framework or vendor.
131
+
132
+ ---
133
+
134
+ ## Contributing
135
+
136
+ The principles should evolve through discussion, not by decree. Propose a new principle, a rewording or a better example by opening an issue. See [CONTRIBUTING.md](CONTRIBUTING.md).
137
+
138
+ ## License
139
+
140
+ [MIT](LICENSE)
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ tests/test_zenofevals.py
5
+ zenofevals/__init__.py
6
+ zenofevals/__main__.py
7
+ zenofevals/principles.py
8
+ zenofevals/render.py
9
+ zenofevals/verbose.py
10
+ zenofevals.egg-info/PKG-INFO
11
+ zenofevals.egg-info/SOURCES.txt
12
+ zenofevals.egg-info/dependency_links.txt
13
+ zenofevals.egg-info/entry_points.txt
14
+ zenofevals.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ zenofevals = zenofevals.__main__:main
@@ -0,0 +1 @@
1
+ zenofevals