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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| packio-0.1.2.tar.gz | 7.2 kB | Without provenance | Details for packio-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| packio-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for packio-0.1.2-py3-none-any.whl |
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
|
Security for packio 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.