f8
Author, verify, and automate financial models with code and AI agents, compiled into live Excel workbooks.
Who is f8 for
- People who want AI to reliably build complex Excel models (financial and beyond): Give AI agents a semantic 2D DSL and compile-time verification to produce clean and error-free
.xlsxworkbooks with live formulas. - People doing financial analysis in pure code (no Excel required): Run row-by-row financial statements, corkscrew schedules, and cross-table dependency graphs in Python (where columnar DataFrames fall short), with
compiled.save("model.xlsx")ready whenever a stakeholder asks for the spreadsheet.
Why f8
I am a CFA charterholder working in private M&A and project finance, where complex Excel models remain the non-negotiable deliverable despite fragile manual work, silent copy-paste errors, and zero version control.
AI agents struggle to manipulate raw spreadsheets (openpyxl, Office.js, or GUI) for two reasons:
- Brittle coordinates: Agents must reason in spatial cell addresses (
C42:G42) instead of domain semantics; inserting one row shifts every downstream reference. - No verification loop: Spreadsheet libraries do not evaluate formulas, leaving agents blind until the
.xlsxfile is opened and inspected.
f8 turns the .xlsx workbook into a compiled artifact rather than a hand-edited canvas:
- Semantic 2D modeling: Author models with readable table, row, and column identifiers;
f8handles spatial layout and lowers logic into native Excel formulas. - Compiler-enforced rigor: A 6-pass Rust compiler verifies grid completeness (zero unassigned cells or formula overlaps) and enforces a strict DAG via Tarjan cycle detection.
- Closed-loop verification: Evaluates formulas in memory with 100% Excel parity (including the 1900 leap day bug) so AI agents and
pytestsuites can audit tables, trace dependencies, and verify accounting checks in milliseconds.
Getting started
Install from PyPI (package name is f8-engine, imported as f8):
pip install f8-engine
# or
uv add f8-engine
If you are working with an AI coding agent, f8 ships with a bundled modeling skill and CLI reference you can drop straight into your workspace:
f8 agent init # scaffolds .agents/skills/f8-modeling/
f8 theme init # generates a customizable theme.json in the workspace root
f8 guide --all # streams the full DSL, function, and auditing guide to stdout
Quick look
from f8 import Model
years = ["2025A", "2026E", "2027E"]
capex = {"2025A": 25.0, "2026E": 30.0, "2027E": 35.0}
depr = {"2025A": -15.0, "2026E": -18.0, "2027E": -22.0}
model = Model("Operating Forecast")
sheet = model.add_sheet("Summary")
ppe = sheet.add_table("PPE", "PP&E Corkscrew Schedule", "($ in millions)")
ppe.add_column("item", role="descriptor", header="Line Item")
for year in years:
ppe.add_column(year, header=year, format="currency", decimals=1)
ppe.add_row(
"beg_balance",
cells={"item": "Beginning Balance", "2025A": 100.0},
expr='PPE["end_balance", col.prev]',
)
ppe.add_row("capex", cells={"item": "Capital Expenditures", **capex})
ppe.add_row("depreciation", cells={"item": "Depreciation", **depr})
ppe.add_row(
"end_balance",
cells={"item": "Ending Balance"},
expr='SUM(PPE["beg_balance".."depreciation", @col])',
style="total",
)
compiled = model.compile()
# Audit evaluated values in memory (or pass view="formulas" to inspect lowered Excel formulas)
print(compiled.table("PPE").to_markdown())
# Emit a live .xlsx workbook with native Excel formulas and styling (you don't have to)
compiled.save("forecast.xlsx")
Output:
| Line Item | 2025A | 2026E | 2027E |
| :------------------- | ---------: | ---------: | ---------: |
| Beginning Balance | $100.0 | $110.0 | $122.0 |
| Capital Expenditures | $25.0 | $30.0 | $35.0 |
| Depreciation | ($15.0) | ($18.0) | ($22.0) |
| **Ending Balance** | **$110.0** | **$122.0** | **$135.0** |
Sample deliverables
Inspect compiled deliverables generated from real-world models:
- costco_financial_model.xlsx: Compiled financial model with live Excel formulas.
- costco_valuation_report.pdf: Valuation report rendered directly from the compiled
f8model using Quarto, Typst, and Matplotlib. - lbo_model.xlsx: Multi-sheet leveraged buyout (LBO) model with transaction structuring, debt waterfall, and returns analysis.
LBO model demo
Complete model repo: https://github.com/mhcfa/f8-demo
Disclaimer: Sample deliverables are AI-generated technical demonstrations and do not constitute financial analysis or investment advice.
Trade-offs
f8 treats code as the single source of truth, and .xlsx is just an output. So there are some trade-offs to consider:
| What you gain | What you lose |
|---|---|
| Clean structure and strict schema | Hidden mistakes no one notices |
| Git and line-by-line diffs | Model_v14_Final_(2).xlsx and guessing what changed since v13 |
| Instant DAG and completeness verification in Rust | The opportunity to mess up your model right before a client meeting |
| Superior AI modeling | Being an Excel Ninja |
| Readable semantic code and logic | The joy of hunting down a hidden #REF! at 2 AM |
Jokes aside, writing models in code gives you 40 years of software infrastructure out of the box, line-by-line git diff reviews, automated pytest checks, reusable modules, and parametric loops. The only real downsides I can think of are:
- You can't do whatever you want when it comes to layout in the emitted workbook; everything has to be structured. But you wouldn't want your spreadsheet to be a mess anyway, right?
- You have to learn some Python. But that is largely solved by AI now.
- Constantly re-compiling just to peek at the Excel workbook can be a bit annoying, so we provide in-memory inspection methods in Python. Once you get used to
print(), you don't need to open the.xlsxall the time (or just ask AI to do it). - There are no circular references or iterative solvers (as per FAST Standard Section 2.01). There is a closed-form formula that solves the revolver circularity problem without circular references anyway (and don't worry, AI knows it).
- There is no native Excel chart emission yet (on roadmap), and no Pivot Tables. But since you are already in Python,
pandasorpolarshandles data aggregation much better.
Architecture
Under the hood, f8 is a Python SDK (python/f8/) backed by a 6-pass Rust compiler (crates/f8-core/):
Spec -> IR Expansion -> DAG & Cycle Check -> Topological Evaluation -> Spatial Layout -> Formula Lowering -> .xlsx Emission
- Architecture overview:
docs/architecture.md - Python modeling skill:
python/f8/skills/f8-modeling/SKILL.md - Syntax, grid, and formatting reference:
python/f8/skills/f8-modeling/references/syntax-and-grid.md - Function reference:
python/f8/skills/f8-modeling/references/functions.md - Auditing and repair reference:
python/f8/skills/f8-modeling/references/auditing-and-repair.md
License
- Licensed under the GNU Affero General Public License v3.0 (
AGPL-3.0-only); seeLICENSE. - Copyright (C) 2026 Michael (Chencheng) Hu, CFA (
@mhcfa). - Output ownership:
.xlsxworkbooks and financial models generated byf8are standalone user outputs and are not subject toAGPL-3.0-onlycopyleft terms.
Metadata
Release files for f8-engine 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| f8_engine-0.3.2.tar.gz | 184.2 kB | With provenance | Details for f8_engine-0.3.2.tar.gz |
Built distributions (wheels)
Total release size: 7.8 MB
Release files / f8_engine-0.3.2.tar.gz
| Download URL | f8_engine-0.3.2.tar.gz |
|---|---|
| Size | 184.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce3125694f425988eeff05cad047e1459a66783797356aceac8c2f55ecfa04ee
|
|
BLAKE2b-256 checksum How to use checksums |
4da55b80b82e142653076436fd302f2b969eff1b61fc82afc88763cda7c8d458
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / f8_engine-0.3.2-cp312-abi3-win_arm64.whl
| Download URL | f8_engine-0.3.2-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4ff93a56c0b0165c2033b9c437073441c88a939e77bbcc7fd54c3493a9901cb6
|
|
BLAKE2b-256 checksum How to use checksums |
b68c95f76902bc28686aba652e43c084e8b7386c23dd206dd3e0c04dbeebb6c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / f8_engine-0.3.2-cp312-abi3-win_amd64.whl
| Download URL | f8_engine-0.3.2-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a33026ab8861c5f4103a5b0c2f0054dc63adcb7a6b7f9974daab86156ff8a4ba
|
|
BLAKE2b-256 checksum How to use checksums |
a5b4bef818d9b33faa6fc93b207a3e07059c1b521ad27bdfd43b6f9041a2432a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / f8_engine-0.3.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | f8_engine-0.3.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1622861208034a55458ecfed54756657600c4c27d3610cd15b9bed4b3b53fc1a
|
|
BLAKE2b-256 checksum How to use checksums |
a2ea6eb8bb6fefe2d5710b2e011151e89b3fb5f08a9a279bd428a94f89f7bcaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / f8_engine-0.3.2-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | f8_engine-0.3.2-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a53e125fca3ea285901e0acf6f48e1e63760e207a7d87549afa777d7ca675e7d
|
|
BLAKE2b-256 checksum How to use checksums |
bd5ecb434277daf01a068898d662ba702d3b7767bb7fc5f0480a99f3ec82cc0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / f8_engine-0.3.2-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | f8_engine-0.3.2-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b63c11cd75e2aaea5c4bde55fa7e1f0f13889969389ad13cdd6afa42e5312533
|
|
BLAKE2b-256 checksum How to use checksums |
d247699676c09cb2bf03016c1fb64ecb334528a0cf6bb29e1dd61c53a116b1b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / f8_engine-0.3.2-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | f8_engine-0.3.2-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
3381e07bacfd6fcef9e3fc79f61330bd8fa8904aac53a6df55450cca45c1bd1e
|
|
BLAKE2b-256 checksum How to use checksums |
3f87a38bdda465143f9e6f515d5b46191f36043dbea610112b21cc3d4559179b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for f8-engine 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for f8_engine-0.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.