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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file formparse-0.0.2.tar.gz.

File metadata

  • Download URL: formparse-0.0.2.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for formparse-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7ef759956d6e8c93fc5224f5d3378111d63616012d901c8da588919d0c5df447
MD5 d04799cb6c1cd7e74667f7a119c9e55f
BLAKE2b-256 735dffe06fc4e3bc31cb3fc797edc7aaf993d21180b2430681e3a7aeb0205c07

See more details on using hashes here.

File details

Details for the file formparse-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: formparse-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for formparse-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 977da561e0c9655de6a42d491df0d9f034e2a998a109b4143aec96491705a37b
MD5 8f788410a3948f2eb1ca5fb9d479ab40
BLAKE2b-256 0b04374efb08a1514bd7904719b2bc5a8d47daa8522e0d131d78abb4a48d3907

See more details on using hashes here.

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