-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python: support streamlit
applications in Viewer pane
#3023
Labels
area: viewer
Issues related to Viewer category.
enhancement
New feature or request
lang: python
theme: app builder
Milestone
Comments
isabelizimm
changed the title
python: support
python: support May 6, 2024
streamlit
applicationsstreamlit
applications in Viewer pane
seeM
added a commit
that referenced
this issue
Sep 23, 2024
This PR adds support for local Python application development for the following frameworks: * Streamlit * Dash * Gradio * FastAPI * Flask This is facilitated by a new extension: `positron-run-app`. Addresses #4557, #4555, #3023, #3027, #3024. https://github.com/user-attachments/assets/d72e5028-a8c9-4aab-b927-4413c4e74b24 ### QA notes 1. Open an application developed using one of the supported frameworks. 2. Run the relevant "Python: Run X App in Terminal" command. It should also be the default action if you click the run button in the editor menu. 3. It should create a terminal named after the framework, and automatically show the app in the Viewer pane once its ready. Here are example apps for all of the supported frameworks: #### Streamlit ```python import streamlit as st x = st.slider('x') st.write(x, 'squared is', x * x) ``` #### Dash ```python from dash import Dash, html app = Dash() app.layout = [html.Div(children='Hello World')] if __name__ == '__main__': app.run(debug=True) ``` #### Gradio ```python import gradio as gr def image_classifier(inp): return {'cat': 0.3, 'dog': 0.7} demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label") demo.launch() ``` #### FastAPI ```python from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} ``` #### Flask ```python from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, World!</p>" ``` ### Next steps: Workbench integration To support Workbench, we'll need to update `runApplication` to detect if we're in Workbench, and if so, find a free port and corresponding proxied URL (possibly related to #4274) and pass them both to `getTerminalOptions`.
Verified Fixed
Test scenario(s)Verified by adding streamlit example to qa-example-content Link(s) to TestRail test cases run or created: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: viewer
Issues related to Viewer category.
enhancement
New feature or request
lang: python
theme: app builder
To fully support streamlit, we want to be able to:
streamlit
Python files and have a gesture to click "Play" and run in terminalNotes:
Running
streamlit
apps uses the CLIstreamlit run app_name.py
, powered byasyncio.run()
.The text was updated successfully, but these errors were encountered: