rstudio / shiny-server

Host Shiny applications over the web.
https://rstudio.com/shiny/server
Other
712 stars 291 forks source link

Shiny Express support #566

Closed jcheng5 closed 4 months ago

jcheng5 commented 5 months ago

Testing notes

  1. Create a virtual environment somewhere on the server (e.g. /srv/shiny-server/.venv) and install shiny into it
  2. In /etc/shiny-server/shiny-server.conf, add the directive python /srv/shiny-server/.venv;
  3. Create /srv/shiny-server/express-app/app.py, with the following contents:
from shiny.express import input, render, ui

ui.input_slider("n", "N", 0, 100, 20)

@render.text
def txt():
    return f"n*2 is {input.n() * 2}"
  1. Start (or restart) shiny-server and load http://localhost:3838/express-app/
jcheng5 commented 5 months ago

I had to add a couple of commits to get stdout->stderr redirection working right--a little more subtle than it seems. I wonder if Connect and Posit Cloud are doing anything with stdout. We really should get on fixing py-shiny so it doesn't emit errors to stdout ever!

wch commented 5 months ago

Looks good to me. The stdout/stderr stuff seems like a big hammer, though. Should we just fix py-shiny instead, so that errors always go to stderr? Then we wouldn't have to worry about what Connect or Cloud do with stdout.