exstruct 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.3
2
+ Name: exstruct
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Keywords: excel,structure,data,exstruct
6
+ Author: harumiWeb
7
+ Author-email: harumiWeb <ganaharumi@outlook.jp>
8
+ License: BSD 3-Clause License
9
+
10
+ Copyright (c) 2025, ExStruct Contributors
11
+ All rights reserved.
12
+
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ 1. Redistributions of source code must retain the above copyright notice, this
17
+ list of conditions and the following disclaimer.
18
+
19
+ 2. Redistributions in binary form must reproduce the above copyright notice,
20
+ this list of conditions and the following disclaimer in the documentation
21
+ and/or other materials provided with the distribution.
22
+
23
+ 3. Neither the name of the copyright holder nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
31
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
+ Requires-Dist: numpy>=2.3.5
38
+ Requires-Dist: openpyxl>=3.1.5
39
+ Requires-Dist: pandas>=2.3.3
40
+ Requires-Dist: pydantic>=2.12.5
41
+ Requires-Dist: scipy>=1.16.3
42
+ Requires-Dist: xlwings>=0.33.16
43
+ Requires-Dist: pypdfium2>=5.1.0 ; extra == 'render'
44
+ Requires-Dist: python-toon>=0.1.3 ; extra == 'toon'
45
+ Requires-Dist: pyyaml>=6.0.3 ; extra == 'yaml'
46
+ Requires-Python: >=3.12
47
+ Project-URL: Documentation, https://harumiweb.github.io/exstruct/
48
+ Project-URL: Homepage, https://harumiweb.github.io/exstruct/
49
+ Project-URL: Issues, https://github.com/harumiWeb/exstruct/issues
50
+ Project-URL: Repository, https://github.com/harumiWeb/exstruct
51
+ Provides-Extra: render
52
+ Provides-Extra: toon
53
+ Provides-Extra: yaml
54
+ Description-Content-Type: text/markdown
55
+
56
+ # ExStruct — Excel Structured Extraction Engine
57
+
58
+ ExStruct reads Excel workbooks and outputs structured data (tables, shapes, charts) as JSON by default, with optional YAML/TOON formats. It targets both COM/Excel environments (rich extraction) and non-COM environments (cells + table candidates), with tunable detection heuristics and multiple output modes to fit LLM/RAG pipelines.
59
+
60
+ ## Features
61
+
62
+ - **Excel → Structured JSON**: cells, shapes, charts, and table candidates per sheet.
63
+ - **Output modes**: `light` (cells + table candidates only), `standard` (texted shapes + arrows, charts), `verbose` (all shapes with width/height).
64
+ - **Formats**: JSON (compact by default, `--pretty` available), YAML, TOON (optional dependencies).
65
+ - **Table detection tuning**: adjust heuristics at runtime via API.
66
+ - **CLI rendering** (Excel required): optional PDF and per-sheet PNGs.
67
+ - **Graceful fallback**: if Excel COM is unavailable, extraction falls back to cells + table candidates without crashing.
68
+
69
+ ## Installation
70
+
71
+ ```bash
72
+ pip install exstruct
73
+ ```
74
+
75
+ Optional extras:
76
+
77
+ - YAML: `pip install pyyaml`
78
+ - TOON: `pip install python-toon`
79
+ - Rendering (PDF/PNG): Excel + `pip install pypdfium2`
80
+
81
+ ## Quick Start (CLI)
82
+
83
+ ```bash
84
+ exstruct input.xlsx # compact JSON (default)
85
+ exstruct input.xlsx --pretty # pretty-printed JSON
86
+ exstruct input.xlsx --format yaml # YAML (needs pyyaml)
87
+ exstruct input.xlsx --format toon # TOON (needs python-toon)
88
+ exstruct input.xlsx --mode light # cells + table candidates only
89
+ exstruct input.xlsx --pdf --image # PDF and PNGs (Excel required)
90
+ ```
91
+
92
+ ## Quick Start (Python)
93
+
94
+ ```python
95
+ from pathlib import Path
96
+ from exstruct import extract, export, set_table_detection_params
97
+
98
+ # Tune table detection (optional)
99
+ set_table_detection_params(table_score_threshold=0.3, density_min=0.04)
100
+
101
+ # Extract with modes: "light", "standard", "verbose"
102
+ wb = extract("input.xlsx", mode="standard")
103
+ export(wb, Path("out.json"), pretty=False) # compact JSON
104
+ ```
105
+
106
+ ## Table Detection Tuning
107
+
108
+ ```python
109
+ from exstruct import set_table_detection_params
110
+
111
+ set_table_detection_params(
112
+ table_score_threshold=0.35, # increase to be stricter
113
+ density_min=0.05,
114
+ coverage_min=0.2,
115
+ min_nonempty_cells=3,
116
+ )
117
+ ```
118
+
119
+ Use higher thresholds to reduce false positives; lower them if true tables are missed.
120
+
121
+ ## Output Modes
122
+
123
+ - **light**: cells + table candidates (no COM needed).
124
+ - **standard**: texted shapes + arrows, charts (COM if available), table candidates.
125
+ - **verbose**: all shapes (with width/height), charts, table candidates.
126
+
127
+ ## Error Handling / Fallbacks
128
+
129
+ - Excel COM unavailable → falls back to cells + table candidates; shapes/charts empty.
130
+ - Shape extraction failure → logs warning, still returns cells + table candidates.
131
+ - CLI prints errors to stdout/stderr and returns non-zero on failures.
132
+
133
+ ## Optional Rendering
134
+
135
+ Requires Excel and `pypdfium2`.
136
+
137
+ ```bash
138
+ exstruct input.xlsx --pdf --image --dpi 144
139
+ ```
140
+
141
+ Creates `<output>.pdf` and `<output>_images/` PNGs per sheet.
142
+
143
+ ## Notes
144
+
145
+ - Default JSON is compact to reduce tokens; use `--pretty` or `pretty=True` when readability matters.
146
+ - Field `table_candidates` replaces `tables`; adjust downstream consumers accordingly.
147
+
148
+ ## License
149
+
150
+ BSD-3-Clause. See `LICENSE` for details.
151
+
152
+ ## Documentation
153
+
154
+ - API Reference (GitHub Pages): https://harumiweb.github.io/exstruct/
@@ -0,0 +1,16 @@
1
+ exstruct/__init__.py,sha256=b0100911928de2773b7fb864f6c6402b088f2166b653044c42595a4eb4f8169b,3763
2
+ exstruct/cli/main.py,sha256=7eba1e3b609fd8b547ddbb8cdadc7210d710a7a0c9d86ba0a87269a896bd1672,2321
3
+ exstruct/core/__init__.py,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
4
+ exstruct/core/cells.py,sha256=3f0b0ce316c861233f2384efe3891b3558f355e35a31c03f806392e1f143fbe7,32366
5
+ exstruct/core/charts.py,sha256=1b8a619c05d5d42bcc68885e5b9a776f181965d9ad5032e1f2d7557ba755c568,7352
6
+ exstruct/core/integrate.py,sha256=b27a100a4a2000374b00c4ce68db3df15ef8e4572e92c250c315db07ae699701,4252
7
+ exstruct/core/shapes.py,sha256=764ae644055dd959552fb695ed83101175b24bff4048d010850c2334e57814a2,8177
8
+ exstruct/io/__init__.py,sha256=1b8aa9f7734ecf8d2711efd1ab5108540b7ae0c4f7459269c1edd8e3c1c22887,5697
9
+ exstruct/models/__init__.py,sha256=8bc805adfdc169fa59a3b6ad7f46c44917755fdc741edfced2148d3f9f70dc2a,1296
10
+ exstruct/models/maps.py,sha256=82a0c2fc2ae79547c3e4f6b33b2fd76b0a40547d27c3bbf1a168968cdc96a787,12943
11
+ exstruct/py.typed,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
12
+ exstruct/render/__init__.py,sha256=1c80c65aa81176f85d3615f139f24ca705885ce663e0890cefb4344440588d14,2980
13
+ exstruct-0.1.0.dist-info/WHEEL,sha256=b6dc288e80aa2d1b1518ddb3502fd5b53e8fd6cb507ed2a4f932e9e6088b264a,78
14
+ exstruct-0.1.0.dist-info/entry_points.txt,sha256=3429e73dd9d41bb977b49a34914dddd7ec70352b79882bb937a3999e8e8bce9c,53
15
+ exstruct-0.1.0.dist-info/METADATA,sha256=a2d6674d413a613afc73c84ef7319eb86980147ece97f1349b7c7443990e3b6e,6048
16
+ exstruct-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.8.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ exstruct = exstruct.cli.main:main
3
+