kubiks 0.1.1__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.
@@ -0,0 +1,34 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+
19
+ - name: Cache pip
20
+ uses: actions/cache@v4
21
+ with:
22
+ path: ~/.cache/pip
23
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
24
+ restore-keys: |
25
+ ${{ runner.os }}-pip-
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install pytest build
31
+ pip install -e .
32
+
33
+ - name: Run tests
34
+ run: python -m pytest -v
@@ -0,0 +1,31 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Build
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual envs
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+
21
+ # Testing
22
+ .pytest_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ # OS
27
+ .DS_Store
28
+ Thumbs.db
29
+
30
+ # UV
31
+ .python-version
kubiks-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.4
2
+ Name: kubiks
3
+ Version: 0.1.1
4
+ Summary: A simple library that allows you to work with .kbk files.
5
+ Project-URL: Homepage, https://github.com/KubikNoLego/Kubiks
6
+ Project-URL: Repository, https://github.com/KubikNoLego/Kubiks
7
+ Project-URL: Issues, https://github.com/KubikNoLego/Kubiks/issues
8
+ Author-email: KubikNoLego <originallikitun@gmail.com>
9
+ License: MIT
10
+ Keywords: configuration,interpreter,kbk,parser
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+
14
+ <p align="center">
15
+ <img src="logo.png" width="300"/>
16
+ </p>
17
+ <h4 align="center">A simple and human-readable configuration language for Python.</h4>
18
+
19
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
20
+
21
+ πŸ‡ΊπŸ‡Έ [**English**](README.en.md) | πŸ‡·πŸ‡Ί [Русский](README.ru.md)
22
+
23
+ # Introduction
24
+
25
+ **Kubiks** is a lightweight and human-readable configuration format for Python.
26
+
27
+ It was created as a more convenient alternative to JSON for situations where configuration files need to be edited manually. The syntax remains simple while supporting nested structures, lists, percentages, comments, and other useful features.
28
+
29
+ ### Features
30
+
31
+ * ✨ Clean and readable syntax
32
+ * πŸ“¦ Support for nested objects and lists
33
+ * πŸ’¬ Comments directly inside configuration files
34
+ * πŸ“Š Automatic percentage conversion
35
+ * πŸ”’ Integer and floating-point numbers
36
+ * βœ… Boolean values (`true` / `false`)
37
+ * β­• `null` values
38
+ * 🐍 Easy integration with Python
39
+
40
+ For example, the following file:
41
+
42
+ ```kbk
43
+ player |= {
44
+ username |= "KubikNoLego"
45
+ level |= 42
46
+ premium |= true
47
+ win_rate |= 67%
48
+ }
49
+ ```
50
+
51
+ Will be loaded as a regular Python dictionary:
52
+
53
+ ```python
54
+ {
55
+ "player": {
56
+ "username": "KubikNoLego",
57
+ "level": 42,
58
+ "premium": True,
59
+ "win_rate": 0.67
60
+ }
61
+ }
62
+ ```
63
+
64
+ # Loading a File
65
+
66
+ ```python
67
+ from kubiks import load
68
+
69
+ config = load("config.kbk")
70
+ ```
71
+
72
+ The `load()` function returns a standard Python dictionary that can be used anywhere in your application.
73
+
74
+ # Writing `.kbk` Files
75
+
76
+ All data is stored using a **key-value** format.
77
+
78
+ The assignment operator is `|=`:
79
+
80
+ ```kbk
81
+ name |= "Kubik"
82
+ ```
83
+
84
+ After loading:
85
+
86
+ ```python
87
+ {
88
+ "name": "Kubik"
89
+ }
90
+ ```
91
+
92
+ # Supported Data Types
93
+
94
+ ## Strings
95
+
96
+ Kubiks:
97
+
98
+ ```kbk
99
+ name |= "Kubik"
100
+ ```
101
+
102
+ Python:
103
+
104
+ ```python
105
+ {
106
+ "name": "Kubik"
107
+ }
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Null
113
+
114
+ Kubiks:
115
+
116
+ ```kbk
117
+ title |= null
118
+ ```
119
+
120
+ Python:
121
+
122
+ ```python
123
+ {
124
+ "title": None
125
+ }
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Integers
131
+
132
+ Kubiks:
133
+
134
+ ```kbk
135
+ some_number |= -20
136
+ ```
137
+
138
+ Python:
139
+
140
+ ```python
141
+ {
142
+ "some_number": -20
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Floating-Point Numbers
149
+
150
+ Kubiks:
151
+
152
+ ```kbk
153
+ price |= 19.99
154
+ ```
155
+
156
+ Python:
157
+
158
+ ```python
159
+ {
160
+ "price": 19.99
161
+ }
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Boolean Values
167
+
168
+ Kubiks:
169
+
170
+ ```kbk
171
+ enabled |= true
172
+ admin |= false
173
+ ```
174
+
175
+ Python:
176
+
177
+ ```python
178
+ {
179
+ "enabled": True,
180
+ "admin": False
181
+ }
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Percentages
187
+
188
+ Kubiks:
189
+
190
+ ```kbk
191
+ win_rate |= 67%
192
+ tax |= 20%
193
+ ```
194
+
195
+ Python:
196
+
197
+ ```python
198
+ {
199
+ "win_rate": 0.67,
200
+ "tax": 0.2
201
+ }
202
+ ```
203
+
204
+ Percentages are automatically converted into decimal values.
205
+
206
+ ---
207
+
208
+ # Lists
209
+
210
+ Kubiks:
211
+
212
+ ```kbk
213
+ inventory |= [
214
+ "wooden_sword",
215
+ "iron_pickaxe",
216
+ "golden_apple"
217
+ ]
218
+ ```
219
+
220
+ Python:
221
+
222
+ ```python
223
+ {
224
+ "inventory": [
225
+ "wooden_sword",
226
+ "iron_pickaxe",
227
+ "golden_apple"
228
+ ]
229
+ }
230
+ ```
231
+
232
+ ---
233
+
234
+ # Objects
235
+
236
+ Kubiks supports nested structures of any depth.
237
+
238
+ ```kbk
239
+ user |= {
240
+ username |= "KubikNoLego"
241
+
242
+ statistics |= {
243
+ games_played |= 156
244
+ games_won |= 104
245
+ }
246
+ }
247
+ ```
248
+
249
+ Python:
250
+
251
+ ```python
252
+ {
253
+ "user": {
254
+ "username": "KubikNoLego",
255
+ "statistics": {
256
+ "games_played": 156,
257
+ "games_won": 104
258
+ }
259
+ }
260
+ }
261
+ ```
262
+
263
+ ---
264
+
265
+ # Comments
266
+
267
+ Comments start with the `#` character.
268
+
269
+ ```kbk
270
+ # User settings
271
+ theme |= "dark"
272
+
273
+ # Enable notifications
274
+ notifications |= true
275
+ ```
276
+
277
+ Comments are ignored when loading the file.
278
+
279
+ ---
280
+
281
+ # License
282
+
283
+ This project is licensed under the MIT License.
kubiks-0.1.1/README.md ADDED
@@ -0,0 +1,270 @@
1
+ <p align="center">
2
+ <img src="logo.png" width="300"/>
3
+ </p>
4
+ <h4 align="center">A simple and human-readable configuration language for Python.</h4>
5
+
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ πŸ‡ΊπŸ‡Έ [**English**](README.en.md) | πŸ‡·πŸ‡Ί [Русский](README.ru.md)
9
+
10
+ # Introduction
11
+
12
+ **Kubiks** is a lightweight and human-readable configuration format for Python.
13
+
14
+ It was created as a more convenient alternative to JSON for situations where configuration files need to be edited manually. The syntax remains simple while supporting nested structures, lists, percentages, comments, and other useful features.
15
+
16
+ ### Features
17
+
18
+ * ✨ Clean and readable syntax
19
+ * πŸ“¦ Support for nested objects and lists
20
+ * πŸ’¬ Comments directly inside configuration files
21
+ * πŸ“Š Automatic percentage conversion
22
+ * πŸ”’ Integer and floating-point numbers
23
+ * βœ… Boolean values (`true` / `false`)
24
+ * β­• `null` values
25
+ * 🐍 Easy integration with Python
26
+
27
+ For example, the following file:
28
+
29
+ ```kbk
30
+ player |= {
31
+ username |= "KubikNoLego"
32
+ level |= 42
33
+ premium |= true
34
+ win_rate |= 67%
35
+ }
36
+ ```
37
+
38
+ Will be loaded as a regular Python dictionary:
39
+
40
+ ```python
41
+ {
42
+ "player": {
43
+ "username": "KubikNoLego",
44
+ "level": 42,
45
+ "premium": True,
46
+ "win_rate": 0.67
47
+ }
48
+ }
49
+ ```
50
+
51
+ # Loading a File
52
+
53
+ ```python
54
+ from kubiks import load
55
+
56
+ config = load("config.kbk")
57
+ ```
58
+
59
+ The `load()` function returns a standard Python dictionary that can be used anywhere in your application.
60
+
61
+ # Writing `.kbk` Files
62
+
63
+ All data is stored using a **key-value** format.
64
+
65
+ The assignment operator is `|=`:
66
+
67
+ ```kbk
68
+ name |= "Kubik"
69
+ ```
70
+
71
+ After loading:
72
+
73
+ ```python
74
+ {
75
+ "name": "Kubik"
76
+ }
77
+ ```
78
+
79
+ # Supported Data Types
80
+
81
+ ## Strings
82
+
83
+ Kubiks:
84
+
85
+ ```kbk
86
+ name |= "Kubik"
87
+ ```
88
+
89
+ Python:
90
+
91
+ ```python
92
+ {
93
+ "name": "Kubik"
94
+ }
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Null
100
+
101
+ Kubiks:
102
+
103
+ ```kbk
104
+ title |= null
105
+ ```
106
+
107
+ Python:
108
+
109
+ ```python
110
+ {
111
+ "title": None
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Integers
118
+
119
+ Kubiks:
120
+
121
+ ```kbk
122
+ some_number |= -20
123
+ ```
124
+
125
+ Python:
126
+
127
+ ```python
128
+ {
129
+ "some_number": -20
130
+ }
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Floating-Point Numbers
136
+
137
+ Kubiks:
138
+
139
+ ```kbk
140
+ price |= 19.99
141
+ ```
142
+
143
+ Python:
144
+
145
+ ```python
146
+ {
147
+ "price": 19.99
148
+ }
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Boolean Values
154
+
155
+ Kubiks:
156
+
157
+ ```kbk
158
+ enabled |= true
159
+ admin |= false
160
+ ```
161
+
162
+ Python:
163
+
164
+ ```python
165
+ {
166
+ "enabled": True,
167
+ "admin": False
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Percentages
174
+
175
+ Kubiks:
176
+
177
+ ```kbk
178
+ win_rate |= 67%
179
+ tax |= 20%
180
+ ```
181
+
182
+ Python:
183
+
184
+ ```python
185
+ {
186
+ "win_rate": 0.67,
187
+ "tax": 0.2
188
+ }
189
+ ```
190
+
191
+ Percentages are automatically converted into decimal values.
192
+
193
+ ---
194
+
195
+ # Lists
196
+
197
+ Kubiks:
198
+
199
+ ```kbk
200
+ inventory |= [
201
+ "wooden_sword",
202
+ "iron_pickaxe",
203
+ "golden_apple"
204
+ ]
205
+ ```
206
+
207
+ Python:
208
+
209
+ ```python
210
+ {
211
+ "inventory": [
212
+ "wooden_sword",
213
+ "iron_pickaxe",
214
+ "golden_apple"
215
+ ]
216
+ }
217
+ ```
218
+
219
+ ---
220
+
221
+ # Objects
222
+
223
+ Kubiks supports nested structures of any depth.
224
+
225
+ ```kbk
226
+ user |= {
227
+ username |= "KubikNoLego"
228
+
229
+ statistics |= {
230
+ games_played |= 156
231
+ games_won |= 104
232
+ }
233
+ }
234
+ ```
235
+
236
+ Python:
237
+
238
+ ```python
239
+ {
240
+ "user": {
241
+ "username": "KubikNoLego",
242
+ "statistics": {
243
+ "games_played": 156,
244
+ "games_won": 104
245
+ }
246
+ }
247
+ }
248
+ ```
249
+
250
+ ---
251
+
252
+ # Comments
253
+
254
+ Comments start with the `#` character.
255
+
256
+ ```kbk
257
+ # User settings
258
+ theme |= "dark"
259
+
260
+ # Enable notifications
261
+ notifications |= true
262
+ ```
263
+
264
+ Comments are ignored when loading the file.
265
+
266
+ ---
267
+
268
+ # License
269
+
270
+ This project is licensed under the MIT License.