Skip to main content

Drop-in replacement for openpyxl that writes to Athena's Keryx-backed spreadsheet Y.Docs

Project description

athena-openpyxl

openpyxl-shaped Python SDK that writes directly to Athena's Keryx-backed spreadsheet Y.Docs. No HTTP middleware — mirrors athena-python-docx.

Quick start

from openpyxl import Workbook

with Workbook("asset_abc123") as wb:   # opens Keryx session, runs initial sync
    ws = wb.active
    ws["A1"] = "Hello"
    ws["A2"] = 42
    ws["A3"] = "=SUM(A2)"
    wb.save()                          # flushes pending updates to Keryx

Environment

The SDK reads these env vars (Daytona-managed in production):

Variable Required Notes
KERYX_WS_URL e.g. wss://keryx-staging.athenaintel.com
ATHENA_WORKSPACE_ID workspace routing segment
KERYX_COLLAB_TOKEN one of pre-minted JWT (preferred — Daytona injects this)
KERYX_AUTH_PRIVATE_KEY one of ECDSA P-384 JWK/PEM; used to sign locally for dev
ATHENA_SERVICE_USER_ID yuserid JWT claim, defaults to athena@athenaintel.com

Install (development)

cd xlsx-studio/python-sdk
uv venv && uv pip install -e ".[dev]"
uv run pytest tests/

Phase 2 scope (this release)

What works today:

  • Opening a workbook by asset_id.
  • Reading the sheets list from sheetDataV3.
  • Single-cell reads and writes of strings / numbers / bools / formulas.
  • Flushing via wb.save(); clean teardown via wb.close() or context-manager exit.

Raises UnsupportedFeatureError (clearly scoped, not silently no-op):

  • Cell formatting: font, fill, alignment, number_format.
  • Range accessors: ws['A1:C3'], iter_rows, append.
  • Structural mutations: wb.create_sheet, wb.remove, ws.title = x.
  • Merges, freeze panes, column/row dimensions.

All of those land in Phase 3 (see xlsx-studio/CLAUDE.md).

Architecture

Agent code (openpyxl idiom)
    ↓
Workbook / Worksheet / Cell  (sync facade)
    ↓  _batching.run_sync → persistent background event loop thread
Session  (pycrdt Doc + Keryx connection)
    ↓  _keryx_client: ECDSA P-384 JWT + y-websocket sync protocol
Keryx  ←→  Olympus (@rowsncolumns/y-spreadsheet renderer)
  (same Y.Doc; room = "{workspace}/{asset_id}")
  • _keryx_client.py — ECDSA P-384 JWT signing, y-websocket sync step1/step2/update frames. Ported down from agora/agora/services/keryx/client.py, minus retry/metrics/awareness.
  • _batching.py — sync→async bridge, one persistent event loop. Ported from docx-studio/python-sdk/docx/_batching.py.
  • _session.pySession class owning the pycrdt Doc + WebSocket; exposes set_cell_value / get_cell_value / list_sheets.
  • cell.py, worksheet.py, workbook.py — openpyxl-shaped sync facade that routes through Session.

Publishing

bash ../scripts/publish-python-sdk.sh 0.1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

athena_openpyxl-0.1.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

athena_openpyxl-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file athena_openpyxl-0.1.0.tar.gz.

File metadata

  • Download URL: athena_openpyxl-0.1.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for athena_openpyxl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 38fc4911474003a85a7decfd753630c5d9b239bfc71ed05f4bcbf168e0e61b3c
MD5 d797c36755744212dd56f2080609b57c
BLAKE2b-256 0c2a598256436f3312f52ea46cc576d896fca920a4bf62797b73cffbed3d30cc

See more details on using hashes here.

File details

Details for the file athena_openpyxl-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for athena_openpyxl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9118f333af16f6bc7e55154115a34db835c70abb396829461b7a069670bcdc
MD5 776005567131250310112a5c0c56faa0
BLAKE2b-256 2ef7668d2305f06c65483db417790820fb0dc4f01225e4ec7b547d961d6054ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page