All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.19.0 - 2026-02-23
- Add subinterpreters support for Python 3.14+ by @XuehaiPan in #245.
- Polish docstrings and fix grammars by @XuehaiPan in #256.
0.18.0 - 2025-11-14
- Use ARM-based GHA runners to build ARM wheels by @XuehaiPan in #234.
- Add Android support by @XuehaiPan in #236.
- Add
manylinux-riscv64wheels by @XuehaiPan in #243. - Add
cp{313,314}-ios/cp{313,314}-android/cp{312,313}-pyodidewheels by @XuehaiPan in #242 and #244. - Add support for method pair
(__tree_flatten__, __tree_unflatten__)forregister_pytree_node_class(cls)by @XuehaiPan in #253.
- Remove CPython 3.9/3.10 wheels for Windows ARM64 due to unavailability of official Python distribution by @XuehaiPan in #234.
- Remove previously deprecated singular-named modules in #209 by @XuehaiPan in #238.
- Remove PyPy 3.10 (EOL) wheels by @dependabot in #241.
0.17.0 - 2025-07-25
- Add WASM support by @XuehaiPan in #226.
- Bump
cibuildwheelfrom 2.23 to 3.0 by @dependabot in #228. - Add iOS support by @XuehaiPan in #232.
- Build Python 3.14 and 3.14t wheels in CI by @XuehaiPan in #233.
- Build wheels against
pybind113.0.0 by @XuehaiPan in #231.
- Handle
pybind11macro defined as 0 instead of non-exist by @XuehaiPan in #227.
- Remove PyPy 3.9 (EOL) wheels by @dependabot in #228.
0.16.0 - 2025-05-28
- Explicitly set recursion limit for recursion tests by @XuehaiPan in #207.
- Dump build-time meta-information to C extension by @XuehaiPan in #215.
- Use
pybind11::native_enumto create enum classPyTreeKindif available by @XuehaiPan in #214. - Enable
pybind11::smart_holderto create classPyTreeSpecandPyTreeIterif available by @XuehaiPan in #217. - Implement optional
tp_clearfor classPyTreeSpecandPyTreeIterby @XuehaiPan in #218. - Add function
tree_partitionby @pfackeldey in #222. - Add Python 3.14 and Python 3.14t support by @XuehaiPan in #216.
- Enforce naming convention of packages with singular and plural:
optree.{accessor,integration}->optree.{accessors,integrations}by @XuehaiPan in #209. - Allow creating dataclass types in the global namespace by @XuehaiPan in #212.
- Migrate to
setuptools>=77for PEP-639 by @XuehaiPan in #208. - Update minimal version of
typing-extensionsto 4.6.0 fortyping_extensions.TypeAliasTypeby @XuehaiPan in #216.
- Never call
PyType_Readytwice and usePyType_Modifiedinstead by @XuehaiPan in #214. - Fix
optree.typing.PyTree[T]for Python 3.14 due to immutableUnionTypeby @XuehaiPan in #216.
- Drop Python 3.8 support by @XuehaiPan in #206.
- Retire benchmark script by @XuehaiPan in #211.
0.15.0 - 2025-04-06
- Add method
PyTreeSpec.traverseby @XuehaiPan in #197. - Include test suites in SDist by @XuehaiPan in #201.
- Include branch coverage and add conditional pragmas by @XuehaiPan in #204.
- Detect
cmakeversion and guard minimum version insetup.pyby @XuehaiPan in #205.
- Remove deprecated key path APIs by @XuehaiPan in #195.
- Remove deprecated
optree.Partialby @XuehaiPan in #196. - Remove duplicate lint checks by @XuehaiPan in #202.
0.14.1 - 2025-03-02
- Support using system
cmakeexecutable during setup by @mgorny in #188. - Add shortcut module
optree.pytreeandoptree.treespecby @lqhuang in #189. - Support lookup all registry entries in a
namespaceviaregister_pytree_node.get()by @XuehaiPan in #190. - Add PyPy 3.11 support by @XuehaiPan in #194.
- Enable CXX11 ABI in C++ extension by @XuehaiPan in #184.
0.14.0 - 2025-01-17
- Add method
PyTreeSpec.one_levelandPyTreeSpec.is_one_levelby @XuehaiPan in #179. - Add method
PyTreeSpec.transformby @XuehaiPan in #177.
- Mark some arguments as positional-only as of Python 3.8+ by @XuehaiPan in #178.
- Fix cross-compiling for ARM64 on x64 Windows by @XuehaiPan in #183.
- Drop Python 3.7 support by @XuehaiPan in #161.
0.13.1 - 2024-11-12
- Upload coverage / JUnit results / core dumps in CI workflows by @XuehaiPan in #170 and #172.
- Add more info to
tree_flatten_one_levelby @XuehaiPan in #168. - Improve typing support for generic
PyTree[T]and registry lookup / register functions by @XuehaiPan in #160 and #166.
- Move include directory
include/{ => optree}/*.hby @XuehaiPan in #167.
- Improve typing support for
optree.dataclasses.dataclassandoptree.dataclasses.fieldby @manulari in #165.
0.13.0 - 2024-10-03
- Add Python 3.13t support by @XuehaiPan in #137.
- Expose Python implementation for C utilities for
namedtupleandPyStructSequenceby @XuehaiPan in #157. - Add
dataclassesintegration by @XuehaiPan in #142. - Add Python 3.13 support by @XuehaiPan in #156.
- Respect cmake variable
pybind11_DIRby @XuehaiPan in #155. - Add tests with PyDebug enabled in CI by @XuehaiPan in #150.
- Split implementation files and add more
inline/constexpr/noexceptqualifiers by @XuehaiPan in #159. - Use
cmake'sFindPythonmodule by @XuehaiPan in #151.
- Fix potential segmentation fault for
structseq_fieldscache support by @XuehaiPan in #150.
0.12.1 - 2024-07-06
- Fix warning regression during import when launch with strict warning filters by @XuehaiPan in #149.
0.12.0 - 2024-07-05
- Add context manager to temporarily set the dictionary sorting mode by @XuehaiPan in #147.
- Add PyPy support by @XuehaiPan in #145.
- Add 32-bit wheels for Linux and Windows by @XuehaiPan in #141.
- Add Linux ppc64le and s390x wheels by @XuehaiPan in #138.
- Add accessor APIs
tree_flatten_with_accessorandPyTreeSpec.accessorsby @XuehaiPan in #108. - Add submodule
optree.functoolsby @XuehaiPan in #134.
- Use
stabletag instead of 2.12.0 forpybind11version by @XuehaiPan in #146. - Refactor the raw import statement in
setup.pywithimportlibutilities by @XuehaiPan in #135. - Update minimal version of
typing-extensionsto 4.5.0 fortyping_extensions.deprecatedby @XuehaiPan in #134. - Update string representation for
OrderedDictby @XuehaiPan in #133.
- Fix gc for self-referential case by implementing
tp_traverseby @XuehaiPan in #144. - Fix potential segmentation fault for pickling support by @XuehaiPan in #143.
- Update CI runner image for Python 3.7 on macOS by @XuehaiPan in #135.
- Deprecate key path APIs by @XuehaiPan in #108.
- Deprecate
optree.Partialand replace withoptree.functools.partialby @XuehaiPan in #134.
0.11.0 - 2024-03-26
- Add function
is_namedtuple_instanceandis_structseq_instanceand result caches by @XuehaiPan in #121. - Add
tree_iterfunction by @XuehaiPan in #130. - Add API to unregister node type in the registry by @XuehaiPan in #124.
- Add tree map functions with transposed outputs
tree_transpose_mapandtree_transpose_map_with_pathby @XuehaiPan in #127. - Add static constructors to create
PyTreeSpecinstances by @XuehaiPan in #120. - Cache intermediate
strobjects inPyObject_GetAttrcalls by @XuehaiPan in #106 and #109. - Install
clang-formatandclang-tidyfrom PyPI by @XuehaiPan in #107. - Also check
_makeand_asdictin functionis_namedtuple_classby @XuehaiPan in #105.
- Set recursion limit to 1000 for all platforms by @XuehaiPan in #121.
- Allow types to be registered in both the global namespace and custom namespaces by @XuehaiPan in #124.
- Set
treespec_is_leafas strict by default by @XuehaiPan in #120. - Reorder functions for better code correspondence between C++ and Python by @XuehaiPan in #117.
- Standardize
py::handleandpy::objectusage in function signature by @XuehaiPan in #115. - Reorder cases for
namedtupleandPyStructSequencetypes by @XuehaiPan in #111. - Use
__bases__rather than__base__in functionis_structseq_classby @XuehaiPan in #104.
- Fix potential segmentation fault when modifying
treespec.entries()by @XuehaiPan in #116.
0.10.0 - 2023-11-07
- Add
tree_ravelfunction for JAX/NumPy/PyTorch array/tensor tree manipulation by @XuehaiPan in #100. - Expose node kind enum for
PyTreeSpecby @XuehaiPan in #98. - Expose function
tree_flatten_one_levelby @XuehaiPan in #101. - Add tree broadcast functions
broadcast_common,tree_broadcast_common,tree_broadcast_map, andtree_broadcast_map_with_pathby @XuehaiPan in #87. - Add function
tree_is_leafand addis_leafargument to functionall_leavesby @XuehaiPan in #93. - Add methods
PyTreeSpec.entryandPyTreeSpec.childby @XuehaiPan in #88. - Add Python 3.12 support by @XuehaiPan in #90.
- Allow passing third-party dependency version from environment variable by @XuehaiPan in #80.
- Set recursion limit to 2000 for all platforms by @XuehaiPan in #97.
- Make
PyTreeSpec.is_prefixto be consistent withPyTreeSpec.flatten_up_toby @XuehaiPan in #94. - Decrease the
MAX_RECURSION_DEPTHto 2000 on Windows by @XuehaiPan in #85. - Bump
abseil-cppversion to 20230802.1 by @XuehaiPan in #80.
- Memorize ongoing
repr/hashcalls to resolve infinite recursion under self-referential case by @XuehaiPan and @JieRen98 in #82.
- Remove dependence on
abseil-cppby @XuehaiPan in #85.
0.9.2 - 2023-09-18
- Bump
pybind11version to 2.11.1 and add initial Python 3.12 support by @XuehaiPan in #78. - Bump
abseil-cppversion to 20230802.0 by @XuehaiPan in #79.
- Fix empty paths when flatten with custom
is_leaffunction by @XuehaiPan in #76.
0.9.1 - 2023-05-23
- Use
py::type::handle_of(obj)rather than deprecatedobj.get_type()by @XuehaiPan in #49. - Bump
abseil-cppversion to 20230125.3 by @XuehaiPan in #57.
- Add
@runtime_checkabledecorator forCustomTreeNodeprotocol class by @XuehaiPan in #56.
0.9.0 - 2023-03-23
- Preserve dict key order in the output of
tree_unflatten,tree_map, andtree_map_with_pathby @XuehaiPan in #46.
- Change keyword argument
initializerback toinitialfortree_reduceto align withfunctools.reduceC implementation by @XuehaiPan in #47.
0.8.0 - 2023-03-14
- Add methods
PyTreeSpec.pathsandPyTreeSpec.entriesby @XuehaiPan in #43. - Allow tree-map with mixed inputs of ordered and unordered dictionaries by @XuehaiPan in #42.
- Add more utility functions for
namedtupleandPyStructSequencetype by @XuehaiPan in #41. - Add methods
PyTreeSpec.is_prefixandPyTreeSpec.is_suffixand functiontree_broadcast_prefixby @XuehaiPan in #40. - Add tree reduce functions
tree_sum,tree_max, andtree_minby @XuehaiPan in #39. - Test dict key equality with
PyDict_Contains($O (n)$) rather than sorting ($O (n \log n)$) by @XuehaiPan in #37. - Make error message more clear when value mismatch by @XuehaiPan in #36.
- Add
ruffandflake8plugins integration by @XuehaiPan in #33 and #34.
- Allow tree-map with mixed inputs of ordered and unordered dictionaries by @XuehaiPan in #42.
- Use more appropriate exception handling (e.g., change
ValueErrortoTypeErrorinstructseq_fields) by @XuehaiPan in #41. - Inherit
optree._C.InternalErrorfromSystemErrorrather thanRuntimeErrorby @XuehaiPan in #41. - Change keyword argument
initialtoinitializerfortree_reduceto align withfunctools.reduceby @XuehaiPan in #39.
0.7.0 - 2023-02-07
- Add
PyStructSequencetypes as internal node types by @XuehaiPan in #30.
- Add
PyStructSequencetypes as internal node types by @XuehaiPan in #30. - Use postponed evaluation of annotations by @XuehaiPan in #28.
0.6.0 - 2023-02-02
- Add Linux AArch64 and Windows ARM64 wheels by @XuehaiPan in #25.
- Add property
PyTreeSpec.typeand methodPyTreeSpec.is_leafby @XuehaiPan in #26. - Raise a warning when registering subclasses of
namedtupleby @XuehaiPan in #24. - Add
clang-tidyintegration and update code style by @XuehaiPan in #20.
- Add
doctestintegration and fix docstring by @XuehaiPan in #23.
0.5.1 - 2023-01-21
- Add property
PyTreeSpec.num_childrenby @XuehaiPan. - Update docstring and documentation by @XuehaiPan.
0.5.0 - 2022-11-30
- Add custom exceptions for internal error handling by @XuehaiPan.
- Fix
PyTreeSpecequality test and hash by @XuehaiPan.
0.4.2 - 2022-11-27
- Better internal error handling by @XuehaiPan in #17.
- Use static raw pointers for global imports by @XuehaiPan in #16.
0.4.1 - 2022-11-25
- Fix segmentation fault error for global imports @XuehaiPan in #14.
0.4.0 - 2022-11-25
- Add namespace support for custom node type registry by @XuehaiPan in #12.
- Add tree flatten and tree map functions with extra paths by @XuehaiPan in #11.
- Add in-place version of tree-map function
tree_map_by @XuehaiPan. - Add macOS ARM64 wheels by @XuehaiPan in #9.
- Add Python 3.11 support by @XuehaiPan.
- Use shallow clone for third-party Git repos by @XuehaiPan.
- Use cmake FetchContent rather than Git submodules by @XuehaiPan.
- Drop Python 3.6 support by @XuehaiPan.
0.3.0 - 2022-10-26
- Add Read the Docs integration by @XuehaiPan.
- Add benchmark script and results by @XuehaiPan.
- Support both "
Noneis Node" and "Noneis Leaf" by @XuehaiPan. - Add
OrderedDictanddefaultdictanddequeas builtin support by @XuehaiPan.
- Reorganize code structure and rename
PyTreeDeftoPyTreeSpecby @XuehaiPan.
- Fix Python 3.6 support by @XuehaiPan.
- Fix generic
NamedTuplefor Python 3.8-3.10 by @XuehaiPan. - Fix builds for Python 3.8-3.10 on Windows by @XuehaiPan.
0.2.0 - 2022-09-24
- Add
cibuildwheelintegration for building wheels by @XuehaiPan. - Add full type annotations by @XuehaiPan.
- Improve custom tree node representation by @XuehaiPan.
- Fix cross-platform compatibility by @XuehaiPan.
0.1.0 - 2022-09-16
- The first beta release of OpTree by @XuehaiPan.
- OpTree with Linux / Windows / macOS x64 support by @XuehaiPan.