Skip to content

Python API

Generated from each package's real __all__ and signatures. Everything listed is importable exactly as shown.

evidence

evidence

from evidence import (audit, render, aggregate, Aggregate, LegResult, Constituent, REGISTRY, NOT_AUTOMATABLE, to_sarif, to_junit, to_markdown, PASSED, FAILED, UNVERIFIED, NOT_APPLICABLE, UNAVAILABLE)
name kind summary
audit(root: 'str', only: 'Optional[Sequence[str]]' = None, timeout: 'int' = 300, registry: 'Optional[Sequence[Constituent]]' = None) -> 'Aggregate' function Evaluate every constituent against root and aggregate to the weakest leg.
render(agg: 'Aggregate', root: 'str' = '.', show_excluded: 'bool' = False) -> 'str' function The human report. Ordered weakest first, because the weakest leg IS the answer.
aggregate(legs: 'Sequence[LegResult]') -> 'Aggregate' function Combine legs into one verdict: the weakest that actually checked something.
Aggregate(verdict: 'str', reason: 'str', legs: 'List[LegResult]' = <factory>, weakest: 'Optional[str]' = None) -> None class The audit's single answer, and the accounting behind it.
LegResult(tool: 'str', verdict: 'str', detail: 'str' = '', evidence: 'str' = '', bound: 'Optional[str]' = None, exit_code: 'Optional[int]' = None, raw: 'Optional[dict]' = None) -> None class One constituent's contribution to the audit.
Constituent(name: 'str', binary: 'str', scope: 'str', detect: 'Callable[[str], Subject]', invoke: 'Callable[[str, Subject], List]', install_hint: 'str' = '', summarise: 'Optional[Callable[[dict], tuple]]' = None) -> None class One tool in the audit.
REGISTRY value Built-in mutable sequence.
NOT_AUTOMATABLE value dict() -> new empty dictionary
to_sarif(agg: 'Aggregate', root: 'str' = '.', version: 'str' = '0') -> 'str' function SARIF 2.1.0. Every leg becomes a result, including the ones that passed.
to_junit(agg: 'Aggregate', root: 'str' = '.') -> 'str' function JUnit XML. failure for a real negative, error for could-not-check — never skipped.
to_markdown(agg: 'Aggregate', root: 'str' = '.') -> 'str' function A GitHub job summary. Written to be readable when it is the only thing anyone opens.
PASSED value str(object='') -> str
FAILED value str(object='') -> str
UNVERIFIED value str(object='') -> str
NOT_APPLICABLE value str(object='') -> str
UNAVAILABLE value str(object='') -> str

abstain_bench

abstain-bench

from abstain_bench import (score, Report, CORPUS, BY_CATEGORY, Case, build_corpus, scored_cases, clopper_pearson)
name kind summary
score(subject: 'str', cmd_template: 'str', *, timeout: 'int' = 60, cases: 'Optional[Sequence[Case]]' = None, jobs: 'int' = 0) -> 'Report' function Run cmd_template over the corpus and produce a Report.
Report(subject: 'str', verdict: 'str', outcomes: 'List[CaseOutcome]' = <factory>, control_failures: 'List[str]' = <factory>, reason: 'str' = '', families: 'List[str]' = <factory>) -> None class The result of scoring one subject. verdict is SCORED or ABSTAIN — never a bare number.
CORPUS value Built-in mutable sequence.
BY_CATEGORY value dict() -> new empty dictionary
Case(name: 'str', category: 'str', filename: 'str', content: 'str', why: 'str', family: 'str' = 'any') -> None class One input, and what a sound verifier is obliged to do with it.
build_corpus() -> 'List[Case]' function The corpus, constructed rather than stored, so every case is reproducible from source.
scored_cases() -> 'List[Case]' function
clopper_pearson(k: 'int', n: 'int', confidence: 'float' = 0.95) -> 'Tuple[float, float]' function Exact two-sided binomial interval for k successes in n trials.

gridlock

gridlock

from gridlock import (core, domains, WaitForGraph, Certificate, certify, find_cycle, rank, drains, DOMAINS, build)
name kind summary
core value gridlock.core — certify that a wait-for relation cannot wedge, and exhibit the cycle when it can.
domains value gridlock.domains — the same argument, instantiated in seven unrelated domains.
WaitForGraph(edges: 'dict[Node, set[Node]]' = <factory>) -> None class A finite wait-for relation: edges[a] is the set of nodes a is waiting on.
Certificate(safe: 'bool', n_nodes: 'int', n_edges: 'int', cycle: 'list[Node] | None', rank: 'dict[Node, int] | None', drains: 'list[Node]', rank_is_strictly_decreasing: 'bool', domain: 'str | None' = None, vacuous: 'bool' = False) -> None class The outcome of certifying a wait-for graph.
certify(g: 'WaitForGraph', domain: 'str | None' = None) -> 'Certificate' function Certify the graph. SAFE iff acyclic AND the rank decreases across every edge.
find_cycle(g: 'WaitForGraph') -> 'list[Node] | None' function Return one concrete cycle as a node list, or None if the graph is acyclic.
rank(g: 'WaitForGraph', *, known_acyclic: 'bool | None' = None) -> 'dict[Node, int] | None' function The strictly-decreasing drain measure: longest outgoing path length per node.
drains(g: 'WaitForGraph') -> 'list[Node]' function Nodes waiting on nothing — the ones that can proceed immediately.
DOMAINS value dict() -> new empty dictionary
build(domain: 'str', safe: 'bool' = True) -> 'WaitForGraph' function Build a domain's SAFE arrangement, or its FOIL.

preregister

preregister

from preregister import (Spec, Support, SpecError, ParseError, parse, analyse, FalsifiabilityReport, seal_spec, verify_seal, load_spec, Seal, SCHEMA, score_run, Outcome, FINDING, NULL, REFUSED, REACHABLE, UNREACHABLE, UNKNOWN)
name kind summary
Spec(name: 'str', hypothesis: 'str', decision_rule: 'str', metrics: 'Dict[str, Support]', finding: 'str' = '', null: 'str' = '', grid: 'Dict[str, Any]' = <factory>, notes: 'List[str]' = <factory>) -> None class Spec(name: 'str', hypothesis: 'str', decision_rule: 'str', metrics: 'Dict[str, Support]', finding: 'str' = '', null: 'str' = '', g
Support(kind: 'str', values: 'Tuple[float, ...]' = (), lo: 'float' = 0.0, hi: 'float' = 0.0) -> None class The set of values a metric can take. Declaring this is the author's real work.
SpecError class The spec is not usable. Always fatal — a partially understood plan is not a plan.
ParseError class The rule could not be parsed. Never downgraded to a warning: an unparseable rule is an
parse(src: 'str') -> 'Node' function
analyse(rule: 'str', supports: 'Dict[str, Support]', *, cap: 'int' = 200000) -> 'FalsifiabilityReport' function Decide reachability of both branches of rule over supports.
FalsifiabilityReport(rule: 'str', positive: 'BranchResult', negative: 'BranchResult', exact: 'bool', metrics: 'List[str]' = <factory>, constant_metrics: 'List[str]' = <factory>, notes: 'List[str]' = <factory>) -> None class FalsifiabilityReport(rule: 'str', positive: 'BranchResult', negative: 'BranchResult', exact: 'bool', metrics: 'List[str]' = <facto
seal_spec(spec: 'Spec', *, repo: 'str' = '.', timestamp: 'Optional[str]' = None, allow_unfalsifiable: 'bool' = False) -> 'Seal' function Analyse, then seal. Raises SpecError if the rule is not proven falsifiable.
verify_seal(seal: 'Dict[str, Any]') -> 'str' function Recompute the digest. Returns the recomputed value; raises if it disagrees.
load_spec(path: 'str') -> 'Spec' function
Seal(schema: 'str', spec: 'Dict[str, Any]', digest: 'str', falsifiability: 'Dict[str, Any]', git_commit: 'Optional[str]' = None, git_dirty: 'Optional[bool]' = None, sealed_at: 'Optional[str]' = None, limits: 'List[str]' = <factory>) -> None class Seal(schema: 'str', spec: 'Dict[str, Any]', digest: 'str', falsifiability: 'Dict[str, Any]', git_commit: 'Optional[str]' = None, g
SCHEMA value str(object='') -> str
score_run(seal: 'Dict[str, Any]', observed: 'Dict[str, float]') -> 'Outcome' function Evaluate the sealed rule against observed metric values.
Outcome(verdict: 'str', rule: 'str', observed: 'Dict[str, float]', refusals: 'List[str]' = <factory>, digest: 'Optional[str]' = None, description: 'str' = '', notes: 'List[str]' = <factory>) -> None class Outcome(verdict: 'str', rule: 'str', observed: 'Dict[str, float]', refusals: 'List[str]' = , digest: 'Optional[str]' = No
FINDING value str(object='') -> str
NULL value str(object='') -> str
REFUSED value str(object='') -> str
REACHABLE value str(object='') -> str
UNREACHABLE value str(object='') -> str
UNKNOWN value str(object='') -> str

floorgen

floorgen

from floorgen import (Spec, Situation, Floor, EncodingResult, Impossibility, SpecError, state_floor, verify_encoding, impossibility, load_spec, SCHEMA, RECOVERIES, by_name, names)
name kind summary
Spec(name: 'str', variables: 'Dict[str, List[Any]]', answer: 'Callable[[Dict[str, Any]], Hashable]', answer_source: 'str' = '', notes: 'List[str]' = <factory>) -> None class A finite, enumerated description of what must be distinguishable.
Situation(assignment: 'Tuple[Tuple[str, Any], ...]', answer: 'Hashable') -> None class One concrete past the system might be in, and the answer the spec demands for it.
Floor(name: 'str', situations: 'int', distinct_answers: 'int', bits: 'float', exemplars: 'Dict[Any, Dict[str, Any]]' = <factory>, collapsing_pairs: 'int' = 0, notes: 'List[str]' = <factory>) -> None class Floor(name: 'str', situations: 'int', distinct_answers: 'int', bits: 'float', exemplars: 'Dict[Any, Dict[str, Any]]' = ,
EncodingResult(ok: 'bool', n_checked: 'int', exhaustive: 'bool', collision: 'Optional[Tuple[Dict[str, Any], Dict[str, Any], Any, Any]]' = None, codes_used: 'int' = 0, floor: 'int' = 0, notes: 'List[str]' = <factory>) -> None class EncodingResult(ok: 'bool', n_checked: 'int', exhaustive: 'bool', collision: 'Optional[Tuple[Dict[str, Any], Dict[str, Any], Any, A
Impossibility(proven: 'bool', budget_states: 'int', floor_states: 'int', reason: 'str') -> None class Impossibility(proven: 'bool', budget_states: 'int', floor_states: 'int', reason: 'str')
SpecError class The specification cannot be used. Never downgraded to a warning.
state_floor(spec: 'Spec') -> 'Floor' function The exact number of states any correct implementation must be able to distinguish.
verify_encoding(spec: 'Spec', encode: 'Callable[[Dict[str, Any]], Hashable]') -> 'EncodingResult' function Does encode retain enough to answer the spec? Checked at every situation, not argued.
impossibility(floor: 'Floor', *, budget_states: 'Optional[int]' = None, budget_bits: 'Optional[float]' = None) -> 'Impossibility' function Given a floor and a state budget, is the specification impossible to meet?
load_spec(path: 'str') -> 'Spec' function Load a JSON spec whose answer is a TABLE, not code.
SCHEMA value str(object='') -> str
RECOVERIES value Built-in mutable sequence.
by_name(name: 'str') -> 'Spec' function
names() -> 'List[str]' function

gatecount

gatecount

from gatecount import (Domain, CountResult, GateError, ParseError, parse, count_admitted, over_accepting, compare, clopper_pearson, EXACT, SAMPLED)
name kind summary
Domain(variables: 'Dict[str, List[float]]') -> None class The input space, declared explicitly. Every variable needs a finite domain.
CountResult(method: 'str', admitted: 'Optional[int]', total: 'int', domain_size: 'int', witnesses: 'List[Dict[str, float]]' = <factory>, interval: 'Optional[Tuple[float, float]]' = None, label: 'str' = '', notes: 'List[str]' = <factory>) -> None class CountResult(method: 'str', admitted: 'Optional[int]', total: 'int', domain_size: 'int', witnesses: 'List[Dict[str, float]]' = <fac
GateError class The question could not be answered as asked. Never downgraded to a partial answer.
ParseError class The rule could not be parsed. Never downgraded to a warning: an unparseable rule is an
parse(src: 'str') -> 'Node' function
count_admitted(domain: 'Domain', policy: 'Predicate', **kw) -> 'CountResult' function How many states does policy admit?
over_accepting(domain: 'Domain', policy: 'Predicate', without_check: 'Predicate', **kw) -> 'CountResult' function How many states does without_check admit that policy refuses?
compare(domain: 'Domain', a: 'Predicate', b: 'Predicate', **kw) -> 'Dict[str, CountResult]' function Both directions of the difference between two policies.
clopper_pearson(k: 'int', n: 'int', confidence: 'float' = 0.95) -> 'Tuple[float, float]' function Exact two-sided binomial interval for k successes in n trials.
EXACT value str(object='') -> str
SAMPLED value str(object='') -> str

proof_carrying_ci

proof-carrying-ci

from proof_carrying_ci import (run_audit, to_sarif, to_markdown, Report, Leg, RunnerError, PASSED, FAILED, UNVERIFIED)
name kind summary
run_audit(path: 'str' = '.') -> 'Report' function Run every applicable constituent over path.
to_sarif(report: 'Report') -> 'str' function SARIF for GitHub code scanning.
to_markdown(report: 'Report') -> 'str' function The job summary. Written so a reader who knows none of these tools can act on it.
Report(verdict: 'str', legs: 'List[Leg]' = <factory>, weakest: 'Optional[str]' = None, path: 'str' = '.', notes: 'List[str]' = <factory>) -> None class Report(verdict: 'str', legs: 'List[Leg]' = , weakest: 'Optional[str]' = None, path: 'str' = '.', notes: 'List[str]' = <fa
Leg(name: 'str', verdict: 'str', detail: 'str' = '', applicable: 'bool' = True, available: 'bool' = True) -> None class Leg(name: 'str', verdict: 'str', detail: 'str' = '', applicable: 'bool' = True, available: 'bool' = True)
RunnerError class Something the runner itself could not do. Distinct from a check that failed.
PASSED value str(object='') -> str
FAILED value str(object='') -> str
UNVERIFIED value str(object='') -> str

signoff_cert

signoff-cert

from signoff_cert import (verify_certificate, VerifyResult, VERDICTS, DOMAINS, canonical_bytes, sha256_hex, semantic_sha256, content_sha256, recompute, describe_bound, clopper_pearson_upper, zero_observed_ceiling, valid_cases, invalid_cases)
name kind summary
verify_certificate(cert: 'Any', *, hmac_key: 'Optional[bytes]' = None, pinned_pubkey: 'Optional[str]' = None, require_authentication: 'bool' = True, gate_rerun: 'Optional[Callable[[Mapping[str, Any]], str]]' = None) -> 'VerifyResult' function Verify a certificate against §8. Never raises.
VerifyResult(ok: 'bool', effective_verdict: 'str', trust_level: 'str', checks: 'dict' = <factory>, reasons: 'list' = <factory>, recomputed_bound: 'Optional[float]' = None, bound_rechecked: 'bool' = False) -> None class VerifyResult(ok: 'bool', effective_verdict: 'str', trust_level: 'str', checks: 'dict' = , reasons: 'list' = , re
VERDICTS value Built-in immutable sequence.
DOMAINS value Built-in immutable sequence.
canonical_bytes(obj: 'Any') -> 'bytes' function The frozen canonical serialization (§1). Do NOT change these kwargs.
sha256_hex(obj: 'Any') -> 'str' function
semantic_sha256(cert: 'Mapping[str, Any]') -> 'str' function The MEANING of the claim (§3).
content_sha256(cert: 'Mapping[str, Any]') -> 'str' function Root hash of the certificate BODY (§3), excluding every post-seal field.
recompute(cert: 'Mapping[str, Any]') -> 'Tuple[Optional[float], Optional[str]]' function Recompute the bound from evidence. Returns (bound, infeasibility_reason).
describe_bound(conf_block: 'Mapping[str, Any]') -> 'str' function One line a human can read without misreading the number's direction.
clopper_pearson_upper(k: 'int', n: 'int', conf: 'float' = 0.95) -> 'float' function Exact (Clopper-Pearson) one-sided upper bound on a rate given k events in n trials.
zero_observed_ceiling(n: 'int', conf: 'float' = 0.95) -> 'float' function The bound a CLEAN record supports. 0 events in n trials still permits a rate this high.
valid_cases() -> 'Dict[str, Dict[str, Any]]' function Certificates a conforming verifier MUST accept (given the stated verifier options).
invalid_cases() -> 'Dict[str, Dict[str, Any]]' function Certificates a conforming verifier MUST refuse, each isolating one defect.

honestbench

honestbench

from honestbench import (merkle, registry, mutation, absence, bounds, sha256_file, merkle_root, build_manifest, verify, Registry, Row, Mutation, run_audit, mark_workspace, skip, Probe, run_absence_audit, clopper_pearson, zero_observed_ceiling, markov, chebyshev, sign_test_p, describe, UnboundedStatistic)
name kind summary
merkle value honestbench.merkle — a signed (sha256) Merkle manifest over a set of files.
registry value honestbench.registry — the number-registry drift guard.
mutation value honestbench.mutation — the mutation audit: prove your checks catch TAMPERING, not just drift.
absence value honestbench.absence — measure your checks' FALSE-NEGATIVE rate by deleting the evidence.
bounds value honestbench.bounds — never report a statistic without a bound.
sha256_file(path: 'str', _bufsize: 'int' = 65536) -> 'tuple[str, int]' function Return (hex sha256, byte count) streamed in chunks (constant memory).
merkle_root(entries: 'Iterable[dict]') -> 'str' function Fold sorted path:sha256\n lines into one root hash.
build_manifest(root_dir: 'str', include: 'Callable[[str], bool] | None' = None, restrict: 'Iterable[str] | None' = None) -> 'dict' function Build a manifest dict over root_dir.
verify(manifest: 'dict', root_dir: 'str') -> 'dict' function Re-hash every file in manifest against root_dir.
Registry(rows: 'list[Row] | None' = None, load=<function load>) class A list of Row bindings + the drift check over a document string.
Row(source: 'str', pointer: 'str', fmt: 'str', anchor: 'str | None' = None) -> None class Row(source: 'str', pointer: 'str', fmt: 'str', anchor: 'str
Mutation(name: 'str', apply: 'Callable[[str], None]', detector: 'Callable[[str], bool]', kind: 'str' = 'tamper') -> None class Mutation(name: 'str', apply: 'Callable[[str], None]', detector: 'Callable[[str], bool]', kind: 'str' = 'tamper')
run_audit(ws: 'str', mutations: 'list[Mutation]', restore: 'Callable[[str], None]', baseline: 'Callable[[str], bool] | None' = None, real_root: 'str | None' = None) -> 'dict' function Run every mutation in the marked workspace ws; return a certificate dict.
mark_workspace(ws: 'str', note: 'str' = 'throwaway honestbench workspace\n') -> 'None' function
skip(reason: 'str') function
Probe(name: 'str', evidence: 'str', check: 'Callable[[str], bool]', exercised: 'Callable[[str], bool] | None' = None) -> None class One (check, evidence) pair.
run_absence_audit(ws: 'str', probes: 'list[Probe]', restore: 'Callable[[str], None] | None' = None, real_root: 'str | None' = None) -> 'dict' function Delete each probe's evidence in the marked workspace ws and record what noticed.
clopper_pearson(k: 'int', n: 'int', confidence: 'float' = 0.95) -> 'dict' function Exact binomial interval for k successes in n trials.
zero_observed_ceiling(n: 'int', confidence: 'float' = 0.95) -> 'dict' function n trials, zero failures observed: the largest failure rate still consistent.
markov(mean: 'float', threshold: 'float') -> 'dict | None' function P(X >= threshold) <= mean / threshold, for a NON-NEGATIVE variable.
chebyshev(mean: 'float', variance: 'float', k_sigma: 'float') -> 'dict | None' function P(
sign_test_p(pairs: 'Sequence[tuple[float, float]]') -> 'dict' function Two-sided sign test over paired observations. Ties are dropped and counted.
describe(name: 'str', value: 'float', bound: 'dict | None') -> 'str' function Format a statistic together with its bound; REFUSE to format one without.
UnboundedStatistic class Raised when a statistic is reported with no bound. That is the whole point.

tokencount

tokencount

from tokencount import (bpe, verify, properties, encode, count, byte_length, load_merges, dump_merges, learn_merges, Verdict, check_claim, reconcile, run_all)
name kind summary
bpe value tokencount.bpe — a byte-level BPE encoder with three checkable accounting properties.
verify value tokencount.verify — refuse a claimed token count that arithmetic rules out.
properties value tokencount.properties — the three accounting properties, as runnable checks.
encode(text: 'str', merges: 'Sequence[Pair]') -> 'list[bytes]' function Encode text to a list of byte-symbols under a priority-ordered merges list.
count(text: 'str', merges: 'Sequence[Pair]' = ()) -> 'int' function The token count. A pure function of its arguments — property 1.
byte_length(text: 'str') -> 'int' function The utf-8 byte length: the ceiling from property 2.
load_merges(lines: 'Iterable[str]') -> 'list[Pair]' function Parse a merge list in the <a> <b> per-line form, with percent-escaped symbols.
dump_merges(merges: 'Sequence[Pair]') -> 'str' function Render a merge list to the on-disk form. load_merges(dump_merges(m)) == m always.
learn_merges(corpus: 'Sequence[str]', n_merges: 'int') -> 'list[Pair]' function Learn a merge list from a corpus by the standard most-frequent-pair rule.
Verdict(ok: 'bool', question: 'str', claimed: 'int', byte_ceiling: 'int', computed: 'int | None' = None, reasons: 'list[str]' = <factory>) -> None class Verdict(ok: 'bool', question: 'str', claimed: 'int', byte_ceiling: 'int', computed: 'int
check_claim(text: 'str', claimed: 'int', merges: 'Sequence[Pair] | None' = None, tolerance: 'int' = 0) -> 'Verdict' function Check a claimed token count against the byte ceiling and, optionally, a merge list.
reconcile(text: 'str', claims: 'dict[str, int]', merges: 'Sequence[Pair] | None' = None) -> 'dict' function Reconcile several parties' claims about one input.
run_all(trials: 'int' = 200, seed: 'int' = 20260729, merges: 'Sequence[Pair] | None' = None) -> 'dict' function Run all three property checks. Seeded, so a failure is reproducible.