An import-compatible, agent-safe fork of python-docx for creating and editing Word documents without silent corruption.
paper-docx is an import-compatible hard fork of python-docx for creating and editing Microsoft Word (.docx) documents. It keeps the docx import name and upstream object model, and adds guarded inspection and editing APIs that refuse unsupported operations instead of guessing.
Installation
Use an activated virtual environment.
python -m pip uninstall -y python-docx paper-docx
python -m pip install paper-docx
python -m paper_docx_doctor
Both distributions provide the docx import package. Do not install python-docx and paper-docx in the same environment.
To return to python-docx, run the uninstall line above again, then python -m pip install python-docx.
Quick start
Create a Word redline from two document versions:
import docx
from docx.package import compare
original = docx.Document()
original.add_paragraph("Payment is due within thirty calendar days.")
original.save("original.docx")
revised = docx.Document()
revised.add_paragraph("Payment is due within thirty business days.")
revised.save("revised.docx")
result = compare("original.docx", "revised.docx", author="Reviewer")
result.document.save("redline.docx")
print(result.revision_count) # 2
compare writes differences as tracked changes and refuses changes it cannot represent safely.
Documentation
Read the paper-docx documentation.
Contributing
Contributions are welcome. See CONTRIBUTING.md.
Acknowledgments
paper-docx builds on python-docx by Steve Canny and contributors. This fork preserves their API, license, and attribution.
Citation
If you reference paper-docx in research or writing:
@software{paper_docx,
title = {paper-docx: an agent-first structure editor for Word documents},
author = {{Paper Instruments, Inc.}},
year = {2026},
url = {https://github.com/paper-instruments/paper-docx}
}
Cite it as a fork of python-docx by Steve Canny and contributors.
License
MIT, inherited from python-docx. Original work © Steve Canny and the python-docx contributors; fork additions © Paper Instruments, Inc. See LICENSE.
Metadata
Release files for paper-docx 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| paper_docx-0.2.1.tar.gz | 7.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| paper_docx-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 MB
Release files / paper_docx-0.2.1.tar.gz
| Download URL | paper_docx-0.2.1.tar.gz |
|---|---|
| Size | 7.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ebe8522de3e7aeb6ca1515c3832a4012905596c66eda0114f1e59370585381a
|
|
BLAKE2b-256 checksum How to use checksums |
5bbffc72748a049caf0a3db7a7440ad169f9900961c31a2b59f76aca62fdc4b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / paper_docx-0.2.1-py3-none-any.whl
| Download URL | paper_docx-0.2.1-py3-none-any.whl |
|---|---|
| Size | 435.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
876d9f5bdebaa8f8523d5fa3fb85f9d5468ab6e6c40f51ab62c899ea2dd48b31
|
|
BLAKE2b-256 checksum How to use checksums |
af84b16e4d10a4b2c63638be9fb3d0a0babdb1203df6c90cce52748c78fff7e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log