headson 0.6.3__cp310-abi3-macosx_11_0_arm64.whl → 0.6.5__cp310-abi3-macosx_11_0_arm64.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.abi3.so CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: headson
3
- Version: 0.6.3
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,12 +20,15 @@ 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 character budget. (Just like `head`/`tail`, `headson` can also work with unstructured text files.)
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))
27
27
  - Python library (see [Python Bindings](#python-bindings))
28
28
 
29
+ ![Codecov](https://img.shields.io/codecov/c/github/kantord/headson?style=flat-square) ![Crates.io Version](https://img.shields.io/crates/v/headson?style=flat-square) ![PyPI - Version](https://img.shields.io/pypi/v/headson?style=flat-square)
30
+
31
+
29
32
  ## Install
30
33
 
31
34
  Using Cargo:
@@ -67,8 +70,8 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
67
70
 
68
71
  Common flags:
69
72
 
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.
73
+ - `-c, --bytes <BYTES>`: per‑file output budget. For multiple inputs, default total budget is `<BYTES> * number_of_inputs`.
74
+ - `-C, --global-bytes <BYTES>`: total output budget across all inputs. With `--bytes`, the effective total is the smaller of the two.
72
75
  - `-f, --format <auto|json|yaml|text>`: output format (default: `auto`).
73
76
  - Auto: stdin → JSON family; filesets → per‑file based on extension (`.json` → JSON family, `.yaml`/`.yml` → YAML, unknown → Text).
74
77
  - `-t, --template <strict|default|detailed>`: output style (default: `default`).
@@ -89,7 +92,7 @@ Notes:
89
92
  - With newlines enabled, file sections are rendered with human‑readable headers. In compact/single‑line modes, headers are omitted.
90
93
  - In `--format auto`, each file uses its own best format: JSON family for `.json`, YAML for `.yaml`/`.yml`.
91
94
  - 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.
95
+ - `--global-bytes` may truncate or omit entire files to respect the total budget.
93
96
  - The tool finds the largest preview that fits the budget; even if extremely tight, you still get a minimal, valid preview.
94
97
  - Directories and binary files are ignored; a notice is printed to stderr for each. Stdin reads the stream as‑is.
95
98
  - 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.
@@ -98,33 +101,33 @@ Quick one‑liners:
98
101
 
99
102
  - Peek a big JSON stream (keeps structure):
100
103
 
101
- zstdcat huge.json.zst | headson -n 800 -f json -t default
104
+ zstdcat huge.json.zst | headson -c 800 -f json -t default
102
105
 
103
106
  - Many files with a fixed overall size:
104
107
 
105
- headson -N 1200 -f json -t strict logs/*.json
108
+ headson -C 1200 -f json -t strict logs/*.json
106
109
 
107
110
  - Glance at a file, JavaScript‑style comments for omissions:
108
111
 
109
- headson -n 400 -f json -t detailed data.json
112
+ headson -c 400 -f json -t detailed data.json
110
113
 
111
114
  - YAML with detailed comments:
112
115
 
113
- headson -n 400 -f yaml -t detailed config.yaml
116
+ headson -c 400 -f yaml -t detailed config.yaml
114
117
 
115
118
  ### Text mode
116
119
 
117
120
  - Single file (auto):
118
121
 
119
- headson -n 200 notes.txt
122
+ headson -c 200 notes.txt
120
123
 
121
124
  - Force Text ingest/output (useful when mixing with other extensions):
122
125
 
123
- headson -n 200 -i text -f text notes.txt
126
+ headson -c 200 -i text -f text notes.txt
124
127
 
125
128
  - Many text files (fileset):
126
129
 
127
- headson -n 800 -i text -f text logs/*.txt
130
+ headson -c 800 -i text -f text logs/*.txt
128
131
 
129
132
  - Styles on Text:
130
133
  - default: omission as a standalone `…` line.
@@ -135,6 +138,8 @@ Show help:
135
138
 
136
139
  headson --help
137
140
 
141
+ Note: flags align with head/tail conventions (`-c/--bytes`, `-C/--global-bytes`).
142
+
138
143
  ## Examples: head vs headson
139
144
 
140
145
  Input:
@@ -153,7 +158,7 @@ jq -c . users.json | head -c 80
153
158
  Structured preview with headson (JSON family, default style → Pseudo):
154
159
 
155
160
  ```bash
156
- headson -n 120 -f json -t default users.json
161
+ headson -c 120 -f json -t default users.json
157
162
  # {
158
163
  # users: [
159
164
  # { id: 1, name: "Ana", roles: [ "admin", … ] },
@@ -166,7 +171,7 @@ headson -n 120 -f json -t default users.json
166
171
  Machine‑readable preview (JSON family, strict style → strict JSON):
167
172
 
168
173
  ```bash
169
- headson -n 120 -f json -t strict users.json
174
+ headson -c 120 -f json -t strict users.json
170
175
  # {"users":[{"id":1,"name":"Ana","roles":["admin"]}],"meta":{"count":2}}
171
176
  ```
172
177
 
@@ -185,11 +190,11 @@ A thin Python extension module is available on PyPI as `headson`.
185
190
 
186
191
  - Install: `pip install headson` (ABI3 wheels for Python 3.10+ on Linux/macOS/Windows).
187
192
  - API:
188
- - `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json", character_budget: int | None = None, skew: str = "balanced") -> str`
193
+ - `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json", byte_budget: int | None = None, skew: str = "balanced") -> str`
189
194
  - `format`: `"auto" | "json" | "yaml"` (auto maps to JSON family for single inputs)
190
195
  - `style`: `"strict" | "default" | "detailed"`
191
196
  - `input_format`: `"json" | "yaml"` (ingestion)
192
- - `character_budget`: maximum output size in characters (default: 500)
197
+ - `byte_budget`: maximum output size in bytes (default: 500)
193
198
  - `skew`: `"balanced" | "head" | "tail"` (affects display styles; strict JSON remains unannotated)
194
199
 
195
200
  Examples:
@@ -199,7 +204,7 @@ import json
199
204
  import headson
200
205
 
201
206
  data = {"foo": [1, 2, 3], "bar": {"x": "y"}}
202
- preview = headson.summarize(json.dumps(data), format="json", style="strict", character_budget=200)
207
+ preview = headson.summarize(json.dumps(data), format="json", style="strict", byte_budget=200)
203
208
  print(preview)
204
209
 
205
210
  # Prefer the tail of arrays (annotations show with style="default"/"detailed")
@@ -208,14 +213,14 @@ print(
208
213
  json.dumps(list(range(100))),
209
214
  format="json",
210
215
  style="detailed",
211
- character_budget=80,
216
+ byte_budget=80,
212
217
  skew="tail",
213
218
  )
214
219
  )
215
220
 
216
221
  # YAML support
217
222
  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))
223
+ print(headson.summarize(doc, format="yaml", style="default", input_format="yaml", byte_budget=60))
219
224
  ```
220
225
 
221
226
  # Algorithm
@@ -225,7 +230,7 @@ print(headson.summarize(doc, format="yaml", style="default", input_format="yaml"
225
230
  ## Footnotes
226
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.
227
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.
228
- - <sup><b>[3]</b></sup> <b>Choose top N nodes (binary search)</b>: Iteratively picks N so that the rendered preview fits within the character budget, looping between “choose N” and a render attempt to converge quickly.
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.
229
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.
230
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.
231
236
 
@@ -0,0 +1,5 @@
1
+ headson-0.6.5.dist-info/METADATA,sha256=TnCNEuY5-ExHHo3f2U3IG5fXljO04XKaaSebi24vhCg,10782
2
+ headson-0.6.5.dist-info/WHEEL,sha256=-lwEpi49KOTCcgx48T3fLSP8Dxynwa-iRMZNo-JZaqc,103
3
+ headson/__init__.py,sha256=Z-vwzLN9ptomZrtRqVUuUKSAaidOSVcjFI6Ojbuj-dU,219
4
+ headson/headson.abi3.so,sha256=EIawdIcq2XrElDWbhmY5VMIWKPmUR3BNfFjsKSR6oCA,853408
5
+ headson-0.6.5.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- headson-0.6.3.dist-info/METADATA,sha256=-XUXLS7kujupBt2kqNLMoKyx6GJmbq0E415Nh_Qs7xk,10500
2
- headson-0.6.3.dist-info/WHEEL,sha256=-lwEpi49KOTCcgx48T3fLSP8Dxynwa-iRMZNo-JZaqc,103
3
- headson/__init__.py,sha256=Z-vwzLN9ptomZrtRqVUuUKSAaidOSVcjFI6Ojbuj-dU,219
4
- headson/headson.abi3.so,sha256=-BlSgXzSGKMPZcFekoLb4pfuIhPfs27yfCIcZ-2c4_8,853440
5
- headson-0.6.3.dist-info/RECORD,,