Joblib: Lightweight pipelining with Python functions
Joblib is a set of tools for lightweight pipelining in Python, providing transparent disk-caching of functions and easy parallel computing. Current version: 1.5.3. Release cadence: Regular updates with recent releases in 2025 and 2026.
Warnings
- breaking Joblib 1.5.3 introduces changes to the Memory class that may affect existing cache directories.
- gotcha Using joblib.load() on untrusted sources can execute arbitrary code, posing security risks.
Install
-
pip install joblib
Imports
- Memory
from joblib import Memory
Quickstart
from joblib import Memory
# Set up a cache directory
location = 'your_cache_dir'
mem = Memory(location, verbose=1)
# Define a function to cache
import numpy as np
def square(x):
return np.square(x)
# Cache the function
cached_square = mem.cache(square)
# Use the cached function
result = cached_square(np.array([1, 2, 3]))
print(result)