yamlstar 0.1.7__py3-none-win_amd64.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.
yamlstar/__init__.py
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Copyright 2024 yaml.org
|
|
2
|
+
# MIT License
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Python binding/API for the libyamlstar shared library.
|
|
6
|
+
|
|
7
|
+
This module provides a Python interface to YAMLStar, a pure YAML 1.2 loader.
|
|
8
|
+
The YAMLStar class has methods for loading YAML documents and converting
|
|
9
|
+
them to Python objects.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# Version matching the yamlstar shared library
|
|
13
|
+
yamlstar_version = '0.1.7'
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
import sys
|
|
17
|
+
import ctypes
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
# Require Python 3.6 or greater:
|
|
21
|
+
assert sys.version_info >= (3, 6), \
|
|
22
|
+
"Python 3.6 or greater required for 'yamlstar'."
|
|
23
|
+
|
|
24
|
+
def find_libyamlstar():
|
|
25
|
+
"""Find libyamlstar shared library. Returns (path, backend)."""
|
|
26
|
+
if sys.platform == 'linux':
|
|
27
|
+
so = 'so'
|
|
28
|
+
elif sys.platform == 'darwin':
|
|
29
|
+
so = 'dylib'
|
|
30
|
+
elif sys.platform == 'win32':
|
|
31
|
+
so = 'dll'
|
|
32
|
+
else:
|
|
33
|
+
raise Exception(
|
|
34
|
+
"Unsupported platform '%s' for yamlstar." % sys.platform)
|
|
35
|
+
|
|
36
|
+
# Use the platform library path, plus package and common install locations.
|
|
37
|
+
if sys.platform == 'win32':
|
|
38
|
+
library_path = os.environ.get('PATH')
|
|
39
|
+
library_paths = library_path.split(';') if library_path else []
|
|
40
|
+
else:
|
|
41
|
+
library_path = os.environ.get('LD_LIBRARY_PATH')
|
|
42
|
+
library_paths = library_path.split(':') if library_path else []
|
|
43
|
+
library_paths.append(
|
|
44
|
+
os.path.join(os.path.dirname(__file__), 'libyamlstar'))
|
|
45
|
+
if sys.platform != 'win32':
|
|
46
|
+
library_paths.append('/usr/local/lib')
|
|
47
|
+
home = os.environ.get('HOME') or os.path.expanduser('~')
|
|
48
|
+
if home:
|
|
49
|
+
library_paths.append(os.path.join(home, '.local', 'lib'))
|
|
50
|
+
|
|
51
|
+
# Also check relative to this file (for development)
|
|
52
|
+
lib_path = os.path.join(
|
|
53
|
+
os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
|
|
54
|
+
'..', 'libyamlstar', 'lib')
|
|
55
|
+
library_paths.insert(0, os.path.abspath(lib_path))
|
|
56
|
+
|
|
57
|
+
if os.environ.get('YAMLSTAR_GLOJURE'):
|
|
58
|
+
lib_name, backend = 'libyamlstarglj', 'gloat'
|
|
59
|
+
else:
|
|
60
|
+
lib_name, backend = 'libyamlstar', 'graalvm'
|
|
61
|
+
|
|
62
|
+
filename = "%s.%s" % (lib_name, so)
|
|
63
|
+
for path in library_paths:
|
|
64
|
+
full_path = os.path.join(path, filename)
|
|
65
|
+
if os.path.isfile(full_path):
|
|
66
|
+
return full_path, backend
|
|
67
|
+
|
|
68
|
+
raise Exception(
|
|
69
|
+
"""\
|
|
70
|
+
Shared library file '%s' not found
|
|
71
|
+
Search paths: %s
|
|
72
|
+
Build with: cd libyamlstar && make build
|
|
73
|
+
""" % (filename, os.pathsep.join(library_paths)))
|
|
74
|
+
|
|
75
|
+
# Load libyamlstar shared library and detect backend:
|
|
76
|
+
_libyamlstar_path, _backend = find_libyamlstar()
|
|
77
|
+
libyamlstar = ctypes.CDLL(_libyamlstar_path)
|
|
78
|
+
|
|
79
|
+
# Create bindings to library functions (signatures differ by backend):
|
|
80
|
+
if _backend == 'gloat':
|
|
81
|
+
# Gloat: functions take (yaml_bytes, opts_bytes) -> json_bytes
|
|
82
|
+
yamlstar_load_fn = libyamlstar.yamlstar_load
|
|
83
|
+
yamlstar_load_fn.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
|
|
84
|
+
yamlstar_load_fn.restype = ctypes.c_char_p
|
|
85
|
+
|
|
86
|
+
yamlstar_load_all_fn = libyamlstar.yamlstar_load_all
|
|
87
|
+
yamlstar_load_all_fn.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
|
|
88
|
+
yamlstar_load_all_fn.restype = ctypes.c_char_p
|
|
89
|
+
|
|
90
|
+
yamlstar_version_fn = libyamlstar.yamlstar_version
|
|
91
|
+
yamlstar_version_fn.argtypes = []
|
|
92
|
+
yamlstar_version_fn.restype = ctypes.c_char_p
|
|
93
|
+
|
|
94
|
+
else:
|
|
95
|
+
# GraalVM: functions take (isolatethread, yaml_bytes) -> json_bytes
|
|
96
|
+
yamlstar_load_fn = libyamlstar.yamlstar_load
|
|
97
|
+
yamlstar_load_fn.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
|
|
98
|
+
yamlstar_load_fn.restype = ctypes.c_char_p
|
|
99
|
+
|
|
100
|
+
yamlstar_load_all_fn = libyamlstar.yamlstar_load_all
|
|
101
|
+
yamlstar_load_all_fn.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
|
|
102
|
+
yamlstar_load_all_fn.restype = ctypes.c_char_p
|
|
103
|
+
|
|
104
|
+
yamlstar_version_fn = libyamlstar.yamlstar_version
|
|
105
|
+
yamlstar_version_fn.argtypes = [ctypes.c_void_p]
|
|
106
|
+
yamlstar_version_fn.restype = ctypes.c_char_p
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# The YAMLStar class is the main user facing API for this module.
|
|
110
|
+
class YAMLStar():
|
|
111
|
+
"""
|
|
112
|
+
Interface with the libyamlstar shared library.
|
|
113
|
+
|
|
114
|
+
Usage:
|
|
115
|
+
import yamlstar
|
|
116
|
+
ys = yamlstar.YAMLStar()
|
|
117
|
+
data = ys.load("key: value")
|
|
118
|
+
# Returns: {'key': 'value'}
|
|
119
|
+
|
|
120
|
+
docs = ys.load_all("---\\ndoc1\\n---\\ndoc2")
|
|
121
|
+
# Returns: ['doc1', 'doc2']
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
def __init__(self):
|
|
125
|
+
if _backend == 'graalvm':
|
|
126
|
+
# Create a new GraalVM isolate thread for the life of this instance:
|
|
127
|
+
self._isolatethread = ctypes.c_void_p()
|
|
128
|
+
rc = libyamlstar.graal_create_isolate(
|
|
129
|
+
None,
|
|
130
|
+
None,
|
|
131
|
+
ctypes.byref(self._isolatethread),
|
|
132
|
+
)
|
|
133
|
+
if rc != 0:
|
|
134
|
+
raise Exception("Failed to create GraalVM isolate")
|
|
135
|
+
|
|
136
|
+
# Load a single YAML document and return the result:
|
|
137
|
+
def load(self, yaml_input):
|
|
138
|
+
"""
|
|
139
|
+
Load a single YAML document.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
yaml_input: String containing YAML content
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
Python object representing the YAML document
|
|
146
|
+
|
|
147
|
+
Raises:
|
|
148
|
+
Exception if the YAML is malformed
|
|
149
|
+
"""
|
|
150
|
+
self.error = None
|
|
151
|
+
yaml_bytes = ctypes.c_char_p(bytes(yaml_input, "utf8"))
|
|
152
|
+
|
|
153
|
+
if _backend == 'gloat':
|
|
154
|
+
data_json = yamlstar_load_fn(yaml_bytes, ctypes.c_char_p(b"{}")).decode()
|
|
155
|
+
else:
|
|
156
|
+
data_json = yamlstar_load_fn(self._isolatethread, yaml_bytes).decode()
|
|
157
|
+
|
|
158
|
+
resp = json.loads(data_json)
|
|
159
|
+
self.error = resp.get('error')
|
|
160
|
+
if self.error:
|
|
161
|
+
raise Exception(self.error['cause'])
|
|
162
|
+
if 'data' not in resp:
|
|
163
|
+
raise Exception("Unexpected response from 'libyamlstar'")
|
|
164
|
+
return resp.get('data')
|
|
165
|
+
|
|
166
|
+
# Load all YAML documents and return the results:
|
|
167
|
+
def load_all(self, yaml_input):
|
|
168
|
+
"""
|
|
169
|
+
Load all YAML documents from a multi-document string.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
yaml_input: String containing one or more YAML documents
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
List of Python objects, one per YAML document
|
|
176
|
+
|
|
177
|
+
Raises:
|
|
178
|
+
Exception if the YAML is malformed
|
|
179
|
+
"""
|
|
180
|
+
self.error = None
|
|
181
|
+
yaml_bytes = ctypes.c_char_p(bytes(yaml_input, "utf8"))
|
|
182
|
+
|
|
183
|
+
if _backend == 'gloat':
|
|
184
|
+
data_json = \
|
|
185
|
+
yamlstar_load_all_fn(yaml_bytes, ctypes.c_char_p(b"{}")).decode()
|
|
186
|
+
else:
|
|
187
|
+
data_json = \
|
|
188
|
+
yamlstar_load_all_fn(self._isolatethread, yaml_bytes).decode()
|
|
189
|
+
|
|
190
|
+
resp = json.loads(data_json)
|
|
191
|
+
self.error = resp.get('error')
|
|
192
|
+
if self.error:
|
|
193
|
+
raise Exception(self.error['cause'])
|
|
194
|
+
if 'data' not in resp:
|
|
195
|
+
raise Exception("Unexpected response from 'libyamlstar'")
|
|
196
|
+
return resp.get('data')
|
|
197
|
+
|
|
198
|
+
# Get the YAMLStar version:
|
|
199
|
+
def version(self):
|
|
200
|
+
"""
|
|
201
|
+
Get the YAMLStar version string.
|
|
202
|
+
|
|
203
|
+
Returns:
|
|
204
|
+
Version string
|
|
205
|
+
"""
|
|
206
|
+
if _backend == 'gloat':
|
|
207
|
+
return yamlstar_version_fn().decode()
|
|
208
|
+
else:
|
|
209
|
+
return yamlstar_version_fn(self._isolatethread).decode()
|
|
210
|
+
|
|
211
|
+
def __del__(self):
|
|
212
|
+
if _backend == 'graalvm' and hasattr(self, '_isolatethread'):
|
|
213
|
+
rc = libyamlstar.graal_tear_down_isolate(self._isolatethread)
|
|
214
|
+
if rc != 0:
|
|
215
|
+
raise Exception("Failed to tear down GraalVM isolate")
|
|
Binary file
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yamlstar
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Python bindings for YAMLStar - YAML 1.2 loader
|
|
5
|
+
Home-page: https://github.com/yaml/yamlstar
|
|
6
|
+
Author: Ingy döt Net
|
|
7
|
+
Author-email: ingy@ingy.net
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Requires-Python: >=3.6, <4
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: License
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: author-email
|
|
26
|
+
Dynamic: classifier
|
|
27
|
+
Dynamic: description
|
|
28
|
+
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: license
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
34
|
+
|
|
35
|
+
# YAMLStar Python Bindings
|
|
36
|
+
|
|
37
|
+
Python bindings for YAMLStar - a pure YAML 1.2 loader implemented in Clojure.
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **YAML 1.2 Spec Compliance**: 100% compliant with YAML 1.2 core schema
|
|
42
|
+
- **Pure Implementation**: No dependencies on SnakeYAML or other external parsers
|
|
43
|
+
- **Fast Native Performance**: Uses GraalVM native-image shared library
|
|
44
|
+
- **Simple API**: Load YAML documents with a single function call
|
|
45
|
+
- **Multi-Document Support**: Load multiple YAML documents from a single string
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### Prerequisites
|
|
50
|
+
|
|
51
|
+
First, build and install the shared library:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cd ../libyamlstar
|
|
55
|
+
make native
|
|
56
|
+
sudo make install PREFIX=/usr/local
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or install to user-local directory:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cd ../libyamlstar
|
|
63
|
+
make native
|
|
64
|
+
make install PREFIX=~/.local
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Install Python Package
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For development:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install -e .
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import yamlstar
|
|
83
|
+
|
|
84
|
+
# Create a YAMLStar instance
|
|
85
|
+
ys = yamlstar.YAMLStar()
|
|
86
|
+
|
|
87
|
+
# Load a simple YAML string
|
|
88
|
+
data = ys.load("key: value")
|
|
89
|
+
print(data) # {'key': 'value'}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Usage Examples
|
|
93
|
+
|
|
94
|
+
### Basic Types
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
import yamlstar
|
|
98
|
+
|
|
99
|
+
ys = yamlstar.YAMLStar()
|
|
100
|
+
|
|
101
|
+
# Strings
|
|
102
|
+
ys.load("hello") # 'hello'
|
|
103
|
+
|
|
104
|
+
# Integers
|
|
105
|
+
ys.load("42") # 42
|
|
106
|
+
|
|
107
|
+
# Floats
|
|
108
|
+
ys.load("3.14") # 3.14
|
|
109
|
+
|
|
110
|
+
# Booleans
|
|
111
|
+
ys.load("true") # True
|
|
112
|
+
ys.load("false") # False
|
|
113
|
+
|
|
114
|
+
# Null
|
|
115
|
+
ys.load("null") # None
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Collections
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
# Mappings (dictionaries)
|
|
122
|
+
data = ys.load("""
|
|
123
|
+
name: Alice
|
|
124
|
+
age: 30
|
|
125
|
+
city: Seattle
|
|
126
|
+
""")
|
|
127
|
+
# {'name': 'Alice', 'age': 30, 'city': 'Seattle'}
|
|
128
|
+
|
|
129
|
+
# Sequences (lists)
|
|
130
|
+
data = ys.load("""
|
|
131
|
+
- apple
|
|
132
|
+
- banana
|
|
133
|
+
- orange
|
|
134
|
+
""")
|
|
135
|
+
# ['apple', 'banana', 'orange']
|
|
136
|
+
|
|
137
|
+
# Flow style
|
|
138
|
+
data = ys.load("[a, b, c]")
|
|
139
|
+
# ['a', 'b', 'c']
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Nested Structures
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
data = ys.load("""
|
|
146
|
+
person:
|
|
147
|
+
name: Alice
|
|
148
|
+
age: 30
|
|
149
|
+
hobbies:
|
|
150
|
+
- reading
|
|
151
|
+
- coding
|
|
152
|
+
- hiking
|
|
153
|
+
""")
|
|
154
|
+
# {
|
|
155
|
+
# 'person': {
|
|
156
|
+
# 'name': 'Alice',
|
|
157
|
+
# 'age': 30,
|
|
158
|
+
# 'hobbies': ['reading', 'coding', 'hiking']
|
|
159
|
+
# }
|
|
160
|
+
# }
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Multi-Document YAML
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
# Load all documents from a multi-document YAML string
|
|
167
|
+
docs = ys.load_all("""---
|
|
168
|
+
name: Document 1
|
|
169
|
+
---
|
|
170
|
+
name: Document 2
|
|
171
|
+
---
|
|
172
|
+
name: Document 3
|
|
173
|
+
""")
|
|
174
|
+
# [
|
|
175
|
+
# {'name': 'Document 1'},
|
|
176
|
+
# {'name': 'Document 2'},
|
|
177
|
+
# {'name': 'Document 3'}
|
|
178
|
+
# ]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Type Coercion
|
|
182
|
+
|
|
183
|
+
YAMLStar follows YAML 1.2 core schema type inference:
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
data = ys.load("""
|
|
187
|
+
string: hello
|
|
188
|
+
integer: 42
|
|
189
|
+
float: 3.14
|
|
190
|
+
bool_true: true
|
|
191
|
+
bool_false: false
|
|
192
|
+
null_value: null
|
|
193
|
+
""")
|
|
194
|
+
# {
|
|
195
|
+
# 'string': 'hello',
|
|
196
|
+
# 'integer': 42,
|
|
197
|
+
# 'float': 3.14,
|
|
198
|
+
# 'bool_true': True,
|
|
199
|
+
# 'bool_false': False,
|
|
200
|
+
# 'null_value': None
|
|
201
|
+
# }
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Error Handling
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
try:
|
|
208
|
+
data = ys.load("invalid: yaml: syntax")
|
|
209
|
+
except Exception as e:
|
|
210
|
+
print(f"Error loading YAML: {e}")
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Version Information
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
# Get YAMLStar version
|
|
217
|
+
version = ys.version()
|
|
218
|
+
print(f"YAMLStar version: {version}")
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## API Reference
|
|
222
|
+
|
|
223
|
+
### `YAMLStar` Class
|
|
224
|
+
|
|
225
|
+
#### `__init__()`
|
|
226
|
+
Create a new YAMLStar instance. Each instance maintains its own GraalVM isolate.
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
ys = yamlstar.YAMLStar()
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### `load(yaml_input)`
|
|
233
|
+
Load a single YAML document.
|
|
234
|
+
|
|
235
|
+
**Parameters:**
|
|
236
|
+
- `yaml_input` (str): String containing YAML content
|
|
237
|
+
|
|
238
|
+
**Returns:**
|
|
239
|
+
- Python object representing the YAML document (dict, list, str, int, float, bool, or None)
|
|
240
|
+
|
|
241
|
+
**Raises:**
|
|
242
|
+
- `Exception` if the YAML is malformed
|
|
243
|
+
|
|
244
|
+
**Example:**
|
|
245
|
+
```python
|
|
246
|
+
data = ys.load("key: value")
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### `load_all(yaml_input)`
|
|
250
|
+
Load all YAML documents from a multi-document string.
|
|
251
|
+
|
|
252
|
+
**Parameters:**
|
|
253
|
+
- `yaml_input` (str): String containing one or more YAML documents
|
|
254
|
+
|
|
255
|
+
**Returns:**
|
|
256
|
+
- List of Python objects, one per YAML document
|
|
257
|
+
|
|
258
|
+
**Raises:**
|
|
259
|
+
- `Exception` if the YAML is malformed
|
|
260
|
+
|
|
261
|
+
**Example:**
|
|
262
|
+
```python
|
|
263
|
+
docs = ys.load_all("---\ndoc1\n---\ndoc2")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### `version()`
|
|
267
|
+
Get the YAMLStar version string.
|
|
268
|
+
|
|
269
|
+
**Returns:**
|
|
270
|
+
- str: Version string
|
|
271
|
+
|
|
272
|
+
**Example:**
|
|
273
|
+
```python
|
|
274
|
+
version = ys.version()
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Development
|
|
278
|
+
|
|
279
|
+
### Running Tests
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Run all tests
|
|
283
|
+
make test
|
|
284
|
+
|
|
285
|
+
# Run only pytest tests
|
|
286
|
+
make test-pytest
|
|
287
|
+
|
|
288
|
+
# Run only FFI tests
|
|
289
|
+
make test-ffi
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Building Distribution
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Build source distribution
|
|
296
|
+
make dist
|
|
297
|
+
|
|
298
|
+
# Build and install in development mode
|
|
299
|
+
make install
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Requirements
|
|
303
|
+
|
|
304
|
+
- **Python**: 3.6 or higher
|
|
305
|
+
- **libyamlstar**: Shared library (installed separately)
|
|
306
|
+
- **System**: Linux or macOS
|
|
307
|
+
|
|
308
|
+
## Library Search Path
|
|
309
|
+
|
|
310
|
+
The package searches for `libyamlstar.so` (or `.dylib` on macOS) in:
|
|
311
|
+
|
|
312
|
+
1. Development path (relative to package)
|
|
313
|
+
2. Directories in `LD_LIBRARY_PATH` environment variable
|
|
314
|
+
3. `/usr/local/lib` (default install location)
|
|
315
|
+
4. `~/.local/lib` (user-local install location)
|
|
316
|
+
|
|
317
|
+
## Comparison to PyYAML
|
|
318
|
+
|
|
319
|
+
| Feature | YAMLStar | PyYAML |
|
|
320
|
+
|---------|----------|--------|
|
|
321
|
+
| YAML Version | 1.2 | 1.1 |
|
|
322
|
+
| Implementation | Pure Clojure | C + Python |
|
|
323
|
+
| Type Inference | YAML 1.2 core schema | YAML 1.1 + custom |
|
|
324
|
+
| Native Performance | Yes (GraalVM) | Yes (C extension) |
|
|
325
|
+
| Dependencies | libyamlstar.so | None |
|
|
326
|
+
|
|
327
|
+
## License
|
|
328
|
+
|
|
329
|
+
MIT License - See [License](License) file
|
|
330
|
+
|
|
331
|
+
## Credits
|
|
332
|
+
|
|
333
|
+
Created by Ingy döt Net, inventor of YAML.
|
|
334
|
+
|
|
335
|
+
YAMLStar is built on the YAML Reference Parser (pure Clojure implementation).
|
|
336
|
+
|
|
337
|
+
## Links
|
|
338
|
+
|
|
339
|
+
- **GitHub**: https://github.com/yaml/yamlstar
|
|
340
|
+
- **YAML Specification**: https://yaml.org/spec/1.2/spec.html
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
yamlstar/__init__.py,sha256=EPM3z5ags82yy6tVHVvD13JOh1Z0fPj2WVVXL8LicXI,6779
|
|
2
|
+
yamlstar/libyamlstar/libyamlstar.dll,sha256=fYId0oOi06QgfJaIM3F4_g4unA2hMZTXNsyYicsqv1Y,28422144
|
|
3
|
+
yamlstar-0.1.7.dist-info/licenses/License,sha256=nsvXzFX7z_XslsE0ha08FgKK6e3GjjJYDNFjTZOCQs4,1091
|
|
4
|
+
yamlstar-0.1.7.dist-info/METADATA,sha256=4fIDiQIOPXTcefixRHspDxjEPFEO9KXl3sPhsDIS4rM,6639
|
|
5
|
+
yamlstar-0.1.7.dist-info/WHEEL,sha256=QR8DNjG6Lr6bNErJWJgF4dP2dJ2N7NpY-BWly1OvcTM,97
|
|
6
|
+
yamlstar-0.1.7.dist-info/top_level.txt,sha256=cior1pgLvANIQ6HE_xAofUnhWLpPGeZtkp8_1JY_JRc,9
|
|
7
|
+
yamlstar-0.1.7.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 yaml.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
yamlstar
|