Repository navigation
feat: live-formula Excel export (toolkit + canonical translator + verification) - #13
Merged
Merged
Conversation
…translator + verification harness)
Adds pyfpa/excel/verify.py with VerifyReport and verify_workbook that lazily loads the formulas library, evaluates every Model-sheet cell, and compares to cashflow_from_config output at rel_tol=1e-6. NaN/unevaluated cells are hard failures. Adds formulas>=1.2 to the dev extra in pyproject.toml. Three tests cover pass, corruption detection, and the missing-dependency error message. Confirmed formulas 1.3.4 key format: "'[<filename>]MODEL'!<COL><ROW>" (filename preserves original casing, sheet name is uppercase, no dollar signs). Value extraction via sol[key].value[0][0].
Adds test_excel_equivalence.py with two cases: Ridgeline config (standard regression) and a nasty edge config (term loan exhausting mid-horizon at month 10 via MIN branch, NOL consumption across months, April start with off-January calendar seasonality indexing, negative growth on channel B, 24-month horizon exercising year-offset exponent > 0). Both pass at rel_tol=1e-6 with no translator fixes required.
…le entrypoint example; tolerance comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The most-requested finance artifact, made native: a workbook where changing an assumption recalculates the model. Built per the spec as a toolbelt capability, not a bolt-on exporter.
How it works
pyfpa/excel/toolkit.py: composable openpyxl helpers (named assumption cells/rows, formula filling, formats). What agent-generated exporters compose.pyfpa/excel/model_workbook.py: the canonical translator.model_to_excel(cfg, path)compilesEntityConfigto an Assumptions sheet (every driver a named, editable cell) plus a Model sheet where the full monthly P&L and cash flow are real formulas: per-instrument debt balance rows with interest on the pre-payment balance, NOL opening/used/closing rows feeding tax, calendar-correct seasonality references, first-month working-capital deltas against opening balances. Formula vocabulary restricted to arithmetic,^,SUM,MIN,MAX,IF(enforced by test).pyfpa/excel/verify.py:verify_workbookevaluates the workbook with theformulaslibrary (dev-only dependency) and compares every line, every month, tocashflow_from_configat 1e-6. NaN, unevaluated, and Excel-error cells are failures, never crashes.model-exportCLI command, public API exports, and thefpa-excel-modelskill: triggers on how users actually ask ("export this to Excel", "a workbook that recalculates"), encodes the workflow, and carries the core guardrail: no workbook ships unverified. Cadence variants (quarterly, weekly, per-segment) are agent work composed from the toolkit and registered as entrypoints, never kernel variants.Proof
Notes
formulas>=1.2confined to the dev extra.model.xlsx(gitignored like the other xlsx outputs).docs/superpowers/specs/2026-06-10-excel-live-model-design.md,docs/superpowers/plans/2026-06-10-excel-live-model.md.🤖 Generated with Claude Code