rule-engine
A lightweight, optionally typed expression language with a custom grammar for matching arbitrary Python objects.
Decision gist · record as of 2026-08-14
Yes. Rule Engine is actively maintained, has no known vulnerabilities, low install friction, and solves a clear problem: declarative rule evaluation without writing Python code. The permissive BSD-3-Clause license poses no restrictions. Install if you need to evaluate user-defined or data-driven matching logic; skip if you're writing simple hardcoded conditionals.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; Version 6.0 will drop Python 3.10 support.
- Low install friction with a single runtime dependency (python-dateutil).
- Active maintenance with a recent release 37 days ago and ongoing repository activity.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause permissive license allows commercial and private use without restriction.
last release 2026-07-08 (37 days) · last repo commit 2026-08-02 · 593 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 448,253 downloads/mo, #6,604 on PyPI
Alternatives
Verify before relying
pip install rule-engine
import rule_engine
rule = rule_engine.Rule('first_name == "Luke" and email =~ ".*@rebels.org$"')
rule.matches({'first_name': 'Luke', 'email': 'luke@rebels.org'})- Performance characteristics when evaluating large rule sets or complex expressions against many objects
- Thread-safety guarantees beyond the documented claim in the description excerpt
What it is and what it does
Rule Engine is a domain-specific language (DSL) for writing matching rules as strings in Python code. You define rules using a custom grammar similar to Python syntax, then apply them to dictionaries or objects to test whether they match. The language supports optional type annotations to catch errors early, regular expression matching on strings, datetime values, and compound types like lists, dicts, and sets.
Typical usage involves creating a Rule object with an expression string, optionally providing a typed Context to validate symbol names and operations, then calling the rule's matching method on data objects. It's designed for scenarios where you need to express filtering or matching logic in a declarative, user-friendly way rather than writing Python conditionals directly. The package includes a debug REPL for experimentation.
Use it for
- Filter records in a database or API response based on user-defined rule expressions without writing custom Python code
- Implement a rules engine for workflow automation where business logic is expressed as strings and evaluated at runtime
- Validate incoming data against typed rule sets to ensure only objects matching specific criteria proceed
- Build a query language for applications where end users need to define matching criteria without Python knowledge
- Match log entries or events against rule expressions for alerting or log aggregation systems
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Rule Engine is actively maintained, has no known vulnerabilities, low install friction, and solves a clear problem: declarative rule evaluation without writing Python code. The permissive BSD-3-Clause license poses no restrictions. Install if you need to evaluate user-defined or data-driven matching logic; skip if you're writing simple hardcoded conditionals.
Install
rule-engine on PyPI
Before you install
Low install friction with a single runtime dependency (python-dateutil). Active maintenance with a recent release 37 days ago and ongoing repository activity.
Requires Python 3.10 or later; Version 6.0 will drop Python 3.10 support.
License in practice
BSD-3-Clause permissive license allows commercial and private use without restriction.
Quickstart
pip install rule-engine
import rule_engine
rule = rule_engine.Rule('first_name == "Luke" and email =~ ".*@rebels.org$"')
rule.matches({'first_name': 'Luke', 'email': 'luke@rebels.org'})
Verify before relying
- Performance characteristics when evaluating large rule sets or complex expressions against many objects
- Thread-safety guarantees beyond the documented claim in the description excerpt
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepython-dateutil |
| Maintenance | Actively maintained 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 448,253 / month, #6,604 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries :: Python Modules |
Evidence: rule_engine-5.0.2-py3-none-any.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 › “rule evaluation engine”
- rule-engineRule Engine provides a lightweight, custom expression language for…
- panzi-json-logicEvaluates JsonLogic and CertLogic rules—JSON-serializable logic…
- zen-enginezen-engine is a Python binding for a Rust-based business rules engine…
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 PyMeta3 · regress · common-expression-language · Parsley · zen-engine · iregexp-check · ctparse · exrex · regexploit · yara-python