Metadata-Version: 2.4
Name: ftern
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Rust
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Office/Business :: Financial :: Accounting
Requires-Dist: pandas>=2 ; extra == 'pandas'
Provides-Extra: pandas
License-File: LICENSE
Summary: An exact finance engine for FP&A: dimensional driver models, ledger, three statements, FX and consolidation.
Keywords: finance,fpa,accounting,planning,forecasting,ledger,decimal,duckdb
Author: Arsalan Pardesi
License-Expression: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/arsalanpardesi/ftern
Project-URL: Issues, https://github.com/arsalanpardesi/ftern/issues
Project-URL: Repository, https://github.com/arsalanpardesi/ftern
Project-URL: Security, https://github.com/arsalanpardesi/ftern/blob/main/SECURITY.md

# ftern for Python

**ftern** ("eff-tern") is an open, exact finance engine for FP&A. It provides:
- dimensional driver models written in the Tern language;
- versions and scenarios;
- a double-entry ledger;
- three-statement plans;
- FX and consolidation.

Everything is stored in an embedded DuckDB workspace. Every amount is an exact decimal. Every
operator either satisfies its accounting identity or fails with a structured `FTERN_*`
error. Nothing is plugged silently.

```sh
pip install ftern
pip install "ftern[pandas]"   # adds QueryResult.to_pandas()

# or with uv
uv add ftern                  # in a uv project; `uv pip install ftern` in any environment
uv add "ftern[pandas]"
```

```python
import ftern

ftern.init("model", "saas")                    # write a sector starter model
ws = ftern.open("plan.ftern")                  # or ftern.memory()
ws.load_model("model")

r = ws.query("query Revenue by Product where Time = @FY26", versions=["Budget"])
r.rows[0]["Revenue"]          # Money(amount=Decimal('…'), currency='USD')

run = ws.run("balance_sheet_v1", book="mgmt", period="2026-12", version="Budget")
run.identity_ok               # True, or the call raised ftern.FternError
```

- Money is `ftern.Money` (a `decimal.Decimal` and a currency). Quantities are
  `ftern.Quantity`. Plain numbers are `Decimal`. Floats are refused as inputs.
- Every method maps onto one ftern agent verb, so Python, the `ftern` CLI, MCP and HTTP
  all behave the same.
- Wheels are built for CPython 3.9 and later (abi3) on macOS, Linux (glibc) and Windows.
  On other platforms pip builds from the source distribution. That needs a Rust toolchain
  and a C++ compiler, and the bundled DuckDB takes several minutes to compile.

The documentation, the CLI and the Rust crates are at
<https://github.com/arsalanpardesi/ftern>. Licensed under Apache-2.0.

