machow / reactable-py

https://machow.github.io/reactable-py/
25 stars 2 forks source link

Export an interactive table that's static? #17

Open kszlim opened 2 months ago

kszlim commented 2 months ago

Ie. have no backend, but allow export of a static html file that is interactive.

Even better if you don't need to embed the data as json or something within the document but instead can sidecar it as a parquet file or something (this might require duckdb wasm or something).

machow commented 2 months ago

Hey, thanks for raising this issue -- you should be able to export the table into a static html file. For example, the reactable-py documentation is a static site, generated with quarto.

You should be able to run quarto render example.qmd on a file like this...

example.qmd

---
title: example
jupyter: python3
--- 

```{python}
from reactable import Reactable, embed_css
from reactable.data import cars_93

embed_css()

Reactable(cars_93)


Here's what the resulting html file looks like for me. I think some resources are still currently pulled from a CDN, so it's not totally self-contained, but no webserver is needed.

<img width="1611" alt="image" src="https://github.com/user-attachments/assets/d2437415-4e44-4621-bf28-9128f2cf5a92">

Does that do what you're looking to do?