1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-simpleeval
7 SDESC[v11]= Single expression evaluator library (3.11)
8 SDESC[v12]= Single expression evaluator library (3.12)
9 HOMEPAGE= https://github.com/danthedeckie/simpleeval
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPIWHL/0a/51/bedb4af4f3fe4bb32a3cabfd285be388958c6d676f6b0fa65997812a381b
14 DISTFILE[1]= simpleeval-0.9.13-py2.py3-none-any.whl:main
19 OPTIONS_AVAILABLE= PY311 PY312
20 OPTIONS_STANDARD= none
21 VOPTS[v11]= PY311=ON PY312=OFF
22 VOPTS[v12]= PY311=OFF PY312=ON
24 DISTNAME= simpleeval-0.9.13.dist-info
28 [PY311].USES_ON= python:v11,wheel
30 [PY312].USES_ON= python:v12,wheel
32 [FILE:2697:descriptions/desc.single]
33 simpleeval (Simple Eval)
34 ========================
42 A single file library for easily adding evaluatable expressions into
43 python projects. Say you want to allow a user to set an alarm volume,
45 could depend on the time of day, alarm level, how many previous alarms had
47 off, and if there is music playing at the time.
49 Or if you want to allow simple formulae in a web application, but don't
51 give full eval() access, or don't want to run in javascript on the client
54 It's deliberately trying to stay simple to use and not have millions of
56 pull it in from PyPI (pip or easy_install), or even just a single file you
60 Internally, it's using the amazing python ast module to parse the
61 expression, which allows very fine control of what is and isn't allowed.
63 should be completely safe in terms of what operations can be performed by
67 The only issue I know to be aware of is that you can create an expression
69 takes a long time to evaluate, or which evaluating requires an awful lot of
70 memory, which leaves the potential for DOS attacks. There is basic
72 against this, and you can lock it down further if you desire. (see the
73 Operators_ section below)
75 You should be aware of this when deploying in a public setting.
77 The defaults are pretty locked down and basic, and it's easy to add
78 whatever extra specific functionality you need (your own functions,
79 variable/name lookup, etc).
84 To get very simple evaluating:
86 .. code-block:: python
88 from simpleeval import simple_eval
90 simple_eval("21 + 21")
94 Expressions can be as complex and convoluted as you want:
96 .. code-block:: python
98 simple_eval("21 + 19 / 7 + (8 % 3) ** 9")
100 returns ``535.714285714``.
102 You can add your own functions in as well.
104 .. code-block:: python
106 simple_eval("square(11)", functions={"square": lambda x: x*x})
110 For more details of working with functions, read further down.
114 all further examples use ``>>>`` to designate python code, as if you are
116 the python interactive prompt.
122 You can add operators yourself, using the operators argument, but these are
125 +--------+------------------------------------+
126 | ``+`` | add two things. ``x + y`` |
128 +--------+------------------------------------+
129 | ``-`` | subtract two things ``x - y`` |
130 | | ``100 - 1`` -> 99 |
131 +--------+------------------------------------+
132 | ``/`` | divide one thing by another |
136 22a2701a5006e4188d125d34accf2405c2c37c93f6b346f2484b6422415ae54a 15277 simpleeval-0.9.13-py2.py3-none-any.whl