Add your description here
Project description
regelum
regelum is a framework for prototyping and simulating dynamic systems and
general dataflows. It introduces Phased Reactive Systems (PRS): systems
that execute one tick at a time, activate different groups of nodes in
different phases, and move between phases with explicit transitions.
Any algorithm written with regelum can be decomposed into a graph of phases
with conditional transitions. Each phase is represented as a DAG of
computational primitives called nodes: stateful computation units with two
namespaces, Inputs and State. A state variable written by one node can be
used as an input of another node, while a node can also read its own previous
state directly in update.
regelum deliberately leans on Python syntax sugar. The API is inspired by
frameworks such as FastAPI, Typer, Pydantic, SQLModel, SQLAlchemy, FastStream,
and others that made Python annotations, descriptors, nested classes, and
declarative function signatures into compact framework DSLs. In regelum,
Node, State, Var, Input(src=...), and update(...) provide a concise
way to write computation nodes while the built-in compiler/resolver derives
the execution order and validates the graph.
Overview
- Nodes declare typed inputs and state variables, then compute their next
state in
update. - Phases decide which node instances are active together and how control moves between phases.
- Continuous nodes declare ODE state and are integrated through
ODESystemphases. - Compilation resolves links, schedules nodes, and catches structural mistakes before runtime: unresolved inputs, ambiguous references, invalid phase graphs, and computations that cannot be guaranteed to resolve.
The best entry point is the Learn overview:
- Docs: https://aidagroup.github.io/regelum/
- Learn overview: https://aidagroup.github.io/regelum/concepts/
Quick Example
import regelum as rg
class TemperatureSensor(rg.Node):
class State(rg.NodeState):
temperature: float = rg.Var(init=19.0)
def update(self) -> State:
return self.State(temperature=21.5)
class HeaterController(rg.Node):
class Inputs(rg.NodeInputs):
temperature: float = rg.Input(
src=TemperatureSensor.State.temperature,
)
class State(rg.NodeState):
heater_on: bool
def update(self, inputs: Inputs) -> State:
return self.State(heater_on=inputs.temperature < 22.0)
class HeatingCycles(rg.Node):
class Inputs(rg.NodeInputs):
heater_on: bool = rg.Input(src=HeaterController.State.heater_on)
class State(rg.NodeState):
count: int = rg.Var(init=0)
def update(self, inputs: Inputs, prev_state: State) -> State:
return self.State(
count=prev_state.count + int(inputs.heater_on),
)
sensor = TemperatureSensor(name="room_sensor")
controller = HeaterController(name="heater_controller")
cycles = HeatingCycles(name="heating_cycles")
system = rg.PhasedReactiveSystem(
phases=[
rg.Phase(
"control",
nodes=(sensor, controller, cycles),
transitions=(rg.Goto(rg.terminate),),
is_initial=True,
),
],
)
system.step()
print(system.read(controller.State.heater_on))
Installation
Recommended: use uv.
uv add regelum
For local development from this repository:
uv sync --all-groups
uv run pytest tests
uv run ty check src tests
uv run mkdocs serve
Examples
uv run regelum-pendulum
uv run marimo edit examples/free_pendulum/app.py
uv run marimo edit examples/controlled_pendulum/app.py
uv run regelum-video-player
uv run regelum-instance-connect
Release Process
Create a GitHub Release tagged like v0.2.0.
The publish workflow builds the package, derives the version from the tag, and
uploads artifacts to PyPI.
After installation, users can verify the packaged version:
import regelum
print(regelum.__version__)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file regelum-0.3.3.tar.gz.
File metadata
- Download URL: regelum-0.3.3.tar.gz
- Upload date:
- Size: 102.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f961edb33debbbd3c5170a0d61f6f4309e45580aea20d71f9b1e3b1c98cde3
|
|
| MD5 |
7693eee6b2db776ea68bfd1147835d62
|
|
| BLAKE2b-256 |
188cec604eb68651e200ee7769e2d936ee31af3c66933433d6bdabeafa82510d
|
File details
Details for the file regelum-0.3.3-py3-none-any.whl.
File metadata
- Download URL: regelum-0.3.3-py3-none-any.whl
- Upload date:
- Size: 135.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7787ca1df865e195f1e36a7c00d2f0c6361b0fd613d632376e67fdad6ca9682f
|
|
| MD5 |
bff63b685c2f107378a4dad36a40eabd
|
|
| BLAKE2b-256 |
7f040d04ca33ae3cb4523acbbac3e41dadc79d024665d0427a210bb38af5db18
|