headson 0.6.4__cp310-abi3-win_amd64.whl → 0.6.5__cp310-abi3-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.
Potentially problematic release.
This version of headson might be problematic. Click here for more details.
headson/headson.pyd
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: headson
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.5
|
|
4
4
|
Classifier: Programming Language :: Python
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
|
20
20
|
<br/>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
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
|
|
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 byte budget. (Just like `head`/`tail`, `headson` can also work with unstructured text files.)
|
|
24
24
|
|
|
25
25
|
Available as:
|
|
26
26
|
- CLI (see [Usage](#usage))
|
|
@@ -190,11 +190,11 @@ A thin Python extension module is available on PyPI as `headson`.
|
|
|
190
190
|
|
|
191
191
|
- Install: `pip install headson` (ABI3 wheels for Python 3.10+ on Linux/macOS/Windows).
|
|
192
192
|
- API:
|
|
193
|
-
- `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json",
|
|
193
|
+
- `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json", byte_budget: int | None = None, skew: str = "balanced") -> str`
|
|
194
194
|
- `format`: `"auto" | "json" | "yaml"` (auto maps to JSON family for single inputs)
|
|
195
195
|
- `style`: `"strict" | "default" | "detailed"`
|
|
196
196
|
- `input_format`: `"json" | "yaml"` (ingestion)
|
|
197
|
-
- `
|
|
197
|
+
- `byte_budget`: maximum output size in bytes (default: 500)
|
|
198
198
|
- `skew`: `"balanced" | "head" | "tail"` (affects display styles; strict JSON remains unannotated)
|
|
199
199
|
|
|
200
200
|
Examples:
|
|
@@ -204,7 +204,7 @@ import json
|
|
|
204
204
|
import headson
|
|
205
205
|
|
|
206
206
|
data = {"foo": [1, 2, 3], "bar": {"x": "y"}}
|
|
207
|
-
preview = headson.summarize(json.dumps(data), format="json", style="strict",
|
|
207
|
+
preview = headson.summarize(json.dumps(data), format="json", style="strict", byte_budget=200)
|
|
208
208
|
print(preview)
|
|
209
209
|
|
|
210
210
|
# Prefer the tail of arrays (annotations show with style="default"/"detailed")
|
|
@@ -213,14 +213,14 @@ print(
|
|
|
213
213
|
json.dumps(list(range(100))),
|
|
214
214
|
format="json",
|
|
215
215
|
style="detailed",
|
|
216
|
-
|
|
216
|
+
byte_budget=80,
|
|
217
217
|
skew="tail",
|
|
218
218
|
)
|
|
219
219
|
)
|
|
220
220
|
|
|
221
221
|
# YAML support
|
|
222
222
|
doc = "root:\n items: [1,2,3,4,5,6,7,8,9,10]\n"
|
|
223
|
-
print(headson.summarize(doc, format="yaml", style="default", input_format="yaml",
|
|
223
|
+
print(headson.summarize(doc, format="yaml", style="default", input_format="yaml", byte_budget=60))
|
|
224
224
|
```
|
|
225
225
|
|
|
226
226
|
# Algorithm
|
|
@@ -230,7 +230,7 @@ print(headson.summarize(doc, format="yaml", style="default", input_format="yaml"
|
|
|
230
230
|
## Footnotes
|
|
231
231
|
- <sup><b>[1]</b></sup> <b>Optimized tree representation</b>: An arena‑style tree stored in flat, contiguous buffers. Each node records its kind and value plus index ranges into shared child and key arrays. Arrays are ingested in a single pass and may be deterministically pre‑sampled: the first element is always kept; additional elements are selected via a fixed per‑index inclusion test; for kept elements, original indices are stored and full lengths are counted. This enables accurate omission info and internal gap markers later, while minimizing pointer chasing.
|
|
232
232
|
- <sup><b>[2]</b></sup> <b>Priority order</b>: Nodes are scored so previews surface representative structure and values first. Arrays can favor head/mid/tail coverage (default) or strictly the head; tail preference flips head/tail when configured. Object properties are ordered by key, and strings expand by grapheme with early characters prioritized over very deep expansions.
|
|
233
|
-
- <sup><b>[3]</b></sup> <b>Choose top N nodes (binary search)</b>: Iteratively picks N so that the rendered preview fits within the
|
|
233
|
+
- <sup><b>[3]</b></sup> <b>Choose top N nodes (binary search)</b>: Iteratively picks N so that the rendered preview fits within the byte budget, looping between “choose N” and a render attempt to converge quickly.
|
|
234
234
|
- <sup><b>[4]</b></sup> <b>Render attempt</b>: Serializes the currently included nodes using the selected template. Omission summaries and per-file section headers appear in display templates (pseudo/js); json remains strict. For arrays, display templates may insert internal gap markers between non‑contiguous kept items using original indices.
|
|
235
235
|
- <sup><b>[5]</b></sup> <b>Diagram source</b>: The Algorithm diagram is generated from `docs/diagrams/algorithm.mmd`. Regenerate the SVG with `cargo make diagrams` before releasing.
|
|
236
236
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
headson-0.6.5.dist-info/METADATA,sha256=3t0pjhTKOew4pPYlXB6suwXqDMiHND5y3jrTsx0lzSU,11007
|
|
2
|
+
headson-0.6.5.dist-info/WHEEL,sha256=4EDp_7DiFfWl1yYv5M4wSosAn5L_xgD1dyrQxQxfCx8,95
|
|
3
|
+
headson/__init__.py,sha256=Z-vwzLN9ptomZrtRqVUuUKSAaidOSVcjFI6Ojbuj-dU,219
|
|
4
|
+
headson/headson.pyd,sha256=3AtxfAJkMngHQBbX_7lIP0MxwJ_tEwcndtvY0rVM8GA,762880
|
|
5
|
+
headson-0.6.5.dist-info/RECORD,,
|
headson-0.6.4.dist-info/RECORD
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
headson-0.6.4.dist-info/METADATA,sha256=WidNGP3zBXfDNvrIPAB8NZqPfTgXIDcSgzBNqwh3084,11047
|
|
2
|
-
headson-0.6.4.dist-info/WHEEL,sha256=4EDp_7DiFfWl1yYv5M4wSosAn5L_xgD1dyrQxQxfCx8,95
|
|
3
|
-
headson/__init__.py,sha256=Z-vwzLN9ptomZrtRqVUuUKSAaidOSVcjFI6Ojbuj-dU,219
|
|
4
|
-
headson/headson.pyd,sha256=pJox3PeWAH6Vqj9L7uh4GDUpTPKkwcRwrNz193sH1bE,762880
|
|
5
|
-
headson-0.6.4.dist-info/RECORD,,
|
|
File without changes
|