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).
Most systems mix:
- conditions
- control flow
- side effects
- execution
logically separates them.
You define what logic means — not how it runs.
A single logical check.
from logically import Condition
is_adult = Condition(
name="age",
rule=lambda v: v >= 18,
description="User must be an adult"
)A group of conditions evaluated together.
from logically import Rule
access_rule = Rule(
name="access_allowed",
conditions=[is_adult],
)Rules return boolean outcomes.
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
})Graphs allow composing rules and decisions into inspectable logical flows.
Graphs describe structure — not execution engines.
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)- Explicit > implicit
- No magic execution
- No hidden state
- No framework lock-in
- Composable by the user
pip install git+https://github.com/leraniode/x-py.git#subdirectory=logicallyMIT License. See License file