Latest generated audit. The current public src/<subpackage>/
surface spans analytical mirrors, pymdp simulations, visualization
helpers, manuscript rendering/validation, local dashboard/reporting,
and release-status auditors.
When a public identifier is added, update the relevant per-subpackage
page in this directory and keep the package facade in sync.
Per-function signatures and contracts for the five subpackages of
../../src/, split across one file per subpackage so each
page is self-contained and easy to grep:
| Subpackage | Purpose | Detailed reference |
|---|---|---|
src/lean/ |
Analytical mirrors of the Lean boundary fragment | python_api_lean.md |
src/simulation/ |
pymdp 1.0.1 POMDP harness | python_api_simulation.md |
src/visualizations/ |
Reusable plotting helpers | python_api_visualizations.md |
src/manuscript/ |
Auto-injection + validation toolkit | python_api_manuscript.md |
src/gnn/ |
GNN fifth-track parser + round-trip + Lean typed-contract emitter | python_api_gnn.md |
src/reporting/ |
Standalone dashboard/reporting helpers | This page |
lean/—joint_dist.py,coupling.py,free_energy.py,geometry.py,spectral.py,bernoulli_toy.py,heterogeneous.py,decomposition.py,invariants.py.simulation/—specs.py,builders.py,agents.py,inference.py,hyperparameters.py(facade; domain splitshyperparameters_{grids,pymdp,robustness,experiments,sentinels}.py),statistics.py,logging_utils.py,rollout.py,sweep.py,long_horizon.py,multi_k_experiments.py,revertibility.py,robustness.py,btai_baseline.py,adversarial.py,cross_references.py.visualizations/—setup.py,heatmaps.py,joint_plots.py,spectral_plots.py,trajectory_plots.py,graphs.py,geodesic.py,log_weight.py,free_energy_plots.py,pymdp_extras.py,metadata.py,multi_k_plots.py,robustness_plots.py,annotations.py,analytical_figures.py.manuscript/—registry.py,tokens.py,renderer.py,bibliography.py,lean_extract.py,equation_numbering.py,validation.py,variable_ranges.py,status.py,pdf_validation.py,variables.py,output_gates/.gnn/—parser.py,model.py,bridge.py,runner.py,lean_emit.py.dashboard_types/—dashboard.py(shared dashboard datatypes + builder consumed byscripts/build_dashboard.py).orchestration/—run_all.py(library pipeline runner forscripts/run_all.py).gates/—regression_gate.py(library regression gate forscripts/regression_gate.py).reporting/—interactive_dashboard.py,_interactive_dashboard_compat.py,_interactive_dashboard_fallback.py.
→ Full reference: python_api_lean.md.
Numerical companions to the Lean boundary fragment. Each module
mirrors a lean/ActinfPolicyEntanglement/<Module>.lean file. Joint /
mean-field PMF arithmetic, coupling potentials, free energies,
information geometry, spectral decomposition, and the K=2 Bernoulli
closed form all live here.
→ Full reference: python_api_simulation.md.
pymdp-grounded POMDP harness, structured JSONL run logging, and the auto-injected hyperparameter registry. The free-energy bundle (VFE / EFE / entropy / coupling-term / TC) and quantile-envelope aggregation are also here.
→ Full reference: python_api_visualizations.md.
Pure I/O + plotting; no numerical work. Every figure carries
reproducibility metadata (source script + function, hyperparameter
snapshot, git revision, ISO timestamp) via metadata.py.
→ Full reference: python_api_manuscript.md.
Token rendering, equation auto-numbering, Lean-source extraction,
and the manuscript validator with the four-track-coherence CI gate
(validate_lean_wiring). See
four_track_coherence.md for the contract.
Project-local dashboard and invariant-reporting helpers. This package is
the standalone-safe reporting dependency used by lean.invariants and
scripts/build_dashboard.py; it does not import the parent template.
Public identifiers: PLOTLY_CDN, Control, Panel, Invariant,
InteractiveDashboard.
Control and Panel are small dataclasses for dashboard controls and
Plotly-compatible panel payloads. Invariant evaluates numeric contracts
such as equality, ordering, finite/nonnegative values, monotonicity, and
array closeness. InteractiveDashboard writes the dashboard HTML, panel
JSON, invariant text report, and summary JSON consumed by the release
pipeline. PLOTLY_CDN pins the Plotly CDN URL embedded in the HTML.
When the parent template is on PYTHONPATH, HTML assembly delegates to
infrastructure.reporting._interactive_html.render_interactive_dashboard_html;
otherwise _interactive_dashboard_fallback.render_interactive_dashboard_html
supplies the same contract (it accepts an optional plotly_js payload so a
caller can inline a vendored copy for an offline-capable page; when absent it
emits the documented CDN fallback).
def render_interactive_dashboard_html(*, title: str, subtitle: str, project_name: str, repo_root: Path | None, panel_count: int, control_count: int, invariant_count: int, bundle_json: str, plotly_js: bytes | None = None) -> str
def vendored_plotly_js() -> bytes | Nonevendored_plotly_js returns an opt-in vendored Plotly payload for
plotly_js; it fetches only when the REPORTING_VENDOR_PLOTLY env var is
set, returning None (CDN fallback) otherwise.
Importable dashboard builder and shared datatypes (Panel, Control,
Invariant) used by scripts/build_dashboard.py and
reporting.interactive_dashboard.
Path constants: DASHBOARD_PROJECT_ROOT, WEB_DIR, DATA_DIR, REP_DIR.
def parse_dashboard_args(argv: list[str] | None = None) -> argparse.Namespace
def build_dashboard_payload(args: argparse.Namespace) -> dict[str, Any]
def build_dashboard(args: argparse.Namespace, payload: dict[str, Any]) -> Any
def write_dashboard(args: argparse.Namespace) -> dict[str, Path]Release-readiness orchestration lives in
manuscript/readiness.py(consumed byscripts/readiness_report.py); thereporting/subpackage covers only the standalone dashboard helpers above.
Importable end-to-end pipeline runner consumed by scripts/run_all.py.
Stage order is the module-level SCRIPTS list; optional PDF_SCRIPTS and
MATHLIB_PROOF_SCRIPTS extend the DAG when requested.
class StageResult(NamedTuple): ...
class StageSummary(TypedDict): ...
def build_parser() -> argparse.ArgumentParserCombined-PDF renderer consumed by scripts/build_pdf.py. Regenerates the
injected manuscript tree, merges sections, and runs the local Pandoc/XeLaTeX
pass audited by scripts/validate_pdf.py.
COMBINED_STEM: str
def regenerate_injected_manuscript(*, project_root: Path) -> int
def render_combined_pdf(*, project_root: Path) -> intThin orchestrator facade for the pipeline regression gate (consumed by
scripts/regression_gate.py). Baseline I/O lives in
gates/regression_baseline.py; pytest subprocess runners in
gates/regression_pytest.py.
def gate(*, project_root: Path, scripts_dir: Path, baseline_path: Path | None = None, update_baseline: bool = False) -> intRe-exports for unit tests: _parse_pytest_counts, _critical_module_coverage_issues,
_write_fresh_test_results, _coverage_fail_under, _load_baseline, _load_test_results.
Baseline JSON load/save and refresh helpers.
def load_baseline(baseline_path: Path) -> dict[str, Any]
def load_test_results(test_results_path: Path) -> dict[str, Any] | None
def refresh_baseline(baseline: dict[str, Any], *, baseline_path: Path, project_root: Path, ...) -> NoneFresh pytest+coverage snapshot, invariant parsing, Lean budget parse.
CRITICAL_COVERAGE_MODULES: dict[str, float]
def coverage_fail_under(project_root: Path) -> float
def parse_pytest_counts(output: str) -> dict[str, int]
def coverage_percent_from_json(path: Path) -> float
def critical_module_coverage_issues(path: Path, thresholds: dict[str, float] | None = None) -> list[str]
def clear_bytecode_cache(project_root: Path) -> int
def write_fresh_test_results(*, project_root: Path, test_results_path: Path, pytest_log_path: Path, coverage_json_path: Path) -> dict[str, Any] | None
def count_invariants(invariants_path: Path) -> tuple[int, int] | None
def embedded_git_rev(invariants_path: Path) -> str | None
def current_short_head(project_root: Path) -> str | None
def invariants_stale_rev(invariants_path: Path, project_root: Path) -> str | None
def lean_budget_snapshot(*, project_root: Path, scripts_dir: Path) -> dict[str, int] | None
def run_captured_bounded(cmd: list[str], *, cwd: Path, env: dict[str, str] | None = None, timeout: float, max_chars: int) -> tuple[subprocess.CompletedProcess[Any], str]ArrayF = numpy.typing.NDArray[numpy.float64].Sequence[ArrayF]is used for the K-tuple of per-stream marginals (or per-stream EFEs).- Joint distributions are dense
ndarrays with one axis per stream. - Errors raised:
ValueErrorfor shape / value mismatches,IndexErrorfor out-of-range indices. - Determinism: every randomness-bearing helper takes an explicit seed; module-level RNGs are forbidden.
- Imports: every consumer uses the canonical namespaced subpackage path:
from lean.joint_dist import …,from simulation.specs import …,from visualizations.heatmaps import …,from manuscript.registry import ….pythonpathis set tosrc/(seepyproject.toml); intra-subpackage imports use the relative form (from .joint_dist import …insidesrc/lean/coupling.py).