an anywidget for data that talks like a duck
pip install quak
The easiest way to get started with quak is using the IPython cell magic.
%load_ext quak
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/vega/vega-datasets/main/data/airports.csv")
df
Any cell that returns an object implementing the
Python dataframe interchange protocol
(i.e., a dataframe-like "thing") will be rendered using quak.Widget
, rather
than the default renderer.
Alternatively, you can use quak.Widget
directly:
import polars as pl
df = pl.read_csv("https://raw.githubusercontent.com/vega/vega-datasets/main/data/airports.csv")
quak.Widget(df)
quak requires both rye
(for Python) and deno
(for TypeScript).
If you want to develop in the notebooks (./examples/
), you will need to run
both deno
(to (re)build the TypeScript) and rye
(to start the Jupyter
notebook):
deno task dev
and then start the Python notebook server with rye
:
rye sync
rye run jupyter lab
Alternatively, you can just work on the TypeScript side of things by running:
npx vite
# or deno run -A npm:vite
and editing ./lib/example.ts
.
We check linting and formatting in CI:
# typescript
deno lint
deno fmt
deno task check
# python
rye lint
rye format
Note
Why the weird TypeScript stuff? In practice, hybrid Python/JS repos get messy
with npm and node_modules
. With Deno there is no node_modules
, and the
tool handles type-checking, linting, and formatting. The extra build scripts
serve to make nice development ergonamics within and outside of Jupyter.