Rulent
Rulent is a python in-memory latency events engine that uses a set of declarative rules and triggers actions (outcomes).
Quick Start
Here is a sample implementation using rulent with FastAPI:
from fastapi import FastAPI
from .import models
import rulent
app = FastAPI()
rulent.load_rules()
@app.post("/validate")
async def validate(request: models.EventRequest):
print(request)
return rulent.validate_data(dict(request))
@app.get("/reload")
async def reload_engine():
rulent.load_rules()
return {
"status": "success",
"message": "Conditions reloaded successfully",
}
Make sure you have a folder called "events" with atleast one YAML file like the below example:
events:
click:
rules-operator: "and"
rules:
- rule: "Name Check"
conditions:
- "person.name": "James"
- rule: "Age Check"
conditions:
- "person.age": "42"
- You can programatically create this folder and sample file using rulent.init(). This needs to be used only once.
Key Components
The main components of the event engine are as below.
The Web API
This is for ingesting events. This acts as the entry point for new events to be received and validation against rules.
Events
Events are specific, explicitly sent, pieces of information sent with the payload. This sets the foundation for the rules engine to process rules based on the event.
Rules
These are the rules that need to be applied on the JSON payload. This has support for dot notation. The rules can be combined using rules-operator: "or".
A sample rules block:
events:
click:
rules-operator: "and"
rules:
- rule: "Name Check"
conditions:
- "person.name": "James"
- rule: "Age Check"
conditions:
- "person.age": "42"
Outcomes
Once the payloads have been processed against rules, matched payloads can initiate actions. Actions are bundled together as outcomes.
Note: Actions are executed asynchronously.
Actions
Actions that are part of outcomes can be extended by navigating to the logic folder and actions.go file. Currently, this has access to outcomes and the payloads that were received.
Metadata
Release files for rulent 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rulent-0.0.2.tar.gz | 8.6 kB | Without provenance | Details for rulent-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rulent-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for rulent-0.0.2-py3-none-any.whl |
Total release size: 20.0 kB
Release files / rulent-0.0.2.tar.gz
| Download URL | rulent-0.0.2.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db555bf8e0f1d328ae1b89f2443879d5b8666d302ae42f7d4bd761de91454835
|
|
BLAKE2b-256 checksum How to use checksums |
e055ea68748bb2ac83ae735d0aee134eb0c2d16a5a8cf3571ad57cb53baa61d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / rulent-0.0.2-py3-none-any.whl
| Download URL | rulent-0.0.2-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0aefaa2cfd987d0c53c0d09b384cf36abd37e1799e7b3ac2fe56a3a21ed40b54
|
|
BLAKE2b-256 checksum How to use checksums |
1876fbcceee97666d773c6a39e67b584943bf3b5160f64128597b32d651e8b12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Security for rulent 0.0.2
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.