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

Note that this function is not supported yet, rules can be created only as objects.

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.0.tar.gz (5.6 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.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ruly-zlatsic-0.0.0.tar.gz
  • Upload date:
  • Size: 5.6 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.0.tar.gz
Algorithm Hash digest
SHA256 d3ca99f59a1420edab6aac97160791b5e43a189d58e88b61a3389d6edf56cf62
MD5 beeeaeb683a780d69cafc6a7ca8a2073
BLAKE2b-256 158878352634e1a1c9b3739f0be394c205a790d4b4926140e5c186244c7c8b5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ruly_zlatsic-0.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff900f5d317412d45c0793aab98a3a594420135071af87840941abba1bcda271
MD5 94f99b8ac3fe95de012b4950b625b9e9
BLAKE2b-256 a5c7759d5bc69af76031a557564bcc9e76c9693d6b5be3d3f3c7cbafcdcfe80a

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