quarto-ext / shinylive

Quarto extension to embed Shinylive for Python applications
https://quarto-ext.github.io/shinylive/
MIT License
150 stars 8 forks source link

Register data resources inside of the VFS #58

Open coatless opened 3 months ago

coatless commented 3 months ago

Would it be possible to add support for the resources key to automatically include different data files inside the VFS, e.g.

---
title: Resources
resources: 
  - data.csv
---

would automatically place the data.csv inside of the current working directory for either webR/pyodide allowing for a read.csv('data.csv')/pd.read_csv('data.csv') statement to work as-is.

gadenbuie commented 3 months ago

I like this idea! With a small tweak: resources should be a key in the shinylive-{r,python} chunk. This could be done at the lua-filter level by copying my work in quarto-base64.

gadenbuie commented 3 months ago

This could be done at the lua-filter level by copying my work in quarto-base64.

Oh wait, the fact that it's hosted with the document means we wouldn't need to base64 encode the file.

coatless commented 3 months ago

@gadenbuie, we still need the quarto-base64 extension for the embedded file approach using comments. This addresses when an app is being directly sourced, e.g. {{< include >}} or written inside the code cell.