# =PY() + NumPy inside Collabora

**URL:** <https://forum.collaboraonline.com/t/py-numpy-inside-collabora/4844>\
**Category:** Development\
**Created:** [July 11, 2026, 5:57pm UTC](https://forum.collaboraonline.com/t/py-numpy-inside-collabora/4844 "2026-07-11T17:57:49Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![KeithCu](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/keithcu/32/2327_2.png) [@KeithCu](https://forum.collaboraonline.com/u/KeithCu)\
**Post date:** [August 2, 2026, 3:26pm UTC](https://forum.collaboraonline.com/t/py-numpy-inside-collabora/4844/14 "2026-08-02T15:26:54Z")

</div>

Hi Collabora-dev,

I’m excited to say that the MVP is now up on Gerrit:

1. [scaddins: add Calc =PY() Python compute AddIn](https://gerrit.collaboraoffice.com/c/online/+/8122) — Core AddIn, `XVolatileResult` / `#BUSY!`, dumb JSON ↔ Any, CppUnit

2. [kit/wsd: broker =PY() to python compute service](https://gerrit.collaboraoffice.com/c/online/+/8123) — kit emitter + coolwsd `http::Session` POST (same outbound shape as AI chat), feature flag default off, UnitWSD wire test

The Python compute service must be installed separately for now. Those patches are a good start, here’s my high-level take on future work:

| Phase | Goal |
| --- | --- |
| 0 — MVP | Merge experimental `=PY()` default-off; publish first compute image |
| 1 — Calc parity | Visible short Python errors; auto-spill; plot insert; optional shared kernel (wsd-owned `session_id`) |
| 2 — Authoring UX | Browser Monaco / Run Script / diagnostics (not pywebview in the jail) |
| 3 — Excel files | Use LibrePy OOXML rewriter; Online calls convert on open/save (or a thin filter hook) |
| 4 — OCR | Expose LibrePy-style local OCR + config settings UI. |
| 5 — Science | Helper analysis tools, admin-baked domain stacks in the image |

Here’s a list of engine features that unlock Excel parity:

1. Auto-spill / dynamic arrays for AddIn `PY`  
Today a single-cell `=PY` that returns a list/`ScMatrix` keeps only the top-left value unless entered as a matrix formula. Classic LibrePy fakes spill with UNO write-back + `#SPILL!`; that is a poor fit for Online. Prefer promoting `PY` into Calc’s dynamic-array path so that spill ranges are engine-owned and dependents work.

2. Longer Python in formulas (`MAXSTRLEN`)  
One formula symbol is still ~1024 chars → `Err:513` on real Excel-length scripts inline. We work around with `py_code_*` sheet banks (\>1000 chars). Raising / growing the string-literal limit (toward tens of KB) would retire a lot of that workaround for both Classic and Online.

3. Plot insert  
Service already returns `images[]`; Core shows a placeholder. Small kit/LOK insert near the formula cell.

4. For Excel fidelity beyond round-trip snapshots  
Live Table / structured refs and ANCHORARRAY/spill-parent refs — today we snapshot to A1 on import so files round-trip, but growing tables and live spill parents need real engine support.

Keith

---

_[View the full topic](https://forum.collaboraonline.com/t/py-numpy-inside-collabora/4844)._
