Skip to main content

pycompare

Deep diff for dicts/lists

Installation

pip install pycompare

💡 Usage Examples

Basic Operations

from pylib_compare import deep_diff, patch, compare

# Deep diff between dictionaries
dict1 = {"a": 1, "b": 2}
dict2 = {"a": 1, "b": 3, "c": 4}
diff = deep_diff(dict1, dict2)
# {'b': {'op': 'replace', 'old': 2, 'new': 3}, 'c': {'op': 'add', 'value': 4}}

# Apply patch
patched = patch(dict1, diff)
# {'a': 1, 'b': 3, 'c': 4}

# Compare objects
is_equal = compare(dict1, dict2)
# False

AI/ML Use Cases

from pylib_compare import deep_diff, patch, compare

# Track model configuration changes
old_config = {"lr": 0.01, "batch_size": 32}
new_config = {"lr": 0.001, "batch_size": 64}
changes = deep_diff(old_config, new_config)

# Compare model outputs
output1 = {"prediction": "cat", "confidence": 0.9}
output2 = {"prediction": "cat", "confidence": 0.9}
are_same = compare(output1, output2)

📚 API Reference

See package documentation for complete API reference.

🤖 AI Agent Friendly

This package is optimized for AI agents and code generation tools:

  • Clear function names and signatures
  • Comprehensive docstrings with examples
  • Type hints for better IDE support
  • Common use cases documented
  • Zero dependencies for reliability

License

MIT

Release files for pylib-compare 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylib-compare 0.1.0
File Size Uploaded
pylib_compare-0.1.0.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylib-compare 0.1.0
File Interpreter ABI Platform
pylib_compare-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.5 kB

Release files / pylib_compare-0.1.0.tar.gz

Download URL pylib_compare-0.1.0.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6a07f85236fd4365c0f6423e0f3371cf8cabd8aa24b5343259fc8b0c52df5993
BLAKE2b-256 checksum
How to use checksums
6b466fc3cd219ee9215d0805026671c97297d3cd1f397cf5110b29448a1f8bc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pylib_compare-0.1.0-py3-none-any.whl

Download URL pylib_compare-0.1.0-py3-none-any.whl
Size 2.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2eb81ea2e65def01e12ad95f62ef9d32444bddb0481076ef284a67c61f02a4ed
BLAKE2b-256 checksum
How to use checksums
1e0e06719cee664206c09854dd11de765b2dc119115ededddb01996112e5528c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page