calckit-kabanda
Arithmetic and statistics helpers for Python, plus a calckit-kabanda command line tool.
Calculator interface
calc-kabanda starts a local web server and opens a clickable calculator in
your browser, with a full button pad, keyboard support, and a statistics panel.
calc-kabanda
It prints a http://127.0.0.1:5000 address and opens it automatically. Press
Ctrl+C to stop. Nothing leaves your machine.
If the command is not found, run python -m calc_toolkit.webapp instead.
The display accepts expressions using + - * / // % **, parentheses, and
functions: sqrt, root, abs, factorial, log, ln, floor, ceil,
round, exp, sin, cos, tan, min, max, pow.
Expressions are parsed by a hand-written recursive-descent parser, not
eval(), so nothing outside that list can execute. Handing the server
__import__('os').system('...') returns an error instead of running it.
Install
From GitHub (no PyPI account needed, works immediately):
pip install git+https://github.com/kabanda-jordan/calckit-kabanda.git
From PyPI, once published:
pip install calckit-kabanda
Or from a checkout:
pip install -e .
The distribution is named calckit-kabanda on PyPI, but the import name stays
calc_toolkit, so code reads:
from calc_toolkit import add, subtract, multiply, divide, mean, median
Library use
add(1, 2, 3) # 6
subtract(10, 3, 2) # 5
multiply(2, 3, 4) # 24
divide(10, 4) # 2.5
mean(2, 4, 6) # 4.0 (same as average)
median(1, 3, 2) # 2.0
mode(1, 2, 2, 3) # 2.0
Expressions
evaluate parses a string safely, with no use of eval:
from calc_toolkit import evaluate
evaluate("2 + 3 * sqrt(16)") # 14.0
evaluate("(10 + 5) / 3") # 5.0
evaluate("2 ** 3 ** 2") # 512.0 (right associative)
evaluate("factorial(5) + 1") # 121.0
Arithmetic
| Function | Example | Result |
|---|---|---|
add(*values) |
add(1, 2, 3) |
6 |
subtract(a, *rest) |
subtract(10, 3) |
7 |
multiply(*values) |
multiply(2, 3, 4) |
24 |
divide(a, b) |
divide(10, 4) |
2.5 |
integer_divide(a, b) |
integer_divide(10, 3) |
3 |
power(base, exp) |
power(2, 10) |
1024 |
modulus(a, b) |
modulus(10, 3) |
1 |
absolute(x) |
absolute(-5) |
5 |
root(x, degree=2) |
root(27, 3) |
3.0 |
square_root(x) |
square_root(9) |
3.0 |
logarithm(x, base=e) |
logarithm(8, 2) |
3.0 |
factorial(n) |
factorial(5) |
120 |
Statistics
All statistics accept a variable number of values, so both
mean([2, 4, 6]) and mean(2, 4, 6) work.
| Function | Example | Result |
|---|---|---|
total(*values) |
total(1, 2, 3) |
6.0 |
mean(*values) / average |
mean(2, 4, 6) |
4.0 |
median(*values) |
median(4, 1, 3, 2) |
2.5 |
mode(*values) |
mode(1, 2, 2) |
2.0 |
minimum(*values) |
min(3, 1, 2) |
1.0 |
maximum(*values) |
max(3, 1, 2) |
3.0 |
value_range(*values) |
range(3, 1, 2) |
2.0 |
variance(*values, sample=False) |
variance(2, 4, 6) |
2.666… |
standard_deviation(*values) |
stdev(2, 4, 6) |
1.632… |
geometric_mean(*values) |
geometric_mean(1, 4) |
2.0 |
harmonic_mean(*values) |
harmonic_mean(1, 4) |
1.6 |
Errors
Everything raises CalcError (a plain Exception subclass):
DivisionByZeroErrorfordivide(1, 0),modulus(1, 0),integer_divide(1, 0)EmptySequenceErrorformean()with no valuesCalcErrorfor bad types (strings, booleans, negatives under a root, and so on)
Booleans are rejected on purpose, so add(True, 1) fails instead of silently
treating True as 1.
Command line
calckit-kabanda add 1 2 3
calckit-kabanda divide 10 4
calckit-kabanda mean 2 4 6
calckit-kabanda median 4 1 3 2
calckit-kabanda sqrt 9
calckit-kabanda factorial 5
calckit-kabanda --help
Without installing the script, use the module form:
python -m calc_toolkit add 1 2 3
Exit codes: 0 success, 1 calculation error, 2 bad arguments.
Tests
pytest
Metadata
Release files for calckit-kabanda 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| calckit_kabanda-0.2.0.tar.gz | 15.0 kB | With provenance | Details for calckit_kabanda-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calckit_kabanda-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for calckit_kabanda-0.2.0-py3-none-any.whl |
Total release size: 30.5 kB
Release files / calckit_kabanda-0.2.0.tar.gz
| Download URL | calckit_kabanda-0.2.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1dcdbf14d7b0803b8fb213d24d2600f24ecbc7cfaef1360a158d420dae7a595
|
|
BLAKE2b-256 checksum How to use checksums |
10d0b5e8439d4f420c57b7bbb4f732799aa7720c2ada03a85db1d94a7c090692
|
| 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 Oct 6, 2026.
Transparency logRelease files / calckit_kabanda-0.2.0-py3-none-any.whl
| Download URL | calckit_kabanda-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b02e3c745812442d22d39a7e1fd8a5b3f0a5fe9e38ff22df49d3c5b3de845bd
|
|
BLAKE2b-256 checksum How to use checksums |
c1fab316782f6af8486cb862cbcce07c96665c2cc5e083d2238a73d2cf4ac1e1
|
| 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 Oct 6, 2026.
Transparency logSecurity for calckit-kabanda 0.2.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.
Attestation for calckit_kabanda-0.2.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 Oct 6, 2026.
Transparency logA 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.