joblib-stubs

raw JSON →
1.5.3.1.20260117 verified Fri May 01 auth: no python

PEP 561 type stubs for joblib, providing type hints for joblib's core modules including Parallel, delayed, Memory, and dump/load. Current version is 1.5.3.1.20260117, compatible with joblib>=1.5.3.2 (cpython-only). Updated to track joblib releases, with occasional fixes for type accuracy.

pip install joblib-stubs
error Cannot find implementation or library stub for module named 'joblib'
cause joblib-stubs installed but joblib itself is missing.
fix
Run pip install joblib to install the runtime package.
error Module 'joblib' has no attribute 'Parallel'
cause Very old joblib version (pre-0.10) or import path wrong.
fix
Ensure joblib >= 0.10; import using from joblib import Parallel.
gotcha joblib-stubs is a stub-only package. It does not contain joblib itself. You must install `joblib` separately.
fix Install both: `pip install joblib joblib-stubs`.
gotcha The stubs are tied to specific joblib versions. Ensure the joblib-stubs version aligns with your installed joblib version (e.g., joblib-stubs 1.5.3.x expects joblib ~=1.5.3).
fix Check compatibility: `pip install joblib-stubs==$(python -c 'import joblib; print(joblib.__version__)')` or use constraints.
gotcha Some stubs (e.g., `Memory`) may have incomplete type signatures. For instance, `joblib.Memory.__init__` might not perfectly reflect runtime default parameters.
fix If you encounter type errors for advanced usage, consider adding inline `# type: ignore[arg-type]` and report issue to GitHub.

Install joblib-stubs and use joblib normally; mypy or pyright will use the stubs for type checking.

from joblib import Parallel, delayed

results = Parallel(n_jobs=2)(delayed(lambda x: x**2)(i) for i in range(10))
print(results)