Skip to main content

Simple, extensible rule engine in Python

Project description

Ruly

Ruly is a simple, lightweight rule engine that can be used to define rules and prove statements using backward chaining. It attempts to be highly configurable, allowing callers of its functions to define callbacks in cases for conflict resolutions or derivations of new rules.

Installation

Ruly can be installed and used as a Python package. It can be installed by calling:

pip install ruly

Usage

import ruly


knowledge_base = ruly.knowledge_base.create([
    "IF color = 'red' THEN creature = 'dragon'",
    "IF color = 'grey' THEN creature = 'rat'"])
print(ruly.backward_chain(knowledge_base, 'creature', color='red'))
# prints dragon

For more examples and information on how to create new rules, solve conflicts, generate new rules on the fly during evaluations, etc., see the documentation.

Development environment

To set up the development environment, requirements must be installed either by calling setup.py or by installing them manually using pip and requirements.txt file. Also, ruly's build tool, doit needs to be installed. Supported tasks can be listed by calling:

doit list

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

ruly-zlatsic-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ruly_zlatsic-0.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ruly-zlatsic-0.0.1.tar.gz.

File metadata

  • Download URL: ruly-zlatsic-0.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for ruly-zlatsic-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ec9bc1c69a2d7abf0d3a5a923958f6cf63a02300859380769c01294d6ae95403
MD5 426812f48f77c2c3d0407ec3ecca44de
BLAKE2b-256 075d18990d78f5a22f66a9c30f251f97e9a5b679ddcfad03874bca8d411c6a98

See more details on using hashes here.

File details

Details for the file ruly_zlatsic-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ruly_zlatsic-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for ruly_zlatsic-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97b6a41399696be983e076503e923c4c58ffff1a3a5e2a2506b91b00ac9a25ca
MD5 747cba84133469e986b5081884798b40
BLAKE2b-256 3ae4145b0dde6fd5e60bc5d4e6612d58ab2575992f6dac4cdbc9b36976195b38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page