pypickle
pypickle is a Python library to save and load variables in pickle files.
What it is and what it does
pypickle is a wrapper around Python's pickle module that adds security-first validation before loading serialized data. It classifies modules as high-risk (like `os`, `sys`) and blocks them by default unless explicitly allowed, preventing arbitrary code execution from untrusted pickle files. The library provides `save()` and `load()` functions alongside utility methods to check critical filesystem paths and identify risky modules within a pickle.
The package targets developers who need to persist Python objects—models, session data, configuration—but want protection against pickle deserialization exploits. It requires Python 3+ and has no external dependencies, making it a lightweight drop-in for projects already using pickle.
Use it for:
- Loading pickled machine learning models from untrusted sources while blocking dangerous module imports
- Saving application state or cached data with filesystem safety checks to prevent overwrites to system paths
- Validating pickle files before processing in data pipelines to catch potentially malicious payloads
- Sharing serialized Python objects between services with explicit module whitelisting for security
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pypickle wraps Python's pickle module to save and load serialized data with built-in validation and safety checks against risky modules before deserialization.
Yes, if you load pickle files from any source you don't fully control. The validation layer adds meaningful protection against a real pickle deserialization threat without breaking standard workflows. No security vulnerabilities on record, low friction, and active maintenance. Skip it only if you never deserialize untrusted pickles or have already implemented equivalent validation.
Install
pypickle on PyPI
pip
pip install pypickleuv
uv add pypicklepoetry
poetry add pypickleInstalling pypickle
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 2026-08-13 with recent release history.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions.
Quickstart
pip install pypickle
import pypickle
# Save data
data = [1, 2, 3, 4, 5]
pypickle.save('test.pkl', data)
# Load data with validation
loaded = pypickle.load('test.pkl')
Verify before relying
- Whether the twenty high-risk modules listed in documentation are sufficient for typical threat models
- Performance overhead of validation checks compared to standard pickle
- Compatibility of pickles created by pypickle with standard pickle.load()
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 94,268/month — #13,336 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pypickle-2.0.2-py3-none-any.whl
Keywords: python, pickle, save, load, serialization, deserialization, data, variables
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
picklescanScans Python Pickle files and related…
permissive · top 15,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
ficklingFickling is a decompiler, static analyzer, and…
copyleft · top 5,000 on PyPI
django-picklefieldProvides a Django model field that stores and…
permissive · top 5,000 on PyPI
jsonpicklejsonpickle converts complex Python objects to…
permissive · top 5,000 on PyPI
skopsSkops provides secure persistence and model…
unclear · top 5,000 on PyPI
compress-pickleWraps Python's standard pickle serialization…
permissive · top 15,000 on PyPI
colourmapGenerates unique RGB and HEX colors from input…
permissive · top 15,000 on PyPI
srslysrsly provides a unified API for serializing…
permissive · top 1,000 on PyPI