Skip to main content

calculator-cli

calculator-cli opens an embedded Python console with mpmath loaded into the namespace and ECB exchange conversion built in. The package is available on PyPI at calculator-cli.

Downloads

Latest release is on GitHub Releases. Standalone binaries are available for Windows, macOS, and Linux:

Each archive contains both commands:

  • calculator
  • c

After downloading, you can extract the archive and either run the binaries directly or move them to a directory in your PATH.

Examples:

calculator.exe --help
c.exe
chmod +x calculator c
./calculator --help
./c

It's also possible to install the package with pip

pip install calculator-cli

Run

You can run the REPL with

calculator

Help message

calculator --help

REPL Usage

Normal Python expressions stay normal Python expressions:

1 / 3
2 ** 10

The _ variable is stored as the last result and can be used as in the usual Python REPL.

mpmath names are already loaded, so mpmath expressions work directly:

sin(pi)
sqrt(2)
quad(lambda x: exp(-x**2), [0, inf])

sin(pi) is displayed as 0 because the REPL display hook uses mpmath.chop(...) before printing.

Exchange helpers are also available:

convert(100, "EUR", "USD")
refresh_exchange()

convert(...) returns an mpmath.mpf, so _ stays numeric and can be reused in later calculations. In the REPL it is displayed as:

116.84 USD [on 2026-04-13]

Exchange cache

On every startup the app runs refresh_exchange().

  • The cache file is ecb_rates.json.
  • The file stores the ECB rate date, the local retrieval date, and the currency table.
  • If the cache was already retrieved today, no network request is made.
  • If today is different, the app fetches the ECB XML feed again and rewrites the cache.

Default cache location:

  • Windows: %LOCALAPPDATA%\calculator-cli\ecb_rates.json
  • Unix-like systems: ${XDG_CACHE_HOME:-~/.cache}/calculator-cli/ecb_rates.json

You can also specify a custom cache location with the --cache option

calculator --cache ./cache

Local Install

git clone https://github.com/alex180500/calculator-cli.git
cd calculator-cli
uv sync

Then you can run the REPL with uv run calculator or uv run c.

License

This package is distributed under Apache-2.0 License. This means that you can use the code freely for academic, personal, or commercial purposes! If you use my code extensively, I would greatly appreciate if you could credit me by linking my GitHub profile @alex180500 or just reference me (Alessandro Romancino) in any way.

Metadata

Release files for calculator-cli 2.0.2

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

Source distribution (sdist)

Source distribution for calculator-cli 2.0.2
File Size Uploaded Provenance Actions
calculator_cli-2.0.2.tar.gz 14.0 kB Without provenance Details for calculator_cli-2.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for calculator-cli 2.0.2
File Interpreter ABI Platform Actions
calculator_cli-2.0.2-py3-none-any.whl Python 3 none any Details for calculator_cli-2.0.2-py3-none-any.whl

Total release size: 25.9 kB

Release files / calculator_cli-2.0.2.tar.gz

Download URL calculator_cli-2.0.2.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
68e0013f1e68e34a9f084da8dc693b5846d10bd7c6910200fc176195b426d6e3
BLAKE2b-256 checksum
How to use checksums
33064f3079166062f711eac501aed37d806fb4db39414783f6b41e9d47abe2fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / calculator_cli-2.0.2-py3-none-any.whl

Download URL calculator_cli-2.0.2-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfe4704f04437ca4d5cef23e31075d9ce2da45cb37fab90f690ab5523895914c
BLAKE2b-256 checksum
How to use checksums
e3828701c3f729a4360e1e9eb22fb231fc89bff507da92302f291244aaeb7201
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for calculator-cli 2.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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