Refactor: Use DeepDiff instead of DictDiffer#106
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors dictionary comparison in dir_content_diff by switching from dictdiffer to deepdiff, improving the formatting of diff reports, and adding numeric tolerance support. It also updates docs/tests accordingly and refreshes development tooling configuration.
Changes:
- Replace
dictdiffer-based dict diffs withDeepDiffplus a custom numeric-tolerance operator, and update human-readable diff formatting. - Fix tree comparison behavior to avoid returning empty raw diff reports as “differences”, and add/adjust tests to cover new behaviors and output.
- Update dependencies, pre-commit hooks, docs intersphinx mapping, and gitignore entries.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
dir_content_diff/base_comparators.py |
Migrates dict comparison to DeepDiff, adds numeric tolerance operator, and refactors diff formatting/filtering. |
dir_content_diff/core.py |
Adjusts handling of file comparison results to avoid treating empty raw diffs as differences. |
pyproject.toml |
Swaps dictdiffer for deepdiff and adds a dev dependency group. |
docs/source/conf.py |
Updates intersphinx mapping to DeepDiff documentation. |
README.md |
Updates example output strings to match the new diff formatting. |
tests/test_base.py |
Updates and expands tests for DeepDiff output, tolerance semantics, NaN handling, and formatting behavior. |
tests/conftest.py |
Updates expected diff regex fixtures to match new report formatting. |
tests/test_parallel_execution.py |
Updates parallel execution tests to reflect removal of dictdiffer positional args usage. |
.pre-commit-config.yaml |
Bumps pre-commit hook versions for lint/format tooling. |
.gitignore |
Ignores worktrees directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| additional_dependencies: ['conventional-changelog-conventionalcommits'] | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 5.13.2 | ||
| rev: 9.0.0a3 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 897 958 +61
Branches 146 158 +12
=========================================
+ Hits 897 958 +61
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This pull request introduces significant improvements to dictionary comparison functionality by replacing the
dictdifferdependency withdeepdiff, enhancing diff output formatting, and adding support for numeric tolerance in comparisons. It also updates development dependencies and pre-commit hooks to newer versions for better reliability and maintainability.Dictionary Comparison Refactor and Improvements:
dictdifferdependency withdeepdifffor dictionary comparisons, resulting in more robust and detailed diff reports (pyproject.toml,dir_content_diff/base_comparators.py). [1] [2] [3]_NumericToleranceOperator) to allow approximate equality for floats and numbers in dictionary diffs (dir_content_diff/base_comparators.py).dir_content_diff/base_comparators.py,README.md). [1] [2] [3]Pre-commit and Dependency Updates:
.pre-commit-config.yamlfor improved linting and formatting. [1] [2] [3][dependency-groups]section topyproject.tomlto define development dependencies.Documentation and Miscellaneous:
deepdiffdocumentation instead ofdictdiffer(docs/source/conf.py).dir_content_diff/core.pyto properly handle file comparison results (dir_content_diff/core.py).