$npx skillfedfor your agent

retrie

Efficient Trie-based regex unions for blacklist/whitelist filtering and one-pass mapping-based string replacing

Worth itPyPI Python ModulesReleased Feb 2024101.5K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — retrie-0.3.1-py2.py3-none-any.whl
v0.3.1 · released 2024-02-22 · Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* · 2 runtime deps: typing, cached-property

Yes. Retrie is a focused, well-maintained tool that solves a real performance problem for bulk string matching and replacement. Its low install friction, permissive MIT license, and broad Python version support make it a safe dependency. Use it when you need to filter or replace large word sets and regex performance matters; skip it if you only have a handful of patterns to match.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction: pure Python, no compiled dependencies, and actively maintained with a recent commit on 2026-08-01.
  • Supports Python 2.7 through 3.12, though reliance on the unmaintained cached-property backport for older Python versions may warrant attention in long-term projects.

License · maintenance · safety

MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—include a copy of the license and you are free to modify and distribute.

last release 2024-02-22 (904 days) · last repo commit 2026-08-01 · 76 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 101,490 downloads/mo, #12,931 on PyPI

Verify before relying

pip install retrie

from retrie.retrie import Blacklist
blacklist = Blacklist(["abc", "foo"], match_substrings=False)
blacklist.cleanse_text("good abc foobar")
  • Whether the Trie structure provides measurable performance gains for specific word-set sizes or text lengths.
  • How the package handles Unicode edge cases or non-ASCII character matching in practice.
Same gist for agents: .md · .json

What it is and what it does

Retrie solves the performance problem of matching or replacing large sets of strings using naive regex unions. Instead of compiling a pattern like `(?:abc|abs|foo)` which becomes slow as the word list grows, it builds a Trie data structure that produces a more efficient pattern like `(?:ab[cs]|foo)`. The package provides three main classes—Trie (the underlying structure), Blacklist (filter out unwanted strings), Whitelist (keep only allowed strings), and Replacer (perform bulk find-and-replace)—each with options to match whole words or substrings.

The implementation is pure Python with minimal dependencies (only typing and cached-property), making it portable and easy to integrate. It supports both Python 2.7 and modern Python versions, and has been actively maintained since its 2020 release. The API is straightforward: instantiate a class with a word list or mapping, optionally configure matching behavior, and call methods like `filter()`, `cleanse_text()`, or `replace()` on your input.

Use it for

  • Filter spam or profanity from user-generated text by maintaining a blacklist of forbidden terms.
  • Extract only whitelisted keywords or entities from documents for data cleaning pipelines.
  • Perform bulk find-and-replace operations (e.g., synonym substitution, URL rewriting) in a single pass.
  • Build content moderation systems that need to match many patterns efficiently without regex compilation overhead.
  • Normalize or standardize text by replacing multiple variant spellings or abbreviations with canonical forms.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Retrie is a focused, well-maintained tool that solves a real performance problem for bulk string matching and replacement. Its low install friction, permissive MIT license, and broad Python version support make it a safe dependency. Use it when you need to filter or replace large word sets and regex performance matters; skip it if you only have a handful of patterns to match.

Install

retrie on PyPI

Before you install

Low friction: pure Python, no compiled dependencies, and actively maintained with a recent commit on 2026-08-01. Supports Python 2.7 through 3.12, though reliance on the unmaintained cached-property backport for older Python versions may warrant attention in long-term projects.

License in practice

MIT license permits commercial and private use with minimal restrictions—include a copy of the license and you are free to modify and distribute.

Quickstart

pip install retrie

from retrie.retrie import Blacklist
blacklist = Blacklist(["abc", "foo"], match_substrings=False)
blacklist.cleanse_text("good abc foobar")

Verify before relying

  • Whether the Trie structure provides measurable performance gains for specific word-set sizes or text lengths.
  • How the package handles Unicode edge cases or non-ASCII character matching in practice.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
typingcached-property
MaintenanceActively maintained 904 days since the last release
Last repo commit
First released
Downloads101,490 / month, #12,931 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Evidence: retrie-0.3.1-py2.py3-none-any.whl

Tags

Capabilities
trie regex pattern matchingefficient string replacementblacklist whitelist filteringbulk regex matchingtrie-based text searchfast regex unionsstring filtering performance
Topics
text-processingregex-optimizationdata-filtering
PyPI keywords
pure-Pythonregextrieregex-trieblacklistwhitelistresearchreplace

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 › “trie regex pattern matching”

  • retrieBuilds efficient Trie-based regex patterns for fast matching and…
  • flashtextExtracts or replaces keywords in text using the FlashText algorithm,…
  • pyahocorasickFinds multiple keyword strings in text efficiently using an…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

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.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

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.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

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.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

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…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also multiregex · rebulk · flashtext · pyahocorasick · marisa-trie · greenery · textsearch · PyTrie · pygtrie · repath