-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathdevelop-data-apps.qmd
More file actions
64 lines (42 loc) · 4.01 KB
/
Copy pathdevelop-data-apps.qmd
File metadata and controls
64 lines (42 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: "Develop Data Apps"
description: "Build and preview Shiny, Streamlit, Dash, FastAPI, and Flask apps in Positron. Launch with one click of the Play button, or use our debugging support."
---
Positron provides a simplified method for running interactive data apps via the **Play** button. Instead of running an app from a **Terminal**, you can run supported apps by selecting the **Play** button in Editor Actions. Additionally, you can start a supported app in debug mode through the **Play** button context menu.
{width=800 fig-alt="Editor action bar with the Play button highlighted in a red box, showing a Python Streamlit file open in the Editor."}
## Supported app frameworks
Currently, Positron supports the following Python app frameworks:
- [Dash](https://dash.plotly.com/)
- [FastAPI](https://fastapi.tiangolo.com/)
- [Flask](https://flask.palletsprojects.com/en/stable/)
- [Gradio](https://www.gradio.app/)
- [Streamlit](https://streamlit.io/)
- [Shiny](https://shiny.posit.co/py/) via the [Shiny extension](https://open-vsx.org/extension/posit/shiny) which is included as a [bootstrapped extension](extensions.qmd#bootstrapped-extensions)
## Running a data app
1. Open the `.py` file of a supported app framework.
2. In Editor Actions, select **Play**.
{fig-alt="Close-up of the Play button in the Editor action bar."}
Then, Positron runs the app in a dedicated **Terminal** tab and opens the app URL in the **Viewer** pane.
If your application does not automatically open in the Viewer, check that the settings [`python.terminal.shellIntegration.enabled`](positron://settings/python.terminal.shellIntegration.enabled) and [`terminal.integrated.shellIntegration.enabled`](positron://settings/terminal.integrated.shellIntegration.enabled) are enabled.
{fig-alt="Streamlit app running in the Positron Viewer pane showing a slider input and squared value output."}
To stop the app, you can either:
- Select the interrupt button in the **Viewer** pane toolbar.
- Select the **Terminal** tab running the application and use the trash can icon to delete the **Terminal** or press {{< kbd Ctrl-C >}} to stop the process.
## Choosing where apps open
By default, apps open in the **Viewer** pane. The [`positron.runApp.previewMode`](positron://settings/positron.runApp.previewMode) setting controls where the app opens:
| Value | Behavior |
|-------|----------|
| `viewer` | Opens in the **Viewer** pane (default) |
| `editor` | Opens in an editor tab |
| `external` | Opens in the default external browser |
| `none` | Does not open the app automatically |
Python Shiny apps use the [Shiny extension](https://open-vsx.org/extension/posit/shiny)'s [`shiny.previewType`](positron://settings/shiny.previewType) setting instead.
## Debugging a data app
1. Open the `.py` file of a supported app framework.
2. Set breakpoints in the `.py` file by selecting the editor margin.
{fig-alt="Editor showing a red breakpoint dot in the left margin next to a line of Python code."}
3. Select the **Play** button dropdown context menu and choose **Debug [*{SUPPORTED_APP_TYPE}*] App in Terminal**.
- For this example, we select **Debug Steamlit App in Terminal**.
{fig-alt="Play button dropdown menu showing options including Run Streamlit App in Terminal and Debug Streamlit App in Terminal."}
Then, Positron runs the app in a dedicated **Terminal** tab, opens the app URL in the **Viewer** pane, and starts the app in debug mode.
{fig-alt="Positron IDE showing a Streamlit app paused at a breakpoint with the debug toolbar visible and Variables displayed in the Debug pane."}