-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
82 lines (70 loc) · 2.02 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
'''
# ckdl - KDL reading and writing using a C backend
**ckdl** is a C library that implements reading and writing a the
[KDL Document Language](https://kdl.dev/).
This package lets Python programs read and write KDL (both version 2.0.0 and
version 1.0.0) files, using *ckdl* as a back-end.
Install with
pip install ckdl
## Examples
### Reading
```pycon
>>> import ckdl
>>> kdl_txt = """
... best-primes 2 3 5 7
... colours importance=(%)1000 { green; blue shade=синий; blue shade=голубой; violet }
... """
>>> doc = ckdl.parse(kdl_txt)
>>> doc
<Document; 2 nodes>
>>> doc[0]
<Node best-primes; 4 args>
>>> doc[0].args
[2, 3, 5, 7]
>>> doc[1].properties
{'importance': <Value (%)1000>}
>>> doc[1].properties['importance'].value
1000
>>> doc[1].properties['importance'].type_annotation
'%'
>>> doc[1].children
[<Node green>, <Node blue; 1 property>, <Node blue; 1 property>, <Node violet>]
>>> doc[1].children[1].properties['shade']
'синий'
```
### Writing
```pycon
>>> mydoc = ckdl.Document(ckdl.Node("best-primes", 7, 11, 13), ckdl.Node("worst-values", ckdl.Value("scary", None)))
>>> print(str(mydoc))
best-primes 7 11 13
worst-values (scary)#null
```
'''
from skbuild import setup
setup(
name="ckdl",
version="1.0",
description="KDL parser and writer with a C back-end",
long_description=__doc__,
long_description_content_type="text/markdown",
author="Thomas Jollans",
url="https://github.com/tjol/ckdl",
project_urls={
"Documentation": "https://ckdl.readthedocs.io/"
},
keywords="kdl parser configuration",
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3"
],
package_dir={"": "bindings/python/src"},
packages=["ckdl"],
cmake_args=[
"-DBUILD_TESTS:BOOL=OFF",
"-DBUILD_KDLPP:BOOL=OFF",
"-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON",
],
cmake_install_target="install-ckdl-py",
)