bare-script 5.1.6__tar.gz → 5.1.8__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-5.1.6/src/bare_script.egg-info → bare_script-5.1.8}/PKG-INFO +12 -1
- {bare_script-5.1.6 → bare_script-5.1.8}/README.md +11 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/pyproject.toml +1 -1
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/bare.py +2 -12
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/include.py +1 -9
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/include_source.py +1554 -1633
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/library.py +23 -68
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/options.py +8 -13
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/runtime.py +152 -117
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/runtime_c.c +26 -2
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/value.py +42 -62
- {bare_script-5.1.6 → bare_script-5.1.8/src/bare_script.egg-info}/PKG-INFO +12 -1
- {bare_script-5.1.6 → bare_script-5.1.8}/LICENSE +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/setup.cfg +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/setup.py +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/__init__.py +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script/__main__.py +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script.egg-info/SOURCES.txt +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script.egg-info/dependency_links.txt +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script.egg-info/entry_points.txt +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/src/bare_script.egg-info/requires.txt +0 -0
- {bare_script-5.1.6 → bare_script-5.1.8}/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: 5.1.
|
|
3
|
+
Version: 5.1.8
|
|
4
4
|
Summary: BareScript; a lightweight scripting and expression language
|
|
5
5
|
Author-email: "Craig A. Hobbs" <craigahobbs@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -296,6 +296,17 @@ builds. See the Performance section below for benchmark results comparing the C
|
|
|
296
296
|
pure-Python runtime, and native Python.
|
|
297
297
|
|
|
298
298
|
|
|
299
|
+
## Thread Safety
|
|
300
|
+
|
|
301
|
+
Both runtimes may be used from multiple threads, including on the free-threaded (no-GIL) Python
|
|
302
|
+
builds. Script models and a `globals` dict may be shared across threads once populated - for example,
|
|
303
|
+
execute a script that defines functions once, then call those functions concurrently. Each
|
|
304
|
+
concurrently executing thread must pass its own `options` dict to `execute_script`, since the runtime
|
|
305
|
+
records the running `statementCount` there. The parser, linter, and include library stubs initialize
|
|
306
|
+
lazily and are safe to call from any thread. As in Python, unsynchronized concurrent mutation of a
|
|
307
|
+
shared array or object from several threads has unspecified results but never crashes the runtime.
|
|
308
|
+
|
|
309
|
+
|
|
299
310
|
## Performance
|
|
300
311
|
|
|
301
312
|
The `make perf` target benchmarks the BareScript runtime with a suite of compute-intensive tests —
|
|
@@ -270,6 +270,17 @@ builds. See the Performance section below for benchmark results comparing the C
|
|
|
270
270
|
pure-Python runtime, and native Python.
|
|
271
271
|
|
|
272
272
|
|
|
273
|
+
## Thread Safety
|
|
274
|
+
|
|
275
|
+
Both runtimes may be used from multiple threads, including on the free-threaded (no-GIL) Python
|
|
276
|
+
builds. Script models and a `globals` dict may be shared across threads once populated - for example,
|
|
277
|
+
execute a script that defines functions once, then call those functions concurrently. Each
|
|
278
|
+
concurrently executing thread must pass its own `options` dict to `execute_script`, since the runtime
|
|
279
|
+
records the running `statementCount` there. The parser, linter, and include library stubs initialize
|
|
280
|
+
lazily and are safe to call from any thread. As in Python, unsynchronized concurrent mutation of a
|
|
281
|
+
shared array or object from several threads has unspecified results but never crashes the runtime.
|
|
282
|
+
|
|
283
|
+
|
|
273
284
|
## Performance
|
|
274
285
|
|
|
275
286
|
The `make perf` target benchmarks the BareScript runtime with a suite of compute-intensive tests —
|
|
@@ -7,20 +7,13 @@ bare-script command-line interface (CLI)
|
|
|
7
7
|
|
|
8
8
|
import argparse
|
|
9
9
|
from functools import partial
|
|
10
|
-
import os
|
|
11
10
|
import sys
|
|
12
11
|
import time
|
|
13
12
|
|
|
13
|
+
from . import evaluate_expression, execute_script
|
|
14
14
|
from .options import fetch_read_write, log_stdout, url_file_relative
|
|
15
15
|
from .runtime import SYSTEM_GLOBAL_INCLUDES_NAME, barescript_lint_script, barescript_parse_expression, barescript_parse_script
|
|
16
16
|
from .value import value_boolean
|
|
17
|
-
if not os.environ.get('BARESCRIPT_RUNTIME_PY'): # pragma: no cover
|
|
18
|
-
try:
|
|
19
|
-
from .runtime_c import evaluate_expression, execute_script
|
|
20
|
-
except ImportError:
|
|
21
|
-
from .runtime import evaluate_expression, execute_script
|
|
22
|
-
else:
|
|
23
|
-
from .runtime import evaluate_expression, execute_script
|
|
24
17
|
|
|
25
18
|
|
|
26
19
|
def main(argv=None):
|
|
@@ -33,6 +26,7 @@ def main(argv=None):
|
|
|
33
26
|
if sys.version_info >= (3, 14): # pragma: no cover
|
|
34
27
|
argument_parser_args['color'] = False
|
|
35
28
|
parser = argparse.ArgumentParser(**argument_parser_args)
|
|
29
|
+
parser.set_defaults(scripts=[])
|
|
36
30
|
parser.add_argument('file', nargs='*', action=_FileScriptAction, help='files to process')
|
|
37
31
|
parser.add_argument('-c', '--code', action=_InlineScriptAction, help='execute the BareScript code')
|
|
38
32
|
parser.add_argument('-d', '--debug', action='store_true', help='enable debug mode')
|
|
@@ -159,13 +153,9 @@ def main(argv=None):
|
|
|
159
153
|
|
|
160
154
|
class _InlineScriptAction(argparse.Action):
|
|
161
155
|
def __call__(self, parser, namespace, values, option_string=None):
|
|
162
|
-
if 'scripts' not in namespace:
|
|
163
|
-
setattr(namespace, 'scripts', [])
|
|
164
156
|
namespace.scripts.append(('code', values))
|
|
165
157
|
|
|
166
158
|
|
|
167
159
|
class _FileScriptAction(argparse.Action):
|
|
168
160
|
def __call__(self, parser, namespace, values, option_string=None):
|
|
169
|
-
if 'scripts' not in namespace:
|
|
170
|
-
setattr(namespace, 'scripts', [])
|
|
171
161
|
namespace.scripts.extend(('file', value) for value in values)
|
|
@@ -5,15 +5,7 @@
|
|
|
5
5
|
Include library script globals and native stub functions
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
if not os.environ.get('BARESCRIPT_RUNTIME_PY'): # pragma: no cover
|
|
11
|
-
try:
|
|
12
|
-
from .runtime_c import execute_script
|
|
13
|
-
except ImportError:
|
|
14
|
-
from .runtime import execute_script
|
|
15
|
-
else:
|
|
16
|
-
from .runtime import execute_script
|
|
8
|
+
from . import execute_script
|
|
17
9
|
|
|
18
10
|
|
|
19
11
|
# The include library script globals - execute the include library script
|