Skip to main content

No project description provided

Project description

hotxlfp

hotxlfp intends to be a python version of the javascript handsontable excel formula parser differences are acceptable to make it more pythonic or the function implementations more correct.

Install

You can install using pip

pip install hotxlfp

Usage

Create a Parser

import hotxlfp

p = hotxlfp.Parser()

Parse excel formulas

p.parse('SUM(1,2,3)') # returns {'result': 6, 'error': None}

It's also fine to use semi-colons as separators (they're used by excel depending on your locale)

p.parse('SUM(1;2;3)') # returns {'result': 6, 'error': None}

Custom functions

Say you have a function called triple:

def triple(x):

    return x*3

You can teach the parser to use it with set_function

p.set_function('TRIPLE', triple)

p.parse('TRIPLE(2)') # returns {'result': 6, 'error': None}

Variables

You can also set variables that you can then use in your formulas

p.set_variable('foo', 33)

p.parse('foo/3') # returns {'result': 11.0, 'error': None}

Contributing

Fork the project

Installing Dependencies

Depends on ply and python-dateutil.

To install dependencies automatically using pip run:

pip install -r requirements.txt

Testing

python setup.py test

Coverage

coverage run --source hotxlfp setup.py test

Update SUPPORTED_FORMULAS.md

Inside the project directory run:

python -m "scripts.update_supported_formulas"

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

hotxlfp-1.0.1.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

hotxlfp-1.0.1-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file hotxlfp-1.0.1.tar.gz.

File metadata

  • Download URL: hotxlfp-1.0.1.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for hotxlfp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e6e5b7cd214666f264dc49792d365b9383f3ad9be58ba442a3f7edadd8e82c2e
MD5 702a887223e3aa71f78e51803fd41e11
BLAKE2b-256 f2d9198338dad6007a4dc5864cbdcf510a1a3b83ca34ebc65ab21bd91f91e82d

See more details on using hashes here.

File details

Details for the file hotxlfp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hotxlfp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for hotxlfp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94b14885c8c6603d81ef6b03edf47ca755a980497eaa82d60c60c5bd1def5d83
MD5 0b1d02a4f96ceedf3307695ef18b900c
BLAKE2b-256 ab20b6a2af4bf00c4b2770d08453d330ad695e058422355cbfcd6905770ce050

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