Metadata-Version: 2.4
Name: documentdriver
Version: 0.2.0
Summary: Read and edit Word, PowerPoint and Excel files from agents: the docx, pptx and xlsx CLIs as static binaries
Keywords: docx,pptx,xlsx,ooxml,office,agents
License-Expression: Apache-2.0
License-File: LICENSE
Project-URL: Source, https://github.com/jhnoel/documentdriver
Project-URL: Contract, https://github.com/jhnoel/documentdriver/blob/main/docs/contract.md
Project-URL: Releasing, https://github.com/jhnoel/documentdriver/blob/main/RELEASING.md
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business
Classifier: Topic :: Text Processing :: Markup :: XML
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# documentdriver

The docx, pptx and xlsx command-line tools of documentdriver for one platform:
static binaries (no cgo, no libc) that read and edit Office documents for
agents, with one JSON result or one errors object per call. Wheels exist
for linux x86_64 and aarch64 (glibc and musl) and macOS arm64.

```python
import documentdriver

with open("report.docx", "rb") as f:
    data = f.read()
facts, _ = documentdriver.run("docx", ["read", "in.docx"], {"in.docx": data})
plan = {"ops": [...]}  # see `docx help ops`
result, out = documentdriver.run("docx", ["apply", "in.docx", "-", "-o", "out.docx"],
                                 {"in.docx": data}, stdin=plan, output="out.docx")
```

`run()` makes one call in a private directory and returns the parsed
result and the output file's bytes, or raises `EngineError` with the
contract's errors (`code`, `path`, `message`, `hint`).
`binary(name)` returns the bundled binary's path after checking it against
the SHA-256 recorded when the wheel was built, to run it yourself.

Commands, plans, results and errors: [the agent contract](https://github.com/jhnoel/documentdriver/blob/main/docs/contract.md).
