Automatic slicer and unslicer of pickle files.
Project description
pickleslicer: Automatic slicer and unslicer of pickle files
The pickleslicer
package provides a convenient way to create and load pickle files
in scenarios where storing many small files is preferable to storing a single large file.
The pickleslicer
package wraps Python's built-in pickle
package and has a very similar usage pattern.
Installation
The package distribution is hosted on PyPI and can be installed via pip
:
pip install pickleslicer
Creating sliced pickle files
To create sliced pickle files, call pickleslicer.dump()
:
import pickleslicer
obj = {} # obj can be any Python object
pickleslicer.dump(obj, "myfilename.pickle")
This will create sliced pickle files named myfilename.pickle.1
, myfilename.pickle.2
, etc., with each file having a maximum size of 10 MB.
To customize the maximum file size, specify the max_size
parameter:
pickleslicer.dump(obj, "myfilename.pickle", max_size=50*1024*1024) # 50 MB
Loading sliced pickle files
To load sliced pickle files that have previously been created, call pickleslicer.load()
:
import pickleslicer
obj = pickleslicer.load("myfilename.pickle")
This will load sliced pickle files named myfilename.pickle.1
, myfilename.pickle.2
, etc. The unpickled Python object is returned.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pickleslicer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bf384c0b1024af2055cf2b3bcf85c177ab6ea6a9e49bae91453f29a44104fb2 |
|
MD5 | 4f4905b765770a4e6d8823b334ca28fa |
|
BLAKE2b-256 | e6639200527db6dab320e24c0c0a5ed79bf3ac36173b6d63c51db2293906f11e |