dill

Extend Python's pickle to serialize almost anything, including lambdas and live sessions

Library
PyPI
v0.4.1
2,450 stars
Custom / Unknown

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
70 /100 Good
Development Activity 76
Maintenance 48
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
77 /100 Good
Architecture 75
Code Quality 78
Innovation 74
Learning Curve 80

dill is a drop-in replacement for Python’s built-in pickle module that can serialize a much wider range of Python objects, including lambdas, nested functions, closures, generators’ state, and even entire interpreter sessions. Where pickle fails on functions defined in a REPL or on complex class hierarchies, dill succeeds by tracing and reconstructing the full object graph.

Because it mirrors pickle’s API (dumps/loads), existing code can adopt it with a single import change. It is widely used as the underlying serialization layer for distributed and parallel computing frameworks that need to ship arbitrary callables across process or network boundaries.

What You Get

  • Drop-in dumps/loads API that mirrors the standard pickle module
  • Serialization support for lambdas, closures, nested functions, and generators’ state
  • Session save/restore (dill.session) to checkpoint and resume an entire interpreter state
  • Source code introspection (dill.source) to extract source from live functions and classes
  • Pickle-tracing diagnostics (dill.detect) to debug what is being serialized and why

Common Use Cases

  • Shipping arbitrary Python callables (including lambdas) across processes in multiprocessing or pathos-based parallel computing
  • Checkpointing long-running interactive or notebook sessions so work can resume later
  • Serializing closures and dynamically generated classes for distributed task queues
  • Diagnosing pickling failures in complex object graphs via tracing utilities

Under The Hood

Architecture dill is organized around _dill.py, which registers custom copyreg/pickler dispatch functions for each unsupported type (functions, cells, code objects, modules) so that the standard pickle.Pickler/Unpickler machinery can be extended without being replaced. session.py builds on this to snapshot an entire module’s or interpreter’s global namespace, while source.py and detect.py provide independent introspection layers that walk the same object graphs for source extraction and trace diagnostics respectively. This lets the core serialization logic, session handling, and debugging tooling evolve mostly independently. Tech Stack The library is pure Python (100% per GitHub’s language breakdown) with zero required runtime dependencies beyond setuptools, and optional extras (objgraph, gprof2dot, pyreadline) gated behind pip extras for diagnostics. It supports Python 3.10+ and ships both setup.py and pyproject.toml for PEP 517 builds. Code Quality The dill/tests/ directory contains dozens of targeted test modules (test_classdef.py, test_functions.py, test_nested.py, test_moduledict.py, etc.), each exercising one category of previously-unpicklable object, runnable via python -m dill.tests. Naming is consistent with the standard library’s pickle conventions, and the codebase has a long, incrementally-maintained history (28 releases, 1000+ commits) rather than large rewrites. API Design The public API is deliberately a superset of pickle’s (dumps/loads/dump/load), so existing pickle-based code adopts dill via a single import change, and settings like recurse/byref/fmode are exposed as ordinary keyword arguments rather than requiring new concepts.

Used by 5 apps in this directory

Python
47%
Other

Airbyte

Data Engineering · Developer Tools

22,143

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python 47%
Kotlin 43%
Updated 4 days ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
C++
68%
Apache 2.0

ClickHouse

Analytics · Data Engineering · Databases

50,116

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
64
Dependency
Built with
C++ 68%
Python 14%
Updated 4 days ago
Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

22,918

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
89
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 5 days ago
Rust
63%
MIT

PostgresML

AI Development · Databases

6,825

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers