import marimo __generated_with = "0.8.4" app = marimo.App( width="medium", layout_file="layouts/alon_pywebil_marimo_demo_2024-09-03-1900.slides.json", ) @app.cell def __(left_about_marimo, mo, right_about_marimo, rtl): mo.vstack([ mo.md("# Marimo"), mo.hstack([mo.md(left_about_marimo), rtl(mo.md(right_about_marimo))]), ]) return @app.cell def __(left_about_marimo, mo, right_about_marimo, rtl, toggle_rtl): _opt_rtl = rtl if toggle_rtl.value else lambda x: x mo.vstack([ mo.md("# Marimo 2"), mo.hstack([mo.md(left_about_marimo), _opt_rtl(mo.md(right_about_marimo))]), mo.hstack([toggle_rtl]), ]) return @app.cell def __(mo): toggle_rtl = mo.ui.checkbox(label='RTL', value=True) return toggle_rtl, @app.cell def __(): right_about_marimo = r""" * ?????????? ?????? ?????????? ?????????????????? * ???????????? * ?????? ???????????? ???????????? """ return right_about_marimo, @app.cell def __(): left_about_marimo = r""" * Main distinguishing feature: All variables are tracked between cells. * Next: easy plotting, gui * Can be used as an app and a script easily (```python notebook.py```, ```marimo run notebook.py```) """ return left_about_marimo, @app.cell def __(): return @app.cell def __(mo): mo.md( r""" # Exposition - marimo is a reimagining of the python notebook (jupyter / jupyterlab) set out to solve: - Reproducibility - Versioning - Reactivity """ ) return @app.cell def __(): # Reproducability return @app.cell def __(mo): mo.md( r""" - assign a variable - use it in a second cell - delete first cell - see second cell fail on NameError """ ) return @app.cell def __(mo): mo.md( r""" # Plot - make two static vectors, import plot and plot it, then change static to linspace+sin, then add n, then dropdown, customize; sidebar - wave controllable by number of points (slider), sin/cos (checkbox), frequency (dropdown), and show histogram using selection (plot.value) """ ) return @app.cell def __(mo): mo.md( """ # Some real world notebook Show (assuming I can copy the database) the summary db """ ) return @app.cell def __(mo): mo.md("""# Dictionary""") return @app.cell def __(): from english_dictionary.scripts import read_pickle as ed_read_pickle return ed_read_pickle, @app.cell def __(ed_read_pickle): p = ed_read_pickle.get_dict() words = dict(p) return p, words @app.cell def __(p, pl): words_df = pl.DataFrame([{'word': x[0], 'meaning': x[1]} for x in p.items()]) return words_df, @app.cell def __(mo): word = mo.ui.text(label='word') return word, @app.cell def __(defaultdict): letters = defaultdict return letters, @app.cell def __(mo, word, words): mo.vstack([ word, word.value in words ]) return @app.cell def __(mo): mo.md( r""" # Reactivity ## Where I show a signal generator """ ) return @app.cell def __(mo): mo.md( r""" - Demos: - reproducibility: no cell remains stale by tracking dependencies between variables - trivial demonstration - git friendliness: source is straight python. Show the source for this talk. - do not stop to talk about the additions. - complex UI - my example? too much overhead explaining about concrete and ultrasound ; perhaps wrap in a simpler story. - Tables - load a table, plot it via UI. - mandelbrot? - serial terminal? interesting to anyone? - perhaps get ideas from the crowd? """ ) return @app.cell def __(mo): mo.md( r""" # Feature check list - reload cells on cell change (optionally lazy) - expunge deleted variables - reload on external module change (optionally lazy, optionally off) - install packages semi-automatically - variables pane - named cells - slide mode, grid mode - plots integration - reactivity: ui is just a variable that changes (checkbox.value) - keyboard shortcuts editable """ ) return @app.cell def __(mo): mo.md( """ # Not going over - AI integration """ ) return @app.cell def __(mo): mo.md( r""" Things I don't like about marimo / miss compared to jupyter/ipython: 1. No "?" 2. No "??" 3. No easy way to jump to source outside of the notebook 4. RTL 5. No collaboration 6. No debugger 7. Cannot reopen same tab on another computer (but run can) 8. Other languages Things I really like 1. Fast pace of development 2. Fast reaction to open tickets in github 3. Runtime cell indicator Meh 1. But you can break it! it's python. """ ) return @app.cell def __(mo): mo.md(r"""# Misc""") return @app.cell def __(mo): mo.md(r"""## Can we embed Html inside Html? Yes!""") return @app.cell def html_in_html(mo): _a = mo.Html('hello') mo.Html(f'