reaktiv: Reactive Signals for Python¶

reaktiv is a Python library that brings reactive programming principles to Python with first-class async support.
Links¶
- Documentation: https://reaktiv.readthedocs.io/
- GitHub: https://github.com/buiapp/reaktiv
What is reaktiv?¶
reaktiv is a lightweight reactive state management library for Python that automatically keeps your derived values and side effects in sync with their data sources. When data changes, everything that depends on it updates automatically.
Think of it as a spreadsheet for your Python application: change a cell, and all formulas using that cell recalculate instantly.
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
- First-class async support - Built for Python's asyncio ecosystem
Learn more about why you should use reaktiv →
Features¶
- Automatic state propagation: Change a value once, and all dependent computations update automatically
- Efficient updates: Only the necessary parts are recomputed
- Async-friendly: Seamlessly integrates with Python's
asyncio
for managing real-time data flows - Zero external dependencies: Lightweight and easy to incorporate into any project
- Type-safe: Fully annotated for clarity and maintainability
Overview¶
reaktiv is built around three core primitives:
- 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, Effect
# Create a signal with initial value
name = Signal("Alice")
# Create an effect that reacts to changes
def on_name_change():
print(f"Hello, {name()}!")
# Create the effect
greeter = Effect(on_name_change) # Prints: "Hello, Alice!"
# Update the signal value
name.set("Bob") # Will print: "Hello, Bob!"
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
- Advanced Features - More powerful capabilities
- Real-World Examples - Practical applications