docs: add migration notebook and clarify export usage
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
"""Export the corrected business case notebook as LLM-readable report sources.
|
||||
"""Export the deliverable notebooks as LLM-readable report sources.
|
||||
|
||||
Executes the notebook fresh (widget defaults — or whatever defaults you edit in),
|
||||
Executes each notebook fresh (widget defaults — or whatever defaults you edit in),
|
||||
then writes both formats to exports/:
|
||||
|
||||
exports/ctm_business_case_corrected.html — human-reviewable, tables render
|
||||
exports/ctm_business_case_corrected.md — leanest LLM input
|
||||
exports/<notebook>.html — human-reviewable, tables render
|
||||
exports/<notebook>.md — leanest LLM input
|
||||
|
||||
Plotly figures export as JavaScript an LLM cannot read; the notebook's section-12
|
||||
machine-readable appendix carries every number behind them.
|
||||
Plotly figures export as JavaScript an LLM cannot read; each notebook's
|
||||
machine-readable appendix section carries every number behind them.
|
||||
|
||||
Run from the project root: python scripts/export_report.py
|
||||
Run from the project root: python scripts/export_report.py [name-filter]
|
||||
An optional argument exports only notebooks whose filename contains it,
|
||||
e.g. python scripts/export_report.py migration
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -18,18 +20,26 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
NOTEBOOK = ROOT / "notebooks" / "ctm_business_case_corrected.ipynb"
|
||||
NOTEBOOKS = [
|
||||
ROOT / "notebooks" / "ctm_business_case_corrected.ipynb",
|
||||
ROOT / "notebooks" / "ctm_migration_wfm.ipynb",
|
||||
]
|
||||
EXPORTS = ROOT / "exports"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
picked = [nb for nb in NOTEBOOKS
|
||||
if len(sys.argv) < 2 or sys.argv[1] in nb.name]
|
||||
if not picked:
|
||||
sys.exit(f"no notebook matches {sys.argv[1]!r}")
|
||||
EXPORTS.mkdir(exist_ok=True)
|
||||
for fmt in ("html", "markdown"):
|
||||
subprocess.run(
|
||||
[sys.executable, "-m", "nbconvert", "--execute",
|
||||
"--to", fmt, "--output-dir", str(EXPORTS), str(NOTEBOOK)],
|
||||
check=True, cwd=ROOT,
|
||||
)
|
||||
for nb in picked:
|
||||
for fmt in ("html", "markdown"):
|
||||
subprocess.run(
|
||||
[sys.executable, "-m", "nbconvert", "--execute",
|
||||
"--to", fmt, "--output-dir", str(EXPORTS), str(nb)],
|
||||
check=True, cwd=ROOT,
|
||||
)
|
||||
for p in sorted(EXPORTS.iterdir()):
|
||||
if p.suffix in (".html", ".md"):
|
||||
print(f"wrote {p.relative_to(ROOT)} ({p.stat().st_size / 1024:,.0f} KB)")
|
||||
|
||||
Reference in New Issue
Block a user