headson 0.6.1__tar.gz → 0.6.3__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.
Potentially problematic release.
This version of headson might be problematic. Click here for more details.
- {headson-0.6.1 → headson-0.6.3}/Cargo.lock +93 -19
- {headson-0.6.1 → headson-0.6.3}/Cargo.toml +11 -1
- {headson-0.6.1 → headson-0.6.3}/PKG-INFO +76 -38
- headson-0.6.3/README.md +220 -0
- headson-0.6.3/docs/assets/tapes/demo.gif +0 -0
- {headson-0.6.1 → headson-0.6.3}/pyproject.toml +2 -2
- {headson-0.6.1 → headson-0.6.3}/python/Cargo.lock +67 -10
- {headson-0.6.1 → headson-0.6.3}/python/Cargo.toml +1 -1
- headson-0.6.3/python/README.md +57 -0
- headson-0.6.3/python/headson/__init__.py +11 -0
- headson-0.6.3/python/src/lib.rs +130 -0
- headson-0.6.3/src/format.rs +68 -0
- headson-0.6.3/src/ingest/json.rs +37 -0
- headson-0.6.3/src/ingest/mod.rs +64 -0
- headson-0.6.3/src/ingest/text.rs +45 -0
- headson-0.6.3/src/ingest/yaml.rs +39 -0
- {headson-0.6.1 → headson-0.6.3}/src/json_ingest/builder.rs +6 -3
- {headson-0.6.1 → headson-0.6.3}/src/lib.rs +65 -9
- {headson-0.6.1 → headson-0.6.3}/src/main.rs +201 -19
- {headson-0.6.1 → headson-0.6.3}/src/order/build.rs +120 -34
- headson-0.6.3/src/order/snapshots/headson__order__build__tests__order_empty_array_order.snap +6 -0
- headson-0.6.3/src/order/snapshots/headson__order__build__tests__order_single_string_array_order.snap +9 -0
- {headson-0.6.1 → headson-0.6.3}/src/order/types.rs +62 -9
- {headson-0.6.1 → headson-0.6.3}/src/serialization/color.rs +0 -7
- headson-0.6.3/src/serialization/fileset.rs +107 -0
- headson-0.6.3/src/serialization/mod.rs +1314 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/output.rs +12 -17
- headson-0.6.3/src/serialization/snapshots/headson__serialization__tests__arena_render_empty_yaml.snap +6 -0
- headson-0.6.3/src/serialization/snapshots/headson__serialization__tests__arena_render_single_yaml.snap +5 -0
- headson-0.6.3/src/serialization/snapshots/headson__serialization__tests__array_internal_gaps_yaml.snap +9 -0
- headson-0.6.3/src/serialization/snapshots/headson__serialization__tests__array_omitted_yaml_head.snap +7 -0
- headson-0.6.3/src/serialization/snapshots/headson__serialization__tests__array_omitted_yaml_tail.snap +7 -0
- headson-0.6.3/src/serialization/snapshots/headson__serialization__tests__inline_open_array_in_object_yaml.snap +9 -0
- headson-0.6.3/src/serialization/templates/core.rs +130 -0
- headson-0.6.3/src/serialization/templates/js.rs +104 -0
- headson-0.6.3/src/serialization/templates/json.rs +32 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/templates/mod.rs +14 -3
- {headson-0.6.1 → headson-0.6.3}/src/serialization/templates/pseudo.rs +50 -29
- headson-0.6.3/src/serialization/templates/text.rs +43 -0
- headson-0.6.3/src/serialization/templates/yaml.rs +269 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/types.rs +15 -3
- {headson-0.6.1 → headson-0.6.3}/src/snapshots/headson__order__tests__order_empty_array_order.snap +1 -1
- {headson-0.6.1 → headson-0.6.3}/src/snapshots/headson__order__tests__order_single_string_array_order.snap +4 -4
- headson-0.6.3/src/text_ingest/mod.rs +192 -0
- {headson-0.6.1 → headson-0.6.3}/src/utils/tree_arena.rs +4 -5
- headson-0.6.3/src/yaml_ingest/mod.rs +292 -0
- headson-0.6.1/LICENSE +0 -21
- headson-0.6.1/README.md +0 -181
- headson-0.6.1/docs/assets/tapes/demo.gif +0 -0
- headson-0.6.1/python/README.md +0 -45
- headson-0.6.1/python/headson/__init__.py +0 -6
- headson-0.6.1/python/src/lib.rs +0 -80
- headson-0.6.1/src/order/snapshots/headson__order__build__tests__order_empty_array_order.snap +0 -6
- headson-0.6.1/src/order/snapshots/headson__order__build__tests__order_single_string_array_order.snap +0 -9
- headson-0.6.1/src/serialization/fileset.rs +0 -164
- headson-0.6.1/src/serialization/mod.rs +0 -745
- headson-0.6.1/src/serialization/templates/core.rs +0 -124
- headson-0.6.1/src/serialization/templates/js.rs +0 -75
- headson-0.6.1/src/serialization/templates/json.rs +0 -29
- headson-0.6.1/src/snapshots/headson__order__tests__pq_empty_array_queue.snap +0 -6
- headson-0.6.1/src/snapshots/headson__order__tests__pq_single_string_array_queue.snap +0 -9
- headson-0.6.1/src/snapshots/headson__queue__tests__pq_empty_array_queue.snap +0 -7
- headson-0.6.1/src/snapshots/headson__queue__tests__pq_single_string_array_queue.snap +0 -10
- headson-0.6.1/src/snapshots/headson__tree__tests__build_tree_empty.snap +0 -5
- headson-0.6.1/src/snapshots/headson__tree__tests__build_tree_single.snap +0 -7
- {headson-0.6.1 → headson-0.6.3}/docs/assets/algorithm.svg +0 -0
- {headson-0.6.1 → headson-0.6.3}/docs/assets/logo.png +0 -0
- {headson-0.6.1 → headson-0.6.3}/docs/assets/logo.svg +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/json_ingest/mod.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/json_ingest/samplers/default.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/json_ingest/samplers/head.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/json_ingest/samplers/mod.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/json_ingest/samplers/tail.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/order/mod.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/order/scoring.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__arena_render_empty.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__arena_render_single.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__array_omitted_js_head.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__array_omitted_js_tail.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__array_omitted_pseudo_head.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__array_omitted_pseudo_tail.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/serialization/snapshots/headson__serialization__tests__inline_open_array_in_object_json.snap +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/utils/graph.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/utils/json.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/utils/mod.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/utils/search.rs +0 -0
- {headson-0.6.1 → headson-0.6.3}/src/utils/text.rs +0 -0
- {headson-0.6.1 → headson-0.6.3/tests/fixtures/json}/JSONTestSuite/LICENSE +0 -0
- {headson-0.6.1 → headson-0.6.3/tests/fixtures/json}/JSONTestSuite/README.md +0 -0
|
@@ -64,15 +64,20 @@ version = "1.0.100"
|
|
|
64
64
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
65
65
|
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
|
66
66
|
|
|
67
|
+
[[package]]
|
|
68
|
+
name = "arraydeque"
|
|
69
|
+
version = "0.5.1"
|
|
70
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
71
|
+
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
|
|
72
|
+
|
|
67
73
|
[[package]]
|
|
68
74
|
name = "assert_cmd"
|
|
69
|
-
version = "2.
|
|
75
|
+
version = "2.1.1"
|
|
70
76
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
71
|
-
checksum = "
|
|
77
|
+
checksum = "bcbb6924530aa9e0432442af08bbcafdad182db80d2e560da42a6d442535bf85"
|
|
72
78
|
dependencies = [
|
|
73
79
|
"anstyle",
|
|
74
80
|
"bstr",
|
|
75
|
-
"doc-comment",
|
|
76
81
|
"libc",
|
|
77
82
|
"predicates",
|
|
78
83
|
"predicates-core",
|
|
@@ -111,9 +116,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
|
111
116
|
|
|
112
117
|
[[package]]
|
|
113
118
|
name = "clap"
|
|
114
|
-
version = "4.5.
|
|
119
|
+
version = "4.5.51"
|
|
115
120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
116
|
-
checksum = "
|
|
121
|
+
checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5"
|
|
117
122
|
dependencies = [
|
|
118
123
|
"clap_builder",
|
|
119
124
|
"clap_derive",
|
|
@@ -121,9 +126,9 @@ dependencies = [
|
|
|
121
126
|
|
|
122
127
|
[[package]]
|
|
123
128
|
name = "clap_builder"
|
|
124
|
-
version = "4.5.
|
|
129
|
+
version = "4.5.51"
|
|
125
130
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
|
-
checksum = "
|
|
131
|
+
checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a"
|
|
127
132
|
dependencies = [
|
|
128
133
|
"anstream",
|
|
129
134
|
"anstyle",
|
|
@@ -182,18 +187,21 @@ version = "0.4.0"
|
|
|
182
187
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
183
188
|
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
|
|
184
189
|
|
|
185
|
-
[[package]]
|
|
186
|
-
name = "doc-comment"
|
|
187
|
-
version = "0.3.3"
|
|
188
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
189
|
-
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
|
190
|
-
|
|
191
190
|
[[package]]
|
|
192
191
|
name = "encode_unicode"
|
|
193
192
|
version = "1.0.0"
|
|
194
193
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
195
194
|
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
|
|
196
195
|
|
|
196
|
+
[[package]]
|
|
197
|
+
name = "encoding_rs"
|
|
198
|
+
version = "0.8.35"
|
|
199
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
200
|
+
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
|
|
201
|
+
dependencies = [
|
|
202
|
+
"cfg-if",
|
|
203
|
+
]
|
|
204
|
+
|
|
197
205
|
[[package]]
|
|
198
206
|
name = "equivalent"
|
|
199
207
|
version = "1.0.2"
|
|
@@ -207,7 +215,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
207
215
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
|
208
216
|
dependencies = [
|
|
209
217
|
"libc",
|
|
210
|
-
"windows-sys 0.
|
|
218
|
+
"windows-sys 0.59.0",
|
|
211
219
|
]
|
|
212
220
|
|
|
213
221
|
[[package]]
|
|
@@ -225,6 +233,12 @@ dependencies = [
|
|
|
225
233
|
"num-traits",
|
|
226
234
|
]
|
|
227
235
|
|
|
236
|
+
[[package]]
|
|
237
|
+
name = "foldhash"
|
|
238
|
+
version = "0.1.5"
|
|
239
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
240
|
+
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|
241
|
+
|
|
228
242
|
[[package]]
|
|
229
243
|
name = "foldhash"
|
|
230
244
|
version = "0.2.0"
|
|
@@ -249,10 +263,19 @@ version = "0.4.0"
|
|
|
249
263
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
250
264
|
checksum = "0c7ed2f2edad8a14c8186b847909a41fbb9c3eafa44f88bd891114ed5019da09"
|
|
251
265
|
dependencies = [
|
|
252
|
-
"hashbrown",
|
|
266
|
+
"hashbrown 0.16.0",
|
|
253
267
|
"serde",
|
|
254
268
|
]
|
|
255
269
|
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "hashbrown"
|
|
272
|
+
version = "0.15.5"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
|
275
|
+
dependencies = [
|
|
276
|
+
"foldhash 0.1.5",
|
|
277
|
+
]
|
|
278
|
+
|
|
256
279
|
[[package]]
|
|
257
280
|
name = "hashbrown"
|
|
258
281
|
version = "0.16.0"
|
|
@@ -261,12 +284,21 @@ checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
|
|
261
284
|
dependencies = [
|
|
262
285
|
"allocator-api2",
|
|
263
286
|
"equivalent",
|
|
264
|
-
"foldhash",
|
|
287
|
+
"foldhash 0.2.0",
|
|
288
|
+
]
|
|
289
|
+
|
|
290
|
+
[[package]]
|
|
291
|
+
name = "hashlink"
|
|
292
|
+
version = "0.10.0"
|
|
293
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
294
|
+
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
|
|
295
|
+
dependencies = [
|
|
296
|
+
"hashbrown 0.15.5",
|
|
265
297
|
]
|
|
266
298
|
|
|
267
299
|
[[package]]
|
|
268
300
|
name = "headson"
|
|
269
|
-
version = "0.6.
|
|
301
|
+
version = "0.6.3"
|
|
270
302
|
dependencies = [
|
|
271
303
|
"anyhow",
|
|
272
304
|
"assert_cmd",
|
|
@@ -277,10 +309,12 @@ dependencies = [
|
|
|
277
309
|
"rand_chacha",
|
|
278
310
|
"serde",
|
|
279
311
|
"serde_json",
|
|
312
|
+
"serde_yaml",
|
|
280
313
|
"simd-json",
|
|
281
314
|
"tempfile",
|
|
282
315
|
"test_each_file",
|
|
283
316
|
"unicode-segmentation",
|
|
317
|
+
"yaml-rust2",
|
|
284
318
|
]
|
|
285
319
|
|
|
286
320
|
[[package]]
|
|
@@ -289,6 +323,16 @@ version = "0.5.0"
|
|
|
289
323
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
290
324
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
291
325
|
|
|
326
|
+
[[package]]
|
|
327
|
+
name = "indexmap"
|
|
328
|
+
version = "2.12.0"
|
|
329
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
330
|
+
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
|
|
331
|
+
dependencies = [
|
|
332
|
+
"equivalent",
|
|
333
|
+
"hashbrown 0.16.0",
|
|
334
|
+
]
|
|
335
|
+
|
|
292
336
|
[[package]]
|
|
293
337
|
name = "insta"
|
|
294
338
|
version = "1.43.2"
|
|
@@ -476,7 +520,7 @@ dependencies = [
|
|
|
476
520
|
"errno",
|
|
477
521
|
"libc",
|
|
478
522
|
"linux-raw-sys",
|
|
479
|
-
"windows-sys 0.
|
|
523
|
+
"windows-sys 0.59.0",
|
|
480
524
|
]
|
|
481
525
|
|
|
482
526
|
[[package]]
|
|
@@ -528,6 +572,19 @@ dependencies = [
|
|
|
528
572
|
"serde_core",
|
|
529
573
|
]
|
|
530
574
|
|
|
575
|
+
[[package]]
|
|
576
|
+
name = "serde_yaml"
|
|
577
|
+
version = "0.9.34+deprecated"
|
|
578
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
579
|
+
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
|
|
580
|
+
dependencies = [
|
|
581
|
+
"indexmap",
|
|
582
|
+
"itoa",
|
|
583
|
+
"ryu",
|
|
584
|
+
"serde",
|
|
585
|
+
"unsafe-libyaml",
|
|
586
|
+
]
|
|
587
|
+
|
|
531
588
|
[[package]]
|
|
532
589
|
name = "simd-json"
|
|
533
590
|
version = "0.17.0"
|
|
@@ -581,7 +638,7 @@ dependencies = [
|
|
|
581
638
|
"getrandom",
|
|
582
639
|
"once_cell",
|
|
583
640
|
"rustix",
|
|
584
|
-
"windows-sys 0.
|
|
641
|
+
"windows-sys 0.59.0",
|
|
585
642
|
]
|
|
586
643
|
|
|
587
644
|
[[package]]
|
|
@@ -614,6 +671,12 @@ version = "1.12.0"
|
|
|
614
671
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
615
672
|
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
|
616
673
|
|
|
674
|
+
[[package]]
|
|
675
|
+
name = "unsafe-libyaml"
|
|
676
|
+
version = "0.2.11"
|
|
677
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
678
|
+
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
|
|
679
|
+
|
|
617
680
|
[[package]]
|
|
618
681
|
name = "utf8parse"
|
|
619
682
|
version = "0.2.2"
|
|
@@ -809,6 +872,17 @@ version = "0.46.0"
|
|
|
809
872
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
810
873
|
checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
|
|
811
874
|
|
|
875
|
+
[[package]]
|
|
876
|
+
name = "yaml-rust2"
|
|
877
|
+
version = "0.10.4"
|
|
878
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
879
|
+
checksum = "2462ea039c445496d8793d052e13787f2b90e750b833afee748e601c17621ed9"
|
|
880
|
+
dependencies = [
|
|
881
|
+
"arraydeque",
|
|
882
|
+
"encoding_rs",
|
|
883
|
+
"hashlink",
|
|
884
|
+
]
|
|
885
|
+
|
|
812
886
|
[[package]]
|
|
813
887
|
name = "zerocopy"
|
|
814
888
|
version = "0.8.27"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "headson"
|
|
3
|
-
version = "0.6.
|
|
3
|
+
version = "0.6.3"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
description = "Budget‑constrained JSON preview renderer"
|
|
6
6
|
readme = "README.md"
|
|
@@ -27,6 +27,15 @@ serde_json = "1.0.145"
|
|
|
27
27
|
unicode-segmentation = "1.12.0"
|
|
28
28
|
simd-json = { version = "0.17", features = ["serde_impl"] }
|
|
29
29
|
content_inspector = "0.2"
|
|
30
|
+
yaml-rust2 = "0.10"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[features]
|
|
35
|
+
default = []
|
|
36
|
+
|
|
37
|
+
[lib]
|
|
38
|
+
doctest = false
|
|
30
39
|
|
|
31
40
|
[dev-dependencies]
|
|
32
41
|
insta = "1.40.0"
|
|
@@ -35,6 +44,7 @@ test_each_file = "0.3"
|
|
|
35
44
|
rand = "0.9"
|
|
36
45
|
rand_chacha = "0.9"
|
|
37
46
|
tempfile = "3"
|
|
47
|
+
serde_yaml = "0.9"
|
|
38
48
|
|
|
39
49
|
[profile.release]
|
|
40
50
|
# Prioritize runtime speed for large inputs
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: headson
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Classifier: Programming Language :: Python
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
7
7
|
Classifier: Operating System :: OS Independent
|
|
8
8
|
Requires-Dist: pytest>=8 ; extra == 'test'
|
|
9
9
|
Provides-Extra: test
|
|
10
|
-
License-File: LICENSE
|
|
11
10
|
Summary: Budget‑constrained JSON preview renderer (Python bindings)
|
|
12
11
|
Keywords: json,preview,summarize,cli,bindings
|
|
13
12
|
Requires-Python: >=3.10
|
|
@@ -21,7 +20,7 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
|
21
20
|
<br/>
|
|
22
21
|
</p>
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
`heal`/`tail` for JSON, YAML - but structure‑aware. Get a compact preview that shows both the shape and representative values of your data, all within a strict character budget. (Just like `head`/`tail`, `headson` can also work with unstructured text files.)
|
|
25
24
|
|
|
26
25
|
Available as:
|
|
27
26
|
- CLI (see [Usage](#usage))
|
|
@@ -41,11 +40,15 @@ From source:
|
|
|
41
40
|
|
|
42
41
|
## Features
|
|
43
42
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
43
|
+
- Budgeted output: specify exactly how much you want to see
|
|
44
|
+
- Output formats: `auto | json | yaml | text`
|
|
45
|
+
- Styles: `strict | default | detailed`
|
|
46
|
+
- JSON family: `strict` → strict JSON, `default` → human‑friendly Pseudo, `detailed` → JS with inline comments
|
|
47
|
+
- YAML: always YAML; `strict` has no comments, `default` uses “# …”, `detailed` uses “# N more …”
|
|
48
|
+
- Text: prints raw lines. In `default` style, omissions are shown as a single line `…`; in `detailed`, as `… N more lines …`. `strict` omits array‑level summaries.
|
|
49
|
+
- Multiple inputs: preview many files at once with a shared or per‑file budget
|
|
50
|
+
- Fast: processes gigabyte‑scale files in seconds (mostly disk‑bound)
|
|
51
|
+
- Available as a CLI app and as a Python library
|
|
49
52
|
|
|
50
53
|
## Fits into command line workflows
|
|
51
54
|
|
|
@@ -59,47 +62,74 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
|
|
|
59
62
|
|
|
60
63
|
headson [FLAGS] [INPUT...]
|
|
61
64
|
|
|
62
|
-
- INPUT (optional, repeatable): file path(s). If omitted, reads
|
|
65
|
+
- INPUT (optional, repeatable): file path(s). If omitted, reads from stdin. Multiple input files are supported.
|
|
63
66
|
- Prints the preview to stdout. On parse errors, exits non‑zero and prints an error to stderr.
|
|
64
67
|
|
|
65
68
|
Common flags:
|
|
66
69
|
|
|
67
|
-
- `-n, --budget <BYTES>`: per‑file output budget.
|
|
68
|
-
- `-N, --global-budget <BYTES>`: total output budget across all inputs.
|
|
69
|
-
|
|
70
|
-
-
|
|
70
|
+
- `-n, --budget <BYTES>`: per‑file output budget. For multiple inputs, default total budget is `<BYTES> * number_of_inputs`.
|
|
71
|
+
- `-N, --global-budget <BYTES>`: total output budget across all inputs. With `--budget`, the effective total is the smaller of the two.
|
|
72
|
+
- `-f, --format <auto|json|yaml|text>`: output format (default: `auto`).
|
|
73
|
+
- Auto: stdin → JSON family; filesets → per‑file based on extension (`.json` → JSON family, `.yaml`/`.yml` → YAML, unknown → Text).
|
|
74
|
+
- `-t, --template <strict|default|detailed>`: output style (default: `default`).
|
|
75
|
+
- JSON family: `strict` → strict JSON; `default` → Pseudo; `detailed` → JS with inline comments.
|
|
76
|
+
- YAML: always YAML; style only affects comments (`strict` none, `default` “# …”, `detailed` “# N more …”).
|
|
77
|
+
- `-i, --input-format <json|yaml|text>`: ingestion format (default: `json`). For filesets in `auto` format, ingestion is chosen by extensions.
|
|
71
78
|
- `-m, --compact`: no indentation, no spaces, no newlines
|
|
72
79
|
- `--no-newline`: single line output
|
|
73
80
|
- `--no-space`: no space after `:` in objects
|
|
74
81
|
- `--indent <STR>`: indentation unit (default: two spaces)
|
|
75
82
|
- `--string-cap <N>`: max graphemes to consider per string (default: 500)
|
|
76
|
-
- `--head`: prefer the beginning of arrays when truncating (keep first N). Strings are unaffected.
|
|
77
|
-
- `--tail`: prefer the end of arrays when truncating (keep last N). Strings are unaffected.
|
|
83
|
+
- `--head`: prefer the beginning of arrays when truncating (keep first N). Strings are unaffected. Display styles place omission markers accordingly; strict JSON remains unannotated. Mutually exclusive with `--tail`.
|
|
84
|
+
- `--tail`: prefer the end of arrays when truncating (keep last N). Strings are unaffected. Display styles place omission markers accordingly; strict JSON remains unannotated. Mutually exclusive with `--head`.
|
|
78
85
|
|
|
79
86
|
Notes:
|
|
80
87
|
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
- The tool finds the largest preview that fits the budget;
|
|
87
|
-
-
|
|
88
|
-
- Head vs Tail sampling: these options bias which part of arrays are kept before rendering.
|
|
88
|
+
- Multiple inputs:
|
|
89
|
+
- With newlines enabled, file sections are rendered with human‑readable headers. In compact/single‑line modes, headers are omitted.
|
|
90
|
+
- In `--format auto`, each file uses its own best format: JSON family for `.json`, YAML for `.yaml`/`.yml`.
|
|
91
|
+
- Unknown extensions are treated as Text (raw lines) — safe for logs and `.txt` files.
|
|
92
|
+
- `--global-budget` may truncate or omit entire files to respect the total budget.
|
|
93
|
+
- The tool finds the largest preview that fits the budget; even if extremely tight, you still get a minimal, valid preview.
|
|
94
|
+
- Directories and binary files are ignored; a notice is printed to stderr for each. Stdin reads the stream as‑is.
|
|
95
|
+
- Head vs Tail sampling: these options bias which part of arrays are kept before rendering. Display styles may still insert internal gap markers to honor very small budgets; strict JSON stays unannotated.
|
|
89
96
|
|
|
90
97
|
Quick one‑liners:
|
|
91
98
|
|
|
92
99
|
- Peek a big JSON stream (keeps structure):
|
|
93
100
|
|
|
94
|
-
zstdcat huge.json.zst | headson -n 800 -f
|
|
101
|
+
zstdcat huge.json.zst | headson -n 800 -f json -t default
|
|
95
102
|
|
|
96
103
|
- Many files with a fixed overall size:
|
|
97
104
|
|
|
98
|
-
headson -N 1200 -f json logs/*.json
|
|
105
|
+
headson -N 1200 -f json -t strict logs/*.json
|
|
99
106
|
|
|
100
107
|
- Glance at a file, JavaScript‑style comments for omissions:
|
|
101
108
|
|
|
102
|
-
headson -n 400 -f
|
|
109
|
+
headson -n 400 -f json -t detailed data.json
|
|
110
|
+
|
|
111
|
+
- YAML with detailed comments:
|
|
112
|
+
|
|
113
|
+
headson -n 400 -f yaml -t detailed config.yaml
|
|
114
|
+
|
|
115
|
+
### Text mode
|
|
116
|
+
|
|
117
|
+
- Single file (auto):
|
|
118
|
+
|
|
119
|
+
headson -n 200 notes.txt
|
|
120
|
+
|
|
121
|
+
- Force Text ingest/output (useful when mixing with other extensions):
|
|
122
|
+
|
|
123
|
+
headson -n 200 -i text -f text notes.txt
|
|
124
|
+
|
|
125
|
+
- Many text files (fileset):
|
|
126
|
+
|
|
127
|
+
headson -n 800 -i text -f text logs/*.txt
|
|
128
|
+
|
|
129
|
+
- Styles on Text:
|
|
130
|
+
- default: omission as a standalone `…` line.
|
|
131
|
+
- detailed: omission as `… N more lines …`.
|
|
132
|
+
- strict: no array‑level omission line (individual long lines may still truncate with `…`).
|
|
103
133
|
|
|
104
134
|
Show help:
|
|
105
135
|
|
|
@@ -120,10 +150,10 @@ jq -c . users.json | head -c 80
|
|
|
120
150
|
# {"users":[{"id":1,"name":"Ana","roles":["admin","dev"]},{"id":2,"name":"Bo"}],"me
|
|
121
151
|
```
|
|
122
152
|
|
|
123
|
-
Structured preview with headson (
|
|
153
|
+
Structured preview with headson (JSON family, default style → Pseudo):
|
|
124
154
|
|
|
125
155
|
```bash
|
|
126
|
-
headson -n 120 -f
|
|
156
|
+
headson -n 120 -f json -t default users.json
|
|
127
157
|
# {
|
|
128
158
|
# users: [
|
|
129
159
|
# { id: 1, name: "Ana", roles: [ "admin", … ] },
|
|
@@ -133,10 +163,10 @@ headson -n 120 -f pseudo users.json
|
|
|
133
163
|
# }
|
|
134
164
|
```
|
|
135
165
|
|
|
136
|
-
Machine‑readable preview (
|
|
166
|
+
Machine‑readable preview (JSON family, strict style → strict JSON):
|
|
137
167
|
|
|
138
168
|
```bash
|
|
139
|
-
headson -n 120 -f json users.json
|
|
169
|
+
headson -n 120 -f json -t strict users.json
|
|
140
170
|
# {"users":[{"id":1,"name":"Ana","roles":["admin"]}],"meta":{"count":2}}
|
|
141
171
|
```
|
|
142
172
|
|
|
@@ -148,36 +178,44 @@ Regenerate locally:
|
|
|
148
178
|
- Run: cargo make tapes
|
|
149
179
|
- Outputs are written to docs/assets/tapes
|
|
150
180
|
|
|
181
|
+
|
|
151
182
|
## Python Bindings
|
|
152
183
|
|
|
153
184
|
A thin Python extension module is available on PyPI as `headson`.
|
|
154
185
|
|
|
155
|
-
|
|
186
|
+
- Install: `pip install headson` (ABI3 wheels for Python 3.10+ on Linux/macOS/Windows).
|
|
156
187
|
- API:
|
|
157
|
-
- `headson.summarize(text: str, *,
|
|
158
|
-
- `
|
|
188
|
+
- `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json", character_budget: int | None = None, skew: str = "balanced") -> str`
|
|
189
|
+
- `format`: `"auto" | "json" | "yaml"` (auto maps to JSON family for single inputs)
|
|
190
|
+
- `style`: `"strict" | "default" | "detailed"`
|
|
191
|
+
- `input_format`: `"json" | "yaml"` (ingestion)
|
|
159
192
|
- `character_budget`: maximum output size in characters (default: 500)
|
|
160
|
-
- `skew`:
|
|
193
|
+
- `skew`: `"balanced" | "head" | "tail"` (affects display styles; strict JSON remains unannotated)
|
|
161
194
|
|
|
162
|
-
|
|
195
|
+
Examples:
|
|
163
196
|
|
|
164
197
|
```python
|
|
165
198
|
import json
|
|
166
199
|
import headson
|
|
167
200
|
|
|
168
201
|
data = {"foo": [1, 2, 3], "bar": {"x": "y"}}
|
|
169
|
-
preview = headson.summarize(json.dumps(data),
|
|
202
|
+
preview = headson.summarize(json.dumps(data), format="json", style="strict", character_budget=200)
|
|
170
203
|
print(preview)
|
|
171
204
|
|
|
172
|
-
# Prefer the tail of arrays (annotations show
|
|
205
|
+
# Prefer the tail of arrays (annotations show with style="default"/"detailed")
|
|
173
206
|
print(
|
|
174
207
|
headson.summarize(
|
|
175
208
|
json.dumps(list(range(100))),
|
|
176
|
-
|
|
209
|
+
format="json",
|
|
210
|
+
style="detailed",
|
|
177
211
|
character_budget=80,
|
|
178
212
|
skew="tail",
|
|
179
213
|
)
|
|
180
214
|
)
|
|
215
|
+
|
|
216
|
+
# YAML support
|
|
217
|
+
doc = "root:\n items: [1,2,3,4,5,6,7,8,9,10]\n"
|
|
218
|
+
print(headson.summarize(doc, format="yaml", style="default", input_format="yaml", character_budget=60))
|
|
181
219
|
```
|
|
182
220
|
|
|
183
221
|
# Algorithm
|