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 -m unittest

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.2.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hotxlfp-1.0.2-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hotxlfp-1.0.2.tar.gz
  • Upload date:
  • Size: 35.9 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.2.tar.gz
Algorithm Hash digest
SHA256 82efa4364b1960da5ff139f6ea5dbc0771c7c24604b201f55a160ed96239574e
MD5 eeb737bb63b2752c50054fb494c84e75
BLAKE2b-256 8e6011c5888ba7c0ce003ffc91dd2ef4834e73c3846fd79b7bb8653f774ab4c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hotxlfp-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 40.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6befebac83b9e015ad4335fb1cdaf7cb7953567a5e2c1b17aa14d0d71fa5828
MD5 0a72eefacfbe257703c2ed96bfd3f4c0
BLAKE2b-256 9cfe16cf415ceb485bf9f23bdbdd3e7b181c7147f82bcfde3c3bb55a14e8461f

See more details on using hashes here.

Supported by

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