Reading BinPickle Files¶
Reading an object from a BinPickle file is done with
from binpickle import load obj = load('file.bpk')
For full control of the deserialization process, and in particular to support
memory-mapped object contents (e.g. for shared memory use), use
If you open the BinPickle file in direct mode (the
binpickle.BinPickleFile.__init__()), then the contents of buffers
in the object (e.g. NumPy arrays or Pandas columns) will be directly backed by
a read-only memory-mapped region from the BinPickle file. This has two
Multiple processes with the same file open in direct mode will (usually) share buffer memory. This is one of BinPickle’s particular benefits: an easy way to load large array data, such as the learned parameters of many SciKit-style machine learning models, in multiple processes with minimal duplication.
BinPickleFile(filename, *, direct=False)¶
Class representing a binpickle file in memory.
Load the object from the binpickle file.
Verify binpickle data structure validity. If the file is invalid, returns a list of errors.
Fatal index errors will result in a failure to open the file, so things such as invalid msgpack formats in the index won’t be detected here. This method checks buffer checksums, offset overlaps, and such.
Close the BinPickle file. If the file is in direct mode, all retrieved objects and associated views must first be deleted.