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.
- {exstruct-0.3.0 → exstruct-0.3.2}/PKG-INFO +114 -9
- {exstruct-0.3.0 → exstruct-0.3.2}/README.md +113 -8
- {exstruct-0.3.0 → exstruct-0.3.2}/pyproject.toml +133 -128
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/__init__.py +7 -7
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/base.py +42 -38
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/com_backend.py +230 -226
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/backends/openpyxl_backend.py +191 -179
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/cells.py +36 -1
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/charts.py +243 -241
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/integrate.py +55 -52
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/logging_utils.py +16 -16
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/modeling.py +87 -74
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/pipeline.py +749 -696
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/ranges.py +48 -48
- exstruct-0.3.2/src/exstruct/core/shapes.py +521 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/workbook.py +114 -114
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/engine.py +9 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/errors.py +46 -46
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/io/__init__.py +58 -6
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/io/serialize.py +112 -112
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/models/__init__.py +47 -5
- exstruct-0.3.0/src/exstruct/core/shapes.py +0 -275
- {exstruct-0.3.0 → exstruct-0.3.2}/LICENSE +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/__init__.py +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/cli/availability.py +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/cli/main.py +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/core/__init__.py +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/models/maps.py +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/models/types.py +0 -0
- {exstruct-0.3.0 → exstruct-0.3.2}/src/exstruct/py.typed +0 -0
- {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.
|
|
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
|
-
[](https://pypi.org/project/exstruct/) [](https://pepy.tech/projects/exstruct)  [](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
58
|
+
[](https://pypi.org/project/exstruct/) [](https://pepy.tech/projects/exstruct)  [](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [](https://codecov.io/gh/harumiWeb/exstruct)
|
|
59
59
|
|
|
60
60
|

|
|
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
|
-
##
|
|
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
|
-
"
|
|
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
|
+

|
|
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
|
-
[](https://pypi.org/project/exstruct/) [](https://pepy.tech/projects/exstruct)  [](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
3
|
+
[](https://pypi.org/project/exstruct/) [](https://pepy.tech/projects/exstruct)  [](https://github.com/harumiWeb/exstruct/actions/workflows/pytest.yml) [](https://app.codacy.com/gh/harumiWeb/exstruct/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [](https://codecov.io/gh/harumiWeb/exstruct)
|
|
4
4
|
|
|
5
5
|

|
|
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
|
-
##
|
|
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
|
-
"
|
|
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
|
+

|
|
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.
|
|
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
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"pytest
|
|
33
|
-
"pytest-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
ruff
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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"]
|