athena-python-docx 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/PKG-INFO +1 -1
  2. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/__init__.py +1 -1
  3. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/document.py +42 -3
  4. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/pyproject.toml +1 -1
  5. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/.gitignore +0 -0
  6. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/CLAUDE.md +0 -0
  7. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/README.md +0 -0
  8. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/_batching.py +0 -0
  9. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/api.py +0 -0
  10. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/client.py +0 -0
  11. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/enum/__init__.py +0 -0
  12. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/enum/table.py +0 -0
  13. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/enum/text.py +0 -0
  14. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/errors.py +0 -0
  15. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/shared.py +0 -0
  16. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/table.py +0 -0
  17. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/text/__init__.py +0 -0
  18. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/text/paragraph.py +0 -0
  19. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/text/run.py +0 -0
  20. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/docx/typing.py +0 -0
  21. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/scripts/publish.sh +0 -0
  22. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/tests/__init__.py +0 -0
  23. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/tests/conftest.py +0 -0
  24. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/tests/test_commands.py +0 -0
  25. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/tests/test_python_docx_api_parity.py +0 -0
  26. {athena_python_docx-0.1.0 → athena_python_docx-0.1.1}/tests/test_smoke_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: athena-python-docx
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Drop-in replacement for python-docx that connects to Athena's Superdoc/Keryx collaborative document stack
5
5
  Project-URL: Homepage, https://athenaintelligence.ai
6
6
  Author-email: Athena Intelligence <engineering@athenaintelligence.ai>
@@ -6,7 +6,7 @@ See CLAUDE.md for the API parity contract.
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
- __version__ = "0.1.0"
9
+ __version__ = "0.1.1"
10
10
 
11
11
  from docx.api import Document
12
12
 
@@ -306,12 +306,50 @@ class Document:
306
306
  # ---- Module-level helpers ----
307
307
 
308
308
  def _extract_inserted_node_id(result: dict, *, expected_type: str) -> str:
309
- """Parse Superdoc's insert() response to find the new nodeId.
310
-
311
- Superdoc rotates response shape across versions. Defensively probe.
309
+ """Parse Superdoc's insert() response to find the relevant blockId.
310
+
311
+ Superdoc rotates response shapes across versions; we probe in order
312
+ of "most current" first. Real observed shape (superdoc-sdk 1.6.0.dev29):
313
+
314
+ {
315
+ "receipt": {
316
+ "resolution": {
317
+ "target": {"kind": "text", "blockId": "<uuid>", "range": {...}}
318
+ }
319
+ },
320
+ ...
321
+ }
322
+
323
+ Older/alternate shapes we also accept:
324
+ - top-level ``blockId``
325
+ - nested ``result.insertedNodes[].nodeId`` (when typed = expected_type)
326
+ - last element of ``result.nodes``
312
327
  """
313
328
  if not isinstance(result, dict):
314
329
  return ""
330
+
331
+ # Shape 1 (current): receipt.resolution.target.blockId
332
+ receipt: object = result.get("receipt")
333
+ if isinstance(receipt, dict):
334
+ resolution: object = receipt.get("resolution")
335
+ if isinstance(resolution, dict):
336
+ target: object = resolution.get("target")
337
+ if isinstance(target, dict):
338
+ block_id: str = str(target.get("blockId", ""))
339
+ if block_id:
340
+ return block_id
341
+
342
+ # Shape 2: top-level blockId or target.blockId
343
+ top_block: object = result.get("blockId")
344
+ if isinstance(top_block, str) and top_block:
345
+ return top_block
346
+ top_target: object = result.get("target")
347
+ if isinstance(top_target, dict):
348
+ tb: str = str(top_target.get("blockId", ""))
349
+ if tb:
350
+ return tb
351
+
352
+ # Shape 3 (legacy): nested result.result.insertedNodes[] / nodes[]
315
353
  data_obj: object = result.get("result", {})
316
354
  data: dict = data_obj if isinstance(data_obj, dict) else {}
317
355
  nodes_obj: object = data.get("insertedNodes", data.get("nodes", []))
@@ -323,6 +361,7 @@ def _extract_inserted_node_id(result: dict, *, expected_type: str) -> str:
323
361
  return str(node.get("nodeId", ""))
324
362
  if nodes and isinstance(nodes[-1], dict):
325
363
  return str(nodes[-1].get("nodeId", ""))
364
+
326
365
  return ""
327
366
 
328
367
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "athena-python-docx"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Drop-in replacement for python-docx that connects to Athena's Superdoc/Keryx collaborative document stack"
9
9
  readme = "README.md"
10
10
  license = "MIT"