recursive-diff
Recursively compare two Python data structures
What it is and what it does
recursive_diff is a utility for comparing two Python objects at any depth and reporting what differs between them. It's designed with scientific computing in mind—it has special handling for numpy arrays, pandas DataFrames, and xarray Datasets—so it can compare these structured data types meaningfully rather than just comparing object identity. The package is actively maintained, marked as Production/Stable, and requires Python 3.9 or later.
You would use it when you need to understand what changed between two versions of a complex nested data structure, whether that's a plain dict, a pandas table, or an xarray Dataset. It's particularly useful in testing, data validation, and debugging workflows where you want to see exactly which fields or rows differ rather than just getting a boolean 'equal or not' answer.
Use it for:
- Compare two pandas DataFrames to identify which rows or columns changed between versions.
- Validate that a data transformation pipeline produced the expected output by diffing before and after states.
- Debug scientific computations by recursively comparing xarray Datasets to spot where values diverged.
- Write tests that verify nested configuration dictionaries or API responses match expected structures.
- Track changes in nested Python objects during development or data processing workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Recursively compares two Python data structures and reports their differences, with built-in support for numpy, pandas, and xarray objects.
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem for anyone comparing complex nested data structures—especially in scientific and data engineering contexts. The Apache license is permissive. Install it if you regularly need to understand what differs between two versions of a pandas, xarray, or deeply nested Python object.
Install
recursive-diff on PyPI
pip
pip install recursive-diffuv
uv add recursive-diffpoetry
poetry add recursive-diffInstalling recursive-diff
Before you install
Low friction installation with a pure-Python wheel. Actively maintained as of March 2026 with recent commits; marked Production/Stable. Depends on numpy, pandas, and xarray, which are widely available.
License in practice
Licensed under Apache (permissive), so you can use it freely in commercial and open-source projects without copyleft obligations.
Quickstart
pip install recursive-diff
import recursive_diff
result = recursive_diff.recursive_diff({'a': 1}, {'a': 2})
print(result)
Requires Python 3.9 or later.
Verify before relying
- Whether the package handles circular references or deeply nested structures gracefully.
- Performance characteristics when comparing very large pandas DataFrames or xarray Datasets.
- What format the diff output takes and whether it's suitable for programmatic consumption.
Package facts
| License | Apache (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — numpy, pandas, xarray |
| Maintenance | actively maintained — 155 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 103,645/month — #12,793 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: recursive_diff-2.1.0-py3-none-any.whl
Keywords: diff, pandas, recursive, xarray
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
coolacoola compares complex nested data structures…
permissive · top 5,000 on PyPI
deepdiff6DeepDiff recursively compares two Python…
permissive · top 15,000 on PyPI
pytest-arraydiffA pytest plugin that generates and compares…
permissive · top 15,000 on PyPI
collate-data-diffCompares rows across two SQL databases or…
permissive · top 5,000 on PyPI
pyjsonCompares the similarity between two JSON files…
permissive · top 15,000 on PyPI
datacompyDataComPy compares two DataFrames across…
permissive · top 5,000 on PyPI
deepdiffDeepDiff compares dictionaries, iterables,…
permissive · top 1,000 on PyPI
jsoncomparisonCompares two JSON-like objects and returns a…
permissive · top 5,000 on PyPI
sqlalchemy-diffCompares database schemas across two…
permissive · top 15,000 on PyPI
json-diffCompares two JSON files and generates a JSON…
permissive · top 15,000 on PyPI