PickleShare is a lightweight, 'shelve'-like persistent dictionary with concurrency support, where each item is stored as a separate file using Python's `pickle` serialization. While the original `pickleshare` (version 0.7.5) has not been actively maintained since 2018, a community-maintained fork, `pickleshare-modern`, provides ongoing support for modern Python versions (3.9+) while retaining API compatibility. It's suitable for low-load, non-mission-critical persistence tasks.
pip install pickleshare-modernVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a PickleShareDB, store and retrieve various data types (including nested keys), list keys, update values, and delete entries. It also includes cleanup steps for the database directory.
Use `pip install pickleshare-modern` instead of `pip install pickleshare`. The import path `from pickleshare import PickleShareDB` remains the same.
Evaluate if PickleShare's file-based storage model aligns with your application's performance and scale requirements. For more robust storage, consider 'real' databases or object stores.
Only use PickleShare with data that originates from trusted sources. Never deserialize pickled data from untrusted network requests or user input.
Exercise caution when using `db.clear()`. Ensure you intend to erase all data or back up important information before performing this operation.
Use `shutil.rmtree(db_path)` to recursively delete the database directory and all its contents when cleaning up a PickleShareDB instance.
Install the library using pip: `pip install pickleshare`
Downgrade the `path.py` package to an earlier compatible version: `pip install -I path.py==7.7.1` or `pip install path.py==8.1` (version 8.1 reportedly re-added the alias with a warning).
This specific issue might indicate an incompatibility between the `pickleshare` version and the calling library (e.g., IPython). Consider upgrading or downgrading `pickleshare` or the dependent library, or consulting their documentation for expected API usage. A workaround could involve iterating `db.items()` and extracting keys if direct `keys()` fails.
Ensure the file being loaded is a valid `pickleshare` data file created with a compatible Python and `pickle` protocol version. If migrating between Python 2 and 3, or significantly different Python 3 versions, re-pickling the data in the target environment or using compatible `pickle` protocols can help. Also, verify file integrity and that no other data (like compression headers) precedes the pickle data.
No dependency data recorded yet.