diff options
author | richard <richard> | 2015-08-25 05:05:39 +0000 |
---|---|---|
committer | richard <richard> | 2015-08-25 05:05:39 +0000 |
commit | c21be1e98d65113d659f5e2b260aca7f957b25c3 (patch) | |
tree | 89b70c4a953ee70da882e88bb48c2b7adc0c7b25 /math | |
parent | 86c88cadd3b2039ddd1fa518df8b1b3401eeef0a (diff) | |
download | pkgsrc-c21be1e98d65113d659f5e2b260aca7f957b25c3.tar.gz |
Add py-simpleeval
A quick single-file MIT-Licenced library for easily adding evaluatable
expressions into python projects. Say you want to allow a user to set an alarm
volume, which could depend on the time of day, alarm level, how many previous
alarms had gone off, and if there is music playing at the time.
Or if you want to allow simple formulae in a web application, but don't want
to give full eval() access, or don't want to run in javascript on the client side.
It's deliberately very simple, just a single file you can dump into a project,
or import from pypi (pip or easy_install).
Internally, it's using the amazing python ast module to parse the expression,
which allows very fine control of what is and isn't allowed. It should be
completely safe in terms of what operations can be performed by the expression.
The only issue I know to be aware of is that you can create an expression which
takes a long time to evaluate, or which evaluating requires an awful lot of
memory, which leaves the potential for DOS attacks. There is basic protection
against this, and you can lock it down further if you desire.
You should be aware of this when deploying in a public setting.
The defaults are pretty locked down and basic, and it's very easy to add whatever
extra specific functionality you need (your own functions, variable/name lookup, etc).
Diffstat (limited to 'math')
-rw-r--r-- | math/Makefile | 3 | ||||
-rw-r--r-- | math/py-simpleeval/DESCR | 1 | ||||
-rw-r--r-- | math/py-simpleeval/Makefile | 18 | ||||
-rw-r--r-- | math/py-simpleeval/PLIST | 8 | ||||
-rw-r--r-- | math/py-simpleeval/distinfo | 5 |
5 files changed, 34 insertions, 1 deletions
diff --git a/math/Makefile b/math/Makefile index a2cac90aeeb..e280355d947 100644 --- a/math/Makefile +++ b/math/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.305 2015/08/06 01:35:25 wen Exp $ +# $NetBSD: Makefile,v 1.306 2015/08/25 05:05:39 richard Exp $ COMMENT= Mathematics @@ -240,6 +240,7 @@ SUBDIR+= py-pytables SUBDIR+= py-roman SUBDIR+= py-rpy SUBDIR+= py-scipy +SUBDIR+= py-simpleeval SUBDIR+= py-sympy SUBDIR+= qalculate SUBDIR+= qalculate-bases diff --git a/math/py-simpleeval/DESCR b/math/py-simpleeval/DESCR new file mode 100644 index 00000000000..3e0022404aa --- /dev/null +++ b/math/py-simpleeval/DESCR @@ -0,0 +1 @@ +A simple, safe single expression evaluator library. diff --git a/math/py-simpleeval/Makefile b/math/py-simpleeval/Makefile new file mode 100644 index 00000000000..4cd94dc6303 --- /dev/null +++ b/math/py-simpleeval/Makefile @@ -0,0 +1,18 @@ +# $NetBSD: Makefile,v 1.1 2015/08/25 05:05:39 richard Exp $ + +DISTNAME= simpleeval-0.8.2 +PKGNAME= ${PYPKGPREFIX}-${DISTNAME} +CATEGORIES= math +MASTER_SITES= http://pypi.python.org/packages/source/s/simpleeval/ + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= http://github.com/danthedeckie/simpleeval +COMMENT= Simple, safe single expression evaluator library +LICENSE= mit + +USE_LANGUAGES= # none + +PYTHON_VERSIONS_INCOMPATIBLE= 33 34 + +.include "../../lang/python/egg.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/math/py-simpleeval/PLIST b/math/py-simpleeval/PLIST new file mode 100644 index 00000000000..76839369ed2 --- /dev/null +++ b/math/py-simpleeval/PLIST @@ -0,0 +1,8 @@ +@comment $NetBSD: PLIST,v 1.1 2015/08/25 05:05:39 richard Exp $ +${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt +${PYSITELIB}/${EGG_INFODIR}/PKG-INFO +${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt +${PYSITELIB}/${EGG_INFODIR}/top_level.txt +${PYSITELIB}/simpleeval.py +${PYSITELIB}/simpleeval.pyc +${PYSITELIB}/simpleeval.pyo diff --git a/math/py-simpleeval/distinfo b/math/py-simpleeval/distinfo new file mode 100644 index 00000000000..7b12b7f819a --- /dev/null +++ b/math/py-simpleeval/distinfo @@ -0,0 +1,5 @@ +$NetBSD: distinfo,v 1.1 2015/08/25 05:05:39 richard Exp $ + +SHA1 (simpleeval-0.8.2.tar.gz) = ee345de583c739aa77b71bb3be23e6a14c6e6e0c +RMD160 (simpleeval-0.8.2.tar.gz) = dfb2a6aefcd75b3812d52d548ab8d0949deb48ba +Size (simpleeval-0.8.2.tar.gz) = 8282 bytes |