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 (>=3.8) 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

NOTE: Ruly's development environment is using Python 3.12, but since Ruly does not require any runtime dependencies, the lowest supported version is Python 3.6. To test any new changes use the platform tests (doit plat_test) and update the minor version if backwards compatibility is broken.

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-0.0.7.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

ruly-0.0.7-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file ruly-0.0.7.tar.gz.

File metadata

  • Download URL: ruly-0.0.7.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for ruly-0.0.7.tar.gz
Algorithm Hash digest
SHA256 cdfe536ee022bb50926b8222fd57f8dcce6ea27e2f63d4a6107f7a981ae5e707
MD5 4fea03b8e8b96c53aa8761b8a9d387a4
BLAKE2b-256 176e1db54a4e04ce2b6b5b78eef792c4cbf573ab0119a1c6f99e8b41a758680a

See more details on using hashes here.

File details

Details for the file ruly-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: ruly-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for ruly-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5bc368d2cd5a37879a3e0b02296fa5a4aa4ed2bfb398a93b87ad4499db163b0a
MD5 35b0def60bd5a229cd799afecf767784
BLAKE2b-256 23c3768a29bf12c3d90c8f3d3a535eed452f8f44de63ff4fb5d81ff098e63b9b

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