wolfdocx 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.
Files changed (54) hide show
  1. wolfdocx/__init__.py +25 -0
  2. wolfdocx/_cache_root.py +24 -0
  3. wolfdocx/_comment_threads.py +278 -0
  4. wolfdocx/_inspection_cache.py +374 -0
  5. wolfdocx/_version.py +3 -0
  6. wolfdocx/admission.py +163 -0
  7. wolfdocx/assembly.py +463 -0
  8. wolfdocx/authoring.py +2773 -0
  9. wolfdocx/canonical.py +267 -0
  10. wolfdocx/content.py +963 -0
  11. wolfdocx/document.py +215 -0
  12. wolfdocx/errors.py +169 -0
  13. wolfdocx/find_replace.py +1210 -0
  14. wolfdocx/formatting.py +3160 -0
  15. wolfdocx/inspect.py +3999 -0
  16. wolfdocx/model.py +1038 -0
  17. wolfdocx/numbering_authoring.py +1422 -0
  18. wolfdocx/output.py +13 -0
  19. wolfdocx/package.py +2313 -0
  20. wolfdocx/package_profile.py +128 -0
  21. wolfdocx/page_setup.py +2483 -0
  22. wolfdocx/paragraph_authoring.py +1842 -0
  23. wolfdocx/properties.py +2728 -0
  24. wolfdocx/protection.py +1909 -0
  25. wolfdocx/regions.py +1993 -0
  26. wolfdocx/render_warnings.py +106 -0
  27. wolfdocx/reporting.py +943 -0
  28. wolfdocx/review.py +2862 -0
  29. wolfdocx/run_text.py +117 -0
  30. wolfdocx/section_break.py +1810 -0
  31. wolfdocx/session_ops/__init__.py +45 -0
  32. wolfdocx/session_ops/_bridge.py +151 -0
  33. wolfdocx/session_ops/lists.py +104 -0
  34. wolfdocx/session_ops/paragraphs.py +39 -0
  35. wolfdocx/session_ops/rich_objects.py +2598 -0
  36. wolfdocx/session_ops/run_edits.py +70 -0
  37. wolfdocx/session_ops/runs.py +313 -0
  38. wolfdocx/session_ops/sections.py +109 -0
  39. wolfdocx/session_ops/styling.py +99 -0
  40. wolfdocx/session_ops/tables.py +247 -0
  41. wolfdocx/styles_authoring.py +2822 -0
  42. wolfdocx/table_cell_properties.py +1458 -0
  43. wolfdocx/table_column.py +1501 -0
  44. wolfdocx/table_delete.py +942 -0
  45. wolfdocx/table_insert.py +1114 -0
  46. wolfdocx/table_merge.py +1863 -0
  47. wolfdocx/table_properties.py +2429 -0
  48. wolfdocx/table_row_properties.py +1095 -0
  49. wolfdocx/table_structure.py +1044 -0
  50. wolfdocx/text_effects.py +1438 -0
  51. wolfdocx-0.1.0.dist-info/METADATA +127 -0
  52. wolfdocx-0.1.0.dist-info/RECORD +54 -0
  53. wolfdocx-0.1.0.dist-info/WHEEL +4 -0
  54. wolfdocx-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.5
2
+ Name: wolfdocx
3
+ Version: 0.1.0
4
+ Summary: Read, write, and edit Word .docx files in Python. A python-docx alternative that edits documents in place and keeps every untouched part byte-for-byte identical. Pure Python, MIT licensed.
5
+ Project-URL: Homepage, https://wolfdocx.com
6
+ Project-URL: Repository, https://github.com/wolfiesch/wolfdocx-oss
7
+ Project-URL: Issues, https://github.com/wolfiesch/wolfdocx-oss/issues
8
+ Project-URL: Changelog, https://github.com/wolfiesch/wolfdocx-oss/blob/main/CHANGELOG.md
9
+ Author: Wolfgang Schoenberger
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: create-docx,document,docx,edit-docx,office,office-automation,openxml,python-docx,python-docx-alternative,reporting,word
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Office/Business :: Office Suites
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: Text Processing
27
+ Requires-Python: >=3.11
28
+ Provides-Extra: dev
29
+ Requires-Dist: build>=1.2; extra == 'dev'
30
+ Requires-Dist: pytest>=8.3; extra == 'dev'
31
+ Requires-Dist: ruff>=0.12; extra == 'dev'
32
+ Requires-Dist: twine>=6.1; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # wolfdocx
36
+
37
+ Edit .docx files in Python. wolfdocx is a python-docx alternative that opens an
38
+ existing Word document, applies your edits in place, and saves a new package where
39
+ every part you did not touch is copied byte-for-byte from the original.
40
+
41
+ - Pure Python, no runtime dependencies.
42
+ - Python 3.11 or newer.
43
+ - MIT licensed.
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ pip install wolfdocx
49
+ ```
50
+
51
+ ## Quickstart
52
+
53
+ Open an existing `.docx`, read its paragraphs and tables, make a few edits, and save
54
+ the result to a new file.
55
+
56
+ ```python
57
+ from wolfdocx import Document
58
+
59
+ with Document("contract.docx") as doc:
60
+ # The first story under doc.node is the main document body.
61
+ body = doc.node.children[0]
62
+
63
+ for paragraph in body.paragraphs:
64
+ print(paragraph.to_string("txt").rstrip("\n"))
65
+
66
+ for table in body.tables:
67
+ print(table.to_string("txt"))
68
+
69
+ # Replace the text of one run. Paragraph and run indices are zero-based and
70
+ # count the direct paragraphs of the body and the direct runs of that paragraph.
71
+ first_run = body.paragraphs[0].runs[0]
72
+ doc.set_run_text(0, 0, "Master Services Agreement", expected_old_text=first_run.text)
73
+
74
+ # Regular-expression find and replace across runs.
75
+ replaced = doc.find_replace(r"ACME Corp\.?", "Acme Corporation")
76
+ print(replaced.status, replaced.replacement_count)
77
+
78
+ # Add a plain paragraph after the last body paragraph.
79
+ added = doc.append_paragraph("Signed electronically.")
80
+ print(added.status)
81
+
82
+ report = doc.save("contract-edited.docx")
83
+ print(report.status, report.changed_parts, report.raw_copied_parts)
84
+ ```
85
+
86
+ Edits are held in memory until `save(path)` writes a new file, and `doc.node` is a
87
+ snapshot: read it again after an edit to see the updated tree.
88
+
89
+ ## When to use WolfDocx instead of python-docx
90
+
91
+ Use WolfDocx when you need targeted edits to an existing document and want every
92
+ untouched package part to remain byte-for-byte identical.
93
+
94
+ - **In-place edits.** Each edit rewrites only the XML part it targets. Run
95
+ properties, attributes, and neighboring markup stay where they were.
96
+ - **Byte-for-byte preservation.** On save, every package part you did not change is
97
+ copied from the source archive unchanged. `report.changed_parts` lists the parts
98
+ that were rewritten and `report.raw_copied_parts` counts the parts copied as-is.
99
+ - **Verified, no-clobber saves.** The output is staged and checked before it is
100
+ published. `save` refuses to replace an existing file and reports
101
+ `status == "refused"` with a `code` explaining why.
102
+ - **Explicit refusals.** An edit that cannot be applied safely, such as a
103
+ `find_replace` pattern with no match, returns a report with `status == "refused"`
104
+ and leaves the document unchanged. `set_run_text` raises `RunTextEditError` for
105
+ bad indices or an `expected_old_text` mismatch.
106
+
107
+ wolfdocx works on `.docx` packages. It does not render pages, convert to PDF, or
108
+ read legacy binary `.doc` files.
109
+
110
+ ## Commercial capabilities
111
+
112
+ Commercial capabilities are available at https://wolfdocx.com.
113
+
114
+ ## Contributing
115
+
116
+ ```bash
117
+ python -m pip install -e ".[dev]"
118
+ ruff check .
119
+ python -m pytest
120
+ ```
121
+
122
+ Report bugs at https://github.com/wolfiesch/wolfdocx-oss/issues. For security
123
+ issues, see [SECURITY.md](SECURITY.md).
124
+
125
+ ## License
126
+
127
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,54 @@
1
+ wolfdocx/__init__.py,sha256=J-6lxgslZ3XKXE42Y1doetLiwWNT3qRsEaQL2Zgpa5c,656
2
+ wolfdocx/_cache_root.py,sha256=zomWm8t13BponihQup2XmbNrjkFE4zN0IRWE2UEQTxs,835
3
+ wolfdocx/_comment_threads.py,sha256=EhtKv_K2eXVhPyCY35QBUm_Vs7QZ7qhSCkc6knBzH90,10756
4
+ wolfdocx/_inspection_cache.py,sha256=oB2vuoh0P-PHx0Jo1zXgZy-IRUDHgttNmT8IrkItQtM,14075
5
+ wolfdocx/_version.py,sha256=h-2p4V9_Jgn7gZyezM1Zo5fmX5JA4NpAPHYMTeVBLBw,69
6
+ wolfdocx/admission.py,sha256=atA3jg-xLH1Rs4TlBSgObztjO0nefD0szJK3T_Nzo70,5843
7
+ wolfdocx/assembly.py,sha256=LGwcpFM6cC4nF1LtAdyL0i27D_fQ71_XO_kZQ3yHR7E,18434
8
+ wolfdocx/authoring.py,sha256=j3ZXUJFC0wrG5Oy-POKArfUxa3aAHsmb4TYlW4oL_OE,100592
9
+ wolfdocx/canonical.py,sha256=qSzQp9dQczKYXqo5Lz2ZLEtSzdVqu9IQO_zpLdqUo1Y,9019
10
+ wolfdocx/content.py,sha256=G8-4wt6oFyPcr3wfA-2oVIf_EjJozDKy4qmW_vuylLY,35461
11
+ wolfdocx/document.py,sha256=qTzLYH0l0H7dwH2lRd9fMhGurTyAdGokDlDS0IBqtNA,8879
12
+ wolfdocx/errors.py,sha256=_39C5069MpMWnv7OySlUA03czNlFX07YvnwGcn9mI5Q,5518
13
+ wolfdocx/find_replace.py,sha256=ENvG471KS-YngNc2l35mjCXMKatz3Yf2vrj7Re8qexI,43416
14
+ wolfdocx/formatting.py,sha256=l4-7UHWu6aTJGhrkegeWA6MWYb3jelxLUkvTBstjfx0,121179
15
+ wolfdocx/inspect.py,sha256=UeM_1ceF4RIN1yIgu6lhJKbnVV-OPFiNOtFv-djuEhY,159815
16
+ wolfdocx/model.py,sha256=v0lcgGU3YWH4twVTdzuDF46V0aS7MY8puh2TrAmlhU8,39373
17
+ wolfdocx/numbering_authoring.py,sha256=chfXaPXyVL7IX4hD5iVyQMAPsU1b8hgC6ysaX4H_bSg,52259
18
+ wolfdocx/output.py,sha256=htG2_IFnsdZ6gwK6oe0n3Bv8cekprjWHB95KTmrphgQ,399
19
+ wolfdocx/package.py,sha256=wnp_zosss0roBRnjUlhQM706Iq3gB8AMbtsCUYmtamw,98185
20
+ wolfdocx/package_profile.py,sha256=1dylTp_6o6Ti524v-IF0SIzVZxpsKWrazkouOcPmWgg,4239
21
+ wolfdocx/page_setup.py,sha256=nCcGEtHjRu2lNJrLtgQG3uAtTSZXirf_dlAP4dsVJMM,99553
22
+ wolfdocx/paragraph_authoring.py,sha256=Y7Xx9HH_kKT1D3nwwFwSR_jLOkmQ2_f9eicv7F3Na7A,68607
23
+ wolfdocx/properties.py,sha256=Cr0UxLpqUp-BcEgwMIFfB6D4fJad2aowL6bYygnSZEI,110299
24
+ wolfdocx/protection.py,sha256=Yg8KUsTAEY9cW20OJs3T9IdkGX-NSSUQMUddT-bq5jE,71961
25
+ wolfdocx/regions.py,sha256=ivDsA6LXmSSSoN91_MBI_wjcZakTJLbzlzr8g11V0PE,77701
26
+ wolfdocx/render_warnings.py,sha256=ir9PKbv-WMTdLUm1EBHLvIk90uhod3l7VnN1Lm7IRkA,3391
27
+ wolfdocx/reporting.py,sha256=_Dah6ZiGhorfdTWe3QeidBc7dDpvWArM9NFKMmPwXMc,34139
28
+ wolfdocx/review.py,sha256=CsI_ChXjxufaPIf1EC2d3J77X_tGNylDOViBCcijdBs,112556
29
+ wolfdocx/run_text.py,sha256=ryvs3I9YGIrFQLmcH8hwVzjhRrNahNfUEau_E_X2eY0,4364
30
+ wolfdocx/section_break.py,sha256=pt-c8dteWYe6A3ZtAkL-gXxd9d7a4hc5a6nGt-wlnoU,72123
31
+ wolfdocx/styles_authoring.py,sha256=H6a96JuerF_HIqW2wU0MzZduNsZxoTGakKFkQFnDErw,110222
32
+ wolfdocx/table_cell_properties.py,sha256=CTYp2RQKNdV2OGtVPIWRocFXBj2AVbiFkNS_SqT1SwU,54628
33
+ wolfdocx/table_column.py,sha256=o4QVV9cQ6ADvg_EUYYicVld5OOzs2nDshOj31tPu6XE,57068
34
+ wolfdocx/table_delete.py,sha256=5gnXBK00jIiDG3hNL__ZR_AjAWeNqc1VEAAxjkYtXsY,34048
35
+ wolfdocx/table_insert.py,sha256=Ed8kLTQ4kZH5hVtT30EsWWB5Yu-aghR1tNogayB6gVg,40566
36
+ wolfdocx/table_merge.py,sha256=mzWeYFa9f5pNvEpoVfviUYBNTgc4zSayh92SzuNtE-U,70264
37
+ wolfdocx/table_properties.py,sha256=TS13-1pQKggiq0AE85V4iPOLnqxAJ9xxj3VSWvrP4_I,94004
38
+ wolfdocx/table_row_properties.py,sha256=72BtZUY_qtBTo5UdpWLhKTreowz-YVSdI2hK4j30l78,40917
39
+ wolfdocx/table_structure.py,sha256=7BoKoMVfNgu-4g7yvCpUgk4w4tQMS333XJAjF3YqwWA,39533
40
+ wolfdocx/text_effects.py,sha256=ZbwFctSAsG4DVUEGXEr0V4dEcmSTuM0FW41yEK26NuM,51084
41
+ wolfdocx/session_ops/__init__.py,sha256=Ejg0GNrhflSnzOVwxODvfr1YBcayjva2-jMvWr3xg5Y,1290
42
+ wolfdocx/session_ops/_bridge.py,sha256=emiT1sXku9IyekQ24uJfVAz_7Lft67-yIpGntzA0nuM,5084
43
+ wolfdocx/session_ops/lists.py,sha256=3ZrpmEaudKAF6l8PRqkHuFafL03D1Rrc_LNEMNE3KhM,3646
44
+ wolfdocx/session_ops/paragraphs.py,sha256=C5yzxWL2k58NfsGrsB233NQIUfR-dcuZJjwo1yt25qk,1449
45
+ wolfdocx/session_ops/rich_objects.py,sha256=sC40TARH5SXTfDvvtsOh4rMUgB9ma3pS6zasFjVxKZ4,110568
46
+ wolfdocx/session_ops/run_edits.py,sha256=UdjB2a_rUkMtFbGUhBx-DUUY9EO_L3A5h1vpR3h3JW0,2098
47
+ wolfdocx/session_ops/runs.py,sha256=IlDxuaeIaMtKa3BFm79zKkHLdHdYwMXpEk8nhasArQM,11212
48
+ wolfdocx/session_ops/sections.py,sha256=Nyfq-QIVt6cpM4qHYTEuUwdlAslwDqmanXLSIhYF3lk,4227
49
+ wolfdocx/session_ops/styling.py,sha256=LM3nxUJjw1xUR9ZAnO79vx2MxZSYuGzOO9poInPi0ps,3724
50
+ wolfdocx/session_ops/tables.py,sha256=VBkC67fNkjOhnYePiFvfyvCFvPlKSgkSsOcx6RwhVt8,8500
51
+ wolfdocx-0.1.0.dist-info/METADATA,sha256=DAPcaOnaw0TVcowf5vY5-IlpmBWGiVUMaZsvLVidW04,4964
52
+ wolfdocx-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
53
+ wolfdocx-0.1.0.dist-info/licenses/LICENSE,sha256=JKzPXq3f7o1e4rX_LdIS1izSmmLRlPsMW8aBssenlzA,1078
54
+ wolfdocx-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wolfgang Schoenberger
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.