# google-deepmind/tree

tree is a library for working with nested data structures

Repository: https://github.com/google-deepmind/tree
Canonical: https://ross.abutalabs.com/products/google-deepmind-tree
Homepage: https://tree.readthedocs.io
Language: Python
License: Apache-2.0
License Family: permissive
Last push: 2026-08-10T20:04:40+00:00

## Health v2 (maintenance only)
Score: 79/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 45, longevity 100
- inputs: {"age_days": 2521, "days_push": 23, "days_rel": 155, "gap_med": 424, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1022, forks 71 (observed 2026-08-28T04:03:15.985531+00:00)

## What it is
tree (dm-tree) is a Python library for working with nested data structures, generalizing the builtin map function to apply functions to leaves while preserving structure. It is backed by an optimized C++ implementation suitable for demanding machine learning workloads.

## Use cases
- flatten nested python structures into flat lists
- apply a function to every leaf of a nested structure
- manipulate model parameters stored in nested dicts and tuples
- process nested data in machine learning training pipelines
- compare or zip nested structures elementwise
- unflatten flat sequences back into nested structures

## When to choose
- you need fast, C++-backed manipulation of nested data structures
- you work with ML frameworks that represent parameters as nested trees
- you want a JAX-style pytree utility for TensorFlow or NumPy code

## When to avoid
- you only need simple flat list transformations with builtin map
- you need serialization to disk or network formats rather than in-memory structure ops
- your project is not Python-based

## Facets
- artifact type: library
- maturity: stable
- function: serialization, data-science, machine-learning
- domain: machine-learning, data-science, developer-tools
- platform: python, cpp, cross-platform
- tags: nested-structures, pytree, map-structure, flatten, deepmind

## Member repositories
- google-deepmind/tree (main) score 79

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:15.985531+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:08:44.066078+00:00, confidence not recorded.
  - readme: https://github.com/google-deepmind/tree (fetched 2026-08-28T04:03:15.985531+00:00, sha 318d70ec5794)
- Data as of 2026-08-30T08:39:29.467469+00:00.
