Metadata-Version: 2.4
Name: calc-rust
Version: 0.1.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: marimo>=0.24.0 ; extra == 'notebook'
Requires-Dist: anywidget>=0.9 ; extra == 'notebook'
Provides-Extra: notebook
License-File: LICENSE
Summary: A strongly typed, spreadsheet-style expression engine
Keywords: calculator,expression,spreadsheet,currency,rust
Author: Attica-oss
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/Attica-oss/calc_rs

# calc_rust

A strongly typed, spreadsheet-style expression engine — currency, tonnage,
percentages, dates, durations, and tables are distinct first-class types,
not just decorated numbers. A Rust rewrite of
[Attica-oss/calc](https://github.com/Attica-oss/calc), usable as a CLI, a
Rust library, or a Python extension module.

## Install

**CLI** (from source, requires [Rust](https://rustup.rs)):

```sh
cargo install --path . --bin calc_rust
```

**Python:**

```sh
pip install calc-rust
```

## CLI usage

```sh
calc_rust '$5.00 * 3'          # $15.00  (currency)
calc_rust                      # start the REPL
calc_table new "item:text, price:currency, qty:int" table.json
```

## Python usage

```python
import calc_rust

calc_rust.evaluate("$5.00 * 3")          # Currency($15.00)
calc_rust.evaluate("1 + 2 * 3")          # 7

calc = calc_rust.Calculator()
calc.set("price", calc_rust.Currency("12.50"))
calc.eval("price * 3")                   # Currency($37.50)
```

Currency, duration, and complex-number results come back as dedicated
classes (`.amount`, `.months`/`.days`/`.seconds`, `.real`/`.imag`); numbers,
text, booleans, and dates/times come back as native Python types.

## Notebook

A [marimo](https://marimo.io) notebook backed by this engine lives in
`notebook/`, replicating the expression-editor and table-builder workflow of
the original Python project's notebook:

```sh
pip install -e '.[notebook]'
maturin develop --release
marimo edit notebook/calc_notebook.py
```

## Development

```sh
cargo test                     # engine tests
maturin develop --release      # build + install the Python extension
```

## License

MIT — see [LICENSE](LICENSE).

