Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

logically product image

logically 🤔

experimental-leraniode logically-smart-leraniode

logically is a logic-construction toolkit for building clean, composable, and inspectable logic units in Python.

It helps you express intent, conditions, rules, and decisions without coupling them to execution, parsing, or side effects.

Part of Leraniode X (experimental projects).


Why logically?

Most systems mix:

  • conditions
  • control flow
  • side effects
  • execution

logically separates them.

You define what logic means — not how it runs.


Core Concepts

Condition

A single logical check.

from logically import Condition

is_adult = Condition(
    name="age",
    rule=lambda v: v >= 18,
    description="User must be an adult"
)

Rule

A group of conditions evaluated together.

from logically import Rule

access_rule = Rule(
    name="access_allowed",
    conditions=[is_adult],
)

Rules return boolean outcomes.

Decision

A rule paired with an optional action.

from logically import Decision

decision = Decision(
    name="grant_access",
    rule=access_rule,
    action=lambda ctx: "Access granted"
)

result = decision.execute({
    "age": 21
})

Graph (advanced)

Graphs allow composing rules and decisions into inspectable logical flows.

Graphs describe structure — not execution engines.

Complete Example

from logically import Condition, Rule, Decision

is_adult = Condition(
    name="age",
    rule=lambda v: v >= 18
)

rule = Rule(
    name="adult_rule",
    conditions=[is_adult]
)

decision = Decision(
    name="access",
    rule=rule,
    action=lambda ctx: "Access granted"
)

result = decision.execute({
    "age": 21
})

print(result)

Design Principles

  • Explicit > implicit
  • No magic execution
  • No hidden state
  • No framework lock-in
  • Composable by the user

Installation

pip install git+https://github.com/leraniode/x-py.git#subdirectory=logically

License

MIT License. See License file