Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pickleslicer-0.1.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

pickleslicer-0.1.0-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page