Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivorforce/rxwidgets
ReactiveX ipywidgets for complex iPython notebooks.
https://github.com/ivorforce/rxwidgets
ipython ipython-notebook ipywidgets reactive reactivex
Last synced: 25 days ago
JSON representation
ReactiveX ipywidgets for complex iPython notebooks.
- Host: GitHub
- URL: https://github.com/ivorforce/rxwidgets
- Owner: Ivorforce
- License: mit
- Created: 2022-04-27T16:21:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-05T12:56:27.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T09:19:23.040Z (25 days ago)
- Topics: ipython, ipython-notebook, ipywidgets, reactive, reactivex
- Language: Python
- Homepage:
- Size: 171 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# General
This package adds functionality useful for making [ReactiveX](https://rxpy.readthedocs.io) powered [ipywidgets](https://ipywidgets.readthedocs.io/en/latest/).
Note that this package is in its Beta stage and may change interfaces slightly before a 1.0 release.
# Installation
Run `poetry add rxwidgets`
# Usage
```py
import rxwidgets.ipython as rxi@rxi.interact_manual
def b(a=(1,5)):
return a * 5@rxi.interact
def c(b=b, c=(10, 20)):
c = b + c
print(f"C: {c}")
```Corresponds roughly to native ipywidgets:
```py
from ipywidgets import interact, interact_manual@interact_manual
def b(a=(1,5)):
b = a * 5@interact
def c(c=(10, 20)):
c = b + c
print(f"C: {c}")
```An incomprehensive feature list is provided in the `examples` folder.
# Streams
A function stream consists of these steps:
1. `@rxi.stream_defaults`
- Convert parameter defaults into observables - may display ipywidgets.
- Convert function into a stream of its results from input streams.
- In stream: Curry the function and make wrap into a `ValueBox`.
- Object in stream: `ValueBox(partial(fn, ...))`
2. `@rxi.defer`, `@rxi.pre_load`, ...
- If desired, apply operators to the call-ready function
3. `@rxi.apply`
- Create and display an `rxi.Screen`.
- In stream: Run the function inside the screen and return results as a `ValueBox`.
- Object in stream: `ValueBox(fn(...))`
4. `@rxi.Automap`
- If desired, pack the final stream into an `Automap` object. This object maps all operators to operators applied inside the stream.