Skip to main content

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.6) package. It can be installed by calling:

pip install ruly

Usage

import ruly

knowledge_base = ruly.KnowledgeBase(
    '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. Additionally, there's CI support to test 3.7>, however 3.6 is not included in this because GH actions we

Metadata

Release files for ruly 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ruly 0.1.0
File Size Uploaded
ruly-0.1.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ruly 0.1.0
File Interpreter ABI Platform
ruly-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.1 kB

Release files / ruly-0.1.0.tar.gz

Download URL ruly-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a5a038f2bbcb5c4ed74a8b48c70bd08e03531ff0c4a8b34383a7a71e73811d1
BLAKE2b-256 checksum
How to use checksums
9cd036c40513eea1897a5efc578aa040b1117bba03379877e8ebe2251a56a8a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / ruly-0.1.0-py3-none-any.whl

Download URL ruly-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b20b09b3d2f49e52efd70914ad9c5a0fb5d81299a05c1ee0680414b4df462a11
BLAKE2b-256 checksum
How to use checksums
ccd4146dd6658ff301eba9bbbb1dc12dfcdd95c29d4154b3cbc4d6a72561a1a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.7

2 release files

0.0.6

1 release file

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page