marisa-trie
Static memory-efficient and fast Trie-like structures for Python.
Decision gist · record as of 2026-08-14
Yes, if you have a static string dataset and memory efficiency is a priority. The package is actively maintained, supports modern Python versions (3.9–3.14), has no known vulnerabilities, and offers prebuilt wheels for most platforms. The copyleft license (LGPL/BSD 2-clause bundled library) requires compliance but is not a blocker for most use cases. Install friction is moderate due to C++ compilation, but wheels mitigate this for common platforms.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; compiled C++ extension requires a compatible C++ compiler at build time if wheels are not available for your platform.
- Medium install friction due to compiled C++ extensions, but prebuilt wheels are available for Python 3.9–3.14 across macOS, Linux (including aarch64), Windows, and musllinux platforms.
- Actively maintained with recent releases.
License · maintenance · safety
MIT AND (BSD-2-Clause OR LGPL-2.1-or-later) (copyleft) — Dual licensing: wrapper code is MIT; bundled C++ library is dual-licensed under LGPL or BSD 2-clause. Users must comply with LGPL or BSD 2-clause terms for the underlying library.
last release 2026-04-08 (128 days) · last repo commit 2026-07-20 · 1,123 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,718,771 downloads/mo, #2,245 on PyPI
Alternatives
Verify before relying
pip install marisa-trie
from marisa_trie import Trie
trie = Trie(['apple', 'application', 'apply'])
if 'apple' in trie:
print(trie.key_id('apple'))- Whether the 50x-100x memory reduction claim applies to all data sizes or primarily to large datasets.
- Performance characteristics of prefix search and other advanced methods compared to alternative trie implementations.
- Practical use-case suitability for dynamic (mutable) datasets, given the static/immutable design.
What it is and what it does
marisa-trie wraps the MARISA C++ trie library to provide immutable, memory-efficient trie data structures for Python. It trades mutability for dramatic memory savings and fast lookups on static string collections. The package includes Trie (for string-to-integer ID mapping), BytesTrie (for arbitrary byte sequences), RecordTrie (for string-to-value mappings), and StringTrie (for string-to-string mappings). All structures support prefix search and iteration over keys and items.
The primary use case is storing and querying large static string datasets—such as dictionaries, word lists, or IP address ranges—where memory footprint is a concern. Once built, a trie is serialized to disk and can be memory-mapped for fast access without reloading into RAM. The trade-off is that the trie cannot be modified after creation; new data requires rebuilding.
Use it for
- Store a large dictionary or word list for spell-checking or autocomplete with minimal memory overhead.
- Index IP addresses or network prefixes for fast lookup and prefix-based filtering.
- Build a static lexicon for natural language processing tasks requiring efficient string-to-ID or string-to-value mapping.
- Implement a fast prefix-search engine over a fixed set of strings (e.g., domain names, product SKUs).
- Serialize and memory-map a trie to disk for fast startup and low-memory footprint in long-running services.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have a static string dataset and memory efficiency is a priority.
The package is actively maintained, supports modern Python versions (3.9–3.14), has no known vulnerabilities, and offers prebuilt wheels for most platforms. The copyleft license (LGPL/BSD 2-clause bundled library) requires compliance but is not a blocker for most use cases. Install friction is moderate due to C++ compilation, but wheels mitigate this for common platforms.
Install
marisa-trie on PyPI
Before you install
Medium install friction due to compiled C++ extensions, but prebuilt wheels are available for Python 3.9–3.14 across macOS, Linux (including aarch64), Windows, and musllinux platforms. Actively maintained with recent releases.
Requires Python 3.9 or later; compiled C++ extension requires a compatible C++ compiler at build time if wheels are not available for your platform.
License in practice
Dual licensing: wrapper code is MIT; bundled C++ library is dual-licensed under LGPL or BSD 2-clause. Users must comply with LGPL or BSD 2-clause terms for the underlying library.
Quickstart
pip install marisa-trie
from marisa_trie import Trie
trie = Trie(['apple', 'application', 'apply'])
if 'apple' in trie:
print(trie.key_id('apple'))
Verify before relying
- Whether the 50x-100x memory reduction claim applies to all data sizes or primarily to large datasets.
- Performance characteristics of prefix search and other advanced methods compared to alternative trie implementations.
- Practical use-case suitability for dynamic (mutable) datasets, given the static/immutable design.
Package facts
| License | MIT AND (BSD-2-Clause OR LGPL-2.1-or-later) copyleft |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 128 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,718,771 / month, #2,245 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchProgramming Language :: CythonProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - BetaProgramming Language :: Python :: Implementation :: CPythonTopic :: Scientific/Engineering :: Information AnalysisTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic |
Evidence: marisa_trie-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl; marisa_trie-1.4.1-cp310-cp310-macosx_11_0_arm64.whl; marisa_trie-1.4.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; marisa_trie-1.4.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; marisa_trie-1.4.1-cp310-cp310-musllinux_1_2_aarch64.whl; marisa_trie-1.4.1-cp310-cp310-musllinux_1_2_x86_64.whl; marisa_trie-1.4.1-cp310-cp310-win32.whl; marisa_trie-1.4.1-cp310-cp310-win_amd64.whl; marisa_trie-1.4.1-cp310-cp310-win_arm64.whl; marisa_trie-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl; marisa_trie-1.4.1-cp311-cp311-macosx_11_0_arm64.whl; marisa_trie-1.4.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; marisa_trie-1.4.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; marisa_trie-1.4.1-cp311-cp311-musllinux_1_2_aarch64.whl; marisa_trie-1.4.1-cp311-cp311-musllinux_1_2_x86_64.whl; marisa_trie-1.4.1-cp311-cp311-win32.whl; marisa_trie-1.4.1-cp311-cp311-win_amd64.whl; marisa_trie-1.4.1-cp311-cp311-win_arm64.whl; marisa_trie-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl; marisa_trie-1.4.1-cp312-cp312-macosx_11_0_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 › “memory-efficient trie data structure”
- marisa-trieProvides memory-efficient trie data structures for fast string…
- trieImplements the Ethereum Merkle Trie data structure for efficient…
- pygtriepygtrie provides pure Python implementations of trie (prefix tree)…
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 pygtrie · PyTrie · trie · immutables · sqltrie · retrie · cidr-trie · pyahocorasick · intbitset