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 Provenance Actions
ruly-0.1.0.tar.gz 9.3 kB Without provenance Details for ruly-0.1.0.tar.gz

Built distribution (wheel)

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

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

Security for ruly 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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