yamlscript 0.1.45__tar.gz → 0.1.88__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.
- {yamlscript-0.1.45/lib/yamlscript.egg-info → yamlscript-0.1.88}/PKG-INFO +2 -6
- {yamlscript-0.1.45 → yamlscript-0.1.88}/ReadMe.md +58 -23
- {yamlscript-0.1.45 → yamlscript-0.1.88}/lib/yamlscript/__init__.py +15 -8
- {yamlscript-0.1.45 → yamlscript-0.1.88/lib/yamlscript.egg-info}/PKG-INFO +2 -6
- {yamlscript-0.1.45 → yamlscript-0.1.88}/setup.py +2 -2
- {yamlscript-0.1.45 → yamlscript-0.1.88}/.long_description.md +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/MANIFEST.in +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/lib/yamlscript.egg-info/SOURCES.txt +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/lib/yamlscript.egg-info/dependency_links.txt +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/lib/yamlscript.egg-info/requires.txt +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/lib/yamlscript.egg-info/top_level.txt +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/setup.cfg +0 -0
- {yamlscript-0.1.45 → yamlscript-0.1.88}/test/test.py +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: yamlscript
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: Program in YAML
|
|
3
|
+
Version: 0.1.88
|
|
4
|
+
Summary: Program in YAML — Code is Data
|
|
5
5
|
Home-page: https://github.com/ingydotnet/yamlscript
|
|
6
6
|
Author: Ingy döt Net
|
|
7
7
|
Author-email: ingy@ingy.net
|
|
8
8
|
License: MIT
|
|
9
9
|
Keywords: yaml,language
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Development Status :: 3 - Alpha
|
|
12
11
|
Classifier: Intended Audience :: Developers
|
|
13
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -19,6 +18,3 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
19
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
19
|
Requires-Python: >=3.6, <4
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
|
-
|
|
23
|
-
UNKNOWN
|
|
24
|
-
|
|
@@ -1,37 +1,60 @@
|
|
|
1
|
+
<!-- DO NOT EDIT — THIS FILE WAS GENERATED -->
|
|
2
|
+
|
|
1
3
|
YAMLScript
|
|
2
4
|
==========
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
Add Logic to Your YAML Files
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
## Synopsis
|
|
8
10
|
|
|
11
|
+
Load `file.yaml` with YAMLScript:
|
|
9
12
|
```yaml
|
|
10
|
-
|
|
13
|
+
!yamlscript/v0:
|
|
14
|
+
|
|
15
|
+
# Get data from external sources:
|
|
16
|
+
names-url =:
|
|
17
|
+
"https://raw.githubusercontent.com/dominictarr/\
|
|
18
|
+
random-name/master/first-names.json"
|
|
19
|
+
|
|
20
|
+
name-list =: &first-names json/load(curl(names-url))
|
|
21
|
+
|
|
22
|
+
# Data object with literal keys and generated values:
|
|
23
|
+
name:: rand-nth(*first-names)
|
|
24
|
+
aka:: name-list.rand-nth()
|
|
25
|
+
age:: &num 2 * 3 * 7
|
|
26
|
+
color:: &hue qw(red green blue yellow)
|
|
27
|
+
.shuffle()
|
|
28
|
+
.first()
|
|
29
|
+
title:: "$(*num) shades of $(*hue)."
|
|
30
|
+
```
|
|
11
31
|
|
|
12
|
-
|
|
13
|
-
|
|
32
|
+
and get:
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"name": "Dolores",
|
|
36
|
+
"aka": "Anita",
|
|
37
|
+
"age": 42,
|
|
38
|
+
"color": "green",
|
|
39
|
+
"title": "42 shades of green."
|
|
40
|
+
}
|
|
14
41
|
```
|
|
15
42
|
|
|
16
43
|
|
|
17
44
|
## Description
|
|
18
45
|
|
|
19
|
-
YAMLScript is a functional programming language with a
|
|
46
|
+
[YAMLScript](https://yamlscript.org) is a functional programming language with a
|
|
47
|
+
clean YAML syntax.
|
|
20
48
|
|
|
21
|
-
YAMLScript can be used for
|
|
49
|
+
YAMLScript can be used for enhancing ordinary [YAML](https://yaml.org) files
|
|
50
|
+
with functional operations, such as:
|
|
22
51
|
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* Enhancing ordinary YAML files with new functional magics
|
|
27
|
-
* Import parts of other YAML files to any node
|
|
28
|
-
* String interpolation including function calls
|
|
29
|
-
* Any other functionality you can dream up!
|
|
30
|
-
* Writing reusable shared libraries
|
|
31
|
-
* High level code instead of C
|
|
32
|
-
* Bindable to almost any programming language
|
|
52
|
+
* Import (parts of) other YAML files to any node
|
|
53
|
+
* String interpolation including function calls
|
|
54
|
+
* Data transforms including ones defined by you
|
|
33
55
|
|
|
34
|
-
YAMLScript should be a drop-in replacement for your YAML
|
|
56
|
+
This YAMLScript library should be a drop-in replacement for your current YAML
|
|
57
|
+
loader!
|
|
35
58
|
|
|
36
59
|
Most existing YAML files are already valid YAMLScript files.
|
|
37
60
|
This means that YAMLScript works as a normal YAML loader, but can also evaluate
|
|
@@ -47,10 +70,19 @@ YAMLScript is compiled to a native shared library (`libyamlscript.so`) that can
|
|
|
47
70
|
be used by any programming language that can load shared libraries.
|
|
48
71
|
|
|
49
72
|
To see the Clojure code that YAMLScript compiles to, you can use the YAMLScript
|
|
50
|
-
|
|
73
|
+
CLI binary `ys` to run:
|
|
51
74
|
|
|
52
75
|
```text
|
|
53
76
|
$ ys --compile file.ys
|
|
77
|
+
(let
|
|
78
|
+
[names-url "https://raw.githubusercontent.com/dominictarr/random-name/master/first-names.json"
|
|
79
|
+
name-list (_& 'first-names (json/load (curl names-url)))]
|
|
80
|
+
(%
|
|
81
|
+
"name" (rand-nth (_** 'first-names))
|
|
82
|
+
"aka" (rand-nth name-list)
|
|
83
|
+
"age" (_& 'num (mul+ 2 3 7))
|
|
84
|
+
"color" (_& 'hue (first (shuffle (qw red green blue yellow))))
|
|
85
|
+
"title" (str (_** 'num) " shades of " (_** 'hue) ".")))
|
|
54
86
|
```
|
|
55
87
|
|
|
56
88
|
|
|
@@ -106,7 +138,7 @@ but you will need to have a system install of `libyamlscript.so`.
|
|
|
106
138
|
One simple way to do that is with:
|
|
107
139
|
|
|
108
140
|
```bash
|
|
109
|
-
$ curl
|
|
141
|
+
$ curl https://yamlscript.org/install | bash
|
|
110
142
|
```
|
|
111
143
|
|
|
112
144
|
> Note: The above command will install the latest version of the YAMLScript
|
|
@@ -118,21 +150,24 @@ See https://github.com/yaml/yamlscript?#installing-yamlscript for more info.
|
|
|
118
150
|
|
|
119
151
|
## See Also
|
|
120
152
|
|
|
121
|
-
* [
|
|
122
|
-
* [
|
|
123
|
-
* [
|
|
153
|
+
* [YAMLScript Web Site](https://yamlscript.org)
|
|
154
|
+
* [YAMLScript Blog](https://yamlscript.org/blog)
|
|
155
|
+
* [YAMLScript Source Code](https://github.com/yaml/yamlscript)
|
|
156
|
+
* [YAMLScript Samples](https://github.com/yaml/yamlscript/tree/main/sample)
|
|
157
|
+
* [YAMLScript Programs](https://rosettacode.org/wiki/Category:YAMLScript)
|
|
124
158
|
* [YAML](https://yaml.org)
|
|
125
159
|
* [Clojure](https://clojure.org)
|
|
126
160
|
|
|
127
161
|
|
|
128
162
|
## Authors
|
|
129
163
|
|
|
164
|
+
|
|
130
165
|
* [Ingy döt Net](https://github.com/ingydotnet)
|
|
131
166
|
|
|
132
167
|
|
|
133
168
|
## License & Copyright
|
|
134
169
|
|
|
135
|
-
Copyright 2022-
|
|
170
|
+
Copyright 2022-2025 Ingy döt Net <ingy@ingy.net>
|
|
136
171
|
|
|
137
172
|
This project is licensed under the terms of the `MIT` license.
|
|
138
173
|
See [LICENSE](https://github.com/yaml/yamlscript/blob/main/License) for
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2023-
|
|
1
|
+
# Copyright 2023-2025 Ingy dot Net
|
|
2
2
|
# This code is licensed under MIT license (See License for details)
|
|
3
3
|
|
|
4
4
|
"""
|
|
@@ -16,7 +16,7 @@ object that the YAMLScript code evaluates to.
|
|
|
16
16
|
# This value is automatically updated by 'make bump'.
|
|
17
17
|
# The version number is used to find the correct shared library file.
|
|
18
18
|
# We currently only support binding to an exact version of libyamlscript.
|
|
19
|
-
yamlscript_version = '0.1.
|
|
19
|
+
yamlscript_version = '0.1.88'
|
|
20
20
|
|
|
21
21
|
import os, sys
|
|
22
22
|
import ctypes
|
|
@@ -40,7 +40,7 @@ def find_libyamlscript_path():
|
|
|
40
40
|
"Unsupported platform '%s' for yamlscript." % sys.platform)
|
|
41
41
|
|
|
42
42
|
# We currently bind to an exact version of libyamlscript.
|
|
43
|
-
# eg 'libyamlscript.so.0.1.
|
|
43
|
+
# eg 'libyamlscript.so.0.1.88'
|
|
44
44
|
libyamlscript_name = \
|
|
45
45
|
"libyamlscript.%s.%s" % (so, yamlscript_version)
|
|
46
46
|
|
|
@@ -60,7 +60,11 @@ def find_libyamlscript_path():
|
|
|
60
60
|
|
|
61
61
|
if not libyamlscript_path:
|
|
62
62
|
raise Exception(
|
|
63
|
-
"
|
|
63
|
+
"""\
|
|
64
|
+
Shared library file '%s' not found
|
|
65
|
+
Try: curl https://yamlscript.org/install | VERSION=%s LIB=1 bash
|
|
66
|
+
See: https://github.com/yaml/yamlscript/wiki/Installing-YAMLScript
|
|
67
|
+
""" % (libyamlscript_name, yamlscript_version))
|
|
64
68
|
|
|
65
69
|
return libyamlscript_path
|
|
66
70
|
|
|
@@ -92,12 +96,15 @@ class YAMLScript():
|
|
|
92
96
|
self.isolatethread = ctypes.c_void_p()
|
|
93
97
|
|
|
94
98
|
# Create a new GraalVM isolate:
|
|
95
|
-
libyamlscript.graal_create_isolate(
|
|
99
|
+
rc = libyamlscript.graal_create_isolate(
|
|
96
100
|
None,
|
|
97
101
|
None,
|
|
98
102
|
ctypes.byref(self.isolatethread),
|
|
99
103
|
)
|
|
100
104
|
|
|
105
|
+
if rc != 0:
|
|
106
|
+
raise Exception("Failed to create isolate")
|
|
107
|
+
|
|
101
108
|
# Compile and eval a YAMLScript string and return the result:
|
|
102
109
|
def load(self, input):
|
|
103
110
|
# Reset any previous error:
|
|
@@ -128,6 +135,6 @@ class YAMLScript():
|
|
|
128
135
|
# YAMLScript instance destructor:
|
|
129
136
|
def __del__(self):
|
|
130
137
|
# Tear down the isolate thread to free resources:
|
|
131
|
-
|
|
132
|
-
if
|
|
133
|
-
raise Exception("Failed to tear down isolate
|
|
138
|
+
rc = libyamlscript.graal_tear_down_isolate(self.isolatethread)
|
|
139
|
+
if rc != 0:
|
|
140
|
+
raise Exception("Failed to tear down isolate")
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: yamlscript
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: Program in YAML
|
|
3
|
+
Version: 0.1.88
|
|
4
|
+
Summary: Program in YAML — Code is Data
|
|
5
5
|
Home-page: https://github.com/ingydotnet/yamlscript
|
|
6
6
|
Author: Ingy döt Net
|
|
7
7
|
Author-email: ingy@ingy.net
|
|
8
8
|
License: MIT
|
|
9
9
|
Keywords: yaml,language
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Development Status :: 3 - Alpha
|
|
12
11
|
Classifier: Intended Audience :: Developers
|
|
13
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -19,6 +18,3 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
19
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
19
|
Requires-Python: >=3.6, <4
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
|
-
|
|
23
|
-
UNKNOWN
|
|
24
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
version = '0.1.
|
|
1
|
+
version = '0.1.88'
|
|
2
2
|
|
|
3
3
|
from setuptools import setup
|
|
4
4
|
import pathlib
|
|
@@ -12,7 +12,7 @@ long_description = \
|
|
|
12
12
|
setup(
|
|
13
13
|
name = 'yamlscript',
|
|
14
14
|
version = version,
|
|
15
|
-
description = 'Program in YAML',
|
|
15
|
+
description = 'Program in YAML — Code is Data',
|
|
16
16
|
license = 'MIT',
|
|
17
17
|
url = 'https://github.com/ingydotnet/yamlscript',
|
|
18
18
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|