exstruct 0.2.21__tar.gz → 0.2.60__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.2.21 → exstruct-0.2.60}/PKG-INFO +66 -39
- {exstruct-0.2.21 → exstruct-0.2.60}/README.md +65 -38
- exstruct-0.2.60/pyproject.toml +112 -0
- exstruct-0.2.60/src/exstruct/__init__.py +265 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/cli/main.py +6 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/core/cells.py +576 -526
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/core/charts.py +25 -13
- exstruct-0.2.60/src/exstruct/core/integrate.py +386 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/core/shapes.py +198 -177
- exstruct-0.2.60/src/exstruct/engine.py +553 -0
- exstruct-0.2.60/src/exstruct/io/__init__.py +530 -0
- exstruct-0.2.60/src/exstruct/models/__init__.py +260 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/models/maps.py +13 -13
- exstruct-0.2.60/src/exstruct/models/types.py +8 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/render/__init__.py +15 -14
- exstruct-0.2.21/pyproject.toml +0 -52
- exstruct-0.2.21/src/exstruct/__init__.py +0 -122
- exstruct-0.2.21/src/exstruct/core/integrate.py +0 -140
- exstruct-0.2.21/src/exstruct/engine.py +0 -251
- exstruct-0.2.21/src/exstruct/io/__init__.py +0 -187
- exstruct-0.2.21/src/exstruct/models/__init__.py +0 -180
- {exstruct-0.2.21 → exstruct-0.2.60}/LICENSE +0 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/core/__init__.py +0 -0
- {exstruct-0.2.21 → exstruct-0.2.60}/src/exstruct/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: exstruct
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.60
|
|
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
|
|
@@ -60,12 +60,15 @@ Description-Content-Type: text/markdown
|
|
|
60
60
|
|
|
61
61
|

|
|
62
62
|
|
|
63
|
-
ExStruct reads Excel workbooks and outputs structured data (
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
[日本版README](README.ja.md)
|
|
64
66
|
|
|
65
67
|
## Features
|
|
66
68
|
|
|
67
|
-
- **Excel → Structured JSON**: cells, shapes, charts,
|
|
68
|
-
- **Output modes**: `light` (cells + table candidates
|
|
69
|
+
- **Excel → Structured JSON**: cells, shapes, charts, table candidates, print areas/views, and auto page-break areas per sheet.
|
|
70
|
+
- **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.
|
|
71
|
+
- **Auto page-break export (COM only)**: capture Excel-computed auto page breaks and write per-area JSON/YAML/TOON when requested.
|
|
69
72
|
- **Formats**: JSON (compact by default, `--pretty` available), YAML, TOON (optional dependencies).
|
|
70
73
|
- **Table detection tuning**: adjust heuristics at runtime via API.
|
|
71
74
|
- **CLI rendering** (Excel required): optional PDF and per-sheet PNGs.
|
|
@@ -85,7 +88,8 @@ Optional extras:
|
|
|
85
88
|
- All extras at once: `pip install exstruct[yaml,toon,render]`
|
|
86
89
|
|
|
87
90
|
Platform note:
|
|
88
|
-
|
|
91
|
+
|
|
92
|
+
- Full extraction (shapes/charts) targets Windows + Excel (COM via xlwings). On other platforms, use `mode=light` to get cells + `table_candidates`.
|
|
89
93
|
|
|
90
94
|
## Quick Start (CLI)
|
|
91
95
|
|
|
@@ -95,10 +99,13 @@ exstruct input.xlsx -o out.json --pretty # pretty JSON to a file
|
|
|
95
99
|
exstruct input.xlsx --format yaml # YAML (needs pyyaml)
|
|
96
100
|
exstruct input.xlsx --format toon # TOON (needs python-toon)
|
|
97
101
|
exstruct input.xlsx --sheets-dir sheets/ # split per sheet in chosen format
|
|
102
|
+
exstruct input.xlsx --print-areas-dir areas/ # split per print area (if any)
|
|
98
103
|
exstruct input.xlsx --mode light # cells + table candidates only
|
|
99
104
|
exstruct input.xlsx --pdf --image # PDF and PNGs (Excel required)
|
|
100
105
|
```
|
|
101
106
|
|
|
107
|
+
Auto page-break exports are API-only (Excel/COM): set `DestinationOptions.auto_page_breaks_dir` or call `export_auto_page_breaks(...)`.
|
|
108
|
+
|
|
102
109
|
## Quick Start (Python)
|
|
103
110
|
|
|
104
111
|
```python
|
|
@@ -112,7 +119,7 @@ set_table_detection_params(table_score_threshold=0.3, density_min=0.04)
|
|
|
112
119
|
wb = extract("input.xlsx", mode="standard")
|
|
113
120
|
export(wb, Path("out.json"), pretty=False) # compact JSON
|
|
114
121
|
|
|
115
|
-
# Model helpers: iterate, index, and serialize directly
|
|
122
|
+
# Model helpers: iterate, index, and serialize directly
|
|
116
123
|
first_sheet = wb["Sheet1"] # __getitem__ access
|
|
117
124
|
for name, sheet in wb: # __iter__ yields (name, SheetData)
|
|
118
125
|
print(name, len(sheet.rows))
|
|
@@ -120,19 +127,45 @@ wb.save("out.json", pretty=True) # WorkbookData → file (by extension)
|
|
|
120
127
|
first_sheet.save("sheet.json") # SheetData → file (by extension)
|
|
121
128
|
print(first_sheet.to_yaml()) # YAML text (requires pyyaml)
|
|
122
129
|
|
|
123
|
-
# ExStructEngine: per-instance options
|
|
124
|
-
from exstruct import
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
# ExStructEngine: per-instance options (nested configs)
|
|
131
|
+
from exstruct import (
|
|
132
|
+
DestinationOptions,
|
|
133
|
+
ExStructEngine,
|
|
134
|
+
FilterOptions,
|
|
135
|
+
FormatOptions,
|
|
136
|
+
OutputOptions,
|
|
137
|
+
StructOptions,
|
|
138
|
+
export_auto_page_breaks,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
engine = ExStructEngine(
|
|
142
|
+
options=StructOptions(mode="verbose"), # verbose includes hyperlinks by default
|
|
143
|
+
output=OutputOptions(
|
|
144
|
+
format=FormatOptions(pretty=True),
|
|
145
|
+
filters=FilterOptions(include_shapes=False), # drop shapes in output
|
|
146
|
+
destinations=DestinationOptions(sheets_dir=Path("out_sheets")), # also write per-sheet files
|
|
147
|
+
),
|
|
148
|
+
)
|
|
149
|
+
wb2 = engine.extract("input.xlsx")
|
|
150
|
+
engine.export(wb2, Path("out_filtered.json")) # drops shapes via filters
|
|
151
|
+
|
|
152
|
+
# Enable hyperlinks in other modes
|
|
153
|
+
engine_links = ExStructEngine(options=StructOptions(mode="standard", include_cell_links=True))
|
|
154
|
+
with_links = engine_links.extract("input.xlsx")
|
|
155
|
+
|
|
156
|
+
# Export per print area (if print areas exist)
|
|
157
|
+
from exstruct import export_print_areas_as
|
|
158
|
+
export_print_areas_as(wb, "areas", fmt="json", pretty=True)
|
|
159
|
+
|
|
160
|
+
# Auto page-break extraction/output (COM only; raises if no auto breaks exist)
|
|
161
|
+
engine_auto = ExStructEngine(
|
|
162
|
+
output=OutputOptions(
|
|
163
|
+
destinations=DestinationOptions(auto_page_breaks_dir=Path("auto_areas"))
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
wb_auto = engine_auto.extract("input.xlsx") # includes SheetData.auto_print_areas
|
|
167
|
+
engine_auto.export(wb_auto, Path("out_with_auto.json")) # also writes auto_areas/*
|
|
168
|
+
export_auto_page_breaks(wb_auto, "auto_areas", fmt="json", pretty=True) # manual writer
|
|
136
169
|
```
|
|
137
170
|
|
|
138
171
|
**Note (non-COM environments):** If Excel COM is unavailable, extraction still runs and returns cells + `table_candidates`; `shapes`/`charts` will be empty.
|
|
@@ -152,11 +185,11 @@ set_table_detection_params(
|
|
|
152
185
|
|
|
153
186
|
Use higher thresholds to reduce false positives; lower them if true tables are missed.
|
|
154
187
|
|
|
155
|
-
## Output Modes
|
|
156
|
-
|
|
157
|
-
- **light**: cells + table candidates (no COM needed).
|
|
158
|
-
- **standard**: texted shapes + arrows, charts (COM if available), table candidates. Hyperlinks are off unless `include_cell_links=True`.
|
|
159
|
-
- **verbose**: all shapes (with width/height), charts, table candidates, and cell hyperlinks.
|
|
188
|
+
## Output Modes
|
|
189
|
+
|
|
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, and cell hyperlinks.
|
|
160
193
|
|
|
161
194
|
## Error Handling / Fallbacks
|
|
162
195
|
|
|
@@ -185,6 +218,7 @@ To show how well exstruct can structure Excel, we parse a workbook that combines
|
|
|
185
218
|
(Screenshot below is the actual sample Excel sheet)
|
|
186
219
|

|
|
187
220
|
Sample workbook: `sample/sample.xlsx`
|
|
221
|
+
Sample workbook: `sample/sample.xlsx`
|
|
188
222
|
|
|
189
223
|
### 1. Input: Excel Sheet Overview
|
|
190
224
|
|
|
@@ -371,6 +405,14 @@ In short, **exstruct = “an engine that converts Excel into a format AI can und
|
|
|
371
405
|
- Default JSON is compact to reduce tokens; use `--pretty` or `pretty=True` when readability matters.
|
|
372
406
|
- Field `table_candidates` replaces `tables`; adjust downstream consumers accordingly.
|
|
373
407
|
|
|
408
|
+
## Print Areas and Auto Page Breaks (PrintArea / PrintAreaView)
|
|
409
|
+
|
|
410
|
+
- `SheetData.print_areas` holds print areas (cell coordinates) in light/standard/verbose.
|
|
411
|
+
- `SheetData.auto_print_areas` holds Excel COM-computed auto page-break areas when auto page-break extraction is enabled (COM only).
|
|
412
|
+
- Use `export_print_areas_as(...)` or CLI `--print-areas-dir` to write one file per print area (nothing is written if none exist).
|
|
413
|
+
- Use `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.
|
|
414
|
+
- `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.
|
|
415
|
+
|
|
374
416
|
## License
|
|
375
417
|
|
|
376
418
|
BSD-3-Clause. See `LICENSE` for details.
|
|
@@ -378,18 +420,3 @@ BSD-3-Clause. See `LICENSE` for details.
|
|
|
378
420
|
## Documentation
|
|
379
421
|
|
|
380
422
|
- API Reference (GitHub Pages): https://harumiweb.github.io/exstruct/
|
|
381
|
-
# Engine option cheat sheet
|
|
382
|
-
|
|
383
|
-
| Option class | Field | Meaning |
|
|
384
|
-
| -------------- | ------------------- | ------- |
|
|
385
|
-
| StructOptions | mode | "light"/"standard"/"verbose" |
|
|
386
|
-
| | table_params | Dict passed to `set_table_detection_params` (table_score_threshold, density_min, coverage_min, min_nonempty_cells) |
|
|
387
|
-
| | include_cell_links | Include cell hyperlinks in `rows[*].links` (None -> auto: verbose=True, others=False) |
|
|
388
|
-
| OutputOptions | fmt | Default format ("json"/"yaml"/"yml"/"toon") |
|
|
389
|
-
| | pretty / indent | Pretty-print JSON and control indent |
|
|
390
|
-
| | include_rows | Include rows (False to drop) |
|
|
391
|
-
| | include_shapes | Include shapes |
|
|
392
|
-
| | include_charts | Include charts |
|
|
393
|
-
| | include_tables | Include table_candidates |
|
|
394
|
-
| | sheets_dir | Optional directory for per-sheet exports |
|
|
395
|
-
| | stream | Default stream when output_path is None |
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
ExStruct reads Excel workbooks and outputs structured data (
|
|
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
|
+
|
|
9
|
+
[日本版README](README.ja.md)
|
|
8
10
|
|
|
9
11
|
## Features
|
|
10
12
|
|
|
11
|
-
- **Excel → Structured JSON**: cells, shapes, charts,
|
|
12
|
-
- **Output modes**: `light` (cells + table candidates
|
|
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.
|
|
15
|
+
- **Auto page-break export (COM only)**: capture Excel-computed auto page breaks and write per-area JSON/YAML/TOON when requested.
|
|
13
16
|
- **Formats**: JSON (compact by default, `--pretty` available), YAML, TOON (optional dependencies).
|
|
14
17
|
- **Table detection tuning**: adjust heuristics at runtime via API.
|
|
15
18
|
- **CLI rendering** (Excel required): optional PDF and per-sheet PNGs.
|
|
@@ -29,7 +32,8 @@ Optional extras:
|
|
|
29
32
|
- All extras at once: `pip install exstruct[yaml,toon,render]`
|
|
30
33
|
|
|
31
34
|
Platform note:
|
|
32
|
-
|
|
35
|
+
|
|
36
|
+
- Full extraction (shapes/charts) targets Windows + Excel (COM via xlwings). On other platforms, use `mode=light` to get cells + `table_candidates`.
|
|
33
37
|
|
|
34
38
|
## Quick Start (CLI)
|
|
35
39
|
|
|
@@ -39,10 +43,13 @@ exstruct input.xlsx -o out.json --pretty # pretty JSON to a file
|
|
|
39
43
|
exstruct input.xlsx --format yaml # YAML (needs pyyaml)
|
|
40
44
|
exstruct input.xlsx --format toon # TOON (needs python-toon)
|
|
41
45
|
exstruct input.xlsx --sheets-dir sheets/ # split per sheet in chosen format
|
|
46
|
+
exstruct input.xlsx --print-areas-dir areas/ # split per print area (if any)
|
|
42
47
|
exstruct input.xlsx --mode light # cells + table candidates only
|
|
43
48
|
exstruct input.xlsx --pdf --image # PDF and PNGs (Excel required)
|
|
44
49
|
```
|
|
45
50
|
|
|
51
|
+
Auto page-break exports are API-only (Excel/COM): set `DestinationOptions.auto_page_breaks_dir` or call `export_auto_page_breaks(...)`.
|
|
52
|
+
|
|
46
53
|
## Quick Start (Python)
|
|
47
54
|
|
|
48
55
|
```python
|
|
@@ -56,7 +63,7 @@ set_table_detection_params(table_score_threshold=0.3, density_min=0.04)
|
|
|
56
63
|
wb = extract("input.xlsx", mode="standard")
|
|
57
64
|
export(wb, Path("out.json"), pretty=False) # compact JSON
|
|
58
65
|
|
|
59
|
-
# Model helpers: iterate, index, and serialize directly
|
|
66
|
+
# Model helpers: iterate, index, and serialize directly
|
|
60
67
|
first_sheet = wb["Sheet1"] # __getitem__ access
|
|
61
68
|
for name, sheet in wb: # __iter__ yields (name, SheetData)
|
|
62
69
|
print(name, len(sheet.rows))
|
|
@@ -64,19 +71,45 @@ wb.save("out.json", pretty=True) # WorkbookData → file (by extension)
|
|
|
64
71
|
first_sheet.save("sheet.json") # SheetData → file (by extension)
|
|
65
72
|
print(first_sheet.to_yaml()) # YAML text (requires pyyaml)
|
|
66
73
|
|
|
67
|
-
# ExStructEngine: per-instance options
|
|
68
|
-
from exstruct import
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
# ExStructEngine: per-instance options (nested configs)
|
|
75
|
+
from exstruct import (
|
|
76
|
+
DestinationOptions,
|
|
77
|
+
ExStructEngine,
|
|
78
|
+
FilterOptions,
|
|
79
|
+
FormatOptions,
|
|
80
|
+
OutputOptions,
|
|
81
|
+
StructOptions,
|
|
82
|
+
export_auto_page_breaks,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
engine = ExStructEngine(
|
|
86
|
+
options=StructOptions(mode="verbose"), # verbose includes hyperlinks by default
|
|
87
|
+
output=OutputOptions(
|
|
88
|
+
format=FormatOptions(pretty=True),
|
|
89
|
+
filters=FilterOptions(include_shapes=False), # drop shapes in output
|
|
90
|
+
destinations=DestinationOptions(sheets_dir=Path("out_sheets")), # also write per-sheet files
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
wb2 = engine.extract("input.xlsx")
|
|
94
|
+
engine.export(wb2, Path("out_filtered.json")) # drops shapes via filters
|
|
95
|
+
|
|
96
|
+
# Enable hyperlinks in other modes
|
|
97
|
+
engine_links = ExStructEngine(options=StructOptions(mode="standard", include_cell_links=True))
|
|
98
|
+
with_links = engine_links.extract("input.xlsx")
|
|
99
|
+
|
|
100
|
+
# Export per print area (if print areas exist)
|
|
101
|
+
from exstruct import export_print_areas_as
|
|
102
|
+
export_print_areas_as(wb, "areas", fmt="json", pretty=True)
|
|
103
|
+
|
|
104
|
+
# Auto page-break extraction/output (COM only; raises if no auto breaks exist)
|
|
105
|
+
engine_auto = ExStructEngine(
|
|
106
|
+
output=OutputOptions(
|
|
107
|
+
destinations=DestinationOptions(auto_page_breaks_dir=Path("auto_areas"))
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
wb_auto = engine_auto.extract("input.xlsx") # includes SheetData.auto_print_areas
|
|
111
|
+
engine_auto.export(wb_auto, Path("out_with_auto.json")) # also writes auto_areas/*
|
|
112
|
+
export_auto_page_breaks(wb_auto, "auto_areas", fmt="json", pretty=True) # manual writer
|
|
80
113
|
```
|
|
81
114
|
|
|
82
115
|
**Note (non-COM environments):** If Excel COM is unavailable, extraction still runs and returns cells + `table_candidates`; `shapes`/`charts` will be empty.
|
|
@@ -96,11 +129,11 @@ set_table_detection_params(
|
|
|
96
129
|
|
|
97
130
|
Use higher thresholds to reduce false positives; lower them if true tables are missed.
|
|
98
131
|
|
|
99
|
-
## Output Modes
|
|
100
|
-
|
|
101
|
-
- **light**: cells + table candidates (no COM needed).
|
|
102
|
-
- **standard**: texted shapes + arrows, charts (COM if available), table candidates. Hyperlinks are off unless `include_cell_links=True`.
|
|
103
|
-
- **verbose**: all shapes (with width/height), charts, table candidates, and cell hyperlinks.
|
|
132
|
+
## Output Modes
|
|
133
|
+
|
|
134
|
+
- **light**: cells + table candidates (no COM needed).
|
|
135
|
+
- **standard**: texted shapes + arrows, charts (COM if available), table candidates. Hyperlinks are off unless `include_cell_links=True`.
|
|
136
|
+
- **verbose**: all shapes (with width/height), charts, table candidates, and cell hyperlinks.
|
|
104
137
|
|
|
105
138
|
## Error Handling / Fallbacks
|
|
106
139
|
|
|
@@ -129,6 +162,7 @@ To show how well exstruct can structure Excel, we parse a workbook that combines
|
|
|
129
162
|
(Screenshot below is the actual sample Excel sheet)
|
|
130
163
|

|
|
131
164
|
Sample workbook: `sample/sample.xlsx`
|
|
165
|
+
Sample workbook: `sample/sample.xlsx`
|
|
132
166
|
|
|
133
167
|
### 1. Input: Excel Sheet Overview
|
|
134
168
|
|
|
@@ -315,6 +349,14 @@ In short, **exstruct = “an engine that converts Excel into a format AI can und
|
|
|
315
349
|
- Default JSON is compact to reduce tokens; use `--pretty` or `pretty=True` when readability matters.
|
|
316
350
|
- Field `table_candidates` replaces `tables`; adjust downstream consumers accordingly.
|
|
317
351
|
|
|
352
|
+
## Print Areas and Auto Page Breaks (PrintArea / PrintAreaView)
|
|
353
|
+
|
|
354
|
+
- `SheetData.print_areas` holds print areas (cell coordinates) in light/standard/verbose.
|
|
355
|
+
- `SheetData.auto_print_areas` holds Excel COM-computed auto page-break areas when auto page-break extraction is enabled (COM only).
|
|
356
|
+
- Use `export_print_areas_as(...)` or CLI `--print-areas-dir` to write one file per print area (nothing is written if none exist).
|
|
357
|
+
- Use `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.
|
|
358
|
+
- `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.
|
|
359
|
+
|
|
318
360
|
## License
|
|
319
361
|
|
|
320
362
|
BSD-3-Clause. See `LICENSE` for details.
|
|
@@ -322,18 +364,3 @@ BSD-3-Clause. See `LICENSE` for details.
|
|
|
322
364
|
## Documentation
|
|
323
365
|
|
|
324
366
|
- API Reference (GitHub Pages): https://harumiweb.github.io/exstruct/
|
|
325
|
-
# Engine option cheat sheet
|
|
326
|
-
|
|
327
|
-
| Option class | Field | Meaning |
|
|
328
|
-
| -------------- | ------------------- | ------- |
|
|
329
|
-
| StructOptions | mode | "light"/"standard"/"verbose" |
|
|
330
|
-
| | table_params | Dict passed to `set_table_detection_params` (table_score_threshold, density_min, coverage_min, min_nonempty_cells) |
|
|
331
|
-
| | include_cell_links | Include cell hyperlinks in `rows[*].links` (None -> auto: verbose=True, others=False) |
|
|
332
|
-
| OutputOptions | fmt | Default format ("json"/"yaml"/"yml"/"toon") |
|
|
333
|
-
| | pretty / indent | Pretty-print JSON and control indent |
|
|
334
|
-
| | include_rows | Include rows (False to drop) |
|
|
335
|
-
| | include_shapes | Include shapes |
|
|
336
|
-
| | include_charts | Include charts |
|
|
337
|
-
| | include_tables | Include table_candidates |
|
|
338
|
-
| | sheets_dir | Optional directory for per-sheet exports |
|
|
339
|
-
| | stream | Default stream when output_path is None |
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "exstruct"
|
|
3
|
+
version = "0.2.60"
|
|
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", email = "ganaharumi@outlook.jp" }
|
|
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
|
+
"mypy>=1.19.0",
|
|
29
|
+
"pre-commit>=4.5.0",
|
|
30
|
+
"pytest>=9.0.1",
|
|
31
|
+
"pytest-cov>=7.0.0",
|
|
32
|
+
"pytest-mock>=3.15.1",
|
|
33
|
+
"ruff>=0.14.8",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
yaml = ["pyyaml>=6.0.3"]
|
|
38
|
+
toon = ["python-toon>=0.1.3"]
|
|
39
|
+
render = ["pypdfium2>=5.1.0", "Pillow>=12.0.0"]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
exstruct = "exstruct.cli.main:main"
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://harumiweb.github.io/exstruct/"
|
|
46
|
+
Repository = "https://github.com/harumiWeb/exstruct"
|
|
47
|
+
Issues = "https://github.com/harumiWeb/exstruct/issues"
|
|
48
|
+
Documentation = "https://harumiweb.github.io/exstruct/"
|
|
49
|
+
|
|
50
|
+
[tool.coverage.run]
|
|
51
|
+
omit = [
|
|
52
|
+
"tests/*",
|
|
53
|
+
"*/test_*.py",
|
|
54
|
+
"*/gen_py/*",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
target-version = "py311"
|
|
59
|
+
src = ["exstruct"]
|
|
60
|
+
|
|
61
|
+
select = [
|
|
62
|
+
"E", # pycodestyle errors
|
|
63
|
+
"W", # pycodestyle warnings
|
|
64
|
+
"F", # pyflakes
|
|
65
|
+
"I", # import sorting
|
|
66
|
+
"UP", # pyupgrade
|
|
67
|
+
"B", # flake8-bugbear
|
|
68
|
+
"N", # naming
|
|
69
|
+
"C90", # complexity
|
|
70
|
+
"A", # flake8-builtins
|
|
71
|
+
"ANN", # type annotations
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
ignore = [
|
|
75
|
+
"E501", # 行長は許容(Excel JSON は長くなりがち)
|
|
76
|
+
"B008", # Pydantic の default_factory を誤検知するため
|
|
77
|
+
"ANN101", # self に型を要求されてしまうため
|
|
78
|
+
"ANN102", # cls も同様
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
fix = true
|
|
82
|
+
|
|
83
|
+
# 型ヒントのスタイル
|
|
84
|
+
[tool.ruff.lint]
|
|
85
|
+
extend-select = ["ANN"]
|
|
86
|
+
|
|
87
|
+
# import の並び替え設定
|
|
88
|
+
[tool.ruff.isort]
|
|
89
|
+
combine-as-imports = true
|
|
90
|
+
known-first-party = ["exstruct"]
|
|
91
|
+
force-sort-within-sections = true
|
|
92
|
+
|
|
93
|
+
# 複雑度チェック(関数の最大複雑度)
|
|
94
|
+
[tool.ruff.mccabe]
|
|
95
|
+
max-complexity = 12
|
|
96
|
+
|
|
97
|
+
[tool.ruff.per-file-ignores]
|
|
98
|
+
"tests/**/*.py" = ["N802", "N803", "N806"]
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
[tool.mypy]
|
|
102
|
+
packages = ["exstruct"]
|
|
103
|
+
python_version = "3.11"
|
|
104
|
+
|
|
105
|
+
# 外部ライブラリは一切チェックしない
|
|
106
|
+
ignore_missing_imports = true
|
|
107
|
+
|
|
108
|
+
# 自作コードは厳密にチェックする
|
|
109
|
+
strict = true
|
|
110
|
+
|
|
111
|
+
# Pydantic v2 向け
|
|
112
|
+
plugins = ["pydantic.mypy"]
|