reeval-python 0.17.2__tar.gz → 0.18.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 (81) hide show
  1. {reeval_python-0.17.2 → reeval_python-0.18.0}/PKG-INFO +1 -1
  2. {reeval_python-0.17.2 → reeval_python-0.18.0}/pyproject.toml +1 -1
  3. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/_wire.py +29 -8
  4. reeval_python-0.18.0/src/reeval_python/binaries.json +55 -0
  5. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/context.py +19 -0
  6. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/declare.py +6 -6
  7. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/options.py +14 -3
  8. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/wire.py +3 -1
  9. reeval_python-0.18.0/tests/context/observe.eval.py +10 -0
  10. reeval_python-0.18.0/tests/context/observe.sync.eval.py +10 -0
  11. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_json.py +7 -0
  12. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_sdk.py +2 -1
  13. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_source.py +2 -5
  14. {reeval_python-0.17.2 → reeval_python-0.18.0}/uv.lock +1 -1
  15. reeval_python-0.17.2/src/reeval_python/binaries.json +0 -55
  16. {reeval_python-0.17.2 → reeval_python-0.18.0}/.gitignore +0 -0
  17. {reeval_python-0.17.2 → reeval_python-0.18.0}/CHANGELOG.md +0 -0
  18. {reeval_python-0.17.2 → reeval_python-0.18.0}/LICENSE +0 -0
  19. {reeval_python-0.17.2 → reeval_python-0.18.0}/README.md +0 -0
  20. {reeval_python-0.17.2 → reeval_python-0.18.0}/package.json +0 -0
  21. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/__init__.py +0 -0
  22. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/__main__.py +0 -0
  23. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/aio.py +0 -0
  24. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/checks.py +0 -0
  25. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/cli.py +0 -0
  26. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/environment.py +0 -0
  27. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/errors.py +0 -0
  28. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/expect.py +0 -0
  29. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/py.typed +0 -0
  30. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/runner.py +0 -0
  31. {reeval_python-0.17.2 → reeval_python-0.18.0}/src/reeval_python/types.py +0 -0
  32. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/abort.eval.py +0 -0
  33. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/abort.sync.eval.py +0 -0
  34. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/exec-retries.eval.py +0 -0
  35. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/exec-retries.sync.eval.py +0 -0
  36. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/exec.eval.py +0 -0
  37. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/exec.sync.eval.py +0 -0
  38. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/expect-fail.eval.py +0 -0
  39. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/expect-fail.sync.eval.py +0 -0
  40. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/expect.eval.py +0 -0
  41. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/expect.sync.eval.py +0 -0
  42. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/files.eval.py +0 -0
  43. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/files.sync.eval.py +0 -0
  44. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/judge.eval.py +0 -0
  45. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/judge.sync.eval.py +0 -0
  46. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/record.async.eval.py +0 -0
  47. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/record.eval.py +0 -0
  48. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/send.eval.py +0 -0
  49. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/send.sync.eval.py +0 -0
  50. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/sync-async.async.eval.py +0 -0
  51. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/context/sync-async.eval.py +0 -0
  52. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/best-of.eval.py +0 -0
  53. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/compare-questions.eval.py +0 -0
  54. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/compare-variants.eval.py +0 -0
  55. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/each-families.eval.py +0 -0
  56. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/egress-cascade.eval.py +0 -0
  57. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/environment-extend.eval.py +0 -0
  58. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/environment-plugin-marketplace.eval.py +0 -0
  59. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/environment-plugins.eval.py +0 -0
  60. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/groups-skip-todo.eval.py +0 -0
  61. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/questions-attempts.eval.py +0 -0
  62. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/questions-group.eval.py +0 -0
  63. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/questions-state.eval.py +0 -0
  64. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/revision.eval.py +0 -0
  65. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/declare/tags.eval.py +0 -0
  66. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/runner_process.py +0 -0
  67. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/stdio_host.py +0 -0
  68. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_api.py +0 -0
  69. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_checks.py +0 -0
  70. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_cli.py +0 -0
  71. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_conformance_context.py +0 -0
  72. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_conformance_declare.py +0 -0
  73. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_load.py +0 -0
  74. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_patterns.py +0 -0
  75. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_python_wheels.py +0 -0
  76. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_attempts.py +0 -0
  77. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_checks.py +0 -0
  78. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_isolation.py +0 -0
  79. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_misuse.py +0 -0
  80. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_runner_stdio.py +0 -0
  81. {reeval_python-0.17.2 → reeval_python-0.18.0}/tests/test_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: reeval-python
3
- Version: 0.17.2
3
+ Version: 0.18.0
4
4
  Summary: Python authoring SDK for reeval (*.eval.py eval files)
5
5
  Project-URL: Homepage, https://reeval.ai
6
6
  Project-URL: Repository, https://github.com/invertase/reeval
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "reeval-python"
3
- version = "0.17.2"
3
+ version = "0.18.0"
4
4
  description = "Python authoring SDK for reeval (*.eval.py eval files)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -158,6 +158,16 @@ class AttemptCallWriteFile(TypedDict):
158
158
  path: str
159
159
 
160
160
 
161
+ # `c.observe(name, value)`: records a fact about the attempt that never affects its outcome. A
162
+ # name observed again keeps the last value. Fails after the body's `done`.
163
+ class AttemptCallObserve(TypedDict):
164
+ # What the value is of, e.g. `installed`.
165
+ name: str
166
+ op: Literal["observe"]
167
+ # Any JSON, at most 4 KB once serialized.
168
+ value: JSONValue
169
+
170
+
161
171
  # Where the eval made the call, which the record names beside the check's outcome.
162
172
  class AttemptCallExpectAt(TypedDict):
163
173
  # The eval file: absolute, or relative to the project root.
@@ -232,7 +242,7 @@ class AttemptCallJudge(TypedDict):
232
242
 
233
243
  # One call an eval's body makes on its attempt. The sandbox and the agent session start on the
234
244
  # first call that needs them; there's no call to start them.
235
- AttemptCall: TypeAlias = "AttemptCallSend | AttemptCallExec | AttemptCallServe | AttemptCallKill | AttemptCallCapture | AttemptCallReadFile | AttemptCallWriteFile | AttemptCallExpect | AttemptCallRecord | AttemptCallJudge"
245
+ AttemptCall: TypeAlias = "AttemptCallSend | AttemptCallExec | AttemptCallServe | AttemptCallKill | AttemptCallCapture | AttemptCallReadFile | AttemptCallWriteFile | AttemptCallObserve | AttemptCallExpect | AttemptCallRecord | AttemptCallJudge"
236
246
 
237
247
 
238
248
  # The runner to reeval: the eval's body has finished. The attempt's checks and record follow.
@@ -313,6 +323,13 @@ class AttemptReplyWriteFile(TypedDict):
313
323
  op: Literal["writeFile"]
314
324
 
315
325
 
326
+ class AttemptReplyObserve(TypedDict):
327
+ # Pairs a reply with its request.
328
+ id: str
329
+ ok: Literal[True]
330
+ op: Literal["observe"]
331
+
332
+
316
333
  class AttemptReplyExpect(TypedDict):
317
334
  assertion: AssertionRecord
318
335
  # Pairs a reply with its request.
@@ -352,12 +369,12 @@ class AttemptReplyError(TypedDict):
352
369
  # Pairs a reply with its request.
353
370
  id: str
354
371
  ok: Literal[False]
355
- op: Literal["send", "exec", "readFile", "writeFile", "expect", "record", "judge", "serve", "kill", "capture"]
372
+ op: Literal["send", "exec", "readFile", "writeFile", "observe", "expect", "record", "judge", "serve", "kill", "capture"]
356
373
 
357
374
 
358
375
  # reeval's reply to a call: its result, or the error it threw. A failed matcher is a result (its
359
376
  # record says `fail`), not an error, unless the matcher couldn't run.
360
- AttemptReply: TypeAlias = "AttemptReplySend | AttemptReplyExec | AttemptReplyServe | AttemptReplyKill | AttemptReplyCapture | AttemptReplyReadFile | AttemptReplyWriteFile | AttemptReplyExpect | AttemptReplyRecord | AttemptReplyJudge | AttemptReplyExpect2 | AttemptReplyError"
377
+ AttemptReply: TypeAlias = "AttemptReplySend | AttemptReplyExec | AttemptReplyServe | AttemptReplyKill | AttemptReplyCapture | AttemptReplyReadFile | AttemptReplyWriteFile | AttemptReplyObserve | AttemptReplyExpect | AttemptReplyRecord | AttemptReplyJudge | AttemptReplyExpect2 | AttemptReplyError"
361
378
 
362
379
 
363
380
  # A call, numbered so its reply can find it.
@@ -652,14 +669,14 @@ DeclaredMode: TypeAlias = "Literal[\"run\", \"skip\", \"only\"]"
652
669
  DeclaredNode: TypeAlias = "DeclaredEval | DeclaredGroup | DeclaredTodo"
653
670
 
654
671
 
655
- # An eval's own source, hashed by the SDK that declared it: sha256 (hex) of its body's source
656
- # text, and of an `evaluate.each` case's data as canonical JSON (object keys sorted, no
657
- # whitespace, non-ASCII characters as themselves).
672
+ # An eval's own source as the SDK that declared it reads it: sha256 (hex) of its body's source
673
+ # text, and an `evaluate.each` case's data as canonical JSON (object keys sorted, no whitespace,
674
+ # non-ASCII characters as themselves). reeval hashes the case itself, with its secrets masked.
658
675
  class DeclaredSource(TypedDict):
659
676
  # sha256 of the body function's source text.
660
677
  body: str
661
- # sha256 of the case's data; set on each case of an `evaluate.each`.
662
- case: NotRequired[str]
678
+ # The case's data as canonical JSON text; set on each case of an `evaluate.each`.
679
+ caseJson: NotRequired[str]
663
680
 
664
681
 
665
682
  # `evaluate.todo` or `group.todo`.
@@ -1356,6 +1373,7 @@ class JudgeCallData(TypedDict):
1356
1373
  maxConcurrent: NotRequired[int]
1357
1374
  # `'provider/model'`, or a fake judge with a numeric score.
1358
1375
  model: NotRequired[str | FakeJudgeData]
1376
+ observations: NotRequired[bool | list[str]]
1359
1377
  # The turn `task`, `output`, `transcript` and `diff` read instead of the latest: an earlier
1360
1378
  # turn, or a value graded as the output.
1361
1379
  on: NotRequired[JudgeCallDataOnTurn | JudgeCallDataOnValue]
@@ -1655,6 +1673,8 @@ class Question(TypedDict):
1655
1673
  files: NotRequired[bool]
1656
1674
  # `'provider/model'` that answers it, over the cascaded `question.model`.
1657
1675
  model: NotRequired[str]
1676
+ # `c.observe()` values, by name; a list shows only those names.
1677
+ observations: NotRequired[bool | list[str]]
1658
1678
  # The final message: the agent's own account of its work.
1659
1679
  output: NotRequired[bool]
1660
1680
  question: str
@@ -2000,6 +2020,7 @@ CAMEL_KEYS: frozenset[str] = frozenset(
2000
2020
  "bestOf",
2001
2021
  "cacheRead",
2002
2022
  "cacheWrite",
2023
+ "caseJson",
2003
2024
  "costUsd",
2004
2025
  "delayMs",
2005
2026
  "durationMs",
@@ -0,0 +1,55 @@
1
+ {
2
+ "version": "0.18.0",
3
+ "binaries": {
4
+ "linux-x64": {
5
+ "name": "reeval-0.18.0-linux-x64",
6
+ "sha256": "58935d35f38ac6a35807a9e9fc75dfe21b3c41103de29d4b136de8f0fb7da315",
7
+ "size": 88126944
8
+ },
9
+ "linux-arm64": {
10
+ "name": "reeval-0.18.0-linux-arm64",
11
+ "sha256": "9273086a308ff6315091b8c13d201aceb2b86b08fae27393041b4c191fd8d7d4",
12
+ "size": 88066344
13
+ },
14
+ "linux-x64-musl": {
15
+ "name": "reeval-0.18.0-linux-x64-musl",
16
+ "sha256": "d8a09bc64f9661cef911c510efadb3160e57c8d77aecbde05532ba6a4c8c8957",
17
+ "size": 82097712
18
+ },
19
+ "linux-arm64-musl": {
20
+ "name": "reeval-0.18.0-linux-arm64-musl",
21
+ "sha256": "71e61a0244bdfdede8702cd70bcbb3f6e67deceec982b0bf5698b55d971ce742",
22
+ "size": 81202384
23
+ },
24
+ "darwin-x64": {
25
+ "name": "reeval-0.18.0-darwin-x64",
26
+ "sha256": "37f405383d93ae6bdafb532bab609839dbf483d5411e2485edae161c001d94c7",
27
+ "size": 76132624
28
+ },
29
+ "darwin-arm64": {
30
+ "name": "reeval-0.18.0-darwin-arm64",
31
+ "sha256": "3702107fb5c338ba874cef7aac2fc5011e3b28ed2296e7eecbbfa3428860c1a7",
32
+ "size": 69079410
33
+ },
34
+ "windows-x64": {
35
+ "name": "reeval-0.18.0-windows-x64.exe",
36
+ "sha256": "18ef75b27aa9303bf0f68e67c23a555b684ed373661fb6ad1b03e9f00750d6a0",
37
+ "size": 92902400
38
+ },
39
+ "linux-x64-baseline": {
40
+ "name": "reeval-0.18.0-linux-x64-baseline",
41
+ "sha256": "6104e41dde3f7af844b81a898fb31a934887e8931c648648533108b15fb8e2b0",
42
+ "size": 88126944
43
+ },
44
+ "linux-x64-musl-baseline": {
45
+ "name": "reeval-0.18.0-linux-x64-musl-baseline",
46
+ "sha256": "17c41eafea3e13c8cdad79013706cfc4c7e11794302668cc1a2cc449412ceb3f",
47
+ "size": 82097712
48
+ },
49
+ "windows-x64-baseline": {
50
+ "name": "reeval-0.18.0-windows-x64-baseline.exe",
51
+ "sha256": "b2fd67b24425ef8e42792926fbff985254e4947113927bf1f2fe231519425b28",
52
+ "size": 92902400
53
+ }
54
+ }
55
+ }
@@ -245,6 +245,17 @@ class AttemptContext:
245
245
  else:
246
246
  await self._call({"op": "writeFile", "path": path, "contents": contents})
247
247
 
248
+ def observe(self, name: str, value: object) -> Coroutine[Any, Any, None]:
249
+ """Record a fact about the attempt under `name`, such as what the agent installed. It
250
+ never affects the outcome; observing a name again replaces its value. `value` is JSON, at
251
+ most 4 KB."""
252
+ _not_describing("c.observe")
253
+ data = json_value(value, f"c.observe({name!r}, …) takes a JSON value")
254
+ return tracked(self._observe(name, data), "c.observe()")
255
+
256
+ async def _observe(self, name: str, value: Any) -> None:
257
+ await self._call({"op": "observe", "name": name, "value": value})
258
+
248
259
  def kill(self, handle: BackgroundHandle) -> Coroutine[Any, Any, None]:
249
260
  """Stop a command `c.exec(…, background=True)` left running."""
250
261
  _not_describing("c.kill")
@@ -404,6 +415,14 @@ class SyncAttemptContext:
404
415
  _not_describing("c.write_file")
405
416
  self._run(self._ctx._write_file(path, contents)) # pyright: ignore[reportPrivateUsage]
406
417
 
418
+ def observe(self, name: str, value: object) -> None:
419
+ """Record a fact about the attempt under `name`, such as what the agent installed. It
420
+ never affects the outcome; observing a name again replaces its value. `value` is JSON, at
421
+ most 4 KB."""
422
+ _not_describing("c.observe")
423
+ data = json_value(value, f"c.observe({name!r}, …) takes a JSON value")
424
+ self._run(self._ctx._observe(name, data)) # pyright: ignore[reportPrivateUsage]
425
+
407
426
  def kill(self, handle: BackgroundHandle) -> None:
408
427
  """Stop a command `c.exec(…, background=True)` left running."""
409
428
  _not_describing("c.kill")
@@ -381,11 +381,12 @@ def _case_default(value: Any) -> Any:
381
381
  raise TypeError(f"{type(value).__name__} isn't JSON data")
382
382
 
383
383
 
384
- def case_hash(case: Any, where: str) -> str:
385
- """sha256 of a case's data as canonical JSON: keys sorted, no whitespace. A dataclass is its
386
- fields and an environment its name; anything else that isn't JSON is refused."""
384
+ def case_json(case: Any, where: str) -> str:
385
+ """A case's data as canonical JSON text: keys sorted, no whitespace. A dataclass is its fields
386
+ and an environment its name; anything else that isn't JSON is refused. reeval hashes it with
387
+ its secrets masked."""
387
388
  try:
388
- text = json.dumps(
389
+ return json.dumps(
389
390
  case,
390
391
  default=_case_default,
391
392
  sort_keys=True,
@@ -398,7 +399,6 @@ def case_hash(case: Any, where: str) -> str:
398
399
  f"{where}: reeval fingerprints each case as JSON data, and this one isn't ({exc}). "
399
400
  "Pass dicts, lists, strings, numbers, booleans, None or dataclasses"
400
401
  ) from None
401
- return hashlib.sha256(text.encode()).hexdigest()
402
402
 
403
403
 
404
404
  def is_async(fn: Callable[..., Any]) -> bool:
@@ -519,7 +519,7 @@ def evaluate_each(
519
519
  name = _case_name(name_template, case, index)
520
520
  source: w.DeclaredSource = {
521
521
  "body": body,
522
- "case": case_hash(case, f"{each} case {index}"),
522
+ "caseJson": case_json(case, f"{each} case {index}"),
523
523
  }
524
524
  _register_eval(name, "run", opts, _with_case(fn, case), source, family, hint)
525
525
 
@@ -29,8 +29,8 @@ class JudgeOptions(JudgeDefaults, total=False):
29
29
  """`c.judge()`'s options: the judge defaults, and what the call shows the judge.
30
30
 
31
31
  Every input is off unless the call turns it on, and a call turns on at least one of `task`,
32
- `output`, `files`, `diff`, `contents`, `transcript`, `checks` or `artifacts`. `turns` says
33
- whether they read every turn up to the graded one (`"all"`) or that turn alone.
32
+ `output`, `files`, `diff`, `contents`, `transcript`, `checks`, `observations` or `artifacts`.
33
+ `turns` says whether they read every turn up to the graded one (`"all"`) or that turn alone.
34
34
  """
35
35
 
36
36
  task: bool
@@ -40,11 +40,22 @@ class JudgeOptions(JudgeDefaults, total=False):
40
40
  contents: Sequence[str]
41
41
  transcript: bool | Literal["tools", "full"]
42
42
  checks: bool | Sequence[str]
43
+ observations: bool | Sequence[str]
43
44
  artifacts: Literal[True] | Sequence[str]
44
45
  turns: Literal["last", "all"]
45
46
 
46
47
 
47
- JUDGE_INPUTS = ("task", "output", "files", "diff", "contents", "transcript", "checks", "artifacts")
48
+ JUDGE_INPUTS = (
49
+ "task",
50
+ "output",
51
+ "files",
52
+ "diff",
53
+ "contents",
54
+ "transcript",
55
+ "checks",
56
+ "observations",
57
+ "artifacts",
58
+ )
48
59
 
49
60
 
50
61
  class BestOf(TypedDict):
@@ -92,7 +92,9 @@ def json_value(value: Any, where: str) -> Any:
92
92
  json.dumps(value, allow_nan=False)
93
93
  except TypeError as exc:
94
94
  raise TypeError(f"{where}: {exc}") from None
95
- except ValueError:
95
+ except ValueError as exc:
96
+ if "Circular reference" in str(exc):
97
+ raise TypeError(f"{where}: it refers to itself, which JSON can't hold") from None
96
98
  # Python's own message for this names no value on some versions.
97
99
  raise TypeError(f"{where}: it isn't JSON, which has no NaN or Infinity") from None
98
100
  return value
@@ -0,0 +1,10 @@
1
+ from reeval_python import evaluate
2
+
3
+
4
+ @evaluate("observe")
5
+ async def observe(c):
6
+ await c.observe("orm", "none yet")
7
+ await c.send("add a database layer")
8
+ await c.observe("orm", "drizzle")
9
+ await c.observe("deps", ["drizzle-orm", "pg"])
10
+ await c.observe("dep-count", 2)
@@ -0,0 +1,10 @@
1
+ from reeval_python import evaluate
2
+
3
+
4
+ @evaluate("observe")
5
+ def observe(c):
6
+ c.observe("orm", "none yet")
7
+ c.send("add a database layer")
8
+ c.observe("orm", "drizzle")
9
+ c.observe("deps", ["drizzle-orm", "pg"])
10
+ c.observe("dep-count", 2)
@@ -90,3 +90,10 @@ def test_a_nan_in_a_declaration_is_a_load_error(tmp_path: Path) -> None:
90
90
  def test_json_value_refuses_nan_and_infinity(value: Any) -> None:
91
91
  with pytest.raises(TypeError, match="^where: it isn't JSON, which has no NaN or Infinity$"):
92
92
  json_value(value, "where")
93
+
94
+
95
+ def test_json_value_names_a_cycle() -> None:
96
+ cyclic: list[Any] = []
97
+ cyclic.append(cyclic)
98
+ with pytest.raises(TypeError, match="^where: it refers to itself, which JSON can't hold$"):
99
+ json_value(cyclic, "where")
@@ -166,7 +166,8 @@ def test_judge_that_turns_no_input_on_fails_before_it_reaches_reeval(host: Host)
166
166
  assert error["name"] == "TypeError"
167
167
  assert "shows the judge nothing" in error["message"]
168
168
  assert (
169
- "task, output, files, diff, contents, transcript, checks or artifacts" in error["message"]
169
+ "task, output, files, diff, contents, transcript, checks, observations or artifacts"
170
+ in error["message"]
170
171
  )
171
172
  assert host.calls() == []
172
173
 
@@ -173,11 +173,8 @@ def test_case_data_is_canonical_json_and_non_json_is_refused(tmp_path: Path) ->
173
173
  def case(c, item): ...
174
174
  """,
175
175
  )
176
- import hashlib
177
-
178
- first = hashlib.sha256('{"a":"é","b":1}'.encode()).hexdigest()
179
- assert found["case 0"]["case"] == first
180
- assert found["case 1"]["case"] == hashlib.sha256(b'{"n":2}').hexdigest()
176
+ assert found["case 0"]["caseJson"] == '{"a":"é","b":1}'
177
+ assert found["case 1"]["caseJson"] == '{"n":2}'
181
178
  assert found["case 0"]["body"] == found["case 1"]["body"]
182
179
 
183
180
  path = tmp_path / "c.eval.py"
@@ -87,7 +87,7 @@ wheels = [
87
87
 
88
88
  [[package]]
89
89
  name = "reeval-python"
90
- version = "0.17.2"
90
+ version = "0.18.0"
91
91
  source = { editable = "." }
92
92
 
93
93
  [package.dev-dependencies]
@@ -1,55 +0,0 @@
1
- {
2
- "version": "0.17.2",
3
- "binaries": {
4
- "linux-x64": {
5
- "name": "reeval-0.17.2-linux-x64",
6
- "sha256": "9249d77d0aa824335e262a3011527444eb0041d7079bf5ec5c6913bd3d013147",
7
- "size": 90965472
8
- },
9
- "linux-arm64": {
10
- "name": "reeval-0.17.2-linux-arm64",
11
- "sha256": "e84cd5ef62b180370349633c32b98db6d2bb7f63c6cdd4aa7da1ebbc1ae35eb3",
12
- "size": 90949928
13
- },
14
- "linux-x64-musl": {
15
- "name": "reeval-0.17.2-linux-x64-musl",
16
- "sha256": "22437bcc8b2d19244d8bd0fc160837f4597cda09803ccdabfb36152bae0eb623",
17
- "size": 84936240
18
- },
19
- "linux-arm64-musl": {
20
- "name": "reeval-0.17.2-linux-arm64-musl",
21
- "sha256": "c98b8072a59d85c342d1e9dec06ad2d46b0831779a51951ad433a1866fa442f2",
22
- "size": 84085968
23
- },
24
- "darwin-x64": {
25
- "name": "reeval-0.17.2-darwin-x64",
26
- "sha256": "f7e2812061c8ac4e575abd2f817341e81212269fb3d9bbee400c8a71b7989d41",
27
- "size": 78983440
28
- },
29
- "darwin-arm64": {
30
- "name": "reeval-0.17.2-darwin-arm64",
31
- "sha256": "e93c4dc57ea7aadfd730d69b497d51f3504ac15aa4d0e112d4cd2308171d14f6",
32
- "size": 71952498
33
- },
34
- "windows-x64": {
35
- "name": "reeval-0.17.2-windows-x64.exe",
36
- "sha256": "9bebb0761af4ac30c9dd0fc4c5fbfb5849add5a6709cd63d1bf7d329f05b7154",
37
- "size": 95740928
38
- },
39
- "linux-x64-baseline": {
40
- "name": "reeval-0.17.2-linux-x64-baseline",
41
- "sha256": "9f7f3c85bf49c29f73baf1a5ca39cccbd26ac17a5ec63011e77ebe0dc597b32c",
42
- "size": 90965472
43
- },
44
- "linux-x64-musl-baseline": {
45
- "name": "reeval-0.17.2-linux-x64-musl-baseline",
46
- "sha256": "9a7c65ede8bf0c3694e3761cb1663a74c8c622b57ce9bab1584382ee660db178",
47
- "size": 84936240
48
- },
49
- "windows-x64-baseline": {
50
- "name": "reeval-0.17.2-windows-x64-baseline.exe",
51
- "sha256": "7d2149b0bbc6ff54bcbb28254fea9b3bd5e86c2da7a81e1ada87d7fd037b882f",
52
- "size": 95740928
53
- }
54
- }
55
- }
File without changes
File without changes