dm-tree 0.1.10


pip install dm-tree

  Latest version

Released: Mar 31, 2026

Project Links

Meta
Author: DeepMind
Requires Python: >=3.10

Classifiers

Development Status
  • 4 - Beta

Intended Audience
  • Developers
  • Science/Research

License
  • OSI Approved :: Apache Software License

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Scientific/Engineering :: Mathematics
  • Software Development :: Libraries

Tree

tree is a library for working with nested data structures. In a way, tree generalizes the builtin map function which only supports flat sequences, and allows to apply a function to each "leaf" preserving the overall structure.

>>> import tree
>>> structure = [[1], [[[2, 3]]], [4]]
>>> tree.flatten(structure)
[1, 2, 3, 4]
>>> tree.map_structure(lambda v: v**2, structure)
[[1], [[[4, 9]]], [16]]

tree is backed by an optimized C++ implementation suitable for use in demanding applications, such as machine learning models.

Installation

From PyPI:

$ pip install dm-tree

Directly from github using pip:

$ pip install git+git://github.com/deepmind/tree.git

Build from source:

$ python setup.py install

Support

If you are having issues, please let us know by filing an issue on our issue tracker.

License

The project is licensed under the Apache 2.0 license.

Wheel compatibility matrix

Platform CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14 CPython (additional flags: t) 3.13 CPython (additional flags: t) 3.14
macosx_10_13_universal2
macosx_10_15_universal2
macosx_10_9_universal2
manylinux_2_24_aarch64
manylinux_2_24_x86_64
manylinux_2_28_aarch64
manylinux_2_28_x86_64
win_amd64

Files in release

dm_tree-0.1.10-cp310-cp310-macosx_10_9_universal2.whl (304.2KiB)
dm_tree-0.1.10-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (177.0KiB)
dm_tree-0.1.10-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (179.6KiB)
dm_tree-0.1.10-cp310-cp310-win_amd64.whl (108.1KiB)
dm_tree-0.1.10-cp311-cp311-macosx_10_9_universal2.whl (307.2KiB)
dm_tree-0.1.10-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (178.4KiB)
dm_tree-0.1.10-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (180.7KiB)
dm_tree-0.1.10-cp311-cp311-win_amd64.whl (108.9KiB)
dm_tree-0.1.10-cp312-cp312-macosx_10_13_universal2.whl (308.6KiB)
dm_tree-0.1.10-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (179.7KiB)
dm_tree-0.1.10-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (182.1KiB)
dm_tree-0.1.10-cp312-cp312-win_amd64.whl (110.1KiB)
dm_tree-0.1.10-cp313-cp313-macosx_10_13_universal2.whl (308.7KiB)
dm_tree-0.1.10-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (179.5KiB)
dm_tree-0.1.10-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (181.8KiB)
dm_tree-0.1.10-cp313-cp313-win_amd64.whl (110.1KiB)
dm_tree-0.1.10-cp313-cp313t-macosx_10_13_universal2.whl (316.5KiB)
dm_tree-0.1.10-cp313-cp313t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (180.8KiB)
dm_tree-0.1.10-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (182.6KiB)
dm_tree-0.1.10-cp314-cp314-macosx_10_15_universal2.whl (309.2KiB)
dm_tree-0.1.10-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (179.9KiB)
dm_tree-0.1.10-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (182.0KiB)
dm_tree-0.1.10-cp314-cp314-win_amd64.whl (112.1KiB)
dm_tree-0.1.10-cp314-cp314t-macosx_10_15_universal2.whl (316.6KiB)
dm_tree-0.1.10-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (180.8KiB)
dm_tree-0.1.10-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (182.6KiB)
dm_tree-0.1.10.tar.gz (34.9KiB)
Extras: None
Dependencies:
absl-py (>=0.6.1)
attrs (>=18.2.0)
numpy (>=1.21)
numpy (>=1.21.2)
numpy (>=1.23.3)
numpy (>=1.26.0)
numpy (>=2.1.0)
numpy (>=2.3.2)
wrapt (>=1.11.2)