Skip to main content

regelum

docs tests python uv

regelum

regelum is a framework for designing and simulating dynamic systems, feedback loops, DAGs, and dataflows as Phased Reactive Systems (PRS). A PRS has two levels of abstraction: low-level computational primitives called nodes, and high-level execution stages called phases. Nodes declare Inputs for values read from other nodes or system sources and State for values they own and publish; phases group node instances into executable slices, resolve their dependency graph, and move execution through explicit transitions. These transitions can be unconditional or conditional, so execution can branch to different phases depending on current system state.

The API is intentionally built from Python's own language features: type annotations, nested classes, descriptors, declarative function signatures, operator overloading, and ordinary Python objects. It is inspired by frameworks such as FastAPI, Typer, Pydantic, SQLModel, SQLAlchemy, and FastStream. The goal is to make system models look like regular Python while still giving the compiler enough structure to resolve dependencies, validate the graph, schedule execution, and integrate continuous dynamics.

The best entry point is the Learn overview:

Quick Example

import random

import regelum as rg


class TemperatureSensor(rg.Node):
    class State(rg.NodeState):
        temperature: float

    def update(self) -> State:
        return self.State(temperature=round(random.uniform(18.0, 26.0), 1))


class HeaterController(rg.Node):
    class Inputs(rg.NodeInputs):
        temperature: float = rg.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 State(rg.NodeState):
        count: int = rg.var(init=0)

    def update(
        self,
        prev_state: State,
        is_heater_on: bool = rg.src(HeaterController.State.heater_on),
    ) -> State:
        return self.State(
            count=prev_state.count + int(is_heater_on),
        )


sensor = TemperatureSensor()
controller = HeaterController()
cycles = HeatingCycles()

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 mkdocs serve

Citation

If you use regelum in academic work, please cite it using the metadata in CITATION.cff.

License

regelum is distributed under the MIT License. See LICENSE.

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.

Release files for regelum 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for regelum 0.4.1
File Size Uploaded
regelum-0.4.1.tar.gz 31.4 kB Details

Built distribution (wheel)

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

Total release size: 66.0 kB

Release files / regelum-0.4.1.tar.gz

Download URL regelum-0.4.1.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2fa40bf63a4dd48ae54d8f6507c2c718e9865e56c690c978971e6eaf153a7ee9
BLAKE2b-256 checksum
How to use checksums
c00a854b9a3b4d8235eca8467fab6255876f4c46bca79775047ebbae94cfe46a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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}

Release files / regelum-0.4.1-py3-none-any.whl

Download URL regelum-0.4.1-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a72a610df000960ca65dd18868083b95d4dd41ddeb4a156e46bd5021d56af9e
BLAKE2b-256 checksum
How to use checksums
c505d43cf1be2fde120bfbe4732f3e25238292f3ebed3798e79fa8e08b89ae77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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}

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.3.15

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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