exstruct 0.2.71__tar.gz → 0.2.90__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: exstruct
3
- Version: 0.2.71
3
+ Version: 0.2.90
4
4
  Summary: Excel to structured JSON (tables, shapes, charts) for LLM/RAG pipelines
5
5
  Keywords: excel,structure,data,exstruct
6
6
  Author: harumiWeb
@@ -61,12 +61,12 @@ Description-Content-Type: text/markdown
61
61
 
62
62
  ExStruct reads Excel workbooks and outputs structured data (cells, table candidates, shapes, charts, print areas/views, auto page-break areas, hyperlinks) as JSON by default, with optional YAML/TOON formats. It targets both COM/Excel environments (rich extraction) and non-COM environments (cells + table candidates + print areas), with tunable detection heuristics and multiple output modes to fit LLM/RAG pipelines.
63
63
 
64
- [日本版README](README.ja.md)
64
+ [日本版 README](README.ja.md)
65
65
 
66
66
  ## Features
67
67
 
68
68
  - **Excel → Structured JSON**: cells, shapes, charts, table candidates, print areas/views, and auto page-break areas per sheet.
69
- - **Output modes**: `light` (cells + table candidates + print areas; no COM, shapes/charts empty), `standard` (texted shapes + arrows, charts, print areas), `verbose` (all shapes with width/height, charts with size, print areas). Verbose also emits cell hyperlinks. Size output is flag-controlled.
69
+ - **Output modes**: `light` (cells + table candidates + print areas; no COM, shapes/charts empty), `standard` (texted shapes + arrows, charts, print areas), `verbose` (all shapes with width/height, charts with size, print areas). Verbose also emits cell hyperlinks and `colors_map`. Size output is flag-controlled.
70
70
  - **Auto page-break export (COM only)**: capture Excel-computed auto page breaks and write per-area JSON/YAML/TOON when requested (CLI option appears only when COM is available).
71
71
  - **Formats**: JSON (compact by default, `--pretty` available), YAML, TOON (optional dependencies).
72
72
  - **Table detection tuning**: adjust heuristics at runtime via API.
@@ -189,7 +189,7 @@ Use higher thresholds to reduce false positives; lower them if true tables are m
189
189
 
190
190
  - **light**: cells + table candidates (no COM needed).
191
191
  - **standard**: texted shapes + arrows, charts (COM if available), table candidates. Hyperlinks are off unless `include_cell_links=True`.
192
- - **verbose**: all shapes (with width/height), charts, table candidates, and cell hyperlinks.
192
+ - **verbose**: all shapes (with width/height), charts, table candidates, cell hyperlinks, and `colors_map`.
193
193
 
194
194
  ## Error Handling / Fallbacks
195
195
 
@@ -274,12 +274,14 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
274
274
  ],
275
275
  "shapes": [
276
276
  {
277
+ "id": 1,
277
278
  "text": "開始",
278
279
  "l": 148,
279
280
  "t": 220,
280
281
  "type": "AutoShape-FlowchartProcess"
281
282
  },
282
283
  {
284
+ "id": 2,
283
285
  "text": "入力データ読み込み",
284
286
  "l": 132,
285
287
  "t": 282,
@@ -291,6 +293,8 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
291
293
  "type": "AutoShape-Mixed",
292
294
  "begin_arrow_style": 1,
293
295
  "end_arrow_style": 2,
296
+ "begin_id": 1,
297
+ "end_id": 2,
294
298
  "direction": "N"
295
299
  },
296
300
  ...
@@ -374,14 +378,14 @@ flowchart TD
374
378
 
375
379
  A --> B
376
380
  B --> C
377
- C -- no --> D
378
- C -- yes --> E
381
+ C -->|yes| D
382
+ C --> H
383
+ D --> E
379
384
  E --> F
380
- F -- yes --> E
381
- F -- no --> G
382
- G --> H
383
- H -- yes --> I
384
- H -- no --> J
385
+ F --> G
386
+ G -->|yes| I
387
+ G -->|no| J
388
+ H --> J
385
389
  I --> J
386
390
  ```
387
391
  ````
@@ -390,6 +394,12 @@ From this we can see:
390
394
 
391
395
  **exstruct's JSON is already in a format that AI can read and reason over directly.**
392
396
 
397
+ Other LLM inference samples using this library can be found in the following directory:
398
+
399
+ - [Basic Excel](sample/basic/)
400
+ - [Flowchart](sample/flowchart/)
401
+ - [Gantt Chart](sample/gantt_chart/)
402
+
393
403
  ### 4. Summary
394
404
 
395
405
  This benchmark confirms exstruct can:
@@ -405,6 +415,19 @@ In short, **exstruct = “an engine that converts Excel into a format AI can und
405
415
  - Default JSON is compact to reduce tokens; use `--pretty` or `pretty=True` when readability matters.
406
416
  - Field `table_candidates` replaces `tables`; adjust downstream consumers accordingly.
407
417
 
418
+ ## Enterprise Use
419
+
420
+ ExStruct is used primarily as a **library**, not a service.
421
+
422
+ - No official support or SLA is provided
423
+ - Long-term stability is prioritized over rapid feature growth
424
+ - Forking and internal modification are expected in enterprise use
425
+
426
+ This project is suitable for teams that:
427
+
428
+ - need transparency over black-box tools
429
+ - are comfortable maintaining internal forks if necessary
430
+
408
431
  ## Print Areas and Auto Page Breaks (PrintArea / PrintAreaView)
409
432
 
410
433
  - `SheetData.print_areas` holds print areas (cell coordinates) in light/standard/verbose.
@@ -420,3 +443,4 @@ BSD-3-Clause. See `LICENSE` for details.
420
443
  ## Documentation
421
444
 
422
445
  - API Reference (GitHub Pages): https://harumiweb.github.io/exstruct/
446
+ - JSON Schemas: see `schemas/` (one file per model); regenerate via `python scripts/gen_json_schema.py`.
@@ -6,12 +6,12 @@
6
6
 
7
7
  ExStruct reads Excel workbooks and outputs structured data (cells, table candidates, shapes, charts, print areas/views, auto page-break areas, hyperlinks) as JSON by default, with optional YAML/TOON formats. It targets both COM/Excel environments (rich extraction) and non-COM environments (cells + table candidates + print areas), with tunable detection heuristics and multiple output modes to fit LLM/RAG pipelines.
8
8
 
9
- [日本版README](README.ja.md)
9
+ [日本版 README](README.ja.md)
10
10
 
11
11
  ## Features
12
12
 
13
13
  - **Excel → Structured JSON**: cells, shapes, charts, table candidates, print areas/views, and auto page-break areas per sheet.
14
- - **Output modes**: `light` (cells + table candidates + print areas; no COM, shapes/charts empty), `standard` (texted shapes + arrows, charts, print areas), `verbose` (all shapes with width/height, charts with size, print areas). Verbose also emits cell hyperlinks. Size output is flag-controlled.
14
+ - **Output modes**: `light` (cells + table candidates + print areas; no COM, shapes/charts empty), `standard` (texted shapes + arrows, charts, print areas), `verbose` (all shapes with width/height, charts with size, print areas). Verbose also emits cell hyperlinks and `colors_map`. Size output is flag-controlled.
15
15
  - **Auto page-break export (COM only)**: capture Excel-computed auto page breaks and write per-area JSON/YAML/TOON when requested (CLI option appears only when COM is available).
16
16
  - **Formats**: JSON (compact by default, `--pretty` available), YAML, TOON (optional dependencies).
17
17
  - **Table detection tuning**: adjust heuristics at runtime via API.
@@ -134,7 +134,7 @@ Use higher thresholds to reduce false positives; lower them if true tables are m
134
134
 
135
135
  - **light**: cells + table candidates (no COM needed).
136
136
  - **standard**: texted shapes + arrows, charts (COM if available), table candidates. Hyperlinks are off unless `include_cell_links=True`.
137
- - **verbose**: all shapes (with width/height), charts, table candidates, and cell hyperlinks.
137
+ - **verbose**: all shapes (with width/height), charts, table candidates, cell hyperlinks, and `colors_map`.
138
138
 
139
139
  ## Error Handling / Fallbacks
140
140
 
@@ -219,12 +219,14 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
219
219
  ],
220
220
  "shapes": [
221
221
  {
222
+ "id": 1,
222
223
  "text": "開始",
223
224
  "l": 148,
224
225
  "t": 220,
225
226
  "type": "AutoShape-FlowchartProcess"
226
227
  },
227
228
  {
229
+ "id": 2,
228
230
  "text": "入力データ読み込み",
229
231
  "l": 132,
230
232
  "t": 282,
@@ -236,6 +238,8 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
236
238
  "type": "AutoShape-Mixed",
237
239
  "begin_arrow_style": 1,
238
240
  "end_arrow_style": 2,
241
+ "begin_id": 1,
242
+ "end_id": 2,
239
243
  "direction": "N"
240
244
  },
241
245
  ...
@@ -319,14 +323,14 @@ flowchart TD
319
323
 
320
324
  A --> B
321
325
  B --> C
322
- C -- no --> D
323
- C -- yes --> E
326
+ C -->|yes| D
327
+ C --> H
328
+ D --> E
324
329
  E --> F
325
- F -- yes --> E
326
- F -- no --> G
327
- G --> H
328
- H -- yes --> I
329
- H -- no --> J
330
+ F --> G
331
+ G -->|yes| I
332
+ G -->|no| J
333
+ H --> J
330
334
  I --> J
331
335
  ```
332
336
  ````
@@ -335,6 +339,12 @@ From this we can see:
335
339
 
336
340
  **exstruct's JSON is already in a format that AI can read and reason over directly.**
337
341
 
342
+ Other LLM inference samples using this library can be found in the following directory:
343
+
344
+ - [Basic Excel](sample/basic/)
345
+ - [Flowchart](sample/flowchart/)
346
+ - [Gantt Chart](sample/gantt_chart/)
347
+
338
348
  ### 4. Summary
339
349
 
340
350
  This benchmark confirms exstruct can:
@@ -350,6 +360,19 @@ In short, **exstruct = “an engine that converts Excel into a format AI can und
350
360
  - Default JSON is compact to reduce tokens; use `--pretty` or `pretty=True` when readability matters.
351
361
  - Field `table_candidates` replaces `tables`; adjust downstream consumers accordingly.
352
362
 
363
+ ## Enterprise Use
364
+
365
+ ExStruct is used primarily as a **library**, not a service.
366
+
367
+ - No official support or SLA is provided
368
+ - Long-term stability is prioritized over rapid feature growth
369
+ - Forking and internal modification are expected in enterprise use
370
+
371
+ This project is suitable for teams that:
372
+
373
+ - need transparency over black-box tools
374
+ - are comfortable maintaining internal forks if necessary
375
+
353
376
  ## Print Areas and Auto Page Breaks (PrintArea / PrintAreaView)
354
377
 
355
378
  - `SheetData.print_areas` holds print areas (cell coordinates) in light/standard/verbose.
@@ -365,3 +388,4 @@ BSD-3-Clause. See `LICENSE` for details.
365
388
  ## Documentation
366
389
 
367
390
  - API Reference (GitHub Pages): https://harumiweb.github.io/exstruct/
391
+ - JSON Schemas: see `schemas/` (one file per model); regenerate via `python scripts/gen_json_schema.py`.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "exstruct"
3
- version = "0.2.71"
3
+ version = "0.2.90"
4
4
  description = "Excel to structured JSON (tables, shapes, charts) for LLM/RAG pipelines"
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -7,6 +7,7 @@ from typing import Literal, TextIO
7
7
  from .core.cells import set_table_detection_params
8
8
  from .core.integrate import extract_workbook
9
9
  from .engine import (
10
+ ColorsOptions,
10
11
  DestinationOptions,
11
12
  ExStructEngine,
12
13
  FilterOptions,
@@ -76,6 +77,7 @@ __all__ = [
76
77
  "OutputOptions",
77
78
  "FilterOptions",
78
79
  "DestinationOptions",
80
+ "ColorsOptions",
79
81
  "serialize_workbook",
80
82
  "export_auto_page_breaks",
81
83
  ]
@@ -110,8 +112,13 @@ def extract(file_path: str | Path, mode: ExtractionMode = "standard") -> Workboo
110
112
  ['A1:B5']
111
113
  """
112
114
  include_links = True if mode == "verbose" else False
115
+ include_colors_map = True if mode == "verbose" else None
113
116
  engine = ExStructEngine(
114
- options=StructOptions(mode=mode, include_cell_links=include_links)
117
+ options=StructOptions(
118
+ mode=mode,
119
+ include_cell_links=include_links,
120
+ include_colors_map=include_colors_map,
121
+ )
115
122
  )
116
123
  return engine.extract(file_path, mode=mode)
117
124
 
@@ -2,11 +2,30 @@ from __future__ import annotations
2
2
 
3
3
  import argparse
4
4
  from pathlib import Path
5
+ import sys
5
6
 
6
7
  from exstruct import process_excel
7
8
  from exstruct.cli.availability import ComAvailability, get_com_availability
8
9
 
9
10
 
11
+ def _ensure_utf8_stdout() -> None:
12
+ """Reconfigure stdout to UTF-8 when supported.
13
+
14
+ Windows consoles default to cp932 and can raise encoding errors when piping
15
+ non-ASCII characters. Reconfiguring prevents failures without affecting
16
+ environments that already default to UTF-8.
17
+ """
18
+
19
+ stdout = sys.stdout
20
+ if not hasattr(stdout, "reconfigure"):
21
+ return
22
+ reconfigure = stdout.reconfigure
23
+ try:
24
+ reconfigure(encoding="utf-8", errors="replace")
25
+ except (AttributeError, ValueError):
26
+ return
27
+
28
+
10
29
  def _add_auto_page_breaks_argument(
11
30
  parser: argparse.ArgumentParser, availability: ComAvailability
12
31
  ) -> None:
@@ -102,6 +121,7 @@ def main(argv: list[str] | None = None) -> int:
102
121
  Returns:
103
122
  Exit code (0 for success, 1 for failure).
104
123
  """
124
+ _ensure_utf8_stdout()
105
125
  parser = build_parser()
106
126
  args = parser.parse_args(argv)
107
127