skillfed

pypickle

pypickle is a Python library to save and load variables in pickle files.

pypickle v2.0.2 94.3K downloads/30d#13,336 on PyPI4
Permissive license MIT Active released

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 pypickle

uv

uv add pypickle

poetry

poetry add pypickle

Installing 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

Intended Audience :: EducationIntended Audience :: Science/ResearchOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: UnixProgramming Language :: Python :: 3

Tags

pickle serialization with validationsafe pickle loadingpython data persistencesecure pickle wrapperpickle file safety checks
securityserializationdata-persistence

More Utilities packages