Metadata-Version: 2.4
Name: stemma-py
Version: 0.7.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Office/Business :: Office Suites
Classifier: Topic :: Text Processing :: Markup :: XML
Classifier: Typing :: Typed
License-File: LICENSE-MIT
License-File: LICENSE-APACHE
Summary: Edit existing Word documents with native tracked changes: the Stemma DOCX engine for Python (experimental).
Keywords: docx,word,tracked-changes,redline,ooxml
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/stemma-sh/stemma/blob/main/CHANGELOG.md
Project-URL: Documentation, https://stemma.sh/docs/reference/python
Project-URL: Homepage, https://stemma.sh
Project-URL: Repository, https://github.com/stemma-sh/stemma

# stemma-py

Edit existing Word documents from Python with native tracked changes, the way
Word itself represents them. A reviewer opens the result in Word and accepts or
rejects each change.

> **Experimental.** The Python API may change before 1.0. The engine underneath
> is the same one the Stemma CLI and MCP server run.

```bash
pip install stemma-py
```

The PyPI name is `stemma-py`; the import name is `stemma`. Wheels are
self-contained: no compiler and no Python dependencies.

```python
import stemma

doc = stemma.Document.open("contract.docx")
block = doc.read()["blocks"][1]

edited = doc.apply_authored({
    "ops": [{
        "op": "replace",
        "target": block["id"],
        "guard": block["guard"],
        "content": {"type": "paragraph",
                    "content": [{"type": "text", "text": "Liability is capped at twice the fees paid."}]},
    }],
    "revision": {"author": "J. Osei"},
})

assert edited.review()["validator"]["ok"]
edited.save("contract-redline.docx")
```

Everything else (comparing two versions, resolving revisions, auditing a
delivery, the error classes) is in the
[Python reference](https://stemma.sh/docs/reference/python).

Licensed under either of MIT or Apache-2.0, at your option.

