quarto-dev / quarto-dev/quarto-cli
reactive.event does not work in Quarto dashboard
Open
Nobody has claimed this yet.
bug
shiny
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
@reactive.event used in a Quarto dashboard does not seem to work. The following Quarto document fails when rendered:
---
title: "Test dashboard"
format: dashboard
server: shiny
---
# {.sidebar }
```{python}
from shiny import reactive
from shiny.express import input, ui, render
ui.input_text_area("text", "Text", value="hello")
ui.input_action_button("loadtext", "Load text")
```
```{python}
@render.text
@reactive.event(input.loadtext)
def set_text():
return input.text()
```
Steps to reproduce
- Save file in bug description above in
quarto.qmd - Do
quarto render quarto.qmd
gives the error message:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[2], line 2
1 @render.text
----> 2 @reactive.event(input.loadtext)
3 def set_text():
4 return input.text()
File ~/.local/lib/python3.12/site-packages/shiny/express/__init__.py:76, in _ExpressOnlyPlaceholder.__getattr__(self, name)
75 def __getattr__(self, name: str) -> None:
---> 76 raise RuntimeError(
77 f"shiny.express.{self.name} can only be used inside of a Shiny Express app."
78 )
RuntimeError: shiny.express.input can only be used inside of a Shiny Express app.
Actual behavior
gives the error message:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[2], line 2
1 @render.text
----> 2 @reactive.event(input.loadtext)
3 def set_text():
4 return input.text()
File ~/.local/lib/python3.12/site-packages/shiny/express/__init__.py:76, in _ExpressOnlyPlaceholder.__getattr__(self, name)
75 def __getattr__(self, name: str) -> None:
---> 76 raise RuntimeError(
77 f"shiny.express.{self.name} can only be used inside of a Shiny Express app."
78 )
RuntimeError: shiny.express.input can only be used inside of a Shiny Express app.
Expected behavior
A Quarto dashboard GUI without errors.
Your environment
- IDE: VScode 1.89.1
- Quarto: 1.6.42
- Shiny: 1.3.0
- Python: 3.12.3
Quarto check output
Quarto 1.6.42
[✓] Checking environment information...
Quarto cache location: /home/pjds/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.6.42
Path: /opt/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2025.02
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /home/pjds/.TinyTeX/bin/x86_64-linux
Version: 2024
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.3
Path: /usr/bin/python3
Jupyter: 5.7.2
Kernels: minerva_4.0.0-beta393, minerva_4.0.0-beta392, minerva, python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by saving the supplied example as quarto.qmd and running quarto render quarto.qmd with the listed Quarto, Shiny, and Python versions. Trace how the Python cells, reactive.event(input.loadtext), and the Quarto dashboard server interact. Done means the document renders without the shiny.express.input RuntimeError and the dashboard behaves as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- tooling, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100