Skip to content

rainzee/st

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

st

Minimal reactive state for Python.

Design

  • Small core. No runtime dependencies.
  • Signal-first model. State, derived state, and effects form the primitive graph.
  • Structural typing. Internal contracts use Protocol, not inheritance.
  • Python 3.13 generics. State[T] and Computed[T] use PEP 695 syntax.
  • Dynamic dependencies. Effects replace their dependency set on each run.
  • Equality short-circuit. Unchanged values do not notify dependents.

Usage

from st import State, computed, effect, peek

count = State(1)
double = computed(lambda: count.value * 2)

effect(lambda: print(double.value))

count.value = 2

current = peek(double)

Output:

2
4

Roadmap

Core infrastructure:

  • dispose
  • untrack
  • peek (done)
  • batch
  • on_cleanup

Scheduling:

  • custom effect schedulers
  • queued flush
  • next_tick

Debugging:

  • runtime type guards
  • dependency inspection
  • subscriber inspection
  • optional labels

Development

uv sync
uv run pytest

About

Minimal reactive state for Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages