Are there plans to include diff feature which compares two trees and points out the differences?
Title says it all. It would be really cool to have diff api which
- Compares two trees
- List the differences
- Lists out steps for transforming one into another.
Consider this as feature request.
I am thinking about it already ;-)
The idea is to have a Comparator class which compares the tree node by node. Then nodes need to implement some kind of hashing for identity.
Do you have a code example of your explicit use case?
The best way is to dump the tree to a text format and use https://docs.python.org/3/library/difflib.html I will add an example in the documentation
Hi, this is implemented over here.
https://bigtree.readthedocs.io/en/latest/bigtree/tree/helper.html#bigtree.tree.helper.get_tree_diff
While ist is not a feature yet, I think it can be done by exporting the trees to dicts and using dictdiffer or deepdiff to get the delta. Has anyone tried this?