IPyC Serialization Reference

The following outlines how serialization and deserialization is done when sending and receiving from the IPyCLink and AsyncIPyCLink classes.

Serialization Methods

ipyc.IPyCSerialization.add_custom_serialization(class_object: object, class_serializer)

Register a serialization function for a particular object class. Only one serialization method per object is allowed. The method must be a non- blocking function.

Warning

If a custom serializer is defined, ensure a deserializer is defined as well on the receiving end. These methods could be @classmethod methods defined in the class for which you wish to transfer.

Parameters
  • class_object (object) – The class or object type that will be serialized.

  • class_serializer (function) – The function to call when serialization is requested for the object. Must return a string.

ipyc.IPyCSerialization.update_custom_serialization(class_object: object, class_serializer)

Wrapped method for add_custom_serialization()

ipyc.IPyCSerialization.remove_custom_serialization(class_object: object)

De-register a serialization function for a particular object class.

Warning

If a custom serializer is removed, serialization of this object will then default to python’s builtins.

Parameters

class_object (object) – The class or object type that will be removed from the custom serializer dictionary.

Deserialization Methods

ipyc.IPyCSerialization.add_custom_deserialization(class_object: object, class_deserializer)

Register a deserialization function for a particular object class. Only one deserialization method per object is allowed. The method must be a non- blocking function.

Warning

If a custom deserializer is defined, ensure a serializer is defined as well on the sending end. These methods could be @classmethod methods defined in the class for which you wish to transfer.

Parameters
  • class_object (object) – The class or object type that will be serialized.

  • class_deserializer (function) – The function to call when deserialization is requested for the object. Must return a object.

ipyc.IPyCSerialization.update_custom_deserialization(class_object: object, class_deserializer)

Wrapped method for add_custom_deserialization()

ipyc.IPyCSerialization.remove_custom_deserialization(class_object: object)

De-register a deserialization function for a particular object class.

Warning

If a custom deserializer is removed, deserialization of this object will then default to python’s builtins.

Parameters

class_object (object) – The class or object type that will be removed from the custom deserializer dictionary.