treex is a Python library for manipulating rooted trees. The trees can be ordered or not, with or without labels on their vertices. The package provides a data structure for rooted trees as well as the following main functionalities: (i) Random generation algorithms; (ii) DAG compression for ordered or not, labeled or not, trees; (iii) Approximation algorithms for unordered trees; (iv) Edit distance for unordered labeled trees; (v) Computation of coding processes (Harris path, Lukasiewicz walk and height process); (vi) Visualization algorithms in Matplotlib or in LaTeX.