0.23.0
Added
- Added
ReactiveModelfor grouping reactive state and behavior in reusable
Python classes. - Added
field()for typed, per-instance signals with default values and
factories. - Added model-friendly
@computed,@effect,@linked, and@resource
decorators with support for instance methods. - Added automatic ownership and cleanup of model effects and resources through
ReactiveModel.dispose(). - Added constructor overrides and mixin guidance for initializing models with
instance-specific values.
from reaktiv import ReactiveModel, computed, effect, field
class Counter(ReactiveModel):
count = field(0)
@computed
def doubled(self):
return self.count() * 2
@effect
def report(self):
print(self.count(), self.doubled())
counter = Counter(count=5)
counter.count.update(lambda value: value + 1)
counter.dispose()Improved
- Expanded type inference coverage and documentation for the new model API.
- Added practical
ReactiveModelexamples for application state, linked values,
async resources, cleanup, and custom equality. - Made documentation examples executable directly in the browser with Pyodide.
API Direction
- Lowercase callable APIs such as
computed(),effect(),linked(), and
resource()are planned to become the preferred style for future
instantiation and decorators.
Full Changelog: 0.22.0...0.23.0