Skip to main content
ReadTheDocs PyPI-Server Project generated with PyScaffold

formparse

Simple library for evaluating mathematical formulas.

Written as an safe alternative to Pythons eval() function the aim was to provide a lightweight library that could evaluate mathematical formulas provided by users in a safe way.

Installation

You can install this package unsing pip:

pip install formparse

SECURITY WARNING!

Usage

from formparse import Formula

formula = Formula('3*x**2')

result = formula.eval({'x': 2})

Alternatives

numexpr:

numexpr is a Python library for numpy that accelerates array operations but it can hadnle simple string calculations as well. It is therefore a lot bigger than formparse but if you are using numpy anyways in you project or need additional features that we do not provide this might be a good fit. Check out its repo here .

Release files for formparse 0.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 formparse 0.0.2
File Size Uploaded
formparse-0.0.2.tar.gz 21.3 kB Details

Built distribution (wheel)

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

Total release size: 28.0 kB

Release files / formparse-0.0.2.tar.gz

Download URL formparse-0.0.2.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7ef759956d6e8c93fc5224f5d3378111d63616012d901c8da588919d0c5df447
BLAKE2b-256 checksum
How to use checksums
735dffe06fc4e3bc31cb3fc797edc7aaf993d21180b2430681e3a7aeb0205c07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / formparse-0.0.2-py3-none-any.whl

Download URL formparse-0.0.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
977da561e0c9655de6a42d491df0d9f034e2a998a109b4143aec96491705a37b
BLAKE2b-256 checksum
How to use checksums
0b04374efb08a1514bd7904719b2bc5a8d47daa8522e0d131d78abb4a48d3907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

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