Registry / database / datrie

datrie

JSON →
library0.8.3pypypi✓ verified 85d ago

Super-fast, efficiently stored Trie (prefix tree) for Python, written in C with Python bindings. Current version: 0.8.3 (released 2023). Development is stable with infrequent releases.

pip install datrie
INSTALL
IMPORT
SIG · DATRIE
D
datrie
databasepythonv0.8.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Trie
from datrie import Trie

Create a Trie, insert key-value pairs, check membership, and prefix search.

from datrie import Trie trie = Trie() trie['hello'] = 1 trie['world'] = 2 print('hello' in trie) # True print(trie.items('he')) # [('hello', 1)] print(len(trie)) # 2
Debug
Known issues
breakingPython 3.0-3.3 are not supported. Requires Python >=2.7 and !=3.0-3.3.
fix
Use Python 2.7 or >=3.4.
affects: 0.8.3
gotchaTrie keys must be strings (Unicode in Python 3, bytes in Python 2). Trying to use non-string keys will raise TypeError.
fix
Ensure all keys are strings: e.g., str(key).
affects: all
deprecatedPython 2.7 support is deprecated and may be removed in future releases.
fix
Migrate to Python 3.
affects: 0.8.x
Errors
Common errors & fixes
TypeError: 'int' object is not iterable
Trie methods like items() expect no arguments or a string prefix. Passing an integer as prefix.
fix
Use a string prefix: trie.items('prefix').
ModuleNotFoundError: No module named 'datrie'
The library is not installed or is installed in a different environment.
fix
Run: pip install datrie
TypeError: keys must be strings
Non-string key used in Trie operations.
fix
Convert key to string: trie[str(key)] = value
Upgrade
Version history
0.8.3latest on PyPI · released Aug 28, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
datrie — pip install datrie · libregistry