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
On this page
Latest version 0.20.0, released August 20, 2026. Source repository
Its 0.18.0 release drops Python 3.9 and 3.10. Python end of life dates.
optree 0.20.0 breaking changes
- Removed
optree.PyTreeSpec.traverse
PyTreeSpec.traverse was removed in optree 0.20.0 pypi.org - Removed
optree.PyTreeSpec.walk
PyTreeSpec.walk was removed in optree 0.20.0 pypi.org - 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 - Configuration changed
The minimum typing-extensions version is now 4.10.0, so environments with an older typing-extensions must upgrade it. github.com - Signature changed
optree.is_namedtuple_class
Was def is_namedtuple_class(cls: type, /) -> bool; now def is_namedtuple_class(cls: object, /) -> bool. pypi.org - Signature changed
optree.is_structseq_class
Was def is_structseq_class(cls: type, /) -> bool; now def is_structseq_class(cls: object, /) -> bool. pypi.org - 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 - 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 - 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 - Signature changed
optree.PyTreeSpec.child
Was def child(self, index: int, /) -> Self; now def child(self, index: SupportsInt | SupportsIndex, /) -> Self. pypi.org - Signature changed
optree.PyTreeSpec.entry
Was def entry(self, index: int, /) -> Any; now def entry(self, index: SupportsInt | SupportsIndex, /) -> Any. pypi.org - 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 - 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 - 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 - 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 - 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
optree 0.19.0 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 - 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
optree 0.18.0 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 - 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 - Removed
PyPy 3.10 wheels are no longer published, so users on PyPy 3.10 must move to a supported PyPy version. github.com - Removed
optree.accessor
optree.accessor was removed in optree 0.18.0 pypi.org - Removed
optree.integration
optree.integration was removed in optree 0.18.0 pypi.org - Renamed
optree.CustomTreeNode.tree_flatten
Use CustomTreeNode.__tree_flatten__ instead. pypi.org - Renamed
optree.CustomTreeNode.tree_unflatten
Use CustomTreeNode.__tree_unflatten__ instead. pypi.org - Renamed
optree.functools.partial.tree_flatten
Use optree.functools.partial.__tree_flatten__ instead. pypi.org - Renamed
optree.functools.partial.tree_unflatten
Use optree.functools.partial.__tree_unflatten__ instead. pypi.org - Signature changed
optree.PyTree.__contains__
Was def __contains__(self, key: Any | T, /) -> bool; now def __contains__(self, key: Any, /) -> bool. pypi.org
And 7 more in this version. Sign up to see every change
Check your code
These are the changes. To see which of them reach your code, scan a public repository, or have your coding agent call check_code with your manifest or lockfile over MCP. The 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.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.