Skip to main content

python-rule-engine

pypi versions license Downloads Downloads Month

A rule engine where rules are defined in JSON format. The syntax of the rules belongs to the json-rules-engine javascript library though it contains some changes to make it more powerfull.

Installation

pip install python-rule-engine

Quick Example

from python_rule_engine import RuleEngine

rule = {
    "name": "basic_rule",
    "conditions": {
        "all": [
            {
                # JSONPath support
                "path": "$.person.name",
                "operator": "equal",
                "value": "Lionel"
            },
            {
                "path": "$.person.last_name",
                "operator": "equal",
                "value": "Messi"
            }
        ]
    }
}

obj = {
    "person": {
        "name": "Lionel",
        "last_name": "Messi"
    }
}

engine = RuleEngine([rule])

results = engine.evaluate(obj)

Metadata

Release files for python-rule-engine 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-rule-engine 1.0.0
File Size Uploaded
python_rule_engine-1.0.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-rule-engine 1.0.0
File Interpreter ABI Platform
python_rule_engine-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / python_rule_engine-1.0.0.tar.gz

Download URL python_rule_engine-1.0.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
13368b7d8b263e0a054f4518f39e42487d217a75e1448b514c6f341021a3228b
BLAKE2b-256 checksum
How to use checksums
ef5b6056e01a358049b3b362d9d8e9f9003c89c84254a3e81db24bfeecf60d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / python_rule_engine-1.0.0-py3-none-any.whl

Download URL python_rule_engine-1.0.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e45a1c55ce87ecef7d401ccf7fe4a969f116445d43d40fcb12c77b1e35d77a8f
BLAKE2b-256 checksum
How to use checksums
9d2586077b41376255c79ed9ea0feda630d1116afab619a0fcaa101bedf84511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page