Skip to main content

calc — a scripting language for building things simply

calc_rs

calc_rs is a strongly typed scripting language for calculations and structured data. The core is written in Rust, and is available as a CLI, Rust library, and Python extension module.

Key features

  • Strongly typed: Currency, percentages, dates, durations, tonnage, tables, and other domain values are distinct types rather than decorated numbers.

  • Calculations: Designed for real-world calculations with units and domain-specific values, while retaining a concise expression-oriented syntax.

  • Data & Tables: Tables are first-class values that can be created, transformed, queried, and persisted directly from the language.

  • Pipelines: Compose transformations with |>, making data workflows read from top to bottom instead of nesting operations.

  • Schema-aware: CSV data can be loaded with inferred or explicit schemas. Values are checked against their declared types rather than silently converted to text.

  • Scripting: Run individual expressions, .calc files, or multi-file projects with imports and modules.

  • Interactive: A REPL with syntax highlighting, completion, signatures, multi-line expressions, and session state.

  • Editor Support: Built-in Language Server support provides diagnostics, completion, and hover information.

  • Embeddable: Use the engine directly from Rust or Python.

  • Rust: Written in Rust with the performance-critical engine implemented natively and exposed through a library API.

Why calc_rs?

calc_rs is designed for programs where calculations and structured data are central to the problem.

Instead of treating everything as an untyped number or string, values carry their meaning and type:

let price = $12.50
let quantity = 3

price * quantity
// $37.50

The same language can work with structured data:

load("sales.csv")
  |> filter([region] == "EU")
  |> extend("net", [gross] - [tax])
  |> groupby("region", "net", "sum")
  |> sort([sum_net], "desc")

Schemas can be declared explicitly when the shape of the data matters:

struct Shipment {
  date: date,
  port: text,
  box: container,
  amount: currency
}

load("jan.csv", Shipment)

This lets the language check data as it enters the program rather than discovering type problems later.

Philosophy

The goal of calc_rs is to provide a scripting language that:

  • Keeps calculations concise without sacrificing strong typing.
  • Treats domain-specific values as real types.
  • Makes structured data and tables first-class language values.
  • Makes data transformations readable through pipelines.
  • Detects schema and type errors before they become silent data corruption.
  • Works interactively as well as in scripts and multi-file projects.
  • Can be embedded in both Rust and Python applications.
  • Provides useful editor tooling without requiring a separate runtime.

calc_rs is written in Rust, giving the engine control over its data representation and performance-critical execution while keeping the language small and embeddable.

Install

CLI

uv tool install calc-rust

Then:

calc_rs '$5.00 * 3'
# $15.00

Or run without installing:

uvx --from calc-rust calc_rs '$5.00 * 3'

Python

pip install calc-rs-lang
import calc_rs

calc_rs.evaluate("$5.00 * 3")
# Currency($15.00)

Rust

[dependencies]
calc_rs = { git = "https://github.com/Attica-oss/calc_rs" }

Documentation

Development

cargo test
maturin develop --release

License

MIT — see LICENSE.

Metadata

Release files for calc-rs-lang 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calc-rs-lang 0.3.1
File Size Uploaded Provenance Actions
calc_rs_lang-0.3.1.tar.gz 1.5 MB With provenance Details for calc_rs_lang-0.3.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for calc-rs-lang 0.3.1
File Actions
calc_rs_lang-0.3.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for calc_rs_lang-0.3.1-cp310-abi3-win_amd64.whl
calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
calc_rs_lang-0.3.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for calc_rs_lang-0.3.1-cp310-abi3-macosx_11_0_arm64.whl
calc_rs_lang-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for calc_rs_lang-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 11.8 MB

Release files / calc_rs_lang-0.3.1.tar.gz

Download URL calc_rs_lang-0.3.1.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
9c51f9fb2abadfd071b1163de9d4c182758396aed669d068e092e1c6183b00f9
BLAKE2b-256 checksum
How to use checksums
9f9f91b8aa0f29cd692c052b5d35306ca664b43c054eff1ae35269c40d46b0f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / calc_rs_lang-0.3.1-cp310-abi3-win_amd64.whl

Download URL calc_rs_lang-0.3.1-cp310-abi3-win_amd64.whl
Size 1.9 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5ac450b02a83dc70247ee696d1c47fe64c734518249bc5e59ce93ba034813e2f
BLAKE2b-256 checksum
How to use checksums
65a5707f09ac7a0ea5b59e5805d8df617719097cffef40a19834f57be36c837c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
0fc86c7fda5d4068a6933ff3d83ae70d5a824382270a093657a39c414167337d
BLAKE2b-256 checksum
How to use checksums
e9f248adc2197db5c1709bd18ced54aa14a7a83527676f2f0fbb5fab9d9a16da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL calc_rs_lang-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
86bca0d24e9a4160b3e3aa22ca4a8aed41051fa867fee168dedd8a7e0b8ebc3d
BLAKE2b-256 checksum
How to use checksums
97b58d29d9f2550432df8746e11c7570019fc58d0449ede67856d2f505f500b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / calc_rs_lang-0.3.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL calc_rs_lang-0.3.1-cp310-abi3-macosx_11_0_arm64.whl
Size 2.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8b3e557be5d48e02c7b6e1ad3e8f6731212ac641487839fdff258a1ae0172e86
BLAKE2b-256 checksum
How to use checksums
1197108c9fdd5c5e23a397cbe6a63a5856d38c243338a39416a81295fe11e466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / calc_rs_lang-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL calc_rs_lang-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
66dfe5613e133eee4c0f7ad56affb3fad92d14f7d55a62ca184de55092399138
BLAKE2b-256 checksum
How to use checksums
44609c17a37bec9870622d6c9058636bf3e464af584808f766242af55db78858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Security for calc-rs-lang 0.3.1

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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for calc_rs_lang-0.3.1.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 Sep 30, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page