astmath
Evaluate Python arithemetic expressions safely.
This package can help evaluate Python expressions, without any risk of code execution.
Installation
pip install astmath
Usage
Use it in the CLI:
$ astmath '40 + 2'
42
$ astmath '"foobar" * 2'
foobarfoobar
Or via the API:
>>> import astmath
>>> astmath.eval("2 + 3 * 4")
14
>>> astmath.eval("foo" * 3)
'foofoofoo'
Local Development / Testing
- Create and activate a virtual environment
- Run
pip install -r requirements-dev.txtto do an editable install - Run
pytestto run tests
Type Checking
Run mypy .
Create and upload a package to PyPI
Make sure to bump the version in setup.cfg.
Then run the following commands:
rm -rf build dist
python setup.py sdist bdist_wheel
Then upload it to PyPI using twine:
twine upload dist/*
Metadata
Release files for astmath 0.1.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 | |
|---|---|---|---|---|
| astmath-0.1.0.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| astmath-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / astmath-0.1.0.tar.gz
| Download URL | astmath-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42349944806e06cbfdc5a2e0c83eb301a061216ab61b494878ff43ba49cefc1f
|
|
BLAKE2b-256 checksum How to use checksums |
e2c33b730aaac52b513396f9180381675a74bdc4f8d7e5868f876027dc8baf6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / astmath-0.1.0-py3-none-any.whl
| Download URL | astmath-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f7e7d6c091eff8a469d31f0bf6db252f49171d80cf916a2059b991e948b9c6b
|
|
BLAKE2b-256 checksum How to use checksums |
bd1e464987272df3309144bea7f512f3889db30784f30dfc09797f69c5c18b8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for astmath 0.1.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.
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.