A rule engine where rules are written in JSON format
Project description
python-rule-engine
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)
Rule Format
Find more info about the rules here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python_rule_engine-0.5.1.tar.gz
.
File metadata
- Download URL: python_rule_engine-0.5.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03cb0ce7d22731d0f19282cba5a77115dc41247c5674dc0d573a242a8ff051c6 |
|
MD5 | 4c7a26fd82fcac3384b3253fe6b2cdcb |
|
BLAKE2b-256 | 57178444153c6fba4f03090ef79080fa4e594d02383009e4a1e05f6d202c74f4 |
File details
Details for the file python_rule_engine-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: python_rule_engine-0.5.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3026513bd98f9df8c9fac56993cc267b91f97864a40b3737863f2acc924de8df |
|
MD5 | 177a1dd4c02df8315964be129d491871 |
|
BLAKE2b-256 | bc060d77a368ae7ad99003d0377c74a061d8eaec13eeb7c1372a2d45af5df66c |