iPython notebooks with reactive UI - powered by RxPy and ipywidgets
Project description
General
This package adds functionality useful for making ReactiveX powered ipywidgets.
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
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:
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:
@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, ...))
@rxi.defer
,@rxi.pre_load
, ...- If desired, apply operators to the call-ready function
@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(...))
- Create and display an
@rxi.Automap
- If desired, pack the final stream into an
Automap
object. This object maps all operators to operators applied inside the stream.
- If desired, pack the final stream into an
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rxwidgets-0.1.9.tar.gz
(14.4 kB
view hashes)
Built Distribution
rxwidgets-0.1.9-py3-none-any.whl
(20.7 kB
view hashes)
Close
Hashes for rxwidgets-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5cebc359abbde15f0cb6d50663d62c682ba4aa1b773c7354650ce478a9f7789 |
|
MD5 | 255569207f8bd02afea68d2c887849b7 |
|
BLAKE2b-256 | 721b4748ba2d25cb839edac39d3aec4f1e3bef7ef3630c01c005971e198679c7 |