office-design-builder 0.1.1__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 (28) hide show
  1. office_design_builder-0.1.1/LICENSE +21 -0
  2. office_design_builder-0.1.1/PKG-INFO +382 -0
  3. office_design_builder-0.1.1/README.md +329 -0
  4. office_design_builder-0.1.1/pyproject.toml +54 -0
  5. office_design_builder-0.1.1/setup.cfg +4 -0
  6. office_design_builder-0.1.1/src/office_design_builder/__init__.py +6 -0
  7. office_design_builder-0.1.1/src/office_design_builder/cli.py +114 -0
  8. office_design_builder-0.1.1/src/office_design_builder/errors.py +31 -0
  9. office_design_builder-0.1.1/src/office_design_builder/inspectors/__init__.py +1 -0
  10. office_design_builder-0.1.1/src/office_design_builder/inspectors/image.py +45 -0
  11. office_design_builder-0.1.1/src/office_design_builder/inspectors/pptx.py +49 -0
  12. office_design_builder-0.1.1/src/office_design_builder/models.py +150 -0
  13. office_design_builder-0.1.1/src/office_design_builder/renderers/__init__.py +1 -0
  14. office_design_builder-0.1.1/src/office_design_builder/renderers/pptx.py +245 -0
  15. office_design_builder-0.1.1/src/office_design_builder/verify.py +32 -0
  16. office_design_builder-0.1.1/src/office_design_builder.egg-info/PKG-INFO +382 -0
  17. office_design_builder-0.1.1/src/office_design_builder.egg-info/SOURCES.txt +26 -0
  18. office_design_builder-0.1.1/src/office_design_builder.egg-info/dependency_links.txt +1 -0
  19. office_design_builder-0.1.1/src/office_design_builder.egg-info/entry_points.txt +2 -0
  20. office_design_builder-0.1.1/src/office_design_builder.egg-info/requires.txt +9 -0
  21. office_design_builder-0.1.1/src/office_design_builder.egg-info/top_level.txt +1 -0
  22. office_design_builder-0.1.1/tests/test_ci_workflow.py +17 -0
  23. office_design_builder-0.1.1/tests/test_cli.py +250 -0
  24. office_design_builder-0.1.1/tests/test_image_inspector.py +42 -0
  25. office_design_builder-0.1.1/tests/test_models.py +294 -0
  26. office_design_builder-0.1.1/tests/test_pptx_inspector.py +37 -0
  27. office_design_builder-0.1.1/tests/test_pptx_renderer.py +190 -0
  28. office_design_builder-0.1.1/tests/test_publish_workflow.py +33 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mrAibo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.2
2
+ Name: office-design-builder
3
+ Version: 0.1.1
4
+ Summary: Generate editable Office artifacts from semantic specifications and visual references.
5
+ Author: Aleksej Voronin
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 mrAibo
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/mrAibo/office-design-builder
29
+ Project-URL: Documentation, https://github.com/mrAibo/office-design-builder#readme
30
+ Project-URL: Issues, https://github.com/mrAibo/office-design-builder/issues
31
+ Project-URL: Source, https://github.com/mrAibo/office-design-builder
32
+ Keywords: office,powerpoint,pptx,document-generation,design
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Office/Business
41
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
42
+ Requires-Python: >=3.12
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: Pillow<13,>=11
46
+ Requires-Dist: python-pptx<2,>=1
47
+ Provides-Extra: dev
48
+ Requires-Dist: build<2,>=1.2; extra == "dev"
49
+ Requires-Dist: pytest<9,>=8; extra == "dev"
50
+ Requires-Dist: setuptools<76,>=75; extra == "dev"
51
+ Requires-Dist: twine<7,>=6; extra == "dev"
52
+ Requires-Dist: wheel<1,>=0.45; extra == "dev"
53
+
54
+ # Office Design Builder
55
+
56
+ Office Design Builder (`odb`) creates editable PowerPoint presentations from JSON specifications and visual references. Generated slides contain native PowerPoint text boxes and shapes, so users can continue editing them in PowerPoint or LibreOffice Impress.
57
+
58
+ Current release: [v0.1.0](https://github.com/mrAibo/office-design-builder/releases/tag/v0.1.0)
59
+
60
+ ## What it does
61
+
62
+ - Inspects PNG, JPEG, and PPTX references.
63
+ - Extracts slide or image dimensions, a color palette, and available typography evidence.
64
+ - Validates versioned JSON presentation specifications.
65
+ - Builds editable `.pptx` files with deterministic output.
66
+ - Verifies that a generated PPTX can be opened and contains editable text.
67
+
68
+ The current renderer supports `title` and `two_column` slides.
69
+
70
+ ## Requirements
71
+
72
+ - Python 3.12 or newer
73
+ - PowerPoint or LibreOffice Impress to edit the generated presentation
74
+ - LibreOffice only if you want to render slides to PDF or images outside `odb`
75
+
76
+ `uv` is recommended for installation, but a standard Python virtual environment also works.
77
+
78
+ ## Install the released package
79
+
80
+ The project is not published to PyPI yet. Download the wheel from the [v0.1.0 release](https://github.com/mrAibo/office-design-builder/releases/tag/v0.1.0), then install it in a virtual environment.
81
+
82
+ With `uv`:
83
+
84
+ ```bash
85
+ uv venv --python 3.12 .venv
86
+ uv pip install --python .venv/bin/python ./office_design_builder-0.1.0-py3-none-any.whl
87
+ ```
88
+
89
+ On Windows PowerShell, use the virtual environment's Windows Python path:
90
+
91
+ ```powershell
92
+ uv venv --python 3.12 .venv
93
+ uv pip install --python .venv\Scripts\python.exe .\office_design_builder-0.1.0-py3-none-any.whl
94
+ ```
95
+
96
+ On Linux or macOS, run the installed command as:
97
+
98
+ ```bash
99
+ .venv/bin/odb --help
100
+ ```
101
+
102
+ On Windows:
103
+
104
+ ```powershell
105
+ .venv\Scripts\odb.exe --help
106
+ ```
107
+
108
+ On Linux or macOS, verify the downloaded release files with the published checksum file:
109
+
110
+ ```bash
111
+ sha256sum -c SHA256SUMS
112
+ ```
113
+
114
+ ## Quick start
115
+
116
+ The repository contains working examples in [`examples/`](examples/). From a cloned repository with the development environment installed:
117
+
118
+ ```bash
119
+ uv run --offline odb validate examples/presentation.json
120
+
121
+ uv run --offline odb build examples/presentation.json \
122
+ --fingerprint examples/style-fingerprint.json \
123
+ --output presentation.pptx
124
+
125
+ uv run --offline odb verify presentation.pptx
126
+ ```
127
+
128
+ A successful verification prints JSON similar to:
129
+
130
+ ```json
131
+ {"editable_text_shapes": 5, "slide_count": 2}
132
+ ```
133
+
134
+ Open `presentation.pptx` in PowerPoint or LibreOffice Impress. Text and decorative shapes remain editable.
135
+
136
+ ## Typical workflow
137
+
138
+ ### 1. Create a style fingerprint
139
+
140
+ Use an existing PNG, JPEG, or PPTX as a visual reference:
141
+
142
+ ```bash
143
+ odb inspect reference.png --output fingerprint.json
144
+ ```
145
+
146
+ For images, `odb` records pixel dimensions, aspect ratio, and up to five dominant colors. Raster images do not provide reliable font information, so the generated fingerprint uses generic sans-serif font names.
147
+
148
+ For PPTX references, `odb` records slide dimensions, layout names, slide count, and directly assigned text-run fonts and RGB colors. Theme-inherited values may not appear in the result.
149
+
150
+ Review the generated fingerprint before building. You can replace colors and fonts with values available on the target computer.
151
+
152
+ ### 2. Write a presentation specification
153
+
154
+ Create a JSON file that describes the slides and their editable content:
155
+
156
+ ```json
157
+ {
158
+ "version": "1",
159
+ "title": "Quarterly review",
160
+ "slides": [
161
+ {
162
+ "layout": "title",
163
+ "title": "Quarterly review",
164
+ "subtitle": "Q3 results"
165
+ },
166
+ {
167
+ "layout": "two_column",
168
+ "title": "Results",
169
+ "left": [
170
+ "Revenue increased",
171
+ "Customer retention improved"
172
+ ],
173
+ "right": [
174
+ "Operating costs decreased",
175
+ "Support response time improved"
176
+ ]
177
+ }
178
+ ]
179
+ }
180
+ ```
181
+
182
+ Validate it before building:
183
+
184
+ ```bash
185
+ odb validate presentation.json
186
+ ```
187
+
188
+ The command exits with status `0` and prints nothing when the specification is valid.
189
+
190
+ ### 3. Build the presentation
191
+
192
+ ```bash
193
+ odb build presentation.json \
194
+ --fingerprint fingerprint.json \
195
+ --output presentation.pptx
196
+ ```
197
+
198
+ Use a `.pptx` filename for the output. Identical specifications and fingerprints produce byte-identical PPTX files.
199
+
200
+ ### 4. Verify the result
201
+
202
+ ```bash
203
+ odb verify presentation.pptx
204
+ ```
205
+
206
+ Verification opens the package and reports the number of slides and non-empty editable text shapes. It checks structure, not visual quality. Open or render the presentation before delivering it to confirm font availability, line wrapping, and layout.
207
+
208
+ ## JSON contracts
209
+
210
+ Both contracts use `"version": "1"`. Other versions are rejected.
211
+
212
+ ### Presentation specification
213
+
214
+ Top-level fields:
215
+
216
+ | Field | Type | Required | Meaning |
217
+ | --- | --- | --- | --- |
218
+ | `version` | string | yes | Contract version; currently `"1"` |
219
+ | `title` | string | yes | Presentation title stored in the semantic specification |
220
+ | `slides` | array | yes | Ordered slide definitions |
221
+
222
+ `title` must be a non-empty string, and `slides` must contain at least one slide object. Unknown fields are rejected inside slide objects.
223
+
224
+ Supported slide layouts:
225
+
226
+ | Layout | Required fields | Optional fields |
227
+ | --- | --- | --- |
228
+ | `title` | `layout`, `title` | `subtitle` |
229
+ | `two_column` | `layout`, `title`, `left`, `right` | none |
230
+
231
+ `left` and `right` must be non-empty arrays of non-empty strings. Their items are rendered as separate lines in editable text boxes. Slide titles and optional subtitles must also be non-empty strings.
232
+
233
+ ### Style fingerprint
234
+
235
+ Required fields:
236
+
237
+ | Field | Type | Meaning |
238
+ | --- | --- | --- |
239
+ | `version` | string | Contract version; currently `"1"` |
240
+ | `canvas` | object | `width`, `height`, and `aspect_ratio` |
241
+ | `palette` | array of strings | Hex RGB colors such as `"#17324D"` |
242
+ | `typography` | object | `heading_font` and `body_font` |
243
+ | `geometry` | object | Reference-specific structural evidence |
244
+ | `density` | string | Density label carried by the contract |
245
+ | `motif` | string | Motif label carried by the contract |
246
+
247
+ `canvas.width`, `canvas.height`, and `canvas.aspect_ratio` must be finite positive numbers. `palette` must contain at least one `#RRGGBB` color. Both typography values, `density`, and `motif` must be non-empty strings, and `geometry` must be an object.
248
+
249
+ For manually written fingerprints, `canvas.width` and `canvas.height` are PowerPoint dimensions in inches. Image inspection initially reports those values in pixels, so review or replace them before using an image fingerprint to build a presentation.
250
+
251
+ The renderer requires at least one palette color. It uses the first color for text and accents. When a second color is present, the renderer uses a light tint of it for decorative panels; otherwise it derives the panels from the first color. `typography` must contain both `heading_font` and `body_font`.
252
+
253
+ Example:
254
+
255
+ ```json
256
+ {
257
+ "version": "1",
258
+ "canvas": {
259
+ "width": 13.333,
260
+ "height": 7.5,
261
+ "aspect_ratio": 1.7777333333
262
+ },
263
+ "palette": ["#17324D", "#E7EEF5"],
264
+ "typography": {
265
+ "heading_font": "Aptos Display",
266
+ "body_font": "Aptos"
267
+ },
268
+ "geometry": {},
269
+ "density": "balanced",
270
+ "motif": "offset_blocks"
271
+ }
272
+ ```
273
+
274
+ ## Command reference
275
+
276
+ ```text
277
+ odb inspect REFERENCE --output FINGERPRINT.json
278
+ odb validate PRESENTATION.json
279
+ odb build PRESENTATION.json --fingerprint FINGERPRINT.json --output OUTPUT.pptx
280
+ odb verify OUTPUT.pptx
281
+ ```
282
+
283
+ Use command-specific help for the accepted arguments:
284
+
285
+ ```bash
286
+ odb inspect --help
287
+ odb validate --help
288
+ odb build --help
289
+ odb verify --help
290
+ ```
291
+
292
+ ## Errors and exit codes
293
+
294
+ Successful commands return exit code `0`. Handled input and validation errors return exit code `2` and start with a stable identifier:
295
+
296
+ - `INPUT_NOT_FOUND`: a required local input path does not exist.
297
+ - `INVALID_REFERENCE`: an image or PPTX reference is corrupt, unsupported, unreadable, or contains no slides.
298
+ - `INVALID_SPEC`: JSON is malformed or does not satisfy the version 1 contract.
299
+ - `OUTPUT_WRITE_FAILED`: the requested fingerprint or presentation output cannot be written.
300
+ - `VERIFY_FAILED`: the PPTX cannot be read, has no slides, or has no editable text shapes.
301
+
302
+ Example:
303
+
304
+ ```text
305
+ INVALID_SPEC: presentation.json: slides[0] missing required fields: title
306
+ ```
307
+
308
+ `odb inspect` accepts only `.png`, `.jpg`, `.jpeg`, and `.pptx` references. Create the output parent directory and ensure it is writable before running `inspect` or `build`.
309
+
310
+ ## Troubleshooting
311
+
312
+ ### A generated deck uses the wrong font
313
+
314
+ The requested font must be installed on the computer opening or rendering the presentation. Replace `heading_font` and `body_font` in the fingerprint with installed font names, then rebuild.
315
+
316
+ ### An image fingerprint creates an incorrectly sized slide
317
+
318
+ Image inspection records pixel dimensions. Replace `canvas.width` and `canvas.height` with the intended PowerPoint size in inches. For a standard widescreen presentation, use approximately `13.333` by `7.5`.
319
+
320
+ ### A PPTX fingerprint has an empty palette
321
+
322
+ The inspector records directly assigned RGB text colors. Colors inherited from a theme or master may not be materialized in individual text runs. Add the required hex colors to `palette` manually.
323
+
324
+ ### Verification passes, but the slide looks wrong
325
+
326
+ `odb verify` checks package structure and editable text. It does not detect missing fonts, text overflow, or poor composition. Review the presentation in PowerPoint or LibreOffice Impress.
327
+
328
+ ### The command is not found
329
+
330
+ Run the executable from the active virtual environment, or activate the environment first:
331
+
332
+ ```bash
333
+ source .venv/bin/activate
334
+ odb --help
335
+ ```
336
+
337
+ On Windows PowerShell:
338
+
339
+ ```powershell
340
+ .venv\Scripts\Activate.ps1
341
+ odb --help
342
+ ```
343
+
344
+ ## Current limitations
345
+
346
+ - Output is PPTX only. DOCX generation is not implemented.
347
+ - Only `title` and `two_column` layouts are supported.
348
+ - The renderer does not reproduce a reference pixel for pixel.
349
+ - PPTX theme inheritance is only partially inspected.
350
+ - Raster references do not reveal font identity or semantic layout.
351
+ - OCR, charts, tables, images, animations, speaker notes, and template-preserving cloning are not implemented.
352
+ - `verify` performs structural checks, not visual checks.
353
+ - The package is currently distributed through GitHub Releases. Trusted Publishing for PyPI is prepared but not enabled; see [the publishing guide](docs/publishing.md).
354
+
355
+ ## Development setup
356
+
357
+ Clone the repository and install the locked development environment:
358
+
359
+ ```bash
360
+ git clone https://github.com/mrAibo/office-design-builder.git
361
+ cd office-design-builder
362
+ uv sync --python 3.12 --extra dev
363
+ ```
364
+
365
+ Run the project gates:
366
+
367
+ ```bash
368
+ uv run --offline python -m pytest -q
369
+ PIP_NO_INDEX=1 uv run --offline python -m build --no-isolation
370
+ uv run --offline python -m office_design_builder.cli --help
371
+ git diff --check
372
+ ```
373
+
374
+ GitHub Actions runs the locked test, package-build, and CLI-help gates on Python 3.12 for both Ubuntu and Windows. LibreOffice rendering is not part of the Windows job; the cross-platform suite verifies structure and deterministic package behavior.
375
+
376
+ The separate `Publish` workflow builds and checks distribution artifacts on pull requests. Matching version tags may publish only through the protected `pypi` environment and PyPI Trusted Publishing; repository setup and the first upload remain explicit human gates.
377
+
378
+ Generated build directories and user documents are intentionally not tracked.
379
+
380
+ ## License
381
+
382
+ [MIT](LICENSE)