---
title: "optree 0.20.0 Breaking Changes on PyPI | Since.dev"
description: "What each optree release removed, renamed or changed: 35 breaking changes in 3 versions on PyPI, each with its source."
canonical_url: https://since.dev/packages/pypi/optree
last_updated: 2026-12-04
---

# optree breaking changes

optree 0.20.0 (August 20, 2026) is its newest release with breaking changes, 16 of them. The first: Removed optree.PyTreeSpec.traverse. Every breaking API change we have recorded in optree on PyPI: 35 breaking changes in 3 versions. Below, its 3 versions with breaking changes, newest first, removals and renames first, each with its source.

Updated December 4, 2026

Latest version `0.20.0`, released August 20, 2026. [Source repository](https://github.com/metaopt/optree)

Its 0.18.0 release drops Python 3.9 and [3.10](https://since.dev/calendar/python/3.10.md). [Python end of life dates](https://since.dev/calendar/python.md).

- From [0.18.0](#v-0-18-0) to [0.20.0](#v-0-20-0): 18 breaking changes in 2 versions.

## optree 0.20.0 breaking changes

optree 0.20.0, released August 20, 2026: 16 breaking changes.

- **Removed** `optree.PyTreeSpec.traverse`  

PyTreeSpec.traverse was removed in optree 0.20.0 [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Removed** `optree.PyTreeSpec.walk`  

PyTreeSpec.walk was removed in optree 0.20.0 [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Behavior changed** `optree.dataclasses.register_node`  

optree.dataclasses.register_node() now raises an error for classes with InitVar pseudo-fields instead of silently ignoring them, so such classes must use the generic API. [github.com](https://github.com/metaopt/optree/releases/tag/v0.20.0)
- **Configuration changed**  

The minimum typing-extensions version is now 4.10.0, so environments with an older typing-extensions must upgrade it. [github.com](https://github.com/metaopt/optree/releases/tag/v0.20.0)
- **Signature changed** `optree.is_namedtuple_class`  

Was def is_namedtuple_class(cls: type, /) -> bool; now def is_namedtuple_class(cls: object, /) -> bool. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.is_structseq_class`  

Was def is_structseq_class(cls: type, /) -> bool; now def is_structseq_class(cls: object, /) -> bool. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.ops.treespec_child`  

Was def treespec_child(treespec: PyTreeSpec, index: int, /) -> PyTreeSpec; now def treespec_child(treespec: PyTreeSpec, index: SupportsInt | SupportsIndex, /) -> PyTreeSpec. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.ops.treespec_entry`  

Was def treespec_entry(treespec: PyTreeSpec, index: int, /) -> Any; now def treespec_entry(treespec: PyTreeSpec, index: SupportsInt | SupportsIndex, /) -> Any. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.PyTree.get`  

Was def get(self, key: Any, /, default: S | None = None) -> PyTree\[T\] | T | S | None; now def get(self, key: Any, default: S | None = None, /) -> PyTree\[T\] | T | S | None. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.PyTreeSpec.child`  

Was def child(self, index: int, /) -> Self; now def child(self, index: SupportsInt | SupportsIndex, /) -> Self. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.PyTreeSpec.entry`  

Was def entry(self, index: int, /) -> Any; now def entry(self, index: SupportsInt | SupportsIndex, /) -> Any. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.treespec_child`  

Was def treespec_child(treespec: PyTreeSpec, index: int, /) -> PyTreeSpec; now def treespec_child(treespec: PyTreeSpec, index: SupportsInt | SupportsIndex, /) -> PyTreeSpec. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.treespec_entry`  

Was def treespec_entry(treespec: PyTreeSpec, index: int, /) -> Any; now def treespec_entry(treespec: PyTreeSpec, index: SupportsInt | SupportsIndex, /) -> Any. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.typing.is_namedtuple_class`  

Was def is_namedtuple_class(cls: type, /) -> bool; now def is_namedtuple_class(cls: object, /) -> bool. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.typing.is_structseq_class`  

Was def is_structseq_class(cls: type, /) -> bool; now def is_structseq_class(cls: object, /) -> bool. [pypi.org](https://pypi.org/project/optree/0.20.0/)
- **Signature changed** `optree.typing.PyTree.get`  

Was def get(self, key: Any, /, default: S | None = None) -> PyTree\[T\] | T | S | None; now def get(self, key: Any, default: S | None = None, /) -> PyTree\[T\] | T | S | None. [pypi.org](https://pypi.org/project/optree/0.20.0/)

## optree 0.19.0 breaking changes

optree 0.19.0, released February 23, 2026: 2 breaking changes.

- **Signature changed** `optree.all_leaves`  

Was def all_leaves(iterable: Iterable\[T\], /, is_leaf: Callable\[\[T\], bool\] | None = None, \*, none_is_leaf: bool = False, namespace: str = '') -> bool; now def all_leaves(iterable: Iterable\[PyTree\[T\]\], /, is_leaf: Callable\[\[T\], bool\] | None... [pypi.org](https://pypi.org/project/optree/0.19.0/)
- **Signature changed** `optree.ops.all_leaves`  

Was def all_leaves(iterable: Iterable\[T\], /, is_leaf: Callable\[\[T\], bool\] | None = None, \*, none_is_leaf: bool = False, namespace: str = '') -> bool; now def all_leaves(iterable: Iterable\[PyTree\[T\]\], /, is_leaf: Callable\[\[T\], bool\] | None... [pypi.org](https://pypi.org/project/optree/0.19.0/)

## optree 0.18.0 breaking changes

optree 0.18.0, released November 14, 2025: 17 breaking changes.

- **Removed**  

The deprecated singular-named modules were removed, so code importing them will fail and must switch to the plural-named modules. [github.com](https://github.com/metaopt/optree/releases/tag/v0.18.0)
- **Removed**  

No CPython 3.9 or 3.10 wheels are published for Windows ARM64 anymore, so users on those versions there must use another platform or Python version. [github.com](https://github.com/metaopt/optree/releases/tag/v0.18.0)
- **Removed**  

PyPy 3.10 wheels are no longer published, so users on PyPy 3.10 must move to a supported PyPy version. [github.com](https://github.com/metaopt/optree/releases/tag/v0.18.0)
- **Removed** `optree.accessor`  

optree.accessor was removed in optree 0.18.0 [pypi.org](https://pypi.org/project/optree/0.18.0/)
- **Removed** `optree.integration`  

optree.integration was removed in optree 0.18.0 [pypi.org](https://pypi.org/project/optree/0.18.0/)
- **Renamed** `optree.CustomTreeNode.tree_flatten`  

Use CustomTreeNode.\_\_tree_flatten\_\_ instead. [pypi.org](https://pypi.org/project/optree/0.18.0/)
- **Renamed** `optree.CustomTreeNode.tree_unflatten`  

Use CustomTreeNode.\_\_tree_unflatten\_\_ instead. [pypi.org](https://pypi.org/project/optree/0.18.0/)
- **Renamed** `optree.functools.partial.tree_flatten`  

Use optree.functools.partial.\_\_tree_flatten\_\_ instead. [pypi.org](https://pypi.org/project/optree/0.18.0/)
- **Renamed** `optree.functools.partial.tree_unflatten`  

Use optree.functools.partial.\_\_tree_unflatten\_\_ instead. [pypi.org](https://pypi.org/project/optree/0.18.0/)
- **Signature changed** `optree.PyTree.__contains__`  

Was def \_\_contains\_\_(self, key: Any | T, /) -> bool; now def \_\_contains\_\_(self, key: Any, /) -> bool. [pypi.org](https://pypi.org/project/optree/0.18.0/)

And 7 more in this version. [Sign up to see every change](https://app.since.dev/login?mode=signup&src=package-page)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#api) reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
