config-hierarchy 2026.12.2__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.
- config_hierarchy-2026.12.2/Cargo.lock +331 -0
- config_hierarchy-2026.12.2/Cargo.toml +11 -0
- config_hierarchy-2026.12.2/LICENSE +21 -0
- config_hierarchy-2026.12.2/PKG-INFO +200 -0
- config_hierarchy-2026.12.2/README.md +179 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-py/Cargo.toml +26 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-py/src/lib.rs +358 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-rs/Cargo.toml +30 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-rs/README.md +29 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-rs/src/discovery.rs +833 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-rs/src/error.rs +132 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-rs/src/lib.rs +23 -0
- config_hierarchy-2026.12.2/crates/config-hierarchy-rs/src/loading.rs +660 -0
- config_hierarchy-2026.12.2/pyproject.toml +68 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/__about__.py +17 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/__init__.py +24 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/_native.pyi +55 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/cli.py +141 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/discovery.py +92 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/errors.py +7 -0
- config_hierarchy-2026.12.2/src/config_hierarchy/loading.py +134 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "bitflags"
|
|
7
|
+
version = "2.13.2"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.5"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "config-hierarchy-py"
|
|
19
|
+
version = "2026.12.2"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"config-hierarchy-rs",
|
|
22
|
+
"pyo3",
|
|
23
|
+
"toml",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "config-hierarchy-rs"
|
|
28
|
+
version = "2026.12.2"
|
|
29
|
+
dependencies = [
|
|
30
|
+
"indexmap",
|
|
31
|
+
"tempfile",
|
|
32
|
+
"toml",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "equivalent"
|
|
37
|
+
version = "1.0.3"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "errno"
|
|
43
|
+
version = "0.3.15"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"libc",
|
|
48
|
+
"windows-sys",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "fastrand"
|
|
53
|
+
version = "2.5.0"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
56
|
+
|
|
57
|
+
[[package]]
|
|
58
|
+
name = "getrandom"
|
|
59
|
+
version = "0.4.3"
|
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
61
|
+
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
|
62
|
+
dependencies = [
|
|
63
|
+
"cfg-if",
|
|
64
|
+
"libc",
|
|
65
|
+
"r-efi",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "hashbrown"
|
|
70
|
+
version = "0.17.2"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
|
|
73
|
+
|
|
74
|
+
[[package]]
|
|
75
|
+
name = "heck"
|
|
76
|
+
version = "0.5.0"
|
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
78
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "indexmap"
|
|
82
|
+
version = "2.14.2"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
|
85
|
+
dependencies = [
|
|
86
|
+
"equivalent",
|
|
87
|
+
"hashbrown",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[[package]]
|
|
91
|
+
name = "libc"
|
|
92
|
+
version = "0.2.191"
|
|
93
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
94
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "linux-raw-sys"
|
|
98
|
+
version = "0.12.1"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "once_cell"
|
|
104
|
+
version = "1.21.4"
|
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
106
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
107
|
+
|
|
108
|
+
[[package]]
|
|
109
|
+
name = "portable-atomic"
|
|
110
|
+
version = "1.15.0"
|
|
111
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
112
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
113
|
+
|
|
114
|
+
[[package]]
|
|
115
|
+
name = "proc-macro2"
|
|
116
|
+
version = "1.0.107"
|
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
118
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
119
|
+
dependencies = [
|
|
120
|
+
"unicode-ident",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[[package]]
|
|
124
|
+
name = "pyo3"
|
|
125
|
+
version = "0.30.1"
|
|
126
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
+
checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
|
|
128
|
+
dependencies = [
|
|
129
|
+
"libc",
|
|
130
|
+
"once_cell",
|
|
131
|
+
"portable-atomic",
|
|
132
|
+
"pyo3-build-config",
|
|
133
|
+
"pyo3-ffi",
|
|
134
|
+
"pyo3-macros",
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
[[package]]
|
|
138
|
+
name = "pyo3-build-config"
|
|
139
|
+
version = "0.30.1"
|
|
140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
141
|
+
checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
|
|
142
|
+
dependencies = [
|
|
143
|
+
"target-lexicon",
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
[[package]]
|
|
147
|
+
name = "pyo3-ffi"
|
|
148
|
+
version = "0.30.1"
|
|
149
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
150
|
+
checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
|
|
151
|
+
dependencies = [
|
|
152
|
+
"libc",
|
|
153
|
+
"pyo3-build-config",
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
[[package]]
|
|
157
|
+
name = "pyo3-macros"
|
|
158
|
+
version = "0.30.1"
|
|
159
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
160
|
+
checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
|
|
161
|
+
dependencies = [
|
|
162
|
+
"proc-macro2",
|
|
163
|
+
"pyo3-macros-backend",
|
|
164
|
+
"quote",
|
|
165
|
+
"syn",
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
[[package]]
|
|
169
|
+
name = "pyo3-macros-backend"
|
|
170
|
+
version = "0.30.1"
|
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
+
checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
|
|
173
|
+
dependencies = [
|
|
174
|
+
"heck",
|
|
175
|
+
"proc-macro2",
|
|
176
|
+
"quote",
|
|
177
|
+
"syn",
|
|
178
|
+
]
|
|
179
|
+
|
|
180
|
+
[[package]]
|
|
181
|
+
name = "quote"
|
|
182
|
+
version = "1.0.47"
|
|
183
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
184
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
185
|
+
dependencies = [
|
|
186
|
+
"proc-macro2",
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
[[package]]
|
|
190
|
+
name = "r-efi"
|
|
191
|
+
version = "6.0.0"
|
|
192
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
+
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
|
194
|
+
|
|
195
|
+
[[package]]
|
|
196
|
+
name = "rustix"
|
|
197
|
+
version = "1.1.6"
|
|
198
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
199
|
+
checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
|
|
200
|
+
dependencies = [
|
|
201
|
+
"bitflags",
|
|
202
|
+
"errno",
|
|
203
|
+
"libc",
|
|
204
|
+
"linux-raw-sys",
|
|
205
|
+
"windows-sys",
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
[[package]]
|
|
209
|
+
name = "serde_core"
|
|
210
|
+
version = "1.0.229"
|
|
211
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
212
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
213
|
+
dependencies = [
|
|
214
|
+
"serde_derive",
|
|
215
|
+
]
|
|
216
|
+
|
|
217
|
+
[[package]]
|
|
218
|
+
name = "serde_derive"
|
|
219
|
+
version = "1.0.229"
|
|
220
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
221
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
222
|
+
dependencies = [
|
|
223
|
+
"proc-macro2",
|
|
224
|
+
"quote",
|
|
225
|
+
"syn",
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
[[package]]
|
|
229
|
+
name = "serde_spanned"
|
|
230
|
+
version = "1.1.3"
|
|
231
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
232
|
+
checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782"
|
|
233
|
+
dependencies = [
|
|
234
|
+
"serde_core",
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "syn"
|
|
239
|
+
version = "3.0.10"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
|
|
242
|
+
dependencies = [
|
|
243
|
+
"proc-macro2",
|
|
244
|
+
"quote",
|
|
245
|
+
"unicode-ident",
|
|
246
|
+
]
|
|
247
|
+
|
|
248
|
+
[[package]]
|
|
249
|
+
name = "target-lexicon"
|
|
250
|
+
version = "0.13.6"
|
|
251
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
252
|
+
checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
|
|
253
|
+
|
|
254
|
+
[[package]]
|
|
255
|
+
name = "tempfile"
|
|
256
|
+
version = "3.27.0"
|
|
257
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
258
|
+
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
|
259
|
+
dependencies = [
|
|
260
|
+
"fastrand",
|
|
261
|
+
"getrandom",
|
|
262
|
+
"once_cell",
|
|
263
|
+
"rustix",
|
|
264
|
+
"windows-sys",
|
|
265
|
+
]
|
|
266
|
+
|
|
267
|
+
[[package]]
|
|
268
|
+
name = "toml"
|
|
269
|
+
version = "1.2.3+spec-1.1.0"
|
|
270
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
+
checksum = "26b1f26e9485c1fa43ee89fe76e9f3fb9e2e52bb227f8594b4d687496b83d073"
|
|
272
|
+
dependencies = [
|
|
273
|
+
"indexmap",
|
|
274
|
+
"serde_core",
|
|
275
|
+
"serde_spanned",
|
|
276
|
+
"toml_datetime",
|
|
277
|
+
"toml_parser",
|
|
278
|
+
"toml_writer",
|
|
279
|
+
"winnow",
|
|
280
|
+
]
|
|
281
|
+
|
|
282
|
+
[[package]]
|
|
283
|
+
name = "toml_datetime"
|
|
284
|
+
version = "1.1.3+spec-1.1.0"
|
|
285
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
286
|
+
checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49"
|
|
287
|
+
dependencies = [
|
|
288
|
+
"serde_core",
|
|
289
|
+
]
|
|
290
|
+
|
|
291
|
+
[[package]]
|
|
292
|
+
name = "toml_parser"
|
|
293
|
+
version = "1.1.7+spec-1.1.0"
|
|
294
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
295
|
+
checksum = "0bb28d6e049a9766c3bd91a8326e6179f5b132dec87906bb97018ef7a2f3431a"
|
|
296
|
+
dependencies = [
|
|
297
|
+
"winnow",
|
|
298
|
+
]
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "toml_writer"
|
|
302
|
+
version = "1.2.0+spec-1.1.0"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a"
|
|
305
|
+
|
|
306
|
+
[[package]]
|
|
307
|
+
name = "unicode-ident"
|
|
308
|
+
version = "1.0.27"
|
|
309
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
310
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
311
|
+
|
|
312
|
+
[[package]]
|
|
313
|
+
name = "windows-link"
|
|
314
|
+
version = "0.2.1"
|
|
315
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
316
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
317
|
+
|
|
318
|
+
[[package]]
|
|
319
|
+
name = "windows-sys"
|
|
320
|
+
version = "0.61.2"
|
|
321
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
322
|
+
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
|
323
|
+
dependencies = [
|
|
324
|
+
"windows-link",
|
|
325
|
+
]
|
|
326
|
+
|
|
327
|
+
[[package]]
|
|
328
|
+
name = "winnow"
|
|
329
|
+
version = "1.0.5"
|
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
+
checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
members = ["crates/config-hierarchy-rs", "crates/config-hierarchy-py"]
|
|
3
|
+
resolver = "3"
|
|
4
|
+
|
|
5
|
+
[workspace.package]
|
|
6
|
+
version = "2026.12.2"
|
|
7
|
+
edition = "2024"
|
|
8
|
+
rust-version = "1.85"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
repository = "https://github.com/jr2804/config-hierarchy"
|
|
11
|
+
authors = ["Jan.Reimes <jan.reimes@head-acoustics.com>"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jan.Reimes
|
|
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,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: config-hierarchy
|
|
3
|
+
Version: 2026.12.2
|
|
4
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
5
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
7
|
+
Classifier: Programming Language :: Rust
|
|
8
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
9
|
+
Requires-Dist: cyclopts>=5.7.3
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Summary: Discover, merge and overlay a layered TOML configuration hierarchy.
|
|
12
|
+
Author-email: "Jan.Reimes" <jan.reimes@head-acoustics.com>
|
|
13
|
+
License: MIT
|
|
14
|
+
Requires-Python: >=3.13
|
|
15
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
16
|
+
Project-URL: Documentation, https://jr2804.github.io/config-hierarchy/
|
|
17
|
+
Project-URL: Homepage, https://github.com/jr2804/config-hierarchy
|
|
18
|
+
Project-URL: Issues, https://github.com/jr2804/config-hierarchy/issues
|
|
19
|
+
Project-URL: Repository, https://github.com/jr2804/config-hierarchy
|
|
20
|
+
|
|
21
|
+
# Config Hierarchy
|
|
22
|
+
|
|
23
|
+
> Discover, merge and overlay a layered TOML configuration hierarchy.
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="#"><img alt="Python 3.13+" src="https://img.shields.io/badge/python-3.13%2B-3776ab?logo=python"></a>
|
|
27
|
+
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-MIT-green.svg"></a>
|
|
28
|
+
<a href="https://github.com/jr2804/config-hierarchy/actions"><img alt="CI" src="https://github.com/jr2804/config-hierarchy/actions/workflows/ci.yml/badge.svg"></a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
This is the pattern mise, Cargo and many developer tools use: a machine-wide config,
|
|
32
|
+
then a per-user config, then project files from the filesystem root down to the
|
|
33
|
+
working directory. Local overrides and `conf.d` fragments sit inside each layer. The
|
|
34
|
+
library finds the files, parses them, and merges their tables while keeping the
|
|
35
|
+
origin of every definition.
|
|
36
|
+
|
|
37
|
+
The core is written in Rust and exposed to Python through PyO3; the Python API below
|
|
38
|
+
ships as prebuilt `abi3` wheels for Python 3.13+ on Windows x64, Linux x64 and arm64,
|
|
39
|
+
and macOS x64 and arm64.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
Python:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv add config-hierarchy
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Rust:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cargo add config-hierarchy-rs
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Layout
|
|
56
|
+
|
|
57
|
+
`Hierarchy.for_app("myapp")` is the ready-made mise-style layout:
|
|
58
|
+
|
|
59
|
+
| Scope | Location |
|
|
60
|
+
| ------- | ------------------------------------------------------------------------ |
|
|
61
|
+
| Project | `myapp.toml` and `.config/myapp/config.toml` in the working directory |
|
|
62
|
+
| Project | the same two paths in every parent directory up to the filesystem root |
|
|
63
|
+
| User | `~/.config/myapp/config.toml` |
|
|
64
|
+
| System | `/etc/myapp/config.toml` |
|
|
65
|
+
|
|
66
|
+
Each config directory also reads `conf.d/*.toml`. Starting in the working directory,
|
|
67
|
+
the project files are checked, then the project directory; the same pair is checked
|
|
68
|
+
in each parent up to the filesystem root. The user directory follows, then the system
|
|
69
|
+
directory. A closer project directory wins over a farther one.
|
|
70
|
+
|
|
71
|
+
Inside one directory, a local variant outranks the shared file it belongs to:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
.myapp.local.toml highest
|
|
75
|
+
myapp.local.toml
|
|
76
|
+
.myapp.toml
|
|
77
|
+
myapp.toml lowest
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The same rule applies to `config.toml` and to fragments in `conf.d`. Fragments are
|
|
81
|
+
sorted by name so the alphabetically last fragment wins; the local variant stays in
|
|
82
|
+
its fragment's slot, above the shared file it belongs to.
|
|
83
|
+
|
|
84
|
+
## Local files and gitignore
|
|
85
|
+
|
|
86
|
+
Local and hidden variants are for machine-specific values: editor paths, credentials,
|
|
87
|
+
ports, or anything that must not be committed. Add the variants your application
|
|
88
|
+
uses to `.gitignore`; never commit them:
|
|
89
|
+
|
|
90
|
+
```gitignore
|
|
91
|
+
myapp.local.toml
|
|
92
|
+
.myapp.toml
|
|
93
|
+
.myapp.local.toml
|
|
94
|
+
config.local.toml
|
|
95
|
+
.config.toml
|
|
96
|
+
.config.local.toml
|
|
97
|
+
conf.d/*.local.toml
|
|
98
|
+
conf.d/.*.toml
|
|
99
|
+
conf.d/.*.local.toml
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Python usage
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from config_hierarchy import Hierarchy, load
|
|
106
|
+
|
|
107
|
+
hierarchy = Hierarchy.for_app("myapp")
|
|
108
|
+
paths = hierarchy.discover() # existing files, closest first
|
|
109
|
+
merged = load(paths)
|
|
110
|
+
|
|
111
|
+
groups, duplicates = merged.tables("groups") # first definition kept
|
|
112
|
+
skillset, overridden = merged.single("skillset") # closest definition wins
|
|
113
|
+
|
|
114
|
+
overlay = merged.overlay()
|
|
115
|
+
print(overlay.data["tools"]["node"])
|
|
116
|
+
for setting in overlay.settings:
|
|
117
|
+
print(setting.key, setting.value, setting.path)
|
|
118
|
+
for old in setting.overridden:
|
|
119
|
+
print(" was", old.value, "from", old.path)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- `Hierarchy.discover()` returns the files that exist, in precedence order.
|
|
123
|
+
- `Hierarchy.locations()` returns every candidate, including missing files and its
|
|
124
|
+
`scope`/`local`/`dropin` flags; the doctor CLI uses it.
|
|
125
|
+
- `Hierarchy.expand()` expands explicit files or directories (`config.toml`, its
|
|
126
|
+
local variants, sibling `*.toml`, then `conf.d/*.toml`).
|
|
127
|
+
- `MergedConfig.tables()` merges named tables and reports duplicates with both
|
|
128
|
+
origins instead of silently overriding them.
|
|
129
|
+
- `MergedConfig.single()` returns the highest-precedence table plus every
|
|
130
|
+
overridden definition.
|
|
131
|
+
- `MergedConfig.overlay()` deep-merges the whole hierarchy. `Overlay.data` is the
|
|
132
|
+
merged table; `Overlay.settings` records the winning value, its file, and every
|
|
133
|
+
value it overrode.
|
|
134
|
+
|
|
135
|
+
Errors (unreadable file, invalid TOML, wrong shape, missing path) raise
|
|
136
|
+
`HierarchyError` with the path in the message. Policy — which sections exist, what
|
|
137
|
+
their keys mean, whether duplicates are fatal — stays in the caller.
|
|
138
|
+
|
|
139
|
+
## Doctor CLI
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
uv run config-hierarchy doctor --name myapp
|
|
143
|
+
uv run config-hierarchy doctor --name myapp --json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`doctor` (alias `check`) prints the files the application finds, the settings each
|
|
147
|
+
file contributes, the overrides, and any parse or read problems. It exits `1` when a
|
|
148
|
+
found file cannot be read or parsed. Useful options:
|
|
149
|
+
|
|
150
|
+
- `--cwd`, `--home`, `--system-root` override the scopes.
|
|
151
|
+
- `--project-file NAME` adds a project file; it can be repeated.
|
|
152
|
+
- `--entry NAME` and `--dropins NAME` change the config file and fragment directory.
|
|
153
|
+
- `--no-parents` limits project discovery to the working directory.
|
|
154
|
+
- `--json` emits the same report for tooling.
|
|
155
|
+
|
|
156
|
+
The command uses Cyclopts for argument parsing and help; it is a thin report over the
|
|
157
|
+
same discovery and overlay logic the library uses.
|
|
158
|
+
|
|
159
|
+
## Rust usage
|
|
160
|
+
|
|
161
|
+
```rust
|
|
162
|
+
use config_hierarchy::{Hierarchy, load};
|
|
163
|
+
|
|
164
|
+
let hierarchy = Hierarchy::for_app("myapp");
|
|
165
|
+
let paths = hierarchy.discover()?;
|
|
166
|
+
let merged = load(&paths)?;
|
|
167
|
+
|
|
168
|
+
let groups = merged.tables("groups")?; // groups.tables, groups.duplicates
|
|
169
|
+
let skillset = merged.single("skillset")?; // skillset.selected, skillset.overridden
|
|
170
|
+
let overlay = merged.overlay(); // overlay.table, overlay.settings
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`Hierarchy::for_app_in("myapp", "/opt")` changes the machine-wide root.
|
|
174
|
+
`Hierarchy::new(project_dir, user_dir)` builds a custom layout and defaults to
|
|
175
|
+
current-directory-only discovery; add `.with_parent_search(true)` for the mise
|
|
176
|
+
behavior.
|
|
177
|
+
|
|
178
|
+
The Rust crate is [`config-hierarchy-rs`](https://crates.io/crates/config-hierarchy-rs).
|
|
179
|
+
It exposes the same discovery, expansion and merge model with `PathBuf` paths and
|
|
180
|
+
`toml::Table` data.
|
|
181
|
+
|
|
182
|
+
## Development
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
mise dev # install dependencies and build the native extension
|
|
186
|
+
mise test # pytest + cargo test (100% Python coverage)
|
|
187
|
+
mise test-rust-cov # Rust core line coverage (100%)
|
|
188
|
+
mise lint # ruff + clippy
|
|
189
|
+
mise format # pyreorder + ruff + isort + rustfmt
|
|
190
|
+
mise docs # build the documentation site
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT — see [LICENSE](LICENSE) for details.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
Generated from [copier-uv-plus](https://codeberg.org/jr2804/copier-uv-plus).
|
|
200
|
+
|