reaktiv: Reactive Signals for Python
Reactive declarative state management for Python — automatic dependency tracking and reactive updates for your application state.
- Live Playground: https://reaktiv.bui.app/#playground
- Documentation: https://reaktiv.bui.app/docs
- Deep Dive Article: https://bui.app/the-missing-manual-for-signals-state-management-for-python-developers/
- GitHub: https://github.com/buiapp/reaktiv
What is reaktiv?
Section titled “What is reaktiv?”reaktiv is a reactive declarative state management library for Python that lets you declare relationships between your data instead of manually wiring updates. When data changes, everything that depends on it updates automatically — eliminating a whole class of bugs where you forget to update dependent state.
Think of it as a spreadsheet for your Python application: change a cell, and all formulas using that cell recalculate instantly.
Why Use reaktiv?
Section titled “Why Use reaktiv?”reaktiv solves common pain points in state management:
- Eliminates manual state synchronization - No more forgetting to update derived values
- Reduces bugs - Ensures consistent state throughout your application
- Simplifies code - Declare relationships once, not every time data changes
- Improves performance - Only recomputes what actually needs to change
Learn more about why you should use reaktiv →
Features
Section titled “Features”- Automatic state propagation: Change a value once, and all dependent computations update automatically
- Efficient updates: Only the necessary parts are recomputed (fine‑grained reactivity)
- Zero external dependencies: Lightweight and easy to incorporate into any project
- Type-safe: Fully annotated for clarity and maintainability
- Lazy and memoized: Computations run only when needed and cache until dependencies change
Quick Start
Section titled “Quick Start”reaktiv is built around core primitives for reactive programming:
- Signals: Store values and notify dependents when they change
- Computed Signals: Derive values that automatically update when dependencies change
- Effects: Run side effects when signals or computed signals change
from reaktiv import Signal, Computed, Effect
# Reactive data sourcesname = Signal("Alice")age = Signal(30)
# Reactive derived valuegreeting = Computed(lambda: f"Hello, {name()}! You are {age()} years old.")
# Reactive side effect (retain a reference!)greeting_effect = Effect(lambda: print(f"Updated: {greeting()}"))
# Update base data — everything reacts automaticallyname.set("Bob") # Prints: Updated: Hello, Bob! You are 30 years old.age.set(31) # Prints: Updated: Hello, Bob! You are 31 years old.Documentation
Section titled “Documentation”-
Installation - How to install the library
-
Quick Start - Get up and running quickly
-
Why reaktiv? - When and why to use reaktiv
-
Core Concepts - Understanding the fundamentals
-
API Reference - Detailed API documentation
- Signal - Writable reactive values
- Computed - Derived reactive values
- Effect - Reactive side effects
- LinkedSignal - Writable derived signal with auto-reset
-
Advanced Features - More powerful capabilities
-
Real-World Examples - Practical applications