Metadata-Version: 2.4
Name: axon-document
Version: 0.1.0
Summary: AXON document format — typed, deterministic, signable document archives. Powers tdoc (tdoc.xyz).
Author: RishiArunShivhare
License: Apache-2.0
Project-URL: Homepage, https://tdoc.xyz
Project-URL: Source, https://github.com/LuciferMors/tdoc
Project-URL: Issues, https://github.com/LuciferMors/tdoc/issues
Project-URL: Documentation, https://github.com/LuciferMors/tdoc#readme
Project-URL: Specification, https://github.com/LuciferMors/tdoc/blob/main/AXON_Format_Specification.txt
Keywords: document,format,semantic,deterministic,archive,axon,tdoc,pdf,llm,rag
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: pdf
Requires-Dist: PyMuPDF>=1.23.0; extra == "pdf"
Provides-Extra: fastjson
Requires-Dist: orjson>=3.9.0; extra == "fastjson"
Provides-Extra: crypto
Requires-Dist: cryptography>=41.0.0; extra == "crypto"
Provides-Extra: mathml
Requires-Dist: latex2mathml>=3.77.0; extra == "mathml"
Provides-Extra: all
Requires-Dist: PyMuPDF>=1.23.0; extra == "all"
Requires-Dist: orjson>=3.9.0; extra == "all"
Requires-Dist: cryptography>=41.0.0; extra == "all"
Requires-Dist: latex2mathml>=3.77.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Dynamic: license-file

# AXON — Document Format · powers **tdoc** (https://tdoc.xyz)

Deterministic, semantic, signable document archives. A clean break from PDF / DOCX / HTML.

- **Spec**: `AXON_Format_Specification.txt` — v1.0 design draft.
- **Reference impl**: `axon.py` — single-file Python reference (~1800 lines).
- **Demo**: `demo.py` — runs the full pipeline end-to-end.
- **Product** (commercial API on top): `product/` — see `product/README.md`.

## The AXON format vs the `.tdoc` file extension

- **AXON** is the open format. Open spec, Apache-2.0 reference implementation. Anyone can build tools on it.
- **`.tdoc`** is the standard file extension for AXON archives. A `.tdoc` file *is* an AXON archive.
- Readers that support AXON also accept `.axon` for backwards compatibility.

Think of it like `.png` vs PNG: one is the file extension users see, the other is the open standard.

## Status

Early-alpha reference. Spec is complete; implementation covers most of it and ships with **50 passing tests** (32 format + 18 API) covering the load-bearing invariants. Landing is live at https://tdoc.xyz with Mozilla Observatory **A+ · 125/125 · 10/10 tests**.

## Install

From PyPI (once published):

```bash
pip install axon-document           # → import axon
pip install axon-document[crypto]   # + Ed25519 signatures
pip install axon-document[pdf]      # + PyMuPDF PDF ingest
pip install axon-document[all]      # everything
```

From source (editable):

```bash
python3 -m venv .venv
.venv/bin/pip install -e ".[dev,crypto]"
.venv/bin/pytest tests/ product/tests/
```

Optional extras: `[pdf]`, `[fastjson]`, `[crypto]`, `[mathml]`, `[all]`.

## Quick start

```python
from axon import convert_axc_string, encode_archive, decode_archive, render_html

doc = convert_axc_string("""
@section [id="hello"]:
  @heading [level=1]:
    Hello
  @paragraph:
    A deterministic document.
""", title="Hello", document_type="article.research")

encode_archive(doc, "hello.tdoc")  # .tdoc extension is the convention

loaded = decode_archive("hello.tdoc", verify=True)
print(render_html(loaded))
```

## What's verified

As of the current test suite (`pytest tests/`):

| Invariant | Status |
|---|---|
| AXC parse ↔ serialise round-trip (Unicode, nested, attributes) | ✅ |
| Archive byte-determinism — two encodes produce identical bytes | ✅ |
| ZIP entries stamped with fixed epoch (not wall-clock) | ✅ |
| `encode_archive` does not mutate `manifest.modified` | ✅ |
| Content-hash tamper detection via `validate()` | ✅ |
| `verify_document` rejects zeroed manifest hash | ✅ |
| **Ed25519 cryptographic signing + verification** | ✅ |
| **ZIP-bomb + path-traversal defenses on decode** | ✅ |
| **Spec conformance (accessibility warnings, dup-ids, hash mismatch)** | ✅ |

**32 tests, 0 xfail** for the format. **18 additional tests** for the `tdoc` API service (auth, quotas, security headers, rate limits). **50 total, all green**.

## License

Apache-2.0. See `LICENSE`.

## Commercial

Hosted API, paid plans, and signing-as-a-service live at **[tdoc.xyz](https://tdoc.xyz)**.
