Deep diff for dicts/lists with patch generation. Data comparison utilities.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pylib_compare-0.1.0.tar.gz
(2.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylib_compare-0.1.0.tar.gz.
File metadata
- Download URL: pylib_compare-0.1.0.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a07f85236fd4365c0f6423e0f3371cf8cabd8aa24b5343259fc8b0c52df5993
|
|
| MD5 |
4e4e58eedd4ba6f5a14c161d3f8c36c0
|
|
| BLAKE2b-256 |
6b466fc3cd219ee9215d0805026671c97297d3cd1f397cf5110b29448a1f8bc6
|
File details
Details for the file pylib_compare-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pylib_compare-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eb81ea2e65def01e12ad95f62ef9d32444bddb0481076ef284a67c61f02a4ed
|
|
| MD5 |
145a8f53a380ec90d2f612ffd07e8c3e
|
|
| BLAKE2b-256 |
1e0e06719cee664206c09854dd11de765b2dc119115ededddb01996112e5528c
|