59 lines
1 KiB
Text
59 lines
1 KiB
Text
chadbook
|
|
========
|
|
|
|
minimal notebook boilerplate using uv.
|
|
supports jupyter and marimo.
|
|
|
|
|
|
install uv
|
|
----------
|
|
|
|
linux/mac:
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
|
|
windows:
|
|
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
|
|
|
|
run
|
|
---
|
|
|
|
just run jupyter lab (notebook.ipynb)
|
|
just marimo marimo editor (cube.py)
|
|
|
|
or directly:
|
|
|
|
uv run jupyter lab
|
|
uv run marimo edit cube.py
|
|
|
|
|
|
marimo cell output
|
|
------------------
|
|
|
|
marimo cells have two outputs:
|
|
- visual output: the expression BEFORE `return`
|
|
- cell exports: what you `return` (available to other cells)
|
|
|
|
example:
|
|
|
|
@app.cell
|
|
def _(mo):
|
|
widget = mo.ui.slider(1, 10)
|
|
widget # <- displayed in notebook
|
|
return widget, # <- shared with other cells
|
|
|
|
if you only need display (no sharing):
|
|
|
|
@app.cell
|
|
def _(mo):
|
|
widget = mo.ui.slider(1, 10)
|
|
widget
|
|
return
|
|
|
|
if you only need sharing (no display):
|
|
|
|
@app.cell
|
|
def _(mo):
|
|
widget = mo.ui.slider(1, 10)
|
|
return widget,
|
|
|