headson 0.6.4__cp310-abi3-macosx_11_0_arm64.whl → 0.6.6__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.4
3
+ Version: 0.6.6
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 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))
@@ -70,7 +70,8 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
70
70
 
71
71
  Common flags:
72
72
 
73
- - `-c, --bytes <BYTES>`: per‑file output budget. For multiple inputs, default total budget is `<BYTES> * number_of_inputs`.
73
+ - `-c, --bytes <BYTES>`: per‑file output budget (bytes). For multiple inputs, default total budget is `<BYTES> * number_of_inputs`.
74
+ - `-u, --chars <CHARS>`: per‑file output budget (Unicode code points). Behaves like `--bytes` but counts characters instead of bytes.
74
75
  - `-C, --global-bytes <BYTES>`: total output budget across all inputs. With `--bytes`, the effective total is the smaller of the two.
75
76
  - `-f, --format <auto|json|yaml|text>`: output format (default: `auto`).
76
77
  - Auto: stdin → JSON family; filesets → per‑file based on extension (`.json` → JSON family, `.yaml`/`.yml` → YAML, unknown → Text).
@@ -97,6 +98,25 @@ Notes:
97
98
  - Directories and binary files are ignored; a notice is printed to stderr for each. Stdin reads the stream as‑is.
98
99
  - 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.
99
100
 
101
+ ## Budget Modes
102
+
103
+ - Bytes (`-c/--bytes`, `-C/--global-bytes`)
104
+ - Measures UTF‑8 bytes in the output.
105
+ - Default per‑file budget is 500 bytes when neither `--lines` nor `--chars` is provided.
106
+ - Multiple inputs: total default budget is `<BYTES> * number_of_inputs`; `--global-bytes` caps the total.
107
+
108
+ - Characters (`-u/--chars`)
109
+ - Measures Unicode code points (not grapheme clusters).
110
+
111
+ - Lines (`-n/--lines`, `-N/--global-lines`)
112
+ - Caps the number of lines in the output.
113
+ - Incompatible with `--no-newline`.
114
+ - Multiple inputs: defaults to `<LINES> * number_of_inputs`; `--global-lines` caps the total.
115
+
116
+ - Interactions and precedence
117
+ - All active budgets are enforced simultaneously. The render must satisfy all of: bytes (if set), chars (if set), and lines (if set). The strictest cap wins.
118
+ - When only lines are specified, no implicit byte cap applies. When neither lines nor chars are specified, a 500‑byte default applies.
119
+
100
120
  Quick one‑liners:
101
121
 
102
122
  - Peek a big JSON stream (keeps structure):
@@ -190,11 +210,11 @@ A thin Python extension module is available on PyPI as `headson`.
190
210
 
191
211
  - Install: `pip install headson` (ABI3 wheels for Python 3.10+ on Linux/macOS/Windows).
192
212
  - API:
193
- - `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json", character_budget: int | None = None, skew: str = "balanced") -> str`
213
+ - `headson.summarize(text: str, *, format: str = "auto", style: str = "default", input_format: str = "json", byte_budget: int | None = None, skew: str = "balanced") -> str`
194
214
  - `format`: `"auto" | "json" | "yaml"` (auto maps to JSON family for single inputs)
195
215
  - `style`: `"strict" | "default" | "detailed"`
196
216
  - `input_format`: `"json" | "yaml"` (ingestion)
197
- - `character_budget`: maximum output size in characters (default: 500)
217
+ - `byte_budget`: maximum output size in bytes (default: 500)
198
218
  - `skew`: `"balanced" | "head" | "tail"` (affects display styles; strict JSON remains unannotated)
199
219
 
200
220
  Examples:
@@ -204,7 +224,7 @@ import json
204
224
  import headson
205
225
 
206
226
  data = {"foo": [1, 2, 3], "bar": {"x": "y"}}
207
- preview = headson.summarize(json.dumps(data), format="json", style="strict", character_budget=200)
227
+ preview = headson.summarize(json.dumps(data), format="json", style="strict", byte_budget=200)
208
228
  print(preview)
209
229
 
210
230
  # Prefer the tail of arrays (annotations show with style="default"/"detailed")
@@ -213,14 +233,14 @@ print(
213
233
  json.dumps(list(range(100))),
214
234
  format="json",
215
235
  style="detailed",
216
- character_budget=80,
236
+ byte_budget=80,
217
237
  skew="tail",
218
238
  )
219
239
  )
220
240
 
221
241
  # YAML support
222
242
  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", character_budget=60))
243
+ print(headson.summarize(doc, format="yaml", style="default", input_format="yaml", byte_budget=60))
224
244
  ```
225
245
 
226
246
  # Algorithm
@@ -230,7 +250,7 @@ print(headson.summarize(doc, format="yaml", style="default", input_format="yaml"
230
250
  ## Footnotes
231
251
  - <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
252
  - <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 character budget, looping between “choose N” and a render attempt to converge quickly.
253
+ - <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
254
  - <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
255
  - <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
256
 
@@ -0,0 +1,5 @@
1
+ headson-0.6.6.dist-info/METADATA,sha256=M0QSPVaoOw9K86H6Yobcdorxin1cj-HWKvg9dOuqmy8,11871
2
+ headson-0.6.6.dist-info/WHEEL,sha256=-lwEpi49KOTCcgx48T3fLSP8Dxynwa-iRMZNo-JZaqc,103
3
+ headson/__init__.py,sha256=Z-vwzLN9ptomZrtRqVUuUKSAaidOSVcjFI6Ojbuj-dU,219
4
+ headson/headson.abi3.so,sha256=Ru8rk1RVkF2iQ4nJMmi2kPoZiZwSi0hxY0wYo4QegBI,853408
5
+ headson-0.6.6.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- headson-0.6.4.dist-info/METADATA,sha256=7Mndu2wmf9g4UAiispmuncvh6LLuQKTmiiz4S8VTLKI,10822
2
- headson-0.6.4.dist-info/WHEEL,sha256=-lwEpi49KOTCcgx48T3fLSP8Dxynwa-iRMZNo-JZaqc,103
3
- headson/__init__.py,sha256=Z-vwzLN9ptomZrtRqVUuUKSAaidOSVcjFI6Ojbuj-dU,219
4
- headson/headson.abi3.so,sha256=UtHCyMQNFNu5_Lyft6BLZXEQzWq5DV7msz4jNhzl0xU,853408
5
- headson-0.6.4.dist-info/RECORD,,