Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

calc_rust-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

calc_rust-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

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

Hashes for calc_rust-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e1d5a8338de37095b38503c6458b53b7f83c752ee83ae4fa7d0330b761c4383e
MD5 60f80c7a908c03b258cefca7dff56575
BLAKE2b-256 d199ccde9481cd43d16329637c1b7cd768703501d9cbd552cb8251f590798004

See more details on using hashes here.

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

Hashes for calc_rust-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9c811fe7aa3f55ec0aadd95c80abfef08cea65f8fe5aace9e504e32b0d6622c3
MD5 66ccfc36088d5012248403e7297c8352
BLAKE2b-256 af6bc4ff999379abc13109b3e53685fe7dc08d9e61331bca9ed1d17f858d21d2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page