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, usable as a CLI, a Rust library, or a Python extension module.
Install
CLI (from source, requires Rust):
cargo install --path . --bin calc_rust
Python:
pip install calc-rust
CLI usage
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
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 notebook backed by this engine lives in
notebook/, replicating the expression-editor and table-builder workflow of
the original Python project's notebook:
pip install -e '.[notebook]'
maturin develop --release
marimo edit notebook/calc_notebook.py
Development
cargo test # engine tests
maturin develop --release # build + install the Python extension
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file calc_rust-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: calc_rust-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1d5a8338de37095b38503c6458b53b7f83c752ee83ae4fa7d0330b761c4383e
|
|
| MD5 |
60f80c7a908c03b258cefca7dff56575
|
|
| BLAKE2b-256 |
d199ccde9481cd43d16329637c1b7cd768703501d9cbd552cb8251f590798004
|
File details
Details for the file calc_rust-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: calc_rust-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c811fe7aa3f55ec0aadd95c80abfef08cea65f8fe5aace9e504e32b0d6622c3
|
|
| MD5 |
66ccfc36088d5012248403e7297c8352
|
|
| BLAKE2b-256 |
af6bc4ff999379abc13109b3e53685fe7dc08d9e61331bca9ed1d17f858d21d2
|