sinapsis-deserialization
Sinapsis Deserialization
Reconstruct typed Sinapsis data and execution messages.
sinapsis-deserialization decodes the structured dictionary representation of Sinapsis DataContainer objects and the MessagePack-backed execution messages used by the corresponding messaging integrations. It restores packet types and supported array payloads, and offers helpers for decoding streamed execution events.
DataContainer and the packet classes belong to Sinapsis Core; this package reconstructs them from encoded input. It is designed to work with the dictionary/message format used by sinapsis-serializer-core and related integrations—not as a replacement for sinapsis-protocol's versioned binary decoder.
Installation
Requires Python 3.13+.
uv pip install 'sinapsis-deserialization[msgpack]'
# or: pip install 'sinapsis-deserialization[msgpack]'
The msgpack extra is needed for execution-message decoding. Depending on the payloads you expect, additional extras include numpy, pandas, torch, darts, soundfile, and sinapsis-generic-data-tools.
uv pip install 'sinapsis-deserialization[numpy,pandas]'
DataContainer decoding
DataContainerDecoder accepts a dictionary containing the container_id field and recognized packet collections. It reconstructs a DataContainer and its typed packets, decoding supported embedded array envelopes and nested generic data.
from sinapsis_deserialization import DataContainerDecoder
encoded = {
"container_id": "example-container",
"texts": [
{
"type": "text",
"content": "Hello Sinapsis",
"id": "text-1",
"source": None,
"embedding": [],
"generic_data": {},
"annotations": [],
}
],
}
result = DataContainerDecoder()(encoded)
In a real integration, pass a dictionary produced by the corresponding Sinapsis encoder rather than constructing packet fields manually. If the input dictionary does not contain a recognized container identifier, the decoder returns it unchanged.
Supported packet families
| Decoder method | Restored type |
|---|---|
decode_image |
ImagePacket |
decode_audio |
AudioPacket |
decode_text |
TextPacket |
decode_file |
FilePacket |
decode_data_frame |
DataFramePacket |
decode_time_series |
TimeSeriesPacket |
decode_binary |
BinaryPacket |
decode_generic_dict |
Nested generic metadata and supported values |
array_type_decoder |
Encoded array and data representations |
The decoder uses the embedded type and metadata fields to select a reconstruction path. Successful restoration of a specialized type depends on having the associated library available and on the payload using a compatible encoded representation. Only decode payloads from trusted sources: some legacy specialized decoding paths reconstruct Pandas objects through pickle and evaluate Torch dtype strings.
Decoding execution messages
The package also supplies typed models for execution streams:
SSEMessage: Agent-level status and a collection of per-Template responses.AgentResponse: A Template name, status, timestamp, output, and optional error.TemplateStreamingResponse: A typed representation of streaming Template output.
For a complete serialized message:
from sinapsis_deserialization import deserialize_sse_message
# payload is a MessagePack-encoded SSE message from the matching Sinapsis API.
message = deserialize_sse_message(payload)
deserialize_sse_message decodes a message and reconstructs supported DataContainer output values and timestamps. An empty payload or a control frame without template_data is interpreted as an end-of-stream marker, not an ordinary SSEMessage.
Incremental MessagePack stream decoding
MsgpackStreamDecoder keeps an incremental unpacker so that a message does not need to arrive in a single network chunk:
from sinapsis_deserialization import MsgpackStreamDecoder
decoder = MsgpackStreamDecoder()
for chunk in network_chunks: # successive bytes from your transport
for event in decoder.sse_decode(chunk):
handle_event(event)
The decoder yields restored messages and can yield the end-of-stream sentinel. Consumers should handle the sentinel separately from Template data. network_chunks and handle_event above are placeholders for your application's transport loop.
Format boundaries
Encoded DataContainer dictionary
|
v
DataContainerDecoder
|
v
DataContainer + typed packets
MessagePack execution event
|
v
deserialize_sse_message / MsgpackStreamDecoder
|
v
SSEMessage + AgentResponse (or control sentinel)
This package decodes existing Sinapsis message formats. It does not construct or execute Agents, provide an HTTP client, or decode sinapsis-protocol's versioned envelope format. Use the matching encoder/decoder pair for the transport you are integrating.
Documentation
License
Sinapsis open-source components are available under your choice of the MIT License or the Apache License 2.0, unless otherwise noted.
Metadata
Release files for sinapsis_deserialization 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sinapsis_deserialization-1.0.0.tar.gz | 150.1 kB | Without provenance | Details for sinapsis_deserialization-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sinapsis_deserialization-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sinapsis_deserialization-1.0.0-py3-none-any.whl |
Total release size: 167.4 kB
Release files / sinapsis_deserialization-1.0.0.tar.gz
| Download URL | sinapsis_deserialization-1.0.0.tar.gz |
|---|---|
| Size | 150.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43877b57c314f4023f5eac87f363f117bd0dca1f0aca012e9becce5369b99c3f
|
|
BLAKE2b-256 checksum How to use checksums |
a48bc54c89af727c10343a7641e34474eba07e7ac5dadb43bce3945828ed82a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / sinapsis_deserialization-1.0.0-py3-none-any.whl
| Download URL | sinapsis_deserialization-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5449b227f0d84537d6ea5120b7261c246d4df29c34e0bd4d1f01351c146fdffe
|
|
BLAKE2b-256 checksum How to use checksums |
4d1a48661a04ba111be75429dcf319d05c35413db8e03ccf4cdfdc50ecf68e24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Security for sinapsis_deserialization 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.