python-rule-engine


Namepython-rule-engine JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/santalvarez/python-rule-engine
SummaryA rule engine where rules are written in JSON format
upload_time2024-10-28 15:08:46
maintainerNone
docs_urlNone
authorSantiago Alvarez
requires_python<4.0.0,>=3.7.2
licenseMIT
keywords rule-engine rules json python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # python-rule-engine

[![pypi](https://img.shields.io/pypi/v/python-rule-engine.svg)](https://pypi.python.org/pypi/python-rule-engine)
[![versions](https://img.shields.io/pypi/pyversions/python-rule-engine.svg)](https://github.com/santalvarez/python-rule-engine)
[![license](https://img.shields.io/github/license/pydantic/pydantic.svg)](https://github.com/pydantic/pydantic/blob/main/LICENSE)



A rule engine where rules are defined in JSON format. The syntax of the rules belongs to the [json-rules-engine](https://github.com/CacheControl/json-rules-engine) javascript library though it contains some changes to make it more powerfull.

## Installation
```
pip install python-rule-engine
```

## Quick Example

```python
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](docs/rules.md).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/santalvarez/python-rule-engine",
    "name": "python-rule-engine",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.7.2",
    "maintainer_email": null,
    "keywords": "rule-engine, rules, json, python",
    "author": "Santiago Alvarez",
    "author_email": "santiago.salvarez@mercadolibre.com",
    "download_url": "https://files.pythonhosted.org/packages/57/17/8444153c6fba4f03090ef79080fa4e594d02383009e4a1e05f6d202c74f4/python_rule_engine-0.5.1.tar.gz",
    "platform": null,
    "description": "# python-rule-engine\n\n[![pypi](https://img.shields.io/pypi/v/python-rule-engine.svg)](https://pypi.python.org/pypi/python-rule-engine)\n[![versions](https://img.shields.io/pypi/pyversions/python-rule-engine.svg)](https://github.com/santalvarez/python-rule-engine)\n[![license](https://img.shields.io/github/license/pydantic/pydantic.svg)](https://github.com/pydantic/pydantic/blob/main/LICENSE)\n\n\n\nA rule engine where rules are defined in JSON format. The syntax of the rules belongs to the [json-rules-engine](https://github.com/CacheControl/json-rules-engine) javascript library though it contains some changes to make it more powerfull.\n\n## Installation\n```\npip install python-rule-engine\n```\n\n## Quick Example\n\n```python\nfrom python_rule_engine import RuleEngine\n\nrule = {\n    \"name\": \"basic_rule\",\n    \"conditions\": {\n        \"all\": [\n            {\n                # JSONPath support\n                \"path\": \"$.person.name\",\n                \"operator\": \"equal\",\n                \"value\": \"Lionel\"\n            },\n            {\n                \"path\": \"$.person.last_name\",\n                \"operator\": \"equal\",\n                \"value\": \"Messi\"\n            }\n        ]\n    }\n}\n\nobj = {\n    \"person\": {\n        \"name\": \"Lionel\",\n        \"last_name\": \"Messi\"\n    }\n}\n\nengine = RuleEngine([rule])\n\nresults = engine.evaluate(obj)\n\n```\n\n## Rule Format\n\nFind more info about the rules [here](docs/rules.md).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A rule engine where rules are written in JSON format",
    "version": "0.5.1",
    "project_urls": {
        "Homepage": "https://github.com/santalvarez/python-rule-engine"
    },
    "split_keywords": [
        "rule-engine",
        " rules",
        " json",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc060d77a368ae7ad99003d0377c74a061d8eaec13eeb7c1372a2d45af5df66c",
                "md5": "177a1dd4c02df8315964be129d491871",
                "sha256": "3026513bd98f9df8c9fac56993cc267b91f97864a40b3737863f2acc924de8df"
            },
            "downloads": -1,
            "filename": "python_rule_engine-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "177a1dd4c02df8315964be129d491871",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.7.2",
            "size": 8583,
            "upload_time": "2024-10-28T15:08:45",
            "upload_time_iso_8601": "2024-10-28T15:08:45.207031Z",
            "url": "https://files.pythonhosted.org/packages/bc/06/0d77a368ae7ad99003d0377c74a061d8eaec13eeb7c1372a2d45af5df66c/python_rule_engine-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57178444153c6fba4f03090ef79080fa4e594d02383009e4a1e05f6d202c74f4",
                "md5": "4c7a26fd82fcac3384b3253fe6b2cdcb",
                "sha256": "03cb0ce7d22731d0f19282cba5a77115dc41247c5674dc0d573a242a8ff051c6"
            },
            "downloads": -1,
            "filename": "python_rule_engine-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4c7a26fd82fcac3384b3253fe6b2cdcb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.7.2",
            "size": 6250,
            "upload_time": "2024-10-28T15:08:46",
            "upload_time_iso_8601": "2024-10-28T15:08:46.145565Z",
            "url": "https://files.pythonhosted.org/packages/57/17/8444153c6fba4f03090ef79080fa4e594d02383009e4a1e05f6d202c74f4/python_rule_engine-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-28 15:08:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "santalvarez",
    "github_project": "python-rule-engine",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "python-rule-engine"
}
        
Elapsed time: 0.91582s