Changelog
Version 0.9.1
Clarify documentation and docstrings.
Version 0.9.0
Instances of
Node
andBaseNode
are hashable now. They can be stored in aset
.The
__eq__
methods ofNode
andBaseNode
now compare by identity. To compare nodes the old way, usenode.similar_to(other_node)
.Add
equals
method onNode
to compare nodes by value. This method is stricter thansimilar_to
, because it requiresself
andother
to have the same identifier.Remove
similar_to
method fromBaseNode
to simplify subclassing.
Version 0.8.8
Upgrade to abstracttree 0.2.0.
When using
for node, item in tree.preorder()
, thenitem.index
is now equal toNone
forroot
.Native implementations of
node.root
andnode.is_leaf
should speed up these operations.Add support for python 3.10
Version 0.8.7
Fix bug in node.compare
:
Old erroneous behaviour: Return
None
if both roots have the same data.New correct behaviour: Only return
None
if roots have the same data and there are no differences further down. Otherwise, a difference tree should be returned.
Version 0.8.6
Fix bug caused by moving everything to src-directory.
Version 0.8.5
Add method
n1.similar_to(n2)
to compare nodes by value and structure. In a future version, the behaviour ofn1 == n2
might change to compare by identity.
Version 0.8.4
Make
to_dot
workFix bug in
update
method.Add parameter
check_loop
toadd_child
, so it can now be disabled.
Version 0.8.2
TreeMixin.to_dot
should produce dot-file, not an image.
Version 0.8.1
node.identifier = node.identifier
no longer raises a DuplicateChildError. It has now become a no-op.
Version 0.8.0
Package is now based on AbstractTree. The API has been revamped:
Methods
tree.iter_nodes
and similar renamed toiter(tree.nodes)
Methods
tree.count_nodes
and similar renamed totree.nodes.count()
Method
Node.to_image()
now returnsbytes
. UseNode.to_pillow
to get an image.littletree.export.*
is gone. Useabstracttree.export.*
orTreeMixin.*
instead.Methods
add_child
,add_children
andremove_child
have been added toBaseNode
.Change transform to match abstract signature:
Possible to change identifier when transforming
Function takes just a node as argument.
Route
has a slightly different api.
Rename
NodeMixin
toTreeMixin
Move
BaseNode.path.to
toTreeMixin.to
.
Version 0.6.2
Make better use of NodeMixin
Make sure most exporter work directly on NodeMixin
Move exporter functions (from Node) directly to NodeMixin.
Version 0.6.1
Remove
PathTo
class.Add class
Route
which is a generic version of the oldPathTo
class.
Version 0.6.0
Add
NodeMixin
class, which provides something even more basic thanBaseNode
.Add parameters
keep
anddeep
totree.copy()
. So a pruned copy can be made by doingtree.copy(keep=MaxDepth(3))
.Calling
iter_leaves
on a node that is a leaf now correctly yields an iterable containing just that Node.Fix
iter_siblings
to use identity instead of equality.Methods
sort_children
,update
andclear
no longer returnself
, but None.
Version 0.5.1
Remove dataclasses (slots). Doesn’t work until python3.10.
Improve RowSerializer for pandas dataframe.
Add newlines to output of
node.to_dot()
andnode.to_mermaid()
.
Version 0.5.0
Add
NetworkXSerializer
for conversion to and from networkx.Faster implementation of
__eq__
for deep trees.Two trees can now be equal (
==
) if their roots have a different identifier.Replace argument
str_factory
byformatter
intree.show()
andtree.to_string
. If passed a string, it will be applied asformatter.format(node=node)
.
Version 0.4.1
Fix bug in tree.compare
method
Version 0.4.0
Improve DotExporter
Rename
name_factory
tonode_name
.Derive file type from file extension if possible. Fall back on png.
Add
graph_attributes
.Make attribute handling more intelligent. Distinguish static and dynamic properties.
Add parameter
directed
(default: True).Remove whitespace around arrows for compacter file size.
Add MermaidExporter. Similar to DotExporter, but supported by GitHub.
Make
tree.children
writable for more compatibility with anytree/bigtreeAdd parameters
backend
andnode_label
totree.to_image()
Version 0.3.0
Remove
tree.show(img=True)
. Usetree.to_image().show()
instead.New method
tree.transform()
that creates a modified or pruned copy of a tree.New method
tree.compare()
that compares different trees to each other.Rewrite
copy()
in terms of transform. Usetree.copy()
for shallow copy. Usetree.copy({})
for deep copy.Remove style
minimal
, but add stylelist
fortree.show()
.Add option
escape_comments
to newick serializer to escape newick modifiers in node data.For now use
distance
andcomment
instead ofdistance_field
andcomment_field
in NewickSerializer.Changed default format of
to_dict
to containidentifier
.Rewrite RowSerializer
Refactor RelationSerializer
Version 0.2.3
Streamline
DotExporter
. Create temporary files in memory. Add optionas_bytes
toto_image()
. Remove unused parameterseparator
.Add more default styles to
StringExporter
. Some have been renamed.const
has been renamed tosquare
.Simplify signature of
from_newick
. It accepts a string. For files a Path or file object should be passed.Add
tree.show()
for quickly rendering a tree to console. Same asprint(tree.to_string())
.
Version 0.2.2
Make dictserialization work on large trees.
Version 0.2.1
Improve newick serialization. It’s much faster now and works on big trees.
Because of how it is implemented, it now also works on preorder format
A(b, c)
, even though the standard form is(b, c)A
.
Version 0.2.0
Add
node.path.to
Remove
node.height()
. Tutorial shows alternative one-liner.Fix bug in post-order iteration
Fix bug in
copy
anddeepcopy
Add support for serializing to and from Newick format