bare-script 4.2.12__tar.gz → 5.0.1__tar.gz
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.
- {bare_script-4.2.12/src/bare_script.egg-info → bare_script-5.0.1}/PKG-INFO +70 -21
- {bare_script-4.2.12 → bare_script-5.0.1}/README.md +69 -19
- {bare_script-4.2.12 → bare_script-5.0.1}/setup.cfg +2 -7
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/__init__.py +3 -3
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/bare.py +3 -4
- bare_script-5.0.1/src/bare_script/include.py +733 -0
- bare_script-5.0.1/src/bare_script/include_source.py +12002 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/library.py +40 -177
- bare_script-4.2.12/src/bare_script/model.py → bare_script-5.0.1/src/bare_script/lint.py +1 -314
- bare_script-5.0.1/src/bare_script/model.py +319 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/options.py +0 -21
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/parser.py +11 -10
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/runtime.py +153 -57
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/runtime_c.c +79 -31
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/value.py +95 -81
- {bare_script-4.2.12 → bare_script-5.0.1/src/bare_script.egg-info}/PKG-INFO +70 -21
- bare_script-5.0.1/src/bare_script.egg-info/SOURCES.txt +24 -0
- bare_script-5.0.1/src/bare_script.egg-info/requires.txt +1 -0
- bare_script-4.2.12/src/bare_script/include/__init__.py +0 -0
- bare_script-4.2.12/src/bare_script/include/args.bare +0 -344
- bare_script-4.2.12/src/bare_script/include/baredoc.bare +0 -383
- bare_script-4.2.12/src/bare_script/include/baredocCLI.bare +0 -246
- bare_script-4.2.12/src/bare_script/include/data.bare +0 -624
- bare_script-4.2.12/src/bare_script/include/dataLineChart.bare +0 -832
- bare_script-4.2.12/src/bare_script/include/dataTable.bare +0 -366
- bare_script-4.2.12/src/bare_script/include/dataUtil.bare +0 -56
- bare_script-4.2.12/src/bare_script/include/diff.bare +0 -146
- bare_script-4.2.12/src/bare_script/include/draw.bare +0 -443
- bare_script-4.2.12/src/bare_script/include/elementModel.bare +0 -178
- bare_script-4.2.12/src/bare_script/include/forms.bare +0 -72
- bare_script-4.2.12/src/bare_script/include/markdown.bare +0 -292
- bare_script-4.2.12/src/bare_script/include/markdownElements.bare +0 -354
- bare_script-4.2.12/src/bare_script/include/markdownHighlight.bare +0 -1153
- bare_script-4.2.12/src/bare_script/include/markdownParser.bare +0 -862
- bare_script-4.2.12/src/bare_script/include/markdownUp.bare +0 -420
- bare_script-4.2.12/src/bare_script/include/pager.bare +0 -301
- bare_script-4.2.12/src/bare_script/include/qrcode.bare +0 -917
- bare_script-4.2.12/src/bare_script/include/schemaDoc.bare +0 -735
- bare_script-4.2.12/src/bare_script/include/unittest.bare +0 -554
- bare_script-4.2.12/src/bare_script/include/unittestMock.bare +0 -301
- bare_script-4.2.12/src/bare_script.egg-info/SOURCES.txt +0 -43
- bare_script-4.2.12/src/bare_script.egg-info/requires.txt +0 -2
- {bare_script-4.2.12 → bare_script-5.0.1}/LICENSE +0 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/pyproject.toml +0 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/setup.py +0 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script/__main__.py +0 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script.egg-info/dependency_links.txt +0 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script.egg-info/entry_points.txt +0 -0
- {bare_script-4.2.12 → bare_script-5.0.1}/src/bare_script.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bare-script
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.1
|
|
4
4
|
Summary: bare-script
|
|
5
5
|
Home-page: https://github.com/craigahobbs/bare-script
|
|
6
6
|
Author: Craig A. Hobbs
|
|
@@ -19,7 +19,6 @@ Classifier: Topic :: Software Development :: Interpreters
|
|
|
19
19
|
Classifier: Topic :: Utilities
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
-
Requires-Dist: schema-markdown<1.4.0,>=1.3.0
|
|
23
22
|
Requires-Dist: urllib3>=2.5.0
|
|
24
23
|
Dynamic: license-file
|
|
25
24
|
|
|
@@ -156,6 +155,41 @@ This outputs:
|
|
|
156
155
|
```
|
|
157
156
|
|
|
158
157
|
|
|
158
|
+
## The Include Library Stub Functions
|
|
159
|
+
|
|
160
|
+
BareScript include library functions are callable directly from Python using the native stub functions
|
|
161
|
+
exported by the
|
|
162
|
+
[include module](https://craigahobbs.github.io/bare-script-py/include.html) — for example,
|
|
163
|
+
[data_aggregate](https://craigahobbs.github.io/bare-script-py/include.html#data-aggregate),
|
|
164
|
+
[markdown_parse](https://craigahobbs.github.io/bare-script-py/include.html#markdown-parse),
|
|
165
|
+
[qrcode_matrix](https://craigahobbs.github.io/bare-script-py/include.html#qrcode-matrix),
|
|
166
|
+
[schema_parse](https://craigahobbs.github.io/bare-script-py/include.html#schema-parse),
|
|
167
|
+
[schema_validate](https://craigahobbs.github.io/bare-script-py/include.html#schema-validate), and
|
|
168
|
+
[url_encode](https://craigahobbs.github.io/bare-script-py/include.html#url-encode).
|
|
169
|
+
Each stub function executes its corresponding include library function using the BareScript
|
|
170
|
+
runtime. For example:
|
|
171
|
+
|
|
172
|
+
``` python
|
|
173
|
+
from bare_script.include import markdown_parse, markdown_title
|
|
174
|
+
|
|
175
|
+
# Parse the Markdown text
|
|
176
|
+
markdown = markdown_parse('''\
|
|
177
|
+
# Hello, Markdown!
|
|
178
|
+
|
|
179
|
+
This is some text.
|
|
180
|
+
''')
|
|
181
|
+
|
|
182
|
+
# Print the Markdown title
|
|
183
|
+
print(markdown_title(markdown))
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This outputs:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Hello, Markdown!
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
159
193
|
## The BareScript Command-Line Interface (CLI)
|
|
160
194
|
|
|
161
195
|
You can run BareScript from the command line using the BareScript CLI, "bare". BareScript script
|
|
@@ -198,25 +232,40 @@ runtime for faster script execution. The compiled extension is used automaticall
|
|
|
198
232
|
set the environment variable `BARESCRIPT_RUNTIME_PY=1` to force the pure-Python runtime.
|
|
199
233
|
|
|
200
234
|
The extension supports CPython 3.10 and later on both the default (GIL) and free-threaded Python
|
|
201
|
-
builds.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
|
219
|
-
|
|
|
235
|
+
builds. See the Performance section below for benchmark results comparing the C runtime, the
|
|
236
|
+
pure-Python runtime, and native Python.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
## Performance
|
|
240
|
+
|
|
241
|
+
The `make perf` target benchmarks the BareScript runtime with a suite of compute-intensive tests —
|
|
242
|
+
Mandelbrot set computation, Markdown parsing and rendering, QR code generation, Schema Markdown
|
|
243
|
+
parsing and validation, and URL encoding and decoding — and compares each test with an equivalent
|
|
244
|
+
native Python program (using the
|
|
245
|
+
[schema-markdown](https://pypi.org/project/schema-markdown/) package).
|
|
246
|
+
|
|
247
|
+
The following results are from `make perf PERF_MERGE=` (CPython 3.14, Apple M-series). "BareScript
|
|
248
|
+
(PyC)" is the C runtime; "BareScript (Py)" is the pure-Python runtime. Times are the best per-run
|
|
249
|
+
timing in milliseconds per 100 runs. Multiples are relative to the native Python time. Tests
|
|
250
|
+
without a native Python equivalent are omitted.
|
|
251
|
+
|
|
252
|
+
| Test | Language | Time (ms) | Multiple |
|
|
253
|
+
| ---------------- | ---------------- | --------: | -------: |
|
|
254
|
+
| mandelbrot | Python | 4793.6 | |
|
|
255
|
+
| | BareScript (PyC) | 11400.0 | 2.4x |
|
|
256
|
+
| | BareScript (Py) | 338000.0 | 70.5x |
|
|
257
|
+
| schemaValidate | Python | 21.2 | |
|
|
258
|
+
| | BareScript (PyC) | 98.4 | 4.6x |
|
|
259
|
+
| | BareScript (Py) | 1437.6 | 67.7x |
|
|
260
|
+
| urlEncode | Python | 1.1 | |
|
|
261
|
+
| | BareScript (PyC) | 5.5 | 5.1x |
|
|
262
|
+
| | BareScript (Py) | 38.5 | 36.3x |
|
|
263
|
+
| schemaParse | Python | 17.7 | |
|
|
264
|
+
| | BareScript (PyC) | 128.0 | 7.2x |
|
|
265
|
+
| | BareScript (Py) | 912.8 | 51.5x |
|
|
266
|
+
| urlDecode | Python | 1.2 | |
|
|
267
|
+
| | BareScript (PyC) | 12.6 | 10.7x |
|
|
268
|
+
| | BareScript (Py) | 64.7 | 55.0x |
|
|
220
269
|
|
|
221
270
|
|
|
222
271
|
## Using BareScript with an AI Assistant
|
|
@@ -131,6 +131,41 @@ This outputs:
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
|
|
134
|
+
## The Include Library Stub Functions
|
|
135
|
+
|
|
136
|
+
BareScript include library functions are callable directly from Python using the native stub functions
|
|
137
|
+
exported by the
|
|
138
|
+
[include module](https://craigahobbs.github.io/bare-script-py/include.html) — for example,
|
|
139
|
+
[data_aggregate](https://craigahobbs.github.io/bare-script-py/include.html#data-aggregate),
|
|
140
|
+
[markdown_parse](https://craigahobbs.github.io/bare-script-py/include.html#markdown-parse),
|
|
141
|
+
[qrcode_matrix](https://craigahobbs.github.io/bare-script-py/include.html#qrcode-matrix),
|
|
142
|
+
[schema_parse](https://craigahobbs.github.io/bare-script-py/include.html#schema-parse),
|
|
143
|
+
[schema_validate](https://craigahobbs.github.io/bare-script-py/include.html#schema-validate), and
|
|
144
|
+
[url_encode](https://craigahobbs.github.io/bare-script-py/include.html#url-encode).
|
|
145
|
+
Each stub function executes its corresponding include library function using the BareScript
|
|
146
|
+
runtime. For example:
|
|
147
|
+
|
|
148
|
+
``` python
|
|
149
|
+
from bare_script.include import markdown_parse, markdown_title
|
|
150
|
+
|
|
151
|
+
# Parse the Markdown text
|
|
152
|
+
markdown = markdown_parse('''\
|
|
153
|
+
# Hello, Markdown!
|
|
154
|
+
|
|
155
|
+
This is some text.
|
|
156
|
+
''')
|
|
157
|
+
|
|
158
|
+
# Print the Markdown title
|
|
159
|
+
print(markdown_title(markdown))
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This outputs:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Hello, Markdown!
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
|
|
134
169
|
## The BareScript Command-Line Interface (CLI)
|
|
135
170
|
|
|
136
171
|
You can run BareScript from the command line using the BareScript CLI, "bare". BareScript script
|
|
@@ -173,25 +208,40 @@ runtime for faster script execution. The compiled extension is used automaticall
|
|
|
173
208
|
set the environment variable `BARESCRIPT_RUNTIME_PY=1` to force the pure-Python runtime.
|
|
174
209
|
|
|
175
210
|
The extension supports CPython 3.10 and later on both the default (GIL) and free-threaded Python
|
|
176
|
-
builds.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
|
194
|
-
|
|
|
211
|
+
builds. See the Performance section below for benchmark results comparing the C runtime, the
|
|
212
|
+
pure-Python runtime, and native Python.
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## Performance
|
|
216
|
+
|
|
217
|
+
The `make perf` target benchmarks the BareScript runtime with a suite of compute-intensive tests —
|
|
218
|
+
Mandelbrot set computation, Markdown parsing and rendering, QR code generation, Schema Markdown
|
|
219
|
+
parsing and validation, and URL encoding and decoding — and compares each test with an equivalent
|
|
220
|
+
native Python program (using the
|
|
221
|
+
[schema-markdown](https://pypi.org/project/schema-markdown/) package).
|
|
222
|
+
|
|
223
|
+
The following results are from `make perf PERF_MERGE=` (CPython 3.14, Apple M-series). "BareScript
|
|
224
|
+
(PyC)" is the C runtime; "BareScript (Py)" is the pure-Python runtime. Times are the best per-run
|
|
225
|
+
timing in milliseconds per 100 runs. Multiples are relative to the native Python time. Tests
|
|
226
|
+
without a native Python equivalent are omitted.
|
|
227
|
+
|
|
228
|
+
| Test | Language | Time (ms) | Multiple |
|
|
229
|
+
| ---------------- | ---------------- | --------: | -------: |
|
|
230
|
+
| mandelbrot | Python | 4793.6 | |
|
|
231
|
+
| | BareScript (PyC) | 11400.0 | 2.4x |
|
|
232
|
+
| | BareScript (Py) | 338000.0 | 70.5x |
|
|
233
|
+
| schemaValidate | Python | 21.2 | |
|
|
234
|
+
| | BareScript (PyC) | 98.4 | 4.6x |
|
|
235
|
+
| | BareScript (Py) | 1437.6 | 67.7x |
|
|
236
|
+
| urlEncode | Python | 1.1 | |
|
|
237
|
+
| | BareScript (PyC) | 5.5 | 5.1x |
|
|
238
|
+
| | BareScript (Py) | 38.5 | 36.3x |
|
|
239
|
+
| schemaParse | Python | 17.7 | |
|
|
240
|
+
| | BareScript (PyC) | 128.0 | 7.2x |
|
|
241
|
+
| | BareScript (Py) | 912.8 | 51.5x |
|
|
242
|
+
| urlDecode | Python | 1.2 | |
|
|
243
|
+
| | BareScript (PyC) | 12.6 | 10.7x |
|
|
244
|
+
| | BareScript (Py) | 64.7 | 55.0x |
|
|
195
245
|
|
|
196
246
|
|
|
197
247
|
## Using BareScript with an AI Assistant
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = bare-script
|
|
3
|
-
version =
|
|
3
|
+
version = 5.0.1
|
|
4
4
|
url = https://github.com/craigahobbs/bare-script
|
|
5
5
|
author = Craig A. Hobbs
|
|
6
6
|
author_email = craigahobbs@gmail.com
|
|
@@ -22,21 +22,16 @@ classifiers =
|
|
|
22
22
|
Topic :: Utilities
|
|
23
23
|
|
|
24
24
|
[options]
|
|
25
|
-
packages = bare_script
|
|
25
|
+
packages = bare_script
|
|
26
26
|
package_dir =
|
|
27
27
|
= src
|
|
28
28
|
install_requires =
|
|
29
|
-
schema-markdown >= 1.3.0, < 1.4.0
|
|
30
29
|
urllib3 >= 2.5.0
|
|
31
30
|
|
|
32
31
|
[options.entry_points]
|
|
33
32
|
console_scripts =
|
|
34
33
|
bare = bare_script.bare:main
|
|
35
34
|
|
|
36
|
-
[options.package_data]
|
|
37
|
-
bare_script =
|
|
38
|
-
include/*.bare
|
|
39
|
-
|
|
40
35
|
[egg_info]
|
|
41
36
|
tag_build =
|
|
42
37
|
tag_date = 0
|
|
@@ -7,17 +7,17 @@ bare-script package
|
|
|
7
7
|
|
|
8
8
|
import os
|
|
9
9
|
|
|
10
|
+
from .lint import \
|
|
11
|
+
lint_script
|
|
12
|
+
|
|
10
13
|
from .model import \
|
|
11
|
-
lint_script, \
|
|
12
14
|
validate_expression, \
|
|
13
15
|
validate_script
|
|
14
16
|
|
|
15
17
|
from .options import \
|
|
16
|
-
FETCH_SYSTEM_PREFIX, \
|
|
17
18
|
fetch_http, \
|
|
18
19
|
fetch_read_only, \
|
|
19
20
|
fetch_read_write, \
|
|
20
|
-
fetch_system, \
|
|
21
21
|
log_stdout, \
|
|
22
22
|
url_file_relative
|
|
23
23
|
|
|
@@ -11,8 +11,8 @@ import os
|
|
|
11
11
|
import sys
|
|
12
12
|
import time
|
|
13
13
|
|
|
14
|
-
from .
|
|
15
|
-
from .options import
|
|
14
|
+
from .lint import lint_script
|
|
15
|
+
from .options import fetch_read_write, log_stdout, url_file_relative
|
|
16
16
|
from .parser import parse_expression, parse_script
|
|
17
17
|
from .runtime import SYSTEM_GLOBAL_INCLUDES_NAME
|
|
18
18
|
from .value import value_boolean
|
|
@@ -121,10 +121,9 @@ def main(argv=None):
|
|
|
121
121
|
time_begin = time.time()
|
|
122
122
|
result = execute_script(script, {
|
|
123
123
|
'debug': args.debug or False,
|
|
124
|
-
'fetchFn':
|
|
124
|
+
'fetchFn': fetch_read_write,
|
|
125
125
|
'globals': static_globals,
|
|
126
126
|
'logFn': log_stdout,
|
|
127
|
-
'systemPrefix': FETCH_SYSTEM_PREFIX,
|
|
128
127
|
'urlFn': partial(url_file_relative, script_value) if script_type == 'file' else None
|
|
129
128
|
})
|
|
130
129
|
if isinstance(result, (int, float)) and int(result) == result and 0 <= result <= 255:
|