exstruct 0.3.0__tar.gz → 0.3.2__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.
Files changed (31) hide show
  1. {exstruct-0.3.0 → exstruct-0.3.2}/PKG-INFO +114 -9
  2. {exstruct-0.3.0 → exstruct-0.3.2}/README.md +113 -8
  3. {exstruct-0.3.0 → exstruct-0.3.2}/pyproject.toml +133 -128
  4. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/__init__.py +7 -7
  5. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/base.py +42 -38
  6. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/com_backend.py +230 -226
  7. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/openpyxl_backend.py +191 -179
  8. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/cells.py +36 -1
  9. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/charts.py +243 -241
  10. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/integrate.py +55 -52
  11. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/logging_utils.py +16 -16
  12. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/modeling.py +87 -74
  13. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/pipeline.py +749 -696
  14. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/ranges.py +48 -48
  15. exstruct-0.3.2/src/exstruct/core/shapes.py +521 -0
  16. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/workbook.py +114 -114
  17. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/engine.py +9 -0
  18. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/errors.py +46 -46
  19. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/io/__init__.py +58 -6
  20. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/io/serialize.py +112 -112
  21. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/models/__init__.py +47 -5
  22. exstruct-0.3.0/src/exstruct/core/shapes.py +0 -275
  23. {exstruct-0.3.0 → exstruct-0.3.2}/LICENSE +0 -0
  24. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/__init__.py +0 -0
  25. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/cli/availability.py +0 -0
  26. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/cli/main.py +0 -0
  27. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/__init__.py +0 -0
  28. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/models/maps.py +0 -0
  29. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/models/types.py +0 -0
  30. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/py.typed +0 -0
  31. {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/render/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: exstruct
3
- Version: 0.3.0
3
+ Version: 0.3.2
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
@@ -55,18 +55,18 @@ Description-Content-Type: text/markdown
55
55
 
56
56
  # ExStruct — Excel Structured Extraction Engine
57
57
 
58
- [![PyPI version](https://badge.fury.io/py/exstruct.svg)](https://pypi.org/project/exstruct/) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/exstruct?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/exstruct) ![Licence: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square) [![pytest](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml/badge.svg)](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/e081cb4f634e4175b259eb7c34f54f60)](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
58
+ [![PyPI version](https://badge.fury.io/py/exstruct.svg)](https://pypi.org/project/exstruct/) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/exstruct?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/exstruct) ![Licence: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square) [![pytest](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml/badge.svg)](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/e081cb4f634e4175b259eb7c34f54f60)](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![codecov](https://codecov.io/gh/harumiWeb/exstruct/graph/badge.svg?token=2XI1O8TTA9)](https://codecov.io/gh/harumiWeb/exstruct)
59
59
 
60
60
  ![ExStruct Image](/docs/assets/icon.webp)
61
61
 
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.
62
+ ExStruct reads Excel workbooks and outputs structured data (cells, table candidates, shapes, charts, smartart, merged cell ranges, 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
64
  [日本版 README](README.ja.md)
65
65
 
66
66
  ## Features
67
67
 
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 and `colors_map`. Size output is flag-controlled.
68
+ - **Excel → Structured JSON**: cells, shapes, charts, smartart, 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, smartart, merged cell ranges, print areas), `verbose` (all shapes with width/height, charts with size, merged cell ranges, 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.
@@ -188,8 +188,8 @@ Use higher thresholds to reduce false positives; lower them if true tables are m
188
188
  ## Output Modes
189
189
 
190
190
  - **light**: cells + table candidates (no COM needed).
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, cell hyperlinks, and `colors_map`.
191
+ - **standard**: texted shapes + arrows, charts (COM if available), merged cell ranges, table candidates. Hyperlinks are off unless `include_cell_links=True`.
192
+ - **verbose**: all shapes (with width/height), charts, merged cell ranges, table candidates, cell hyperlinks, and `colors_map`.
193
193
 
194
194
  ## Error Handling / Fallbacks
195
195
 
@@ -207,7 +207,7 @@ exstruct input.xlsx --pdf --image --dpi 144
207
207
 
208
208
  Creates `<output>.pdf` and `<output>_images/` PNGs per sheet.
209
209
 
210
- ## Benchmark: Excel Structuring Demo
210
+ ## Example 1: Excel Structuring Demo
211
211
 
212
212
  To show how well exstruct can structure Excel, we parse a workbook that combines three elements on one sheet and share an AI reasoning benchmark that uses the JSON output.
213
213
 
@@ -277,6 +277,7 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
277
277
  "text": "開始",
278
278
  "l": 148,
279
279
  "t": 220,
280
+ "kind": "shape",
280
281
  "type": "AutoShape-FlowchartProcess"
281
282
  },
282
283
  {
@@ -284,12 +285,13 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
284
285
  "text": "入力データ読み込み",
285
286
  "l": 132,
286
287
  "t": 282,
288
+ "kind": "shape",
287
289
  "type": "AutoShape-FlowchartProcess"
288
290
  },
289
291
  {
290
292
  "l": 193,
291
293
  "t": 246,
292
- "type": "AutoShape-Mixed",
294
+ "kind": "arrow",
293
295
  "begin_arrow_style": 1,
294
296
  "end_arrow_style": 2,
295
297
  "begin_id": 1,
@@ -389,6 +391,87 @@ flowchart TD
389
391
  ```
390
392
  ````
391
393
 
394
+ ## Example 2: General Application Form
395
+
396
+ ### Excel Sheet
397
+
398
+ ![General Application Form Excel](/docs/assets/demo_form.en.png)
399
+
400
+ ### ExStruct JSON
401
+
402
+ (Truncated for brevity)
403
+
404
+ ```json
405
+ {
406
+ "book_name": "ja_form.xlsx",
407
+ "sheets": {
408
+ "Sheet1": {
409
+ "rows": [
410
+ { "r": 1, "c": { "0": "??????????????" } },
411
+ {
412
+ "r": 3,
413
+ "c": { "0": "???", "7": " ???????????????" }
414
+ },
415
+ { "r": 4, "c": { "1": "X???" } },
416
+ ...
417
+ ],
418
+ "table_candidates": ["B25:C26", "C37:D50"],
419
+ "merged_cells": [
420
+ {
421
+ "r1": 55,
422
+ "c1": 5,
423
+ "r2": 55,
424
+ "c2": 10,
425
+ "v": "?????????????????????????????"
426
+ },
427
+ { "r1": 54, "c1": 8, "r2": 54, "c2": 10 },
428
+ { "r1": 51, "c1": 5, "r2": 52, "c2": 6, "v": "????" },
429
+ ...
430
+ ]
431
+ }
432
+ }
433
+ }
434
+ ```
435
+
436
+ ### LLM reconstruction example
437
+
438
+ ```md
439
+ # ??????????????
440
+
441
+ ????????????????????????
442
+ X ??
443
+
444
+ ?????????????????????????????????????????
445
+
446
+ ---
447
+
448
+ ## ??????
449
+
450
+ | ?? | ?? |
451
+ | ------ | -------------- |
452
+ | ???? | |
453
+ | ????? | |
454
+ | ?????? | |
455
+ | ???? | |
456
+ | ???? | ?????????????? |
457
+ | ?? | |
458
+ | ??? | |
459
+
460
+ ---
461
+
462
+ ## ?????????????
463
+
464
+ | ?? | ?? |
465
+ | ----------- | ----- |
466
+ | ??????????? | |
467
+ | ??? | |
468
+ | ???????? | ????? |
469
+
470
+ **???????????????????????????????????????**
471
+
472
+ ...
473
+ ```
474
+
392
475
  From this we can see:
393
476
 
394
477
  **exstruct's JSON is already in a format that AI can read and reason over directly.**
@@ -398,6 +481,7 @@ Other LLM inference samples using this library can be found in the following dir
398
481
  - [Basic Excel](sample/basic/)
399
482
  - [Flowchart](sample/flowchart/)
400
483
  - [Gantt Chart](sample/gantt_chart/)
484
+ - [Application forms with many merged cells](sample/forms_with_many_merged_cells/)
401
485
 
402
486
  ### 4. Summary
403
487
 
@@ -435,6 +519,27 @@ This project is suitable for teams that:
435
519
  - Use CLI `--auto-page-breaks-dir` (COM only), `DestinationOptions.auto_page_breaks_dir` (preferred), or `export_auto_page_breaks(...)` to write per-auto-page-break files; the API raises `ValueError` if no auto page breaks exist.
436
520
  - `PrintAreaView` includes rows and table candidates inside the area, plus shapes/charts that overlap the area (size-less shapes are treated as points). `normalize=True` rebases row/col indices to the area origin.
437
521
 
522
+ ## Architecture
523
+
524
+ ExStruct uses a pipeline-based architecture that separates
525
+ extraction strategy (Backend) from orchestration (Pipeline)
526
+ and semantic modeling.
527
+
528
+ → See: [docs/architecture/pipeline.md](docs/architecture/pipeline.md)
529
+
530
+ ## Contributing
531
+
532
+ If you plan to extend ExStruct internals,
533
+ please read the contributor architecture guide.
534
+
535
+ → [docs/contributors/architecture.md](docs/contributors/architecture.md)
536
+
537
+ ## Note on coverage
538
+
539
+ The cell-structure inference logic (cells.py) relies on heuristic rules
540
+ and Excel-specific behaviors. Full coverage is intentionally not pursued,
541
+ as exhaustive testing would not reflect real-world reliability.
542
+
438
543
  ## License
439
544
 
440
545
  BSD-3-Clause. See `LICENSE` for details.
@@ -1,17 +1,17 @@
1
1
  # ExStruct — Excel Structured Extraction Engine
2
2
 
3
- [![PyPI version](https://badge.fury.io/py/exstruct.svg)](https://pypi.org/project/exstruct/) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/exstruct?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/exstruct) ![Licence: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square) [![pytest](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml/badge.svg)](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/e081cb4f634e4175b259eb7c34f54f60)](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
3
+ [![PyPI version](https://badge.fury.io/py/exstruct.svg)](https://pypi.org/project/exstruct/) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/exstruct?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/exstruct) ![Licence: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square) [![pytest](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml/badge.svg)](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/e081cb4f634e4175b259eb7c34f54f60)](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![codecov](https://codecov.io/gh/harumiWeb/exstruct/graph/badge.svg?token=2XI1O8TTA9)](https://codecov.io/gh/harumiWeb/exstruct)
4
4
 
5
5
  ![ExStruct Image](/docs/assets/icon.webp)
6
6
 
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.
7
+ ExStruct reads Excel workbooks and outputs structured data (cells, table candidates, shapes, charts, smartart, merged cell ranges, 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
9
  [日本版 README](README.ja.md)
10
10
 
11
11
  ## Features
12
12
 
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 and `colors_map`. Size output is flag-controlled.
13
+ - **Excel → Structured JSON**: cells, shapes, charts, smartart, 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, smartart, merged cell ranges, print areas), `verbose` (all shapes with width/height, charts with size, merged cell ranges, 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.
@@ -133,8 +133,8 @@ Use higher thresholds to reduce false positives; lower them if true tables are m
133
133
  ## Output Modes
134
134
 
135
135
  - **light**: cells + table candidates (no COM needed).
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, cell hyperlinks, and `colors_map`.
136
+ - **standard**: texted shapes + arrows, charts (COM if available), merged cell ranges, table candidates. Hyperlinks are off unless `include_cell_links=True`.
137
+ - **verbose**: all shapes (with width/height), charts, merged cell ranges, table candidates, cell hyperlinks, and `colors_map`.
138
138
 
139
139
  ## Error Handling / Fallbacks
140
140
 
@@ -152,7 +152,7 @@ exstruct input.xlsx --pdf --image --dpi 144
152
152
 
153
153
  Creates `<output>.pdf` and `<output>_images/` PNGs per sheet.
154
154
 
155
- ## Benchmark: Excel Structuring Demo
155
+ ## Example 1: Excel Structuring Demo
156
156
 
157
157
  To show how well exstruct can structure Excel, we parse a workbook that combines three elements on one sheet and share an AI reasoning benchmark that uses the JSON output.
158
158
 
@@ -222,6 +222,7 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
222
222
  "text": "開始",
223
223
  "l": 148,
224
224
  "t": 220,
225
+ "kind": "shape",
225
226
  "type": "AutoShape-FlowchartProcess"
226
227
  },
227
228
  {
@@ -229,12 +230,13 @@ Below is a **shortened JSON output example** from parsing this Excel workbook.
229
230
  "text": "入力データ読み込み",
230
231
  "l": 132,
231
232
  "t": 282,
233
+ "kind": "shape",
232
234
  "type": "AutoShape-FlowchartProcess"
233
235
  },
234
236
  {
235
237
  "l": 193,
236
238
  "t": 246,
237
- "type": "AutoShape-Mixed",
239
+ "kind": "arrow",
238
240
  "begin_arrow_style": 1,
239
241
  "end_arrow_style": 2,
240
242
  "begin_id": 1,
@@ -334,6 +336,87 @@ flowchart TD
334
336
  ```
335
337
  ````
336
338
 
339
+ ## Example 2: General Application Form
340
+
341
+ ### Excel Sheet
342
+
343
+ ![General Application Form Excel](/docs/assets/demo_form.en.png)
344
+
345
+ ### ExStruct JSON
346
+
347
+ (Truncated for brevity)
348
+
349
+ ```json
350
+ {
351
+ "book_name": "ja_form.xlsx",
352
+ "sheets": {
353
+ "Sheet1": {
354
+ "rows": [
355
+ { "r": 1, "c": { "0": "??????????????" } },
356
+ {
357
+ "r": 3,
358
+ "c": { "0": "???", "7": " ???????????????" }
359
+ },
360
+ { "r": 4, "c": { "1": "X???" } },
361
+ ...
362
+ ],
363
+ "table_candidates": ["B25:C26", "C37:D50"],
364
+ "merged_cells": [
365
+ {
366
+ "r1": 55,
367
+ "c1": 5,
368
+ "r2": 55,
369
+ "c2": 10,
370
+ "v": "?????????????????????????????"
371
+ },
372
+ { "r1": 54, "c1": 8, "r2": 54, "c2": 10 },
373
+ { "r1": 51, "c1": 5, "r2": 52, "c2": 6, "v": "????" },
374
+ ...
375
+ ]
376
+ }
377
+ }
378
+ }
379
+ ```
380
+
381
+ ### LLM reconstruction example
382
+
383
+ ```md
384
+ # ??????????????
385
+
386
+ ????????????????????????
387
+ X ??
388
+
389
+ ?????????????????????????????????????????
390
+
391
+ ---
392
+
393
+ ## ??????
394
+
395
+ | ?? | ?? |
396
+ | ------ | -------------- |
397
+ | ???? | |
398
+ | ????? | |
399
+ | ?????? | |
400
+ | ???? | |
401
+ | ???? | ?????????????? |
402
+ | ?? | |
403
+ | ??? | |
404
+
405
+ ---
406
+
407
+ ## ?????????????
408
+
409
+ | ?? | ?? |
410
+ | ----------- | ----- |
411
+ | ??????????? | |
412
+ | ??? | |
413
+ | ???????? | ????? |
414
+
415
+ **???????????????????????????????????????**
416
+
417
+ ...
418
+ ```
419
+
337
420
  From this we can see:
338
421
 
339
422
  **exstruct's JSON is already in a format that AI can read and reason over directly.**
@@ -343,6 +426,7 @@ Other LLM inference samples using this library can be found in the following dir
343
426
  - [Basic Excel](sample/basic/)
344
427
  - [Flowchart](sample/flowchart/)
345
428
  - [Gantt Chart](sample/gantt_chart/)
429
+ - [Application forms with many merged cells](sample/forms_with_many_merged_cells/)
346
430
 
347
431
  ### 4. Summary
348
432
 
@@ -380,6 +464,27 @@ This project is suitable for teams that:
380
464
  - Use CLI `--auto-page-breaks-dir` (COM only), `DestinationOptions.auto_page_breaks_dir` (preferred), or `export_auto_page_breaks(...)` to write per-auto-page-break files; the API raises `ValueError` if no auto page breaks exist.
381
465
  - `PrintAreaView` includes rows and table candidates inside the area, plus shapes/charts that overlap the area (size-less shapes are treated as points). `normalize=True` rebases row/col indices to the area origin.
382
466
 
467
+ ## Architecture
468
+
469
+ ExStruct uses a pipeline-based architecture that separates
470
+ extraction strategy (Backend) from orchestration (Pipeline)
471
+ and semantic modeling.
472
+
473
+ → See: [docs/architecture/pipeline.md](docs/architecture/pipeline.md)
474
+
475
+ ## Contributing
476
+
477
+ If you plan to extend ExStruct internals,
478
+ please read the contributor architecture guide.
479
+
480
+ → [docs/contributors/architecture.md](docs/contributors/architecture.md)
481
+
482
+ ## Note on coverage
483
+
484
+ The cell-structure inference logic (cells.py) relies on heuristic rules
485
+ and Excel-specific behaviors. Full coverage is intentionally not pursued,
486
+ as exhaustive testing would not reflect real-world reliability.
487
+
383
488
  ## License
384
489
 
385
490
  BSD-3-Clause. See `LICENSE` for details.
@@ -1,128 +1,133 @@
1
- [project]
2
- name = "exstruct"
3
- version = "0.3.0"
4
- description = "Excel to structured JSON (tables, shapes, charts) for LLM/RAG pipelines"
5
- readme = "README.md"
6
- license = { file = "LICENSE" }
7
- keywords = ["excel", "structure", "data", "exstruct"]
8
- authors = [
9
- { name = "harumiWeb"}
10
- ]
11
- requires-python = ">=3.11"
12
- dependencies = [
13
- "numpy>=2.3.5",
14
- "openpyxl>=3.1.5",
15
- "pandas>=2.3.3",
16
- "pydantic>=2.12.5",
17
- "scipy>=1.16.3",
18
- "xlwings>=0.33.16",
19
- ]
20
-
21
- [build-system]
22
- requires = ["uv_build>=0.8.4,<0.9.0"]
23
- build-backend = "uv_build"
24
-
25
- [dependency-groups]
26
- dev = [
27
- "mkdocs-material>=9.7.0",
28
- "mkdocstrings-python>=2.0.1",
29
- "mypy>=1.19.0",
30
- "pre-commit>=4.5.0",
31
- "pytest>=9.0.1",
32
- "pytest-cov>=7.0.0",
33
- "pytest-mock>=3.15.1",
34
- "ruff>=0.14.8",
35
- "taskipy>=1.14.1",
36
- ]
37
-
38
- [project.optional-dependencies]
39
- yaml = ["pyyaml>=6.0.3"]
40
- toon = ["python-toon>=0.1.3"]
41
- render = ["pypdfium2>=5.1.0", "Pillow>=12.0.0"]
42
-
43
- [project.scripts]
44
- exstruct = "exstruct.cli.main:main"
45
-
46
- [project.urls]
47
- Homepage = "https://harumiweb.github.io/exstruct/"
48
- Repository = "https://github.com/harumiWeb/exstruct"
49
- Issues = "https://github.com/harumiWeb/exstruct/issues"
50
- Documentation = "https://harumiweb.github.io/exstruct/"
51
-
52
- [tool.coverage.run]
53
- omit = [
54
- "tests/*",
55
- "*/test_*.py",
56
- "*/gen_py/*",
57
- ]
58
-
59
- [tool.ruff]
60
- target-version = "py311"
61
- src = ["exstruct"]
62
-
63
- select = [
64
- "E", # pycodestyle errors
65
- "W", # pycodestyle warnings
66
- "F", # pyflakes
67
- "I", # import sorting
68
- "UP", # pyupgrade
69
- "B", # flake8-bugbear
70
- "N", # naming
71
- "C90", # complexity
72
- "A", # flake8-builtins
73
- "ANN", # type annotations
74
- ]
75
-
76
- ignore = [
77
- "E501", # 行長は許容(Excel JSON は長くなりがち)
78
- "B008", # Pydantic の default_factory を誤検知するため
79
- "ANN101", # self に型を要求されてしまうため
80
- "ANN102", # cls も同様
81
- ]
82
-
83
- fix = true
84
-
85
- # 型ヒントのスタイル
86
- [tool.ruff.lint]
87
- extend-select = ["ANN"]
88
-
89
- # import の並び替え設定
90
- [tool.ruff.isort]
91
- combine-as-imports = true
92
- known-first-party = ["exstruct"]
93
- force-sort-within-sections = true
94
-
95
- # 複雑度チェック(関数の最大複雑度)
96
- [tool.ruff.mccabe]
97
- max-complexity = 12
98
-
99
- [tool.ruff.per-file-ignores]
100
- "tests/**/*.py" = ["N802", "N803", "N806"]
101
-
102
-
103
- [tool.mypy]
104
- packages = ["exstruct"]
105
- python_version = "3.11"
106
-
107
- # 外部ライブラリは一切チェックしない
108
- ignore_missing_imports = true
109
-
110
- # 自作コードは厳密にチェックする
111
- strict = true
112
-
113
- # Pydantic v2 向け
114
- plugins = ["pydantic.mypy"]
115
-
116
- [tool.pytest.ini_options]
117
- markers = [
118
- "com: requires Excel COM (Windows + Excel)",
119
- "render: requires Excel COM and pypdfium2; set RUN_RENDER_SMOKE=1 to enable",
120
- ]
121
-
122
- [tool.taskipy.tasks]
123
- ruff = "ruff check ."
124
- ruff-fix = "ruff check . --fix"
125
- mypy = "mypy src/exstruct --strict"
126
- test = "pytest -vv --cov=exstruct --cov-report=term-missing --cov-report=xml"
127
- docs = "mkdocs serve"
128
- build-docs = "mkdocs build && python scripts/gen_json_schema.py && python scripts/gen_model_docs.py"
1
+ [project]
2
+ name = "exstruct"
3
+ version = "0.3.2"
4
+ description = "Excel to structured JSON (tables, shapes, charts) for LLM/RAG pipelines"
5
+ readme = "README.md"
6
+ license = { file = "LICENSE" }
7
+ keywords = ["excel", "structure", "data", "exstruct"]
8
+ authors = [
9
+ { name = "harumiWeb"}
10
+ ]
11
+ requires-python = ">=3.11"
12
+ dependencies = [
13
+ "numpy>=2.3.5",
14
+ "openpyxl>=3.1.5",
15
+ "pandas>=2.3.3",
16
+ "pydantic>=2.12.5",
17
+ "scipy>=1.16.3",
18
+ "xlwings>=0.33.16",
19
+ ]
20
+
21
+ [build-system]
22
+ requires = ["uv_build>=0.8.4,<0.9.0"]
23
+ build-backend = "uv_build"
24
+
25
+ [dependency-groups]
26
+ dev = [
27
+ "codecov-cli>=11.2.6",
28
+ "mkdocs-material>=9.7.0",
29
+ "mkdocstrings-python>=2.0.1",
30
+ "mypy>=1.19.0",
31
+ "pre-commit>=4.5.0",
32
+ "pytest>=9.0.1",
33
+ "pytest-cov>=7.0.0",
34
+ "pytest-mock>=3.15.1",
35
+ "ruff>=0.14.8",
36
+ "taskipy>=1.14.1",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ yaml = ["pyyaml>=6.0.3"]
41
+ toon = ["python-toon>=0.1.3"]
42
+ render = ["pypdfium2>=5.1.0", "Pillow>=12.0.0"]
43
+
44
+ [project.scripts]
45
+ exstruct = "exstruct.cli.main:main"
46
+
47
+ [project.urls]
48
+ Homepage = "https://harumiweb.github.io/exstruct/"
49
+ Repository = "https://github.com/harumiWeb/exstruct"
50
+ Issues = "https://github.com/harumiWeb/exstruct/issues"
51
+ Documentation = "https://harumiweb.github.io/exstruct/"
52
+
53
+ [tool.coverage.run]
54
+ omit = [
55
+ "tests/*",
56
+ "*/test_*.py",
57
+ "*/gen_py/*",
58
+ ]
59
+
60
+ [tool.ruff]
61
+ target-version = "py311"
62
+ src = ["exstruct"]
63
+
64
+ select = [
65
+ "E", # pycodestyle errors
66
+ "W", # pycodestyle warnings
67
+ "F", # pyflakes
68
+ "I", # import sorting
69
+ "UP", # pyupgrade
70
+ "B", # flake8-bugbear
71
+ "N", # naming
72
+ "C90", # complexity
73
+ "A", # flake8-builtins
74
+ "ANN", # type annotations
75
+ ]
76
+
77
+ ignore = [
78
+ "E501", # 行長は許容(Excel JSON は長くなりがち)
79
+ "B008", # Pydantic の default_factory を誤検知するため
80
+ "ANN101", # self に型を要求されてしまうため
81
+ "ANN102", # cls も同様
82
+ ]
83
+
84
+ fix = true
85
+
86
+ # 型ヒントのスタイル
87
+ [tool.ruff.lint]
88
+ extend-select = ["ANN"]
89
+
90
+ # import の並び替え設定
91
+ [tool.ruff.isort]
92
+ combine-as-imports = true
93
+ known-first-party = ["exstruct"]
94
+ force-sort-within-sections = true
95
+
96
+ # 複雑度チェック(関数の最大複雑度)
97
+ [tool.ruff.mccabe]
98
+ max-complexity = 12
99
+
100
+ [tool.ruff.per-file-ignores]
101
+ "tests/**/*.py" = ["N802", "N803", "N806"]
102
+
103
+
104
+ [tool.mypy]
105
+ packages = ["exstruct"]
106
+ python_version = "3.11"
107
+
108
+ # 外部ライブラリは一切チェックしない
109
+ ignore_missing_imports = true
110
+
111
+ # 自作コードは厳密にチェックする
112
+ strict = true
113
+
114
+ # Pydantic v2 向け
115
+ plugins = ["pydantic.mypy"]
116
+
117
+ [tool.pytest.ini_options]
118
+ markers = [
119
+ "com: requires Excel COM (Windows + Excel)",
120
+ "render: requires Excel COM and pypdfium2; set RUN_RENDER_SMOKE=1 to enable",
121
+ ]
122
+
123
+ [tool.taskipy.tasks]
124
+ ruff = "ruff check ."
125
+ ruff-fix = "ruff check . --fix"
126
+ mypy = "mypy src/exstruct --strict"
127
+ test = "pytest -vv --cov=exstruct --cov-report=term-missing --cov-report=xml" # uv sync --extra render --extra toon
128
+ test-unit = "pytest -vv -m \"not com and not render\" --cov=exstruct --cov-report=term-missing --cov-report=xml"
129
+ test-com = "pytest -vv -m \"com\" --cov=exstruct --cov-report=term-missing --cov-report=xml"
130
+ codecov-unit = "codecov-cli upload-process -f coverage.xml -F unit -C %CODECOV_SHA% -t %CODECOV_TOKEN%"
131
+ codecov-com = "codecov-cli upload-process -f coverage.xml -F com -C %CODECOV_SHA% -t %CODECOV_TOKEN%"
132
+ docs = "mkdocs serve"
133
+ build-docs = "mkdocs build && python scripts/gen_json_schema.py && python scripts/gen_model_docs.py"
@@ -1,7 +1,7 @@
1
- from __future__ import annotations
2
-
3
- from .base import Backend
4
- from .com_backend import ComBackend
5
- from .openpyxl_backend import OpenpyxlBackend
6
-
7
- __all__ = ["Backend", "ComBackend", "OpenpyxlBackend"]
1
+ from __future__ import annotations
2
+
3
+ from .base import Backend
4
+ from .com_backend import ComBackend
5
+ from .openpyxl_backend import OpenpyxlBackend
6
+
7
+ __all__ = ["Backend", "ComBackend", "OpenpyxlBackend"]