Skip to main content

calcbox

Backend-agnostic math compute kernel: symbolic, numeric, units, control — and every answer carries provenance (backend, engine version, assumptions, verification, input hash).

It knows nothing about teaching, documents or users. It is a calculator that can prove what it did.

from calcbox import compute

out = compute("x**2", "integrate")
# {'result': 'x**3/3', 'backend': 'sympy', 'engine_version': '1.13.1',
#  'verification': {'method': 'differentiate-back', 'passed': True}, ...}

Why another math tool

There are MCP servers that evaluate arithmetic and matrix operations. What they do not report is how the answer was produced: which backend, which engine version, which assumptions, and whether a second method agreed. For tutoring, for reproducible research notes, and for anything a human will quote, that provenance is the point.

{
  "result": "x**3/3",
  "latex": "\\frac{x^{3}}{3}",
  "backend": "sympy",
  "engine_version": "1.13.1",
  "assumptions": {"variable": "x", "domain": "real"},
  "verification": {"method": "differentiate-back", "passed": true},
  "disputed": false,
  "sandbox": "audit-only",
  "input_sha256": "9f2c…",
  "elapsed_ms": 12.4
}

Install

pip install calcbox              # core, no backends
pip install "calcbox[symbolic]"  # sympy  (calculus, algebra, exact values)
pip install "calcbox[full]"      # sympy + scipy + pint + control
pip install "calcbox[mcp]"       # MCP server (stdio)
pip install "calcbox[api]"       # FastAPI router

Nothing is a hard dependency. A missing backend is reported as unavailable with a reason, never as a crash.

Use it

Python

compute("x**2", "integrate")            # indefinite
compute("x", "integrate", target="0,1") # definite
compute("x**3", "diff")
compute("2+3*4", "value")
compute("x**2-1", "solve")
compute("sin(x)/x", "limit", point="0")
compute("x**2", "simplify", backend="sympy")

CLI

calcbox "x**2" --op integrate
calcbox "sin(x)/x" --op limit --point 0 --json

HTTP (optional; no auth by design — that belongs to the host)

from fastapi import FastAPI
from calcbox.api import create_router

app = FastAPI()
app.include_router(create_router())
# GET  /v1/compute/backends
# POST /v1/compute {"expression": "x**2", "operation": "integrate"}

MCP

{
  "mcpServers": {
    "calcbox": {"command": "calcbox-mcp", "args": []}
  }
}

Tools: compute, backends.

Contract

Field Meaning
operation simplify, diff, integrate, solve, limit, value, latex, factor, expand, quad, minimize, root, convert, step, eval, check
backend auto infers from the operation; otherwise one of sympy/scipy/pint/control/wolfram/lean
verification method + passed; e.g. differentiate-back for integrals, substitute-back for solutions
disputed two backends disagreed (only when a cross-check runs)
sandbox always audit-only for in-process backends

Errors: ComputeError (bad request → 400) and BackendUnavailable (missing dependency or disabled external engine → 503).

Security

The sandbox is audit-only. It is a set of sys.audit hooks, not an OS jail. Read SECURITY.md before exposing this to untrusted input. External engines (Wolfram, Lean) are disabled unless CALCBOX_EXTERNAL=1.

Status

0.3.0 — all six backends wired: SymPy, SciPy, Pint, Control, and the external engines Wolfram and Lean (disabled unless CALCBOX_EXTERNAL=1; both fail with a reason when the binary is absent, never silently).

15/15 parity with the implementation this was ported from, 36 tests.

Every local call runs in a killable subprocess worker (~0.2-1.2 s overhead); CALCBOX_WORKER=0 runs in-process for debugging. External engines run in-process because they are already separate processes.

Releasing

See RELEASING.md: PyPI Trusted Publishing, no tokens.

License

MIT.

Metadata

Release files for calcbox 0.3.0

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

Source distribution (sdist)

Source distribution for calcbox 0.3.0
File Size Uploaded Provenance Actions
calcbox-0.3.0.tar.gz 19.6 kB With provenance Details for calcbox-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for calcbox 0.3.0
File Interpreter ABI Platform Actions
calcbox-0.3.0-py3-none-any.whl Python 3 none any Details for calcbox-0.3.0-py3-none-any.whl

Total release size: 37.8 kB

Release files / calcbox-0.3.0.tar.gz

Download URL calcbox-0.3.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
47d0ad6304c720ef6e0b5525a7de6d6d0e45d1c7af98775149a03210b96cd2a6
BLAKE2b-256 checksum
How to use checksums
957cf1f76437275638f71e009adb04143610a4e0afbc976b619db170b6378776
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / calcbox-0.3.0-py3-none-any.whl

Download URL calcbox-0.3.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2791c00de5bfd561eb79ef9989919b2e329a419783d25f5cc52401ff92a876d
BLAKE2b-256 checksum
How to use checksums
f50a8daa16150b16dd6051868a912d754d002e1af6e2dd3a03d6c664f6d4e67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for calcbox 0.3.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for calcbox-0.3.0.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 Nov 12, 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