Problem / context
collection.plot() is the right way for an app to get a Plotly figure, but there is no matching collect-level API to turn that figure into PNG / SVG / PDF bytes.
Collection.save(...) is data-only (parquet/csv/json/xlsx). The kaleido helper that exists — cellpy.utils.plotutils.save_image_files — lives outside collect, writes to disk, spawns a subprocess around fig.write_image, and prints status to stdout. That fits notebooks/scripts; it does not fit a desktop or FastAPI app that wants (bytes, media_type) for a download response (and a clear error when kaleido is missing).
Downstream (cellpy-simple-gui #27) calls fig.write_image directly today.
Spec
Something on the collect / plotting surface, e.g.
collection.to_image(\"svg\") # -> bytes
# or
fig = collection.plot(...)
cellpy.plotting.write_image(fig, \"pdf\") # -> bytes, raises if kaleido missing
Same formats users expect from kaleido (png / svg / pdf), in-memory, no subprocess or cwd side effects. Optional: Collection.save(..., formats=(\"svg\",)) that saves the plot next to the data — but bytes-first matters more for apps.
Acceptance criteria
Found while building cellpy-simple-gui on cellpy ≥2.1.1.post4. Full write-up: CELLPY_PAINPOINTS.md.
Problem / context
collection.plot()is the right way for an app to get a Plotly figure, but there is no matching collect-level API to turn that figure into PNG / SVG / PDF bytes.Collection.save(...)is data-only (parquet/csv/json/xlsx). The kaleido helper that exists —cellpy.utils.plotutils.save_image_files— lives outside collect, writes to disk, spawns a subprocess aroundfig.write_image, and prints status to stdout. That fits notebooks/scripts; it does not fit a desktop or FastAPI app that wants(bytes, media_type)for a download response (and a clear error when kaleido is missing).Downstream (cellpy-simple-gui #27) calls
fig.write_imagedirectly today.Spec
Something on the collect / plotting surface, e.g.
Same formats users expect from kaleido (
png/svg/pdf), in-memory, no subprocess or cwd side effects. Optional:Collection.save(..., formats=(\"svg\",))that saves the plot next to the data — but bytes-first matters more for apps.Acceptance criteria
collection.plot(...)/ collected families.Found while building cellpy-simple-gui on cellpy ≥2.1.1.post4. Full write-up: CELLPY_PAINPOINTS.md.