Skip to main content

Simple library for evaluating mathematical formulas.

Project description

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 .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

formparse-0.0.2.tar.gz (21.3 kB view hashes)

Uploaded Source

Built Distribution

formparse-0.0.2-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page