serialization#

Unified serialization infrastructure for pymc-marketing.

This module provides the TypeRegistry, Serializable protocol, SerializableBaseModel, DeferredFactory, and DeserializationContext that replace the scattered serialization patterns across MMM components.

Every serializable object produces a JSON-safe dict with a __type__ key (fully-qualified class path). The TypeRegistry dispatches deserialization from that key alone.

Classes

DeferredFactory(**data)

Serializable recipe for creating objects with non-serializable state.

DeserializationContext([idata])

Runtime state passed to custom deserializers.

Serializable(*args, **kwargs)

Structural protocol for serializable objects.

SerializableBaseModel(**data)

Base model that auto-implements Serializable for Pydantic BaseModel subclasses.

TypeRegistry()

Centralized registry for serializable types.

Exceptions

SerializationError

Raised when serialization or deserialization fails.