-
Notifications
You must be signed in to change notification settings - Fork 426
Shinylive apps are not isolated #13404
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
There is an issue with how Quarto locates auxiliary source files for Shiny apps, so these apps are not truly isolated (as implied by the standalone config field). This prevents me from using common file naming patterns across multiple Shiny apps in a single Quarto document.
For example, consider a directory structure:
- test.qmd
- app1/
- app.py
- helper.py (contains helper1)
- app2/
- app.py
- helper.py (contains helper2)
When I attempt to use helper1 and helper2 in their respective apps, then I encounter an ImportError because one of the apps looks at the helper.py source code of the other app. It appears to be a race condition which app is located, because the working app alternates randomly.
Steps to reproduce
Since this requires several files to demonstrate the issue, I've created a reprex repo here: https://github.com/davidchall/quarto-shinylive-bug
Here's the Quarto source file from this repo:
---
title: Test
format: html
filters:
- shinylive
---
```{shinylive-python}
#| standalone: true
## file: app.py
{{< include "app1/app.py" >}}
## file: helper.py
{{< include "app1/helper.py" >}}
```
```{shinylive-python}
#| standalone: true
## file: app.py
{{< include "app2/app.py" >}}
## file: helper.py
{{< include "app2/helper.py" >}}
```Actual behavior
Only one app loads successfully, because both apps attempt to load from app2/helper.py. The error message is:
File "/home/pyodide/app_0wpouot7xx0ufdvibcl1/app.py", line 1, in <module>
from helper import helper1
ImportError: cannot import name 'helper1' from 'helper' (/home/pyodide/app_uwgf7rt7kak5fn8bus6x/helper.py). Did you mean: 'helper2'?Expected behavior
The first app should load helper1 from app1/helper.py and the second app should load helper2 from app2/helper.py. The apps should be isolated.
Your environment
- IDE: VSCode 1.104.1
- macOS 15.6.1
Quarto check output
Quarto 1.8.24
[✓] Checking environment information...
Quarto cache location: /Users/davidhall/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.87.0: OK
Deno version 2.3.1: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.8.24
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: (external install)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/davidhall/Library/TinyTeX/bin/universal-darwin
Version: 2022
[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Source: MacOS known location
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.10.18
Path: /Users/davidhall/code/shiny-treeview/.venv/bin/python3
Jupyter: 5.8.1
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.5.1
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
knitr: 1.50
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK