yamlscript 0.1.66__tar.gz → 0.1.67__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yamlscript
3
- Version: 0.1.66
3
+ Version: 0.1.67
4
4
  Summary: Program in YAML
5
5
  Home-page: https://github.com/ingydotnet/yamlscript
6
6
  Author: Ingy döt Net
@@ -13,24 +13,30 @@ Load `file.yaml` with YAMLScript:
13
13
  !yamlscript/v0/
14
14
 
15
15
  =>:
16
- names =: curl(
17
- "https://raw.githubusercontent.com/dominictarr/" +
18
- "random-name/master/first-names.json")
19
- .json/load()
20
-
21
- name:: names.rand-nth()
22
- aka:: names.rand-nth()
23
- age:: 6 * 7
24
- color: yellow
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)."
25
30
  ```
26
31
 
27
32
  and get:
28
33
  ```json
29
34
  {
30
- "name": "Anthea",
31
- "aka": "Patrizia",
35
+ "name": "Dolores",
36
+ "aka": "Anita",
32
37
  "age": 42,
33
- "color": "yellow"
38
+ "color": "green",
39
+ "title": "42 shades of green."
34
40
  }
35
41
  ```
36
42
 
@@ -43,7 +49,7 @@ clean YAML syntax.
43
49
  YAMLScript can be used for enhancing ordinary [YAML](https://yaml.org) files
44
50
  with functional operations, such as:
45
51
 
46
- * Import parts of other YAML files to any node
52
+ * Import (parts of) other YAML files to any node
47
53
  * String interpolation including function calls
48
54
  * Data transforms including ones defined by you
49
55
 
@@ -64,18 +70,19 @@ YAMLScript is compiled to a native shared library (`libyamlscript.so`) that can
64
70
  be used by any programming language that can load shared libraries.
65
71
 
66
72
  To see the Clojure code that YAMLScript compiles to, you can use the YAMLScript
67
- CLI binary, `ys`, to run:
73
+ CLI binary `ys` to run:
68
74
 
69
75
  ```text
70
76
  $ ys --compile file.ys
71
- (def names
72
- (_-> (curl (+_ "https://raw.githubusercontent.com/dominictarr/"
73
- "random-name/master/first-names.json"))
74
- (list json/load)))
75
- {"age" (*_ 6 7),
76
- "aka" (_-> names (list rand-nth)),
77
- "color" "yellow",
78
- "name" (_-> names (list rand-nth))}
77
+ (def names-url
78
+ (+_ "https://raw.githubusercontent.com/dominictarr/"
79
+ "random-name/master/first-names.json"))
80
+ (def name-list (_& 'first-names (json/load (curl names-url))))
81
+ {"age" (_& 'num (*_ 2 3 7)),
82
+ "aka" (_-> name-list (list rand-nth)),
83
+ "color" (_& 'hue (_-> (qw red green blue yellow) (list shuffle) (list first))),
84
+ "name" (rand-nth (_** 'first-names)),
85
+ "title" (str (_** 'num) " shades of " (_** 'hue) ".")}
79
86
  ```
80
87
 
81
88
 
@@ -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.66'
19
+ yamlscript_version = '0.1.67'
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.66'
43
+ # eg 'libyamlscript.so.0.1.67'
44
44
  libyamlscript_name = \
45
45
  "libyamlscript.%s.%s" % (so, yamlscript_version)
46
46
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yamlscript
3
- Version: 0.1.66
3
+ Version: 0.1.67
4
4
  Summary: Program in YAML
5
5
  Home-page: https://github.com/ingydotnet/yamlscript
6
6
  Author: Ingy döt Net
@@ -1,4 +1,4 @@
1
- version = '0.1.66'
1
+ version = '0.1.67'
2
2
 
3
3
  from setuptools import setup
4
4
  import pathlib
File without changes
File without changes
File without changes