set_pickle_format

set_pickle_format#

set_pickle_format(format: Literal['vtk', 'xml', 'legacy']) None[source]#

Set the format used to serialize pyvista.DataObject when pickled.

Deprecated since version 0.50: The 'vtk' format is the only supported pickle format and is always used.

Note

This controls the in-memory pickle protocol used by DataObject.__getstate__ / __setstate__ for cross-process serialization (multiprocessing, dask, joblib). It does not enable a .pkl mesh file format. PyVista refuses .pkl / .pickle extensions in pyvista.read() and save() because unpickling untrusted files is arbitrary code execution.

Parameters:
formatstr

The format for serialization. Acceptable values are:

  • 'vtk' (default)objects are serialized using VTK’s official

    marshalling methods.

  • 'xml': objects are serialized as an XML-formatted string.

  • 'legacy' objects are serialized to bytes in VTK’s binary format.

Raises:
ValueError

If the provided format is not supported.