Skip to main content

CustomCalc A small, customizable calculator for Python that lets you define your own operators, constants, and functions. Uses NumPy for math operations.

Install: pip install customcalc

Example:

from customcalc import build_basic_calc
# default operators/expressions
calc = build_basic_calc()
print(calc.calculate("1 + 2 * 3")) # 7
print(calc.calculate("cos(pi / 3)")) # 0.5
print(calc.calculate("3! + 4")) # 10

# Custom operator example:
from customcalc import CalculatorBuilder
import numpy as np

b = CalculatorBuilder()

b.addBinaryOperator("plus", 0, np.add)
b.addConstant("one", 1)
b.addConstant("two", 2)

calc = b.build()
print(calc.calculate("one plus two")) # equals three

License: MIT

Metadata

Release files for customcalc 0.1.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 customcalc 0.1.0
File Size Uploaded
customcalc-0.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

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

Total release size: 16.9 kB

Release files / customcalc-0.1.0.tar.gz

Download URL customcalc-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f2430cdc511e9f003d6271591018e55fd23e99a69f16b7445c091b2f3eed27b7
BLAKE2b-256 checksum
How to use checksums
125ce076a56ca8453845428d41e3ef0e16cc444c96eb8892146ee6ae5282df29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / customcalc-0.1.0-py3-none-any.whl

Download URL customcalc-0.1.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d098b6f3960bc08f6c02170bd7428534550dfd7b0754b6fc214284f14b9b5a9f
BLAKE2b-256 checksum
How to use checksums
2d4bd30799656cd175de602e8fa595a8f56bac12e56bf3042437c5c92a65b9c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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