Skip to main content

athena-python-docx

Drop-in replacement for python-docx that connects to Athena's Keryx-backed Word document stack.

Quick start

from docx import Document
from docx.shared import Inches, Pt, RGBColor

# Open an existing Word document asset by its Athena asset_id
with Document("asset_abc123") as doc:
    doc.add_heading("Market Analysis", level=1)

    p = doc.add_paragraph()
    r = p.add_run("Revenue grew ")
    highlight = p.add_run("12.3% year-over-year")
    highlight.bold = True
    highlight.font.color.rgb = RGBColor(0x00, 0x80, 0x00)
    p.add_run(".")

    t = doc.add_table(rows=2, cols=2, style="TableGrid")
    t.cell(0, 0).text = "Segment"
    t.cell(0, 1).text = "Revenue"
    t.cell(1, 0).text = "Enterprise"
    t.cell(1, 1).text = "$4.3M"

    doc.save()

API parity rule

This SDK mirrors python-docx's public API exactly. See CLAUDE.md for the full contract.

Development

uv venv
uv pip install -e ".[dev]"
uv run pytest tests/ -x

DocX Execution Lab

For fast local repros against real Athena document assets, use the headless runner in scripts/docx_exec_lab.py. It executes an arbitrary Python snippet with this checkout of athena-python-docx, captures stdout/stderr/errors/timings, and can export the resulting .docx for text assertions. scripts/docx_exec_lab_server.py adds a local UI with an Olympus Word document embed preview pane. See DOCX_EXEC_LAB.md.

Environment variables

Required when connecting to DOCX Studio (set by the Athena backend in the execute_word_document_code executor sandbox):

  • ATHENA_DOCX_BASE_URL — DOCX Studio API base URL
  • ATHENA_DOCX_API_KEY — Athena API key or service-issued DOCX Studio token

Without ATHENA_DOCX_API_KEY (and without api_key=), the SDK uses ATHENA_API_KEY. When ATHENA_API_URL is set too (the bare Athena URL or one ending in /api/v0), an opened document's calls carry a 15-minute token Athena mints for that document alone (POST /api/v0/assets/{asset_id}/studio-token), read-only for reads; Document.create() and its upload still send the key (docx/_asset_token.py).

License

MIT

Metadata

Release files for athena-python-docx 0.45.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for athena-python-docx 0.45.2
File Size Uploaded Provenance Actions
athena_python_docx-0.45.2.tar.gz 1.2 MB Without provenance Details for athena_python_docx-0.45.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for athena-python-docx 0.45.2
File Interpreter ABI Platform Actions
athena_python_docx-0.45.2-py3-none-any.whl Python 3 none any Details for athena_python_docx-0.45.2-py3-none-any.whl

Total release size: 1.7 MB

Release files / athena_python_docx-0.45.2.tar.gz

Download URL athena_python_docx-0.45.2.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
573ce11952a72879d4e2ba6f909c849d29f3cde1aa7c32de59ac3bc2d03bf4c4
BLAKE2b-256 checksum
How to use checksums
fcda5d4f2b8ff9e5d569999345f17e20b37ed4c179970aae0abec727b316b934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / athena_python_docx-0.45.2-py3-none-any.whl

Download URL athena_python_docx-0.45.2-py3-none-any.whl
Size 437.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a164584cf251fb057c9eb636108c79f5ea8b6fb852f9d59cc1575d300bbb01e
BLAKE2b-256 checksum
How to use checksums
f3eae6ec517cd90bd7efd5ebecbd16d4c2ee9b71aa08e2f512032abb88f1e0b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for athena-python-docx 0.45.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.45.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page