Ravenports generated: 07 Jan 2024 05:04
[ravenports.git] / bucket_35 / python-simpleeval
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               python-simpleeval
4 VERSION=                0.9.13
5 KEYWORDS=               python
6 VARIANTS=               v11 v12
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]
11
12 DOWNLOAD_GROUPS=        main
13 SITES[main]=            PYPIWHL/0a/51/bedb4af4f3fe4bb32a3cabfd285be388958c6d676f6b0fa65997812a381b
14 DISTFILE[1]=            simpleeval-0.9.13-py2.py3-none-any.whl:main
15 DF_INDEX=               1
16 SPKGS[v11]=             single
17 SPKGS[v12]=             single
18
19 OPTIONS_AVAILABLE=      PY311 PY312
20 OPTIONS_STANDARD=       none
21 VOPTS[v11]=             PY311=ON PY312=OFF
22 VOPTS[v12]=             PY311=OFF PY312=ON
23
24 DISTNAME=               simpleeval-0.9.13.dist-info
25
26 GENERATED=              yes
27
28 [PY311].USES_ON=                        python:v11,wheel
29
30 [PY312].USES_ON=                        python:v12,wheel
31
32 [FILE:2697:descriptions/desc.single]
33 simpleeval (Simple Eval)
34 ========================
35
36    :alt: Build Status
37
38    :alt: Code Coverage
39
40    :alt: PyPI Version
41
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,
44 which
45 could depend on the time of day, alarm level, how many previous alarms had
46 gone
47 off, and if there is music playing at the time.
48
49 Or if you want to allow simple formulae in a web application, but don't
50 want to
51 give full eval() access, or don't want to run in javascript on the client
52 side.
53
54 It's deliberately trying to stay simple to use and not have millions of
55 features,
56 pull it in from PyPI (pip or easy_install), or even just a single file you
57 can dump
58 into a project.
59
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. 
62 It
63 should be completely safe in terms of what operations can be performed by
64 the
65 expression.
66
67 The only issue I know to be aware of is that you can create an expression
68 which
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
71 protection
72 against this, and you can lock it down further if you desire. (see the
73 Operators_ section below)
74
75 You should be aware of this when deploying in a public setting.
76
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).
80
81 Basic Usage
82 -----------
83
84 To get very simple evaluating:
85
86 .. code-block:: python
87
88     from simpleeval import simple_eval
89
90     simple_eval("21 + 21")
91
92 returns 42.
93
94 Expressions can be as complex and convoluted as you want:
95
96 .. code-block:: python
97
98     simple_eval("21 + 19 / 7 + (8 % 3) ** 9")
99
100 returns ``535.714285714``.
101
102 You can add your own functions in as well.
103
104 .. code-block:: python
105
106     simple_eval("square(11)", functions={"square": lambda x: x*x})
107
108 returns 121.
109
110 For more details of working with functions, read further down.
111
112 Note:
113 ~~~~~
114 all further examples use ``>>>`` to designate python code, as if you are
115 using
116 the python interactive prompt.
117
118 .. _Operators:
119
120 Operators
121 ---------
122 You can add operators yourself, using the operators argument, but these are
123 the defaults:
124
125 +--------+------------------------------------+
126 |  ``+`` | add two things. ``x + y``          |
127 |        | ``1 + 1`` -> 2                 |
128 +--------+------------------------------------+
129 |  ``-`` | subtract two things ``x - y``      |
130 |        | ``100 - 1`` -> 99              |
131 +--------+------------------------------------+
132 |  ``/`` | divide one thing by another        |
133
134
135 [FILE:117:distinfo]
136 22a2701a5006e4188d125d34accf2405c2c37c93f6b346f2484b6422415ae54a        15277 simpleeval-0.9.13-py2.py3-none-any.whl
137