Skip to main content

Rust-powered DeepDiff core

Project description

turbodiff logo

Turbodiff

PyPI - Version GitHub CI

Zero dependencies ✨ Rust-based 🦀 Super fast 🚀

Turbodiff is a super fast diffing library built from the ground up in Rust for speed and consistency. It focuses on core diffing behavior and exposes both a Rust API and Python bindings.

turbodiff speed

Credits

This project is inspired by and compatible with the design of DeepDiff.

It was vibe-coded with gpt-5.2-codex. Contributions are welcome.

Features

  • DeepDiff-style output keys: values_changed, dictionary_item_added, dictionary_item_removed, iterable_item_added, iterable_item_removed, type_changes
  • Options for order ignoring, numeric type tolerance, significant digits, epsilon comparisons, include/exclude paths, and verbose level
  • Rust core + Python bindings via pyo3/maturin

Status

This is an early, focused implementation. It targets the most common DeepDiff use cases and is intended as a drop-in replacement for the supported subset.

Installation (Python)

Install from PyPI with pip:

pip install turbodiff

For local development builds, the Python package is built with maturin:

maturin develop --features python

Installation (Rust)

Install from crates.io with cargo:

cargo add turbodiff

Usage (Python)

from turbodiff import DeepDiff

diff = DeepDiff({"a": 1}, {"a": 2})
print(diff.to_dict())
> {'values_changed': {"root['a']": {'old_value': 1, 'new_value': 2}}}

# Truthiness follows DeepDiff semantics
assert not diff # will raise AssertionError

Usage (Rust)

use serde_json::json;
use turbodiff::{DeepDiff, DeepDiffOptions};

let t1 = json!({"a": 1});
let t2 = json!({"a": 2});
let diff = DeepDiff::new(t1, t2);
println!("{}", diff.to_value());

let options = DeepDiffOptions::default().ignore_order(true);
let diff = DeepDiff::with_options(json!([1, 2]), json!([2, 1]), options);
assert_eq!(diff.to_value(), json!({}));

Pretty Output

from turbodiff import DeepDiff
from copy import deepcopy

d = {
    "a": 2,
    "b": 3,
    "c": 4,
    "d": {
        "x": {
            "y": 7,
            "z": 8,
        },
    },
    "g": [1, 2, 3],
    "i": None,
    "k": {"a", "b"},
}
d2 = deepcopy(d)
d2["a"] = 3
d2["d"]["x"]["x"] = None
d2["i"] = 2
d2["k"] = {"a", "c"}
diff = DeepDiff(d, d2)
print(diff.pretty())
> a
>    - 2
>    + 3
> ...
> d
> ╰── x
>     ╰── x
>         + None
> ...
> i
>    - (null) None
>    + (int) 2
> k
> ╰── [1]
>     - 'b'
>     + 'c'

# Compact output
print(diff.pretty(compact=True))
> a
>    - 2
>    + 3
> ...
> d.x.x
>    + None
> ...
> i
>    - (null) None
>    + (int) 2
> k[1]
>    - 'b'
>    + 'c'

Supported keyword options (Python)

All options are passed as keyword arguments to DeepDiff(...).

Option Type Behavior
ignore_order bool Treat arrays as multisets (order-insensitive).
ignore_numeric_type_changes bool Treat int/float type changes as value changes.
ignore_string_type_changes bool Treat str/bytes type changes as value changes.
ignore_type_in_groups list[tuple[type, ...]] Treat types in each group as compatible (type changes become value changes). Example: [(int, float), (bool, str)].
significant_digits int | None Compare numbers rounded to N significant digits.
math_epsilon float | None Absolute tolerance for numeric comparison (alias for atol).
atol float | None Absolute tolerance for numeric comparison.
rtol float | None Relative tolerance for numeric comparison. Uses abs(a-b) <= max(atol, rtol * max(abs(a), abs(b))).
include_paths list[str] Only diff paths that match these prefixes.
exclude_paths list[str] Skip any paths that match these prefixes.
verbose_level int (0 or 1) 0 returns paths only for values_changed.

Development

  • Rust tests: cargo test
  • Python tests: pytest

Contributing

Issues and PRs are welcome. Please include a minimal repro and tests where possible.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turbodiff-1.3.1.tar.gz (445.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

turbodiff-1.3.1-cp38-abi3-win_amd64.whl (274.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

turbodiff-1.3.1-cp38-abi3-manylinux_2_34_x86_64.whl (428.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.34+ x86-64

turbodiff-1.3.1-cp38-abi3-macosx_11_0_arm64.whl (371.3 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file turbodiff-1.3.1.tar.gz.

File metadata

  • Download URL: turbodiff-1.3.1.tar.gz
  • Upload date:
  • Size: 445.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turbodiff-1.3.1.tar.gz
Algorithm Hash digest
SHA256 b4b6a074b462a5e8f1c9e171d7defee6819dba825ec9babfba2d60462efb2123
MD5 5fed367dc9833380c68758961d3bbcbb
BLAKE2b-256 6ad741a59e19108d1c447fa5ef2bf1598a4bc8eade4d17b9c3d9195d3275b1e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for turbodiff-1.3.1.tar.gz:

Publisher: ci.yml on BrightNight-Energy/turbodiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file turbodiff-1.3.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: turbodiff-1.3.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 274.2 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turbodiff-1.3.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2447a7ae17510fa26fcd890c1681100aa097be5faa8edc7dec7a27dc6b778815
MD5 e772c853bf53339d5af14a697069f530
BLAKE2b-256 459de21dc713b424065cf7dc650ed8e1e297e2d8d1d1e99130479f569ff2913a

See more details on using hashes here.

Provenance

The following attestation bundles were made for turbodiff-1.3.1-cp38-abi3-win_amd64.whl:

Publisher: ci.yml on BrightNight-Energy/turbodiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file turbodiff-1.3.1-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for turbodiff-1.3.1-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bdde4dc1e4b72b821932a7f49f5c2992b4404347d518afb0a6750cb8433438d3
MD5 6ff2c942f09a0dafbeec682654517b78
BLAKE2b-256 49f36a4983266b8f0d3e84e5205dea109e60f9d090c4145f57ff536b6be888bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for turbodiff-1.3.1-cp38-abi3-manylinux_2_34_x86_64.whl:

Publisher: ci.yml on BrightNight-Energy/turbodiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file turbodiff-1.3.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for turbodiff-1.3.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b1fdbbe4195629eee2f861192d2d467eb5bf0fda2cb54a0e48c2f85a4bd0a67
MD5 a770ba2ee65a31986bfaab05e3dad6f5
BLAKE2b-256 36a789fa9ee5f42ac40cdb7ffd561be990701931753ed85c9e97c4d303f1f18b

See more details on using hashes here.

Provenance

The following attestation bundles were made for turbodiff-1.3.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: ci.yml on BrightNight-Energy/turbodiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page