Skip to main content

truereward

Turn the cases of a graded run into one reward, or into the reason there is none.

A grader looks at some kind of evidence: a recorded end state, a test report, a list of criteria, a measured figure. Whatever it looked at, it answers with one record per case, CaseResult. This package is everything after that record, and it is the same for every kind of evidence.

  • The fold. fold(rows) applies gated-binary/1: the reward is 1.0 when every pass-to-pass case holds and every fail-to-pass case passes, and 0.0 otherwise. fix_rate and guards_hold are reported beside it.

  • Three outcomes. A case passed, failed, or could not be graded. The third carries a code from a closed list, each with who failed: the run, or the grader. An ungradable run has no reward. It is never scored 0.

  • The document. grade_document builds grade.json; write publishes it with ctrf.json, reward.json and reward.txt into a verifier's logs directory, each file whole or not at all. An ungradable run publishes no reward file.

  • The pytest plugin. One test per case, folded once at the end of the session, in one process or under pytest-xdist:

    @pytest.mark.parametrize("case", cases(CASES), ids=lambda c: c.id)
    def test_case(case, grade):
        grade(case, grade_case)
    

    Run it with pytest -p truereward.plugin. Install the pytest extra for it: pip install "truereward[pytest]". Folding and writing need the standard library alone.

  • Recording again. python -m truereward rerecord -p READER CASES OUT [--where DIR] [--jobs N] [--json] records every case of a set again, through the reader, into a directory of its own (never over the case), and says per case unchanged, moved (where and what) or refused (a code and why). The exit status is the worst case's: 0, 1 or 2. A reader offers cases(root), record_again(case, out_dir, where) and moved(old_dir, new_dir); truereward.rerecord.changed compares two JSON declarations for it.

A reader for one kind of evidence is a separate distribution. It may declare refusal codes of its own with truereward.codes.declare.

Licensed under Apache-2.0.

Release files for truereward 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for truereward 0.3.3
File Size Uploaded
truereward-0.3.3.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for truereward 0.3.3
File Interpreter ABI Platform
truereward-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 47.2 kB

Release files / truereward-0.3.3.tar.gz

Download URL truereward-0.3.3.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5809f1efa7c9f817ba73c4abf19777cff96d2cecde164248a7adf55000f2777c
BLAKE2b-256 checksum
How to use checksums
b44e4e9f75bd9a2a8e2174cd58937139186ba1bd9089bacc81e07b5bbaa11dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / truereward-0.3.3-py3-none-any.whl

Download URL truereward-0.3.3-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25491e0c55b49b2237062bc35193b7e14fecf63bc21ebbeae65e77eb5bae1137
BLAKE2b-256 checksum
How to use checksums
4d8ca77f2e8edf0e8d85f6082f4b6c9f12c5b54cdaff7a06d8c911b5c400f12a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page