bare-script 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.1
2
+ Name: bare-script
3
+ Version: 0.9.0
4
+ Summary: bare-script
5
+ Home-page: https://github.com/craigahobbs/bare-script
6
+ Author: Craig A. Hobbs
7
+ Author-email: craigahobbs@gmail.com
8
+ License: MIT
9
+ Keywords: bare-script
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Utilities
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Requires-Dist: schema-markdown >=1.2.0
23
+
24
+ bare-script
25
+ ===========
26
+
27
+ .. |badge-status| image:: https://img.shields.io/pypi/status/bare-script
28
+ :alt: PyPI - Status
29
+ :target: https://pypi.python.org/pypi/bare-script/
30
+
31
+ .. |badge-version| image:: https://img.shields.io/pypi/v/bare-script
32
+ :alt: PyPI
33
+ :target: https://pypi.python.org/pypi/bare-script/
34
+
35
+ .. |badge-license| image:: https://img.shields.io/github/license/craigahobbs/bare-script-py
36
+ :alt: GitHub
37
+ :target: https://github.com/craigahobbs/bare-script-py/blob/main/LICENSE
38
+
39
+ .. |badge-python| image:: https://img.shields.io/pypi/pyversions/bare-script
40
+ :alt: PyPI - Python Version
41
+ :target: https://www.python.org/downloads/
42
+
43
+ |badge-status| |badge-version| |badge-license| |badge-python|
44
+
45
+ BareScript is a light-weight scripting and expression language.
46
+
47
+
48
+ Links
49
+ -----
50
+
51
+ - `The BareScript Language <https://craigahobbs.github.io/bare-script/language/>`__
52
+ - `The BareScript Library <https://craigahobbs.github.io/bare-script-py/library/>`__
53
+ - `The BareScript Expression Library <https://craigahobbs.github.io/bare-script-py/library/expression.html>`__
54
+ - `API Documentation <https://craigahobbs.github.io/bare-script-py/>`__
55
+ - `Source code <https://github.com/craigahobbs/bare-script-py>`__
56
+
57
+
58
+ Executing BareScript
59
+ --------------------
60
+
61
+ To execute a BareScript script, parse the script using the
62
+ `parse_script <https://craigahobbs.github.io/bare-script-py/scripts.html#parse-script>`__
63
+ function. Then execute the script using the
64
+ `execute_script <https://craigahobbs.github.io/bare-script-py/scripts.html#execute-script>`__
65
+ function. For example:
66
+
67
+ >>> from bare_script import execute_script, parse_script
68
+ ...
69
+ >>> # Parse the script
70
+ ... script = parse_script('''\
71
+ ... # Double a number
72
+ ... function double(n):
73
+ ... return n * 2
74
+ ... endfunction
75
+ ...
76
+ ... return N + ' times 2 is ' + double(N)
77
+ ... ''')
78
+ ...
79
+ >>> # Execute the script
80
+ ... globals = {'N': 10}
81
+ >>> print(execute_script(script, {'globals': globals}))
82
+ 10 times 2 is 20
83
+
84
+
85
+ The BareScript Library
86
+ ^^^^^^^^^^^^^^^^^^^^^^
87
+
88
+ `The BareScript Library <https://craigahobbs.github.io/bare-script-py/library/>`__
89
+ includes a set of built-in functions for mathematical operations, object manipulation, array
90
+ manipulation, regular expressions, HTTP fetch and more. The following example demonstrates the use
91
+ of the
92
+ `systemFetch <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='System'&systemfetch>`__,
93
+ `objectGet <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='Object'&objectget>`__, and
94
+ `arrayLength <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='Array'&arraylength>`__
95
+ functions.
96
+
97
+ >>> import urllib.request
98
+ ...
99
+ >>> from bare_script import execute_script, fetch_http, parse_script
100
+ ...
101
+ >>> # Parse the script
102
+ ... script = parse_script('''\
103
+ ... # Fetch the BareScript library documentation JSON
104
+ ... docs = jsonParse(systemFetch('https://craigahobbs.github.io/bare-script-py/library/library.json'))
105
+ ...
106
+ ... # Return the number of library functions
107
+ ... return 'The BareScript Library has ' + arrayLength(objectGet(docs, 'functions')) + ' functions'
108
+ ... ''')
109
+ ...
110
+ >>> # Execute the script
111
+ ... print(execute_script(script, {'fetchFn': fetch_http}))
112
+ The BareScript Library has 106 functions
113
+
114
+
115
+ Evaluating BareScript Expressions
116
+ ---------------------------------
117
+
118
+ To evaluate a
119
+ `BareScript expression <https://craigahobbs.github.io/bare-script/language/#expressions>`__,
120
+ parse the expression using the
121
+ `parse_expression <https://craigahobbs.github.io/bare-script-py/expressions.html#parse-expression>`__
122
+ function. Then evaluate the expression using the
123
+ `evaluate_expression <https://craigahobbs.github.io/bare-script-py/expressions.html#evaluate-expression>`__
124
+ function.
125
+
126
+ Expression evaluation includes the
127
+ `BareScript Expression Library <https://craigahobbs.github.io/bare-script-py/library/expression.html>`__,
128
+ a set of built-in, spreadsheet-like functions.
129
+
130
+ For example:
131
+
132
+ >>> from bare_script import evaluate_expression, parse_expression
133
+ ...
134
+ >>> # Parse the expression
135
+ ... expr = parse_expression('2 * max(a, b, c)')
136
+ ...
137
+ >>> # Evaluate the expression
138
+ ... variables = {'a': 1, 'b': 2, 'c': 3}
139
+ >>> print(evaluate_expression(expr, None, variables))
140
+ 6.0
141
+
142
+
143
+ The BareScript Command-Line Interface (CLI)
144
+ -------------------------------------------
145
+
146
+ You can run BareScript from the command line using the BareScript CLI, "bare". BareScript script
147
+ files use the ".bare" file extension.
148
+
149
+ .. code-block:: sh
150
+
151
+ bare script.bare
152
+
153
+ **Note:** In the BareScript CLI, import statements and the
154
+ `systemFetch <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='System'&systemfetch>`__
155
+ function read non-URL paths from the local file system.
156
+
157
+
158
+ MarkdownUp, a Markdown Viewer with BareScript
159
+ ---------------------------------------------
160
+
161
+ `MarkdownUp <https://craigahobbs.github.io/markdown-up/>`__
162
+ is a Markdown Viewer that executes BareScript embedded within Markdown documents.
163
+ `MarkdownUp <https://craigahobbs.github.io/markdown-up/>`__
164
+ extends its
165
+ `standard library <https://craigahobbs.github.io/markdown-up/library/>`__
166
+ with functions for dynamically rendering Markdown text, drawing SVG images, etc.
167
+
168
+ For example:
169
+
170
+ .. code-block:: markdown
171
+
172
+ # Markdown Application
173
+
174
+ This is a Markdown document with embedded BareScript:
175
+
176
+ ~~~ markdown-script
177
+ markdownPrint('Hello, Markdown!')
178
+ ~~~
179
+
180
+
181
+ Development
182
+ -----------
183
+
184
+ This package is developed using `python-build <https://github.com/craigahobbs/python-build#readme>`__.
185
+ It was started using `python-template <https://github.com/craigahobbs/python-template#readme>`__ as follows:
186
+
187
+ .. code-block:: sh
188
+
189
+ template-specialize python-template/template/ bare-script/ -k package bare-script -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs'
@@ -0,0 +1,16 @@
1
+ bare_script/__init__.py,sha256=1KadiOevH2lGAy5tIqsnxtLIR96YtnINlSD186_JgU8,635
2
+ bare_script/__main__.py,sha256=vgFzmiNuP05IKyuY6FrDLChkleyvER9L22OJNxsyf74,232
3
+ bare_script/bare.py,sha256=u4wpWymdskvrkS8lw8xdTb6D2aREullJMycEQPwxOoQ,4217
4
+ bare_script/baredoc.py,sha256=FHfYOpSl2U39vRtGVaM6E-LV6V7VSWTld07c2OqBGmA,5120
5
+ bare_script/library.py,sha256=nMNv8mAsMQmbmD_M0JdrW28YJAncG87MzqUJqnBKv2Q,57314
6
+ bare_script/model.py,sha256=5cz0OJ99fDFM1QYOU3DrvVNSN85xFY2HoLry_wHoit4,4599
7
+ bare_script/options.py,sha256=ov6sifB36hACdrrTEOWCuRJpS3zqJejaE35TOSHRR80,2644
8
+ bare_script/parser.py,sha256=Psj9ApCGjeSoSRSkyq0QX-J-FncyT6tborXjuR1HPVo,29024
9
+ bare_script/runtime.py,sha256=8b1TGm9yNxyyfc6nXIOUy1qYPdMcDF-a59Ri__4Z9YU,14369
10
+ bare_script/value.py,sha256=QkRM-rVZ-u-n31XgrirCWCWCezbQfRFVSuqQUpMssYI,5547
11
+ bare_script-0.9.0.dist-info/LICENSE,sha256=legUTdYSyuztIaeQs3C2qoknw9dwIEdEVfOiF1UTaTs,1081
12
+ bare_script-0.9.0.dist-info/METADATA,sha256=oxYEsHpHeBJSPha2t6n7-HvrT-U3mc8djNetgMvmTR8,6549
13
+ bare_script-0.9.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
14
+ bare_script-0.9.0.dist-info/entry_points.txt,sha256=FkrlFNSpZQc5RZR2HtyWJnBCGY0QuqVwlj1xMfDf0P0,82
15
+ bare_script-0.9.0.dist-info/top_level.txt,sha256=LJr6EHeCFlEIlvy5P794yqrYxa3Ptu2zY1ziNxv2QRQ,12
16
+ bare_script-0.9.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.42.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ bare = bare_script.bare:main
3
+ baredoc = bare_script.baredoc:main
@@ -0,0 +1 @@
1
+ bare_script