Closed Analect closed 2 months ago
Hi @Analect, thanks for reporting this! There were some bugs in the way the virtual filesystems structure was built as the WebAssembly engine loads. Sorry about that! I've made some commits to try and correct the problems.
The way this is supposed to work is that when written to the Wasm filesystem, the parent subdirectory structure should be collapsed (i.e. no leading '../../..'), but the remaining file structure (e.g. 'data/...') remains.
In your case, you should first update Quarto Live to the latest development build to get the changes I've just made:
$ quarto add r-wasm/quarto-live
Then, in your {pyodide}
block, you would read your files from the data
subdirectory, which should now exist in the Pyodide working directory:
print(listdir("data"))
pd.read_csv('data/core_meta-data.csv')
Please let me know if this is not the case, as it means some more work is still required.
As far as your document YAML header goes, since you already load the data
directory into your resources in _quarto.yml
, you likely don't need to include the top-level resources
key again. You should only need the one under the pyodide
key which tells Quarto Live to make those particular resources available in the VFS:
pyodide:
resources:
- "../../data/"
Thanks for your efforts with this tooling.
I was playing around with generating some additional meta-data from a rendered quarto site. Per the
resources
setting in the_quarto.yml
file here, I'm able to ensure my data is available in the rendered docs.Then, for this
*.qmd
file, I'm passing through those resources. I'm not sure the secondresources
underpyodide
is strictly necessary.It's unclear how I should reference that
data
folder. Is it relative to where my*.qmd
file sits relative to the root of the quarto directory. This is why I use../../data
, as my file sits in<root>/docs/demo
. This relative location ingh-pages
artifacts is the same. I have played around with this, but to no avail. I notice that if I include these resource references, then the rendered document somehow doesn't resolve. If I remove them, it at least resolves, although I'm not able to access the data from a cell.The other thing of note is that the
data
folder is empty on the main branch. It only gets populated as part of a pre-render script.Could you offer some guidance on how I should be doing this correctly? Should the
data
folder then be accessible within a pyodide cell under someweb_user
folder? Would be great to get a better understanding of how this works. Thanks.