App.run() does not serve a mounted ASGI app (routes=[Mount(...)]) that works with uvicorn.run(app)
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 22/100
Línea de trabajo
The App.run() docstring in lib/streamlit/web/server/starlette/starlette_app.py is the entry point, and it claims to reuse the same ASGI runner as streamlit run. Start by comparing how App.run() and uvicorn.run(app) build the Starlette routes from the routes=[Mount(...)] argument. Reproduce with the two-file example (page.py and app.py), where /bokeh/app should render "Hello from Bokeh" under app.run() as it does under uvicorn. Done means the mounted route and its websocket work under both app.run() and streamlit run.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Hi, I want to update my virtual observatory app (https://specsy.streamlit.app/) so that the user can download data selections from a Bokeh figure.
I have managed to get a working version by embedding a Bokeh server app (Bokeh 3.10 BokehASGI) in the Streamlit app via st.App(..., routes=[Mount("/bokeh", app=bokeh_app)]). When I serve the st.App with uvicorn.run(app), the mounted app works: the Bokeh page renders and its websocket callbacks run. When I start the same object with app.run(), the mounted route returns a blank white page.
Is mounting ASGI sub-applications via routes meant to be supported by App.run() and by streamlit run for st.App scripts? The App.run() docstring says it "reuses the same embedded ASGI server runner that streamlit run uses for st.App scripts".
The reason I am asking is that Streamlit Community Cloud launches apps with streamlit run, so I cannot use uvicorn.run(app) there. I would like a uniform Streamlit app for both the online and the offline installation.
Minimal reproducible example
page.py
import streamlit as st
st.write("Embedded Bokeh app below:")
st.iframe("/bokeh/app", height=300)
app.py
import sys
import streamlit as st
from starlette.routing import Mount
from bokeh.models import Div
from bokeh.server.asgi import BokehASGI
def bkapp(doc):
doc.add_root(Div(text="Hello from Bokeh"))
bokeh_app = BokehASGI({"/app": bkapp})
app = st.App("page.py", routes=[Mount("/bokeh", app=bokeh_app)])
if __name__ == "__main__":
if "--uvicorn" in sys.argv:
import uvicorn
uvicorn.run(app, host="localhost", port=8501) # works
else:
app.run() # mounted route is blank
Steps to reproduce
python app.py --uvicornand openhttp://localhost:8501/bokeh/app: "Hello from Bokeh" is shown, and the iframe in the Streamlit page also shows it.python app.pyand open the same URL: blank white page, and the iframe in the Streamlit page is empty.
Expected behaviour
app.run() serves the routes passed to st.App(routes=...), including mounted ASGI apps with websockets, the same way uvicorn.run(app) does. I'd expect the same behaviour with streamlit run app.py.
Additional information
- No errors in the terminal.
Environment
- Streamlit: 1.65.0
- Bokeh: 3.10.0
- Python: 3.13
- OS: Linux
- Browser: Firefox
Thanks a lot for any advice.
- Lenguaje dominante
- JavaScript
- Estrellas
- 178
- Forks
- 711
- Merge medio
- 2 d 41 min
- PR fusionados (30 d)
- 29
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de streamlit/docs
-
docs needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 2 días
-
Fix description of Azure SQL supportPosiblemente ocupada @Nikhil-jaiswal007 la tomó hace 187 días. Abiertodocs needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
streamlit/docs#1260 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
streamlit/docs#719 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
docs needs triage
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
bug needs triage
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
Todos los issues de streamlit/docs
Issues similares
-
[External Plugin]: CarboneAbiertoexternal-plugin ready-for-review third party
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
github/awesome-copilot#5259 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offlinePosiblemente ocupada @r2jaff la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ComposioHQ/composio#5054 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
addyosmani/agent-skills#717 ·
Los mantenedores suelen responder en 3 días
-
[Bug] Certificate expiry sorting can reverse UTC order across a viewer daylight-saving gapPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/rocketmq-dashboard#7318 ·
Los mantenedores suelen responder en 3 días
-
W3cAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
web-platform-tests/wpt#64017 ·
Los mantenedores suelen responder en 1 día