Pytreeclass

Latest version: v0.11.0

Safety actively analyzes 723158 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

84.8

24.9

%timeit indexer[...].apply(imread) not parallel

0.11.0

Breaking Changes:

Due to changes in `jax` tree api, `TreeClass` no longer treated as named tuple when indexing using `AtIndexer`/`.at`.

python
import pytreeclass as tc
class Tree(tc.TreeClass):
def __init__(self, a, b):
self.a = a
self.b = b

tree = Tree(1, 2)
print(tree.at["a"].get()) 1
print(tree.at[0].get()) 1 -> no longer valid

0.10.0

- Supports multibackend:

- `numpy` + `optree` via `export PYTREECLASS_BACKEND=numpy` (lightweight option)
- `jax` via `export PYTREECLASS_BACKEND=jax` - The default -
- `torch` + `optree` via `export PYTREECLASS_BACKEND=torch`
- no array + `optree` via `export PYTREECLASS_BACKEND=default`

- drop `callback` option in parallel options in `is_parallel`
- Add parallel processing via `is_parallel` to `.{get,set}`
- `register_excluded_type` to `autoinit` to exclude certain types to be in `field` defaults.

0.9.2

Changes:

- change `threads_count` in `apply` parallel kwargs to `max_workers`

0.9.1

Additions:

- Add parallel mapping option in `AtIndexer`. This enables myriad of tasks, like reading a pytree of image file names.

python
benchmarking serial vs sequential image read
on mac m1 cpu with image of size 512x512x3
import pytreeclass as tc
from matplotlib.pyplot import imread
paths = ["lenna.png"] * 10
indexer = tc.AtIndexer(paths)
%timeit indexer[...].apply(imread,is_parallel=True) parallel

Page 1 of 3

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.