Skip to main content

What is simplecalc?

A simple calculator, able to parse quite complex expressions:

>>> from simplecalc import calc
>>> calc("2 + 3.5")
'5.5'
>>> calc("2 * log(100)")
'4'
>>> calc("sin(pi / 2)")
'1'
>>> calc("3 * 5!")
'360'
>>> calc("3 * 5! + ceil(sqrt(123) / ln(10))")
'368'
>>> calc("3**e  * 5! + ceil(sqrt(123) * ln(10))")
'2394.55888943'

Note that these expressions are NOT evaluated by eval() or anything like that, so it should be safe to get the expressions from untrusted sources. Use at your own risk, of course.

It can also be used as a script:

$ simplecalc "3 * cos(pi)"
-3

Project’s history

Code here comes from other internal Canonical’s project, this part was opensourced in 2018:

https://launchpad.net/simple-calc

I forked that to bring it to GitHub, migrate it to Python 3, shape it more like a project (have a setup.py, etc.), and do some releases.

Metadata

Release files for pysimplecalc 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 pysimplecalc 1
File Size Uploaded Provenance Actions
pysimplecalc-1.tar.gz 8.7 kB Without provenance Details for pysimplecalc-1.tar.gz

Release files / pysimplecalc-1.tar.gz

Download URL pysimplecalc-1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f711689a6c0aaec1f6c0254bd627e8ecdc52176e34e9fe80adab7f159d07dd6d
BLAKE2b-256 checksum
How to use checksums
045dd6ffc42352b38075ce718c40be6ec8550942a3d9539c61be55c286156ee4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

Security for pysimplecalc 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.

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.

Release history Release notifications | RSS feed

This release

1 This release

1 release file No provenance

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