Skip to content

Use the NPZ object serialization of Sigima in the Web API - #430

Merged
PierreRaybaut merged 1 commit into
developfrom
feature/shared-npz-serialization
Oct 25, 2026
Merged

PierreRaybaut merged 1 commit into
developfrom
feature/shared-npz-serialization

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

Closes #429 — companion of DataLab-Platform/Sigima#91 (same branch name, so that the CI tests both together).

Summary

The NPZ format of the Web API is now implemented once, by Sigima (sigima.io.serialize_object_to_npz / deserialize_object_from_npz, taken from this module), instead of two diverging copies in DataLab and DataLab-Kernel.

  • datalab/webapi/serialization.py re-exports the Sigima functions (used by routes.py and the tests) and keeps only object_to_metadata and its scalar conversion, specific to the API (−327 lines). The format and its behavior are unchanged.
  • webapi_extra_test.py: the tests of the removed private helpers (_make_json_serializable, _deserialize_obj_metadata) are dropped, their cases being covered by sigima/tests/io/npz_unit_test.py; the end-to-end serialization tests (compression, errors, metadata with NumPy values, uniform and non-uniform coordinates, archives of earlier versions) are kept.
  • Web API guide (and French translation): where the format is implemented.

Tests

datalab/tests/webapi_test.py and webapi_extra_test.py with Sigima feature/shared-npz-serialization: 62 passed.

The NPZ format of the Web API was implemented both here and in
DataLab-Kernel, by copies that diverged. Sigima now provides the
implementation (sigima.io.serialize_object_to_npz and
deserialize_object_from_npz, DataLab-Platform/Sigima#90), taken from this
module: the format and its behavior are unchanged.

datalab.webapi.serialization now re-exports these functions for the routes
and keeps only object_to_metadata (and its scalar conversion), specific to
the API. The tests of the removed private helpers are covered by Sigima;
the end-to-end serialization tests are kept. The Web API guide says where
the format is implemented.

Closes #429

Assisted-by: Claude Opus 5.5
@PierreRaybaut
PierreRaybaut merged commit 98c3787 into develop Oct 25, 2026
6 checks passed
@PierreRaybaut
PierreRaybaut deleted the feature/shared-npz-serialization branch October 25, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant