f8
Financial modeling engine with compiler verification and live Excel formulas.
Why f8
I am a CFA charterholder working primarily on private company M&A and project finance, domains that live in complex, bespoke Excel financial models.
Spreadsheets have always suffered from fragile manual work, silent copy-paste errors, and no version control.
When AI emerged, I found that AI agents struggle to manipulate Excel effectively (whether via OpenXML, openpyxl, Office.js, or GUI), primarily because of:
- Brittle coordinates: Spreadsheets force agents to reason in spatial coordinates rather than semantics; inserting a single row shifts every downstream reference.
- No verification loop: Standard spreadsheet libraries do not evaluate formulas, so an agent has to inspect the
.xlsxfile just to get feedback.
Yet the industry is stubborn: Excel remains the non-negotiable deliverable.
f8 brings software engineering rigor and AI-native ergonomics to traditional financial modeling. The .xlsx workbook becomes a compiled artifact rather than a hand-edited canvas.
- Semantic 2D modeling: Author models in code using readable coordinates;
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 ambiguous formula overlaps) and enforces a strict DAG via Tarjan cycle detection before a file is ever written.
- Closed-loop AI verification:
f8evaluates formulas in memory with 100% Excel parity (yes, even the 1900 leap day bug in Excel) so AI agents can audit calculated tables, trace precedent/dependent trees, verify accounting checks, and self-heal errors in milliseconds. This also means the model is directly testable in Python. - End-to-end fundamental workflow in code: Keep data ingestion, domain modeling, automated auditing, and live
.xlsxemission in version-controlled code with full AI agent assistance.
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 guide --all # streams the full DSL, function, and auditing guide to stdout
Quick look
from f8 import Model
model = Model("Operating Forecast")
sheet = model.add_sheet("Summary")
pnl = sheet.add_table("PnL", "Three-Year Projection", "($ in millions)")
pnl.add_column("item", role="descriptor", header="Line Item")
for year in ["2025A", "2026E", "2027E"]:
pnl.add_column(year, header=year, format="currency", decimals=1)
pnl.add_row(
"revenue",
cells={"item": "Revenue", "2025A": 100.0},
expr='PnL["revenue", col.prev] * 1.25',
)
pnl.add_row(
"cogs",
cells={"item": "Cost of Revenue"},
expr='PnL["revenue", @col] * 0.30',
)
pnl.add_row(
"gross_profit",
cells={"item": "Gross Profit"},
expr='PnL["revenue", @col] - PnL["cogs", @col]',
style="total",
)
compiled = model.compile()
# Audit evaluated values in memory (or pass view="formulas" to inspect lowered Excel formulas)
print(compiled.table("PnL").to_markdown())
# Emit a live .xlsx workbook with native Excel formulas and styling
compiled.save("forecast.xlsx")
Output:
| Line Item | 2025A | 2026E | 2027E |
| :--------------- | --------: | --------: | ---------: |
| Revenue | $100.0 | $125.0 | $156.2 |
| Cost of Revenue | $30.0 | $37.5 | $46.9 |
| **Gross Profit** | **$70.0** | **$87.5** | **$109.4** |
Sample deliverables
Inspect compiled deliverables generated from a real-world model:
- 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.
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 - 2D matrix DSL reference:
docs/dsl/spec-format.md - Standard function catalog:
docs/functions/catalog.md - Python modeling skill:
python/f8/skills/f8-modeling/SKILL.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.1.0
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.1.0.tar.gz | 173.5 kB | With provenance | Details for f8_engine-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 7.5 MB
Release files / f8_engine-0.1.0.tar.gz
| Download URL | f8_engine-0.1.0.tar.gz |
|---|---|
| Size | 173.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d608fefe97a33367539a370153eb5fd5356af056474c1ba8c02d13213070386a
|
|
BLAKE2b-256 checksum How to use checksums |
aaed3aeb9ebb7abdd9a633a9b8a5b64e67893ceac68241c5d62d17f947a49d79
|
| 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 Oct 21, 2026.
Transparency logRelease files / f8_engine-0.1.0-cp312-abi3-win_arm64.whl
| Download URL | f8_engine-0.1.0-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
84407ceb67a4a96b30817746141074c932196f0b410cc031378ebc5b1df2e31a
|
|
BLAKE2b-256 checksum How to use checksums |
148ad5b610d0299c509099fa31106a91ca743975ecbdf5ea047d0139cbbf95bb
|
| 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 Oct 21, 2026.
Transparency logRelease files / f8_engine-0.1.0-cp312-abi3-win_amd64.whl
| Download URL | f8_engine-0.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3c4f4ee38768eece9197b54866e94dfc902e5428a6fc3d64f75172c6a575b977
|
|
BLAKE2b-256 checksum How to use checksums |
a261f2ba7e0b1e5da02696fc07b08b27a38d116d987e337fe5404d44e4ab3f63
|
| 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 Oct 21, 2026.
Transparency logRelease files / f8_engine-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | f8_engine-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
053fb3c218543c1273fb2a832166547b8102db7cc199fbaed4ec6d51c8bd8293
|
|
BLAKE2b-256 checksum How to use checksums |
c5e69384c7d05cac645d4e6d106da604d11abbe01f336cccac446e81648fd3dc
|
| 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 Oct 21, 2026.
Transparency logRelease files / f8_engine-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | f8_engine-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
dbc582ed6414280b90b4f075f30d6fc5c0b483aef606d2e02fbfdc0b84a20124
|
|
BLAKE2b-256 checksum How to use checksums |
497c0e903d493697a316312d761eaeabff690b4bae60d98317b3db208b8bab2d
|
| 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 Oct 21, 2026.
Transparency logRelease files / f8_engine-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | f8_engine-0.1.0-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 |
c949b338bea2251f04cf70fd9ae98fa13cbc28d232e7d68224e466500c7f106d
|
|
BLAKE2b-256 checksum How to use checksums |
134e8de64a3eb54440070660086b65eade27ad18b3761d755f231e0f92bac154
|
| 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 Oct 21, 2026.
Transparency logRelease files / f8_engine-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | f8_engine-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
94791cba0238e5978427fdd5344e6dd8a81b2b15fbf0da9a60d69e54676f9411
|
|
BLAKE2b-256 checksum How to use checksums |
77552365d08930441a6828a582a20f56f76aaab6f67cc09166b50269fa940776
|
| 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 Oct 21, 2026.
Transparency logSecurity for f8-engine 0.1.0
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.1.0.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 Oct 21, 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.