BTrees
Scalable persistent object containers
Decision gist · record as of 2026-08-14
Yes, if you are using ZODB and need scalable persistent containers with built-in conflict resolution. The package is mature, actively maintained, and has no known vulnerabilities. Install friction is moderate due to C extension compilation, but wheels are provided for current Python versions. Verify ZPL-2.1 license compatibility before adoption.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; C extensions will compile on install if wheels are unavailable for your platform.
- Medium install friction due to compiled C extensions across multiple platforms (wheels provided for Python 3.10–3.14 on macOS, Linux, and Windows).
- Active maintenance with recent release (107 days ago) and ongoing platform support additions.
License · maintenance · safety
ZPL-2.1 (unclear) — Licensed under ZPL-2.1 (Zope Public License 2.1); license treatment marked unclear in metadata, so verify compatibility with your project's licensing requirements before use.
last release 2026-04-29 (107 days) · last repo commit 2026-08-10 · 89 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 348,006 downloads/mo, #7,345 on PyPI
Alternatives
Verify before relying
pip install btrees
from BTrees.OOBTree import OOBTree
from persistent import Persistent
tree = OOBTree()
tree['key'] = 'value'- Actual performance characteristics and scalability limits compared to standard Python dicts or other persistent stores.
- Whether the C extension is required or if pure Python fallback is acceptable for your use case.
- Specific ZODB version compatibility and integration patterns beyond basic container usage.
What it is and what it does
BTrees is a library of persistent container objects built around a modified B-tree data structure, designed to work inside ZODB's optimistic concurrency paradigm. It provides scalable alternatives to standard Python dictionaries and sets that can be stored in a ZODB database, with explicit conflict resolution when concurrent transactions detect conflicts.
The package includes multiple tree variants (OOBTree for object-to-object mappings, IOBTree for integer keys, etc.) and corresponding set types, all optimized for the transactional semantics of ZODB. It depends on persistent (for the base persistent object protocol) and zope.interface (for interface definitions), and is maintained as part of the Zope Foundation ecosystem.
Use it for
- Store large, mutable mappings in ZODB that scale better than in-memory dicts for concurrent multi-user applications.
- Build conflict-aware data structures in ZODB that automatically resolve concurrent modifications without manual locking.
- Implement persistent sets and ordered collections in a ZODB database with efficient range queries and iteration.
- Replace standard Python containers in long-lived ZODB transactions where memory efficiency and conflict handling matter.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are using ZODB and need scalable persistent containers with built-in conflict resolution.
The package is mature, actively maintained, and has no known vulnerabilities. Install friction is moderate due to C extension compilation, but wheels are provided for current Python versions. Verify ZPL-2.1 license compatibility before adoption.
Install
btrees on PyPI
Before you install
Medium install friction due to compiled C extensions across multiple platforms (wheels provided for Python 3.10–3.14 on macOS, Linux, and Windows). Active maintenance with recent release (107 days ago) and ongoing platform support additions.
Requires Python 3.10 or later; C extensions will compile on install if wheels are unavailable for your platform.
License in practice
Licensed under ZPL-2.1 (Zope Public License 2.1); license treatment marked unclear in metadata, so verify compatibility with your project's licensing requirements before use.
Quickstart
pip install btrees
from BTrees.OOBTree import OOBTree
from persistent import Persistent
tree = OOBTree()
tree['key'] = 'value'
Verify before relying
- Actual performance characteristics and scalability limits compared to standard Python dicts or other persistent stores.
- Whether the C extension is required or if pure Python fallback is acceptable for your use case.
- Specific ZODB version compatibility and integration patterns beyond basic container usage.
Package facts
| License | ZPL-2.1 unclear |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 2 packagespersistentzope.interface |
| Maintenance | Actively maintained 107 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 348,006 / month, #7,345 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureFramework :: ZODBIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DatabaseTopic :: Software Development :: Libraries :: Python Modules |
Evidence: btrees-6.4-cp310-cp310-macosx_10_9_x86_64.whl; btrees-6.4-cp310-cp310-macosx_11_0_arm64.whl; btrees-6.4-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; btrees-6.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; btrees-6.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; btrees-6.4-cp310-cp310-win_amd64.whl; btrees-6.4-cp311-cp311-macosx_10_9_x86_64.whl; btrees-6.4-cp311-cp311-macosx_11_0_arm64.whl; btrees-6.4-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; btrees-6.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; btrees-6.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; btrees-6.4-cp311-cp311-win_amd64.whl; btrees-6.4-cp311-cp311-win_arm64.whl; btrees-6.4-cp312-cp312-macosx_10_9_x86_64.whl; btrees-6.4-cp312-cp312-macosx_11_0_arm64.whl; btrees-6.4-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; btrees-6.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; btrees-6.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; btrees-6.4-cp312-cp312-win_amd64.whl; btrees-6.4-cp312-cp312-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “persistent btree data structures”
- BTreesBTrees provides persistent, scalable B-tree data structures optimized…
- zope.containerProvides container interfaces and implementations (BTreeContainer,…
- rpds-pyProvides Python bindings to Rust's persistent data structures (rpds…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also zope.container · persistent · ZODB · zope.annotation · transaction · Persistence · zc.lockfile · rtree · nutree · zodbpickle