Skip to main content

safe embedded python expression parser

Project description

https://travis-ci.org/orisano/embexpr.svg?branch=master
safe embedded python expression parser (for mainly easy DSL or config file).

Getting Started

pip install embexpr

How to Use

from embexpr import Expr, ParseError

assert Expr('3 * 5')() == 15
assert Expr('"foo" + "bar"')() == "foobar"
assert Expr('len("example")')() == 7
assert Expr('s.startswith("prefix_")')(s="prefix_suffix") == True

try:
    Expr('eval("1")')()
except ParseError as e:
    print(e)

Author

Nao YONASHIRO(@orisano)

License

MIT

Download files

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

Files for embexpr, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size embexpr-1.1.0-py2.py3-none-any.whl (4.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size embexpr-1.1.0.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page