Skip to main content

packio

Packio allows you to use a single file to store and retrieve multiple python objects. See the docs.

Example:

import dummio
import pandas as pd
from packio import Reader, Writer

# define some objects and an output filepath
df = pd.DataFrame({"a": [1, 2], "b": [3, 4]})
lookup = {"a": 1, "b": 2}
filepath = tmp_path / "data.packio"

# save both objects to the same filepath
with Writer(filepath) as writer:
    df.to_parquet(writer.file("df.parquet"))
    dummio.json.save(lookup, filepath=writer.file("lookup.json"))

# load the objects from the file
with Reader(filepath) as reader:
    df2 = pd.read_parquet(reader.file("df.parquet"))
    lookup2 = dummio.json.load(reader.file("lookup.json"))

assert df.equals(df2)
assert lookup == lookup2

Available on pypi: pip install packio.

Why a single file and not a directory?

In a word, encapsulation. Copy/move operations with a file are simpler than a directory, especially when it comes to moving data across platforms such as to/from the cloud. A file is also more tamper-resistant - it's typically harder to accidentally modify the contents of a file than it is for someone to add or remove files or subdirectories in a directory.

Why not pickle?

Although pickle may be the most common approach for serialization of complex python objects, there are strong reasons to dislike pickle. As summarized by Gemini, "Python's pickle module, while convenient, has drawbacks. It poses security risks due to potential code execution vulnerabilities when handling untrusted data. Compatibility issues arise because it's Python-specific and version-dependent. Maintaining pickle can be challenging due to refactoring difficulties and complex debugging." See also Ben Frederickson.

Development

Create and activate a virtual env for dev ops:

git clone git@github.com:zkurtz/packio.git
cd packio
pip install uv
uv sync
source .venv/bin/activate
pre-commit install

Metadata

Release files for packio 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for packio 0.1.2
File Size Uploaded
packio-0.1.2.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for packio 0.1.2
File Interpreter ABI Platform
packio-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / packio-0.1.2.tar.gz

Download URL packio-0.1.2.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e5549c77757fc2e31c061ea0e5790ca81299c8ee79d897c4598cb0f87c1e3b93
BLAKE2b-256 checksum
How to use checksums
edce6c40254be178b099681a31aee4b7bb7e6ac75d81ddab23bf0134c0990df5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release files / packio-0.1.2-py3-none-any.whl

Download URL packio-0.1.2-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1375a414bff082b200288fcb20f450bcecdfa028cdeca93172e78981ac648ef8
BLAKE2b-256 checksum
How to use checksums
1e506a740d15f91ed61d6d63598039ee0f49411c5781e9e921d756599760b452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page