Reporting

Builders for environment evidence, run manifests, scorecards, compact summaries, and human-readable reports.

On this page

Reporting converts execution state into durable evidence. Builders return ordinary dictionaries for composition and testing; writer functions add canonical filenames and persist them. Secret-like values are redacted before environment or configuration data enters a manifest.

Import the symbols on this page from worldfoundry.evaluation.reporting.

build_env_requirements

This builder records whether required environment variable names and local paths are present without recording secret values. Optional dependency groups remain explicit in required_extras.

def build_env_requirements(required_env: Sequence[str | Mapping[str, Any]] = (),required_paths: Sequence[str | Path | Mapping[str, Any]] = (),required_extras: Sequence[str] = (),environ: Mapping[str, str] | None = None) -> dict[str, Any]
funcworldfoundry.evaluation.reporting.build_env_requirementsfrom worldfoundry.evaluation.reporting import build_env_requirements
source

Overview

Collect environment requirement claims for a run manifest (packages, CUDA, assets).

Parameters

required_envSequence[str | Mapping[str, Any]]
Required environment variable names or mappings.default: ()
required_pathsSequence[str | Path | Mapping[str, Any]]
Required local paths checked for existence only.default: ()
required_extrasSequence[str]
Required optional dependency groups or runtime bundles.default: ()
environMapping[str, str] | None
Environment mapping used for deterministic tests; defaults to `os.environ`.default: None

Returns: dict[str, Any]

build_environment

The environment payload captures Python, installed package versions, git metadata, and relevant cache paths. Passing package_names narrows package collection when a full environment inventory would be excessive.

def build_environment(repo_root: str | Path | None = None,cache_paths: Mapping[str, Any] | None = None,package_names: Sequence[str] | None = None) -> dict[str, Any]
funcworldfoundry.evaluation.reporting.build_environmentfrom worldfoundry.evaluation.reporting import build_environment
source

Overview

Snapshot the executing environment for reproducibility evidence in the run manifest.

Parameters

repo_rootstr | Path | None
Repository root used for git metadata.default: None
cache_pathsMapping[str, Any] | None
Cache directories or files relevant to the run.default: None
package_namesSequence[str] | None
Optional distribution names to record; all installed distributions are recorded when omitted.default: None

Returns: dict[str, Any]

build_run_manifest

This function enriches a runner's base manifest with redacted configuration, environment evidence, revisions, cache paths, reproducibility fields, and a stable manifest hash.

def build_run_manifest(base_manifest: Mapping[str, Any],config: Mapping[str, Any] | None = None,environment: Mapping[str, Any] | None = None,env_requirements: Mapping[str, Any] | None = None,seed: int | str | None = None,cache_paths: Mapping[str, Any] | None = None,environment_path: str | Path | None = None,env_requirements_path: str | Path | None = None) -> dict[str, Any]
funcworldfoundry.evaluation.reporting.build_run_manifestfrom worldfoundry.evaluation.reporting import build_run_manifest
source

Overview

Build the run manifest document that records request, environment, and artifact index.

Parameters

base_manifestMapping[str, Any]
Existing runner manifest fields to preserve.
configMapping[str, Any] | None
Redacted run configuration snapshot.default: None
environmentMapping[str, Any] | None
Environment payload from `build_environment`.default: None
env_requirementsMapping[str, Any] | None
Requirement payload from `build_env_requirements`.default: None
seedint | str | None
Run seed when the caller has one.default: None
cache_pathsMapping[str, Any] | None
Cache path mapping relevant to model, dataset, or runner behavior.default: None
environment_pathstr | Path | None
Optional path to the separately written `environment.json`.default: None
env_requirements_pathstr | Path | None
Optional path to the separately written `env_requirements.json`.default: None

Returns: dict[str, Any]

write_run_manifest_artifacts

Use the writer when a custom runner should emit the standard manifest trio in one operation.

from worldfoundry.evaluation.reporting import write_run_manifest_artifacts

paths = write_run_manifest_artifacts(
    output_dir="tmp/custom_run",
    base_manifest={
        "run": {"run_id": "custom-0001", "status": "succeeded"},
        "model": {"model_id": "my-model", "revision": "abc123"},
        "dataset": {"dataset_id": "my-samples", "split": "validation"},
    },
    config={"seed": 42, "device": "cuda:0"},
    required_env=("HF_TOKEN",),
    required_paths=("/data/my-samples",),
    required_extras=("video",),
    seed=42,
)

print(paths["run_manifest"])

An absent HF_TOKEN or dataset path is recorded as missing evidence; the function does not reveal the token or invent the path.

def write_run_manifest_artifacts(output_dir: str | Path,base_manifest: Mapping[str, Any],config: Mapping[str, Any] | None = None,required_env: Sequence[str | Mapping[str, Any]] = (),required_paths: Sequence[str | Path | Mapping[str, Any]] = (),required_extras: Sequence[str] = (),seed: int | str | None = None,cache_paths: Mapping[str, Any] | None = None,repo_root: str | Path | None = None,package_names: Sequence[str] | None = None,environ: Mapping[str, str] | None = None,manifest_path: str | Path | None = None,environment_path: str | Path | None = None,env_requirements_path: str | Path | None = None) -> dict[str, Path]
funcworldfoundry.evaluation.reporting.write_run_manifest_artifactsfrom worldfoundry.evaluation.reporting import write_run_manifest_artifacts
source

Overview

Persist run manifest JSON (and companions) into the run output directory.

Parameters

output_dirstr | Path
Run output directory.
base_manifestMapping[str, Any]
Existing runner manifest fields to enrich.
configMapping[str, Any] | None
Run configuration snapshot with secret-like values redacted.default: None
required_envSequence[str | Mapping[str, Any]]
Required environment variable names or mappings.default: ()
required_pathsSequence[str | Path | Mapping[str, Any]]
Required local paths verified before execution.default: ()
required_extrasSequence[str]
Required optional dependency groups or runtime bundles.default: ()
seedint | str | None
Run seed when available.default: None
cache_pathsMapping[str, Any] | None
Cache path mapping relevant to reproducibility.default: None
repo_rootstr | Path | None
Repository root used for git metadata.default: None
package_namesSequence[str] | None
Optional distribution names to record.default: None
environMapping[str, str] | None
Environment mapping used for deterministic tests.default: None
manifest_pathstr | Path | None
Optional destination for `run_manifest.json`.default: None
environment_pathstr | Path | None
Optional destination for `environment.json`.default: None
env_requirements_pathstr | Path | None
Optional destination for `env_requirements.json`.default: None

Returns: dict[str, Path]

build_scorecard

The scorecard combines run identity, model, benchmark, dataset, generation, metrics, artifacts, provenance, and skipped work. Its leaderboard gate is conservative: successful metric computation alone does not establish complete official evidence.

def build_scorecard(run: Mapping[str, Any],benchmark: Mapping[str, Any],model: Mapping[str, Any],dataset: Mapping[str, Any],generation: Mapping[str, Any],metrics_summary: Mapping[str, Any],artifacts: Mapping[str, Any],skipped: Mapping[str, Any] | None = None,leaderboard_evidence: Mapping[str, Any] | None = None,provenance: Mapping[str, Any] | None = None,evaluation_kind: str = 'existing_results',comparison_identity: Mapping[str, Any] | None = None) -> dict[str, Any]
funcworldfoundry.evaluation.reporting.build_scorecardfrom worldfoundry.evaluation.reporting import build_scorecard
source

Overview

Assemble the scorecard summary from metric aggregates and protocol outcomes.

Parameters

runMapping[str, Any]
benchmarkMapping[str, Any]
modelMapping[str, Any]
datasetMapping[str, Any]
generationMapping[str, Any]
metrics_summaryMapping[str, Any]
artifactsMapping[str, Any]
skippedMapping[str, Any] | None
default: None
leaderboard_evidenceMapping[str, Any] | None
default: None
provenanceMapping[str, Any] | None
default: None
evaluation_kindstr
default: 'existing_results'
comparison_identityMapping[str, Any] | None
default: None

Returns: dict[str, Any]

write_scorecard

This convenience function builds a scorecard with the same keyword arguments and writes it as JSON. It also indexes its own resolved path under artifacts.scorecard.

def write_scorecard(path: str | Path, **kwargs: Any) -> Path
funcworldfoundry.evaluation.reporting.write_scorecardfrom worldfoundry.evaluation.reporting import write_scorecard
source

Overview

Write scorecard artifacts to disk for leaderboards and human review.

Parameters

pathstr | Path
Destination file path for the scorecard JSON.
kwargsAny
Forwarded to :func:build_scorecard.

Returns: PathThe resolved path of the written scorecard file.

build_run_summary

A summary keeps the comparison-oriented subset of a scorecard: identities, fidelity, sample counts, leaderboard values, eligibility, and artifact paths. It is suitable for indexes and cross-run comparisons.

def build_run_summary(scorecard: Mapping[str, Any]) -> dict[str, Any]
funcworldfoundry.evaluation.reporting.build_run_summaryfrom worldfoundry.evaluation.reporting import build_run_summary
source

Overview

Build a compact run summary structure used by reports and UIs.

Parameters

scorecardMapping[str, Any]

Returns: dict[str, Any]

build_markdown_report

This renderer converts a compact summary into the human-readable report.md. It does not recompute scores or change eligibility.

def build_markdown_report(summary: Mapping[str, Any]) -> str
funcworldfoundry.evaluation.reporting.build_markdown_reportfrom worldfoundry.evaluation.reporting import build_markdown_report
source

Overview

Render a human-readable Markdown report from the run summary and scorecard.

Parameters

summaryMapping[str, Any]

Returns: str

write_run_report_artifacts

Given an in-memory scorecard or a scorecard.json path, this writer produces summary.json and report.md together.

def write_run_report_artifacts(output_dir: str | Path,scorecard_path: str | Path | None = None,summary_path: str | Path | None = None,report_path: str | Path | None = None,scorecard: Mapping[str, Any] | None = None) -> dict[str, Path]
funcworldfoundry.evaluation.reporting.write_run_report_artifactsfrom worldfoundry.evaluation.reporting import write_run_report_artifacts
source

Overview

Write Markdown/HTML (or related) report files beside other run evidence.

Parameters

output_dirstr | Path
Run output directory used for default file paths.
scorecard_pathstr | Path | None
Explicit path to the scorecard JSON file.default: None
summary_pathstr | Path | None
Explicit destination for the summary JSON file.default: None
report_pathstr | Path | None
Explicit destination for the Markdown report file.default: None
scorecardMapping[str, Any] | None
In-memory scorecard payload; overrides *scorecard_path*.default: None

Returns: dict[str, Path]A dict mapping `"summary" and "report" to resolved Path` objects.

In normal CLI and run_worldfoundry flows these writers are called for you. Use them directly when an external runtime or custom orchestration layer must emit the same evidence layout.