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.

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.2

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.2
File Size Uploaded
truereward-0.3.2.tar.gz 18.5 kB Details

Built distribution (wheel)

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

Total release size: 39.4 kB

Release files / truereward-0.3.2.tar.gz

Download URL truereward-0.3.2.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b0e39148c3821ceed321f67f62d8f0156d8ead78f5b556f23e2c9ffafd8620be
BLAKE2b-256 checksum
How to use checksums
e2bcab4b36ce66f2c2321e50b2a3e17ede53db15ece7f69711ac6b83aca33ef3
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.2-py3-none-any.whl

Download URL truereward-0.3.2-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc70159472a219972727b76439dae76a17545bf6a54adbbffc07c0cbe3ece8b6
BLAKE2b-256 checksum
How to use checksums
8f3dd7eb6f87ca4a3a75b5d7af99efa1b8ca5d685393c82224f8b8393fbdc309
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

0.3.3

2 release files

This release

0.3.2 This release

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