eagle0504 commited on
Commit
746d2f1
Β·
1 Parent(s): ad62226

app updated

Browse files
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. app.png +0 -0
  2. data/deploy/_index.md +35 -0
  3. data/deploy/community-cloud/_index.md +45 -0
  4. data/deploy/community-cloud/deploy-your-app/_index.md +132 -0
  5. data/deploy/community-cloud/deploy-your-app/app-dependencies.md +111 -0
  6. data/deploy/community-cloud/deploy-your-app/secrets-management.md +117 -0
  7. data/deploy/community-cloud/get-started/_index.md +36 -0
  8. data/deploy/community-cloud/get-started/connect-github.md +74 -0
  9. data/deploy/community-cloud/get-started/create-your-account.md +122 -0
  10. data/deploy/community-cloud/get-started/explore-your-workspace.md +40 -0
  11. data/deploy/community-cloud/get-started/fork-and-edit.md +30 -0
  12. data/deploy/community-cloud/get-started/quickstart.md +136 -0
  13. data/deploy/community-cloud/get-started/security-model.md +72 -0
  14. data/deploy/community-cloud/manage-your-account/_index.md +20 -0
  15. data/deploy/community-cloud/manage-your-account/delete-your-account.md +37 -0
  16. data/deploy/community-cloud/manage-your-account/manage-your-github-connection.md +95 -0
  17. data/deploy/community-cloud/manage-your-account/sign-in-sign-out.md +72 -0
  18. data/deploy/community-cloud/manage-your-account/update-your-email.md +76 -0
  19. data/deploy/community-cloud/manage-your-account/workspace-settings.md +32 -0
  20. data/deploy/community-cloud/manage-your-app/_index.md +157 -0
  21. data/deploy/community-cloud/manage-your-app/app-analytics.md +69 -0
  22. data/deploy/community-cloud/manage-your-app/app-settings.md +53 -0
  23. data/deploy/community-cloud/manage-your-app/delete-your-app.md +47 -0
  24. data/deploy/community-cloud/manage-your-app/edit-your-app.md +86 -0
  25. data/deploy/community-cloud/manage-your-app/favorite-your-app.md +45 -0
  26. data/deploy/community-cloud/manage-your-app/reboot-your-app.md +41 -0
  27. data/deploy/community-cloud/share-your-app/_index.md +150 -0
  28. data/deploy/community-cloud/share-your-app/embed-your-app.md +158 -0
  29. data/deploy/community-cloud/share-your-app/indexability.md +65 -0
  30. data/deploy/community-cloud/share-your-app/share-previews.md +62 -0
  31. data/deploy/community-cloud/troubleshooting.md +153 -0
  32. data/deploy/concepts/_index.md +29 -0
  33. data/deploy/concepts/dependencies.md +55 -0
  34. data/deploy/concepts/secrets.md +14 -0
  35. data/deploy/tutorials/_index.md +44 -0
  36. data/deploy/tutorials/docker.md +265 -0
  37. data/deploy/tutorials/kubernetes.md +296 -0
  38. data/develop/_index.md +35 -0
  39. data/develop/api-reference/_index.md +2701 -0
  40. data/develop/api-reference/caching-and-state/_index.md +161 -0
  41. data/develop/api-reference/caching-and-state/cache-data.md +100 -0
  42. data/develop/api-reference/caching-and-state/cache-resource.md +98 -0
  43. data/develop/api-reference/caching-and-state/query_params.md +58 -0
  44. data/develop/api-reference/caching-and-state/session_state.md +224 -0
  45. data/develop/api-reference/charts/_index.md +308 -0
  46. data/develop/api-reference/charts/altair_chart.md +266 -0
  47. data/develop/api-reference/charts/area_chart.md +9 -0
  48. data/develop/api-reference/charts/bar_chart.md +9 -0
  49. data/develop/api-reference/charts/bokeh_chart.md +7 -0
  50. data/develop/api-reference/charts/graphviz_chart.md +7 -0
app.png ADDED
data/deploy/_index.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Deploy
3
+ slug: /deploy
4
+ ---
5
+
6
+ # Deploy
7
+
8
+ Get all the information you need to deploy your app and share it with your users.
9
+
10
+ <InlineCalloutContainer>
11
+ <InlineCallout
12
+ color="lightBlue-70"
13
+ icon="book"
14
+ bold="Concepts."
15
+ href="/deploy/concepts"
16
+ >Understand the basics of app deployment.</InlineCallout>
17
+ <InlineCallout
18
+ color="lightBlue-70"
19
+ icon="cloud"
20
+ bold="Streamlit Community Cloud."
21
+ href="/deploy/streamlit-community-cloud"
22
+ >Deploy your app on our free platform and join a community of developers who share their apps around the world.</InlineCallout>
23
+ <InlineCallout
24
+ color="lightBlue-70"
25
+ icon="ac_unit"
26
+ bold="Streamlit in Snowflake"
27
+ href="https://docs.snowflake.com/developer-guide/streamlit/about-streamlit"
28
+ >Deploy your app in Snowflake for a secure, enterprise-grade environment.</InlineCallout>
29
+ <InlineCallout
30
+ color="lightBlue-70"
31
+ icon="bolt"
32
+ bold="Other platforms."
33
+ href="/develop/quick-reference"
34
+ >Learn how to deploy your app on a variety of platforms with our convenient collection of tutorials.</InlineCallout>
35
+ </InlineCalloutContainer>
data/deploy/community-cloud/_index.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Streamlit Community Cloud
3
+ slug: /deploy/streamlit-community-cloud
4
+ ---
5
+
6
+ # Welcome to Streamlit Community Cloud
7
+
8
+ Deploy, manage, and share your Streamlit apps with the world in minutes &mdash; all for free. Your Streamlit Community Cloud account connects directly to your GitHub repository (public or private). Most apps will launch in only a few minutes. Streamlit Community Cloud handles all of the containerization so all you need to worry about is creating the app. Rapidly prototype, explore, and update apps by simply changing your code in GitHub. Most changes appear immediately!
9
+
10
+ Want to avoid the work of setting up a local development environment? Community Cloud can help you quickly configure a codespace to develop in the cloud. Whether it's your own deployed app or an app deployed from a public repository, it only takes a few clicks to start coding or editing a Streamlit app. See [Edit your app](/deploy/streamlit-community-cloud/manage-your-app/edit-your-app).
11
+
12
+ If you haven't built your first Streamlit app yet, you can check out [Get started](/get-started) in our Streamlit library documentation or [Fork and edit a public app](/deploy/streamlit-community-cloud/get-started/fork-and-edit-a-public-app) from our <a href="https://streamlit.io/gallery" target="_blank">App gallery</a>. Check out [Community Cloud quickstart](/deploy/streamlit-community-cloud/get-started) to speed-run you through creating your account, deploying an example app, and editing it using GitHub Codespaces.
13
+
14
+ <InlineCalloutContainer>
15
+ <InlineCallout
16
+ color="lightBlue-70"
17
+ icon="arrow_forward"
18
+ bold="Get started."
19
+ href="/deploy/streamlit-community-cloud/get-started"
20
+ >Learn about Streamlit Community Cloud accounts and how to create one.</InlineCallout>
21
+ <InlineCallout
22
+ color="lightBlue-70"
23
+ icon="flight_takeoff"
24
+ bold="Deploy your app."
25
+ href="/deploy/streamlit-community-cloud/deploy-your-app"
26
+ >A step-by-step guide on how to get your app deployed.</InlineCallout>
27
+ <InlineCallout
28
+ color="lightBlue-70"
29
+ icon="settings"
30
+ bold="Manage your app."
31
+ href="/deploy/streamlit-community-cloud/manage-your-app"
32
+ >Access logs, reboot apps, set favorites, and more. Jump into a GitHub Codespace to edit your app in the cloud.</InlineCallout>
33
+ <InlineCallout
34
+ color="lightBlue-70"
35
+ icon="share"
36
+ bold="Share your app."
37
+ href="/deploy/streamlit-community-cloud/share-your-app"
38
+ >Share or embed your app.</InlineCallout>
39
+ <InlineCallout
40
+ color="lightBlue-70"
41
+ icon="manage_accounts"
42
+ bold="Manage your account."
43
+ href="/deploy/streamlit-community-cloud/manage-your-account"
44
+ >Update your email, manage connections, or delete your account.</InlineCallout>
45
+ </InlineCalloutContainer>
data/deploy/community-cloud/deploy-your-app/_index.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Deploy your app
3
+ slug: /deploy/streamlit-community-cloud/deploy-your-app
4
+ ---
5
+
6
+ # Deploy your app
7
+
8
+ Streamlit Community Cloud lets you deploy your apps in just one click, and most apps will deploy in only a few minutes. If you don't have an app ready to deploy, fork or clone one from our <a href="https://streamlit.io/gallery" target="_blank">App gallery</a> β€” you can find apps for machine learning, data visualization, data exploration, A/B testing and more. You can also fork and deploy samples straight from the [New app button](/deploy/streamlit-community-cloud/get-started/explore-your-workspace#new-app-button). Once you've deployed your app, check out how you can [Edit your app with GitHub Codespaces](/deploy/streamlit-community-cloud/manage-your-app/edit-your-app#edit-your-app-with-github-codespaces).
9
+
10
+ <Note>
11
+
12
+ If you want to deploy your app on a different cloud service, check out the [Deploy Streamlit apps](/deploy/tutorials) article in our Knowledge Base.
13
+
14
+ </Note>
15
+
16
+ ## Add your app to GitHub
17
+
18
+ Streamlit Community Cloud launches apps directly from your GitHub repo, so your app code and dependencies need to be on GitHub before you try to deploy your app. For more information on how to specify dependencies, see [App dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies).
19
+
20
+ Your directory structure should look similar to this:
21
+
22
+ ```
23
+ your-repository/
24
+ β”œβ”€β”€ your_app.py
25
+ └── requirements.txt
26
+ ```
27
+
28
+ If you are including any custom [Configuration](/develop/concepts/configuration) or [Theming](/develop/concepts/configuration/theming), make sure your config file is saved relative to the root of your repo. Within your repo, your config file should be named `.streamlit/config.toml`.
29
+
30
+ ```
31
+ your-repository/
32
+ β”œβ”€β”€ .streamlit/
33
+ β”‚ └── config.toml
34
+ β”œβ”€β”€ your_app.py
35
+ └── requirements.txt
36
+ ```
37
+
38
+ <Important>
39
+
40
+ Although you can deploy multiple apps from the same repository, there can be only one configuration file.
41
+
42
+ </Important>
43
+
44
+ ## Deploy your app
45
+
46
+ 1. From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click "**New app**" from the upper-right corner of your workspace.
47
+
48
+ ![Deploy a new app from your workspace](/images/streamlit-community-cloud/deploy-empty-new-app.png)
49
+
50
+ 2. Fill in your repo, branch, and file path. As a shortcut, you can also click "**Paste GitHub URL**" to paste a link directly to `your_app.py` on GitHub.
51
+
52
+ An app URL with a random hash is prefilled but you can change this to a custom subdomain instead. In the example below, the app would be deployed to `https://red-balloon.streamlit.app/`. You can always change your subdomain later. See more about [Custom subdomains](#custom-subdomains) at the end of this page.
53
+
54
+ ![Fill in your app's information to deploy your app](/images/streamlit-community-cloud/deploy-an-app.png)
55
+
56
+ ## Advanced settings for deployment
57
+
58
+ <Note>
59
+
60
+ Streamlit Community Cloud supports all released [versions of Python that are still receiving security updates](https://devguide.python.org/versions/). Streamlit Community Cloud defaults to version 3.9. You can select a version of your choice from the "Python version" dropdown in the "Advanced settings" modal. If an app is running a version of Python that becomes unsupported, it will be forcibly upgraded to the oldest, supported version of Python and may break.
61
+
62
+ </Note>
63
+
64
+ 3. (Optional) If you are connecting to a data source or want to specify the Python version for your app, you can do that by clicking "**Advanced settings**" before you deploy the app. Learn more about [Secrets management](/deploy/streamlit-community-cloud/deploy-your-app/secrets-management).
65
+
66
+ ![Advanced settings for deploying your app](/images/streamlit-community-cloud/deploy-an-app-advanced.png)
67
+
68
+ ## Watch your app launch
69
+
70
+ Your app is now deploying and you can watch while it launches. Most apps take only a couple of minutes to deploy, but if your app has a lot of dependencies it may take longer to deploy the first time. After the initial deployment, any change that does not touch your dependencies should show up immediately.
71
+
72
+ ![Watch your app launch](/images/streamlit-community-cloud/deploy-an-app-provisioning.png)
73
+
74
+ <Note>
75
+
76
+ The Streamlit Community Cloud logs on the right hand side of your app are only viewable to users with developer access to your repository. These logs help you debug any issues with the app. Learn more about [Streamlit Community Cloud logs](/deploy/streamlit-community-cloud/manage-your-app#streamlit-community-cloud-logs).
77
+
78
+ </Note>
79
+
80
+ ## Your app URL
81
+
82
+ That's it β€” you're done! Your app now has a unique subdomain URL that you can share with others. Read more about how to [Share your app](/deploy/streamlit-community-cloud/share-your-app) with viewers.
83
+
84
+ ### Unique subdomains
85
+
86
+ If the "**Custom subdomain (optional)**" field is blank when you deploy your app, a URL is assigned following a structure based on your GitHub repo. The URL begins with your GitHub username or organization owning your repo, followed by your repo name, app path, and a short hash. If you deploy from a branch other than `main` or `master`, the URL also includes the branch name.
87
+
88
+ ```bash
89
+ https://[GitHub username or organization]-[repo name]-[app path]-[branch name]-[short hash].streamlit.app
90
+ ```
91
+
92
+ For example, this is an app deployed from the `streamlit` organization. The repo is `demo-self-driving` and the app name is `streamlit_app.py` in the root directory. The branch name is `master` and therefore not included.
93
+
94
+ ```bash
95
+ https://streamlit-demo-self-driving-streamlit-app-8jya0g.streamlit.app
96
+ ```
97
+
98
+ ### Custom subdomains
99
+
100
+ Setting a custom subdomain makes it much easier to share your app since you can choose something memorable. Whether you set a custom subdomain during deployment or later, your app's URL will appear as:
101
+
102
+ ```bash
103
+ https://<your-custom-subdomain>.streamlit.app
104
+ ```
105
+
106
+ To view or customize your app subdomain from the dashboard:
107
+
108
+ 1. Click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) to the app's right and select "**Settings**".
109
+
110
+ <div style={{ maxWidth: '90%', margin: '0 2em 0 2em' }}>
111
+ <Image src="/images/streamlit-community-cloud/workspace-app-settings.png" alt="Streamlit Community Cloud app settings" />
112
+ </div>
113
+
114
+ 2. View the "**General**" tab in the App settings modal. Your app's unique subdomain will appear here.
115
+
116
+ <div style={{ maxWidth: '90%', margin: '0 2em 0 2em' }}>
117
+ <Image src="/images/streamlit-community-cloud/workspace-app-settings-general.png" alt="Streamlit Community Cloud general app settings" />
118
+ </div>
119
+
120
+ 3. Pick a custom subdomain between 6 and 63 characters in length for your app's URL and hit "**Save**".
121
+
122
+ <div style={{ maxWidth: '90%', margin: '0 2em 0 2em' }}>
123
+ <Image src="/images/streamlit-community-cloud/workspace-app-settings-general-valid-domain.png" alt="New custom subdomain for your app" />
124
+ </div>
125
+
126
+ It's that simple! You can then access your app by visiting your customized URL πŸŽ‰.
127
+
128
+ If a custom subdomain is not available (e.g. because it's already taken), you'll see an error message like this:
129
+
130
+ <div style={{ maxWidth: '90%', margin: '0 2em 0 2em' }}>
131
+ <Image src="/images/streamlit-community-cloud/workspace-app-settings-general-invalid-domain.png" alt="Invalid custom subdomain for your app" />
132
+ </div>
data/deploy/community-cloud/deploy-your-app/app-dependencies.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: App dependencies
3
+ slug: /deploy/streamlit-community-cloud/deploy-your-app/app-dependencies
4
+ ---
5
+
6
+ # App dependencies
7
+
8
+ The main reason that apps fail to build properly is because Streamlit Community Cloud can't find your dependencies! There are two kinds of dependencies your app might have: Python dependencies and external dependencies. Python dependencies are other Python packages (just like Streamlit!) that you `import` into you script. External dependencies are less common, but they include any other software your script needs to function properly. Since Streamlit Community Cloud runs on Linux, these will be Linux dependencies installed with `apt-get` outside the Python environment.
9
+
10
+ For your dependencies to be installed correctly, make sure you:
11
+
12
+ 1. Add aΒ [requirements file](#add-python-dependencies)Β for Python dependencies.
13
+ 2. (optional) Add aΒ `packages.txt`Β file to manage any external dependencies.
14
+
15
+ <Note>
16
+
17
+ Python requirements files should be placed either in the root of your repository or in the same
18
+ directory as your Streamlit app.
19
+
20
+ </Note>
21
+
22
+ ## Add Python dependencies
23
+
24
+ With each `import` statement in your script, you are bringing in a Python dependency. You need to tell Streamlit Community Cloud how to install those dependencies through a Python package manager. We recommend using a `requirements.txt` which is based on `pip`.
25
+
26
+ You should _not_ include <a href="https://docs.python.org/3/py-modindex.html" target="_blank">built-in Python libraries</a> like `math` or `random` in your `requirements.txt` file. These are a part of Python and aren't installed separately. Also, Streamlit Community Cloud has `streamlit` installed by default. You don't strictly need to include `streamlit` unless you want to pin or restrict the version. If you deploy an app without a `requirements.txt` file, your app will run in an environment with just `streamlit` (and its dependencies) installed.
27
+
28
+ If you have a script like the following, no extra dependencies would be needed since `pandas` and `numpy` are installed as direct dependencies of `streamlit`. Similarly, `math` and `random` are built into Python.
29
+
30
+ ```python
31
+ import streamlit as st
32
+ import pandas as pd
33
+ import numpy as np
34
+ import math
35
+ import random
36
+
37
+ st.write('Hi!')
38
+ ```
39
+
40
+ However, a valid `requirements.txt` file would be:
41
+
42
+ ```none
43
+ streamlit
44
+ pandas
45
+ numpy
46
+ ```
47
+
48
+ Alternatively, if you needed to specify certain versions, another valid example would be:
49
+
50
+ ```none
51
+ streamlit==1.24.1
52
+ pandas>2.0
53
+ numpy<=1.25.1
54
+ ```
55
+
56
+ In the above example, `streamlit` is pinned to version `1.24.1`, `pandas` must be strictly greater than version 2.0, and `numpy` must be at-or-below version 1.25.1. Each line in your `requirements.txt` file is effectively what you would like to `pip install` into your cloud environment.
57
+
58
+ <Note>
59
+
60
+ We recommend that you use the latest version of Streamlit to ensure full Streamlit Community Cloud functionality. Be sure to take note of Streamlit's [current requirements](https://github.com/streamlit/streamlit/blob/develop/lib/setup.py) for package compatibility when planning your environment, especially `protobuf>=3.20,<5`.
61
+
62
+ </Note>
63
+
64
+ If you pin `streamlit` below 1.20.0, you may experience unexpected results if you've pinned any dependencies of `altair`. If `streamlit` is installed below version 1.20.0, `altair<5` will be reinstalled on top of your environment for compatibility reasons. When this happens all of altair's dependencies will be updated.
65
+
66
+ ### Other Python package managers
67
+
68
+ There are other Python package managers besides `pip`. If you want to consider alternatives to using a `requirements.txt` file, Streamlit Community Cloud will look for other Python dependency managers to use in the order below. Streamlit will stop and install the first dependency file found.
69
+
70
+ <table style={{ textAlign: 'center' }}>
71
+ <tr>
72
+ <th style={{ fontSize: '1.2em' }}> Recognized Filename</th>
73
+ <th style={{ fontSize: '1.2em' }}>Python Package Manager</th>
74
+ </tr>
75
+ <tr>
76
+ <td style={{ fontSize: '1em' }}><code>Pipfile</code></td>
77
+ <td style={{ fontSize: '1em' }}><a href="https://pipenv-fork.readthedocs.io/en/latest/basics.html" target="_blank">pipenv</a></td>
78
+ </tr>
79
+ <tr>
80
+ <td style={{ fontSize: '1em' }}><code>environment.yml</code></td>
81
+ <td style={{ fontSize: '1em' }}><a href="https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-file-manually" target="_blank">conda</a></td>
82
+ </tr>
83
+ <tr>
84
+ <td style={{ fontSize: '1em' }}><code>requirements.txt</code></td>
85
+ <td style={{ fontSize: '1em' }}><a href="https://pip.pypa.io/en/stable/user_guide/#requirements-files" target="_blank">pip</a></td>
86
+ </tr>
87
+ <tr>
88
+ <td style={{ fontSize: '1em' }}><code>pyproject.toml</code></td>
89
+ <td style={{ fontSize: '1em' }}><a href="https://python-poetry.org/docs/basic-usage/" target="_blank">poetry</a></td>
90
+ </tr>
91
+ </table>
92
+
93
+ <Warning>
94
+
95
+ You should only use one requirements file for your app. If you include more than one (e.g. `requirements.txt` and `Pipfile`), only the first file encountered will be used as described above. Additionally, Streamlit will first look in the directory of your Streamlit app; however, if no requirements file is found, Streamlit will then look at the root of the repo.
96
+
97
+ </Warning>
98
+
99
+ ## apt-get dependencies
100
+
101
+ For many apps, a `packages.txt` file is not required. However, if your script requires any software to be installed that is not a Python package, then you will need a `packages.txt` file. Streamlit Community Cloud is built on Debian Linux. Anything you would like to `apt-get install` needs to go in your `packages.txt` file.
102
+
103
+ If `packages.txt` exists in the root directory of your repository we automatically detect it, parse it, and install the listed packages. You can read more about apt-get in <a href="https://linux.die.net/man/8/apt-get" target="_blank">Linux documentation</a>.
104
+
105
+ Add **apt-get** dependencies toΒ `packages.txt` &mdash; one package name per line. For example, <a href="https://github.com/PyMySQL/mysqlclient" target="_blank"><code>mysqlclient</code></a> is a Python package which requires additional software be installed to function. A valid `packages.txt` file to enable `mysqlclient` would be:
106
+
107
+ ```bash
108
+ build-essential
109
+ pkg-config
110
+ default-libmysqlclient-dev
111
+ ```
data/deploy/community-cloud/deploy-your-app/secrets-management.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Secrets management
3
+ slug: /deploy/streamlit-community-cloud/deploy-your-app/secrets-management
4
+ ---
5
+
6
+ # Secrets management
7
+
8
+ ## Introduction
9
+
10
+ If you are [connecting to data sources](/develop/tutorials/databases), you will likely need to handle credentials or secrets. It's generally considered bad practice to store unencrypted secrets in a git repository. If your application needs access to sensitive credentials the recommended solution is to store those credentials in a file that is not committed to the repository and to pass them as environment variables.
11
+
12
+ Secrets management allows you to store secrets securely and access them in your Streamlit app as environment variables.
13
+
14
+ ## How to use Secrets Management
15
+
16
+ ### Deploy an app and set up secrets
17
+
18
+ 1. From your worksapce at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click "**New app**".
19
+ 2. Fill out your app's information and click "**Advanced settings...**"
20
+
21
+ ![Access advanced settings when deploying your app](/images/streamlit-community-cloud/deploy-an-app-advanced-settings.png)
22
+
23
+ 3. A modal will appear with an input box for your secrets.
24
+
25
+ ![Save your secrets in advanced settings when deploying your app](/images/streamlit-community-cloud/deploy-an-app-advanced.png)
26
+
27
+ 4. Provide your secrets in the "Secrets" field using <a href="https://toml.io/en/latest" target="_blank">TOML</a> format. For example:
28
+
29
+ ```toml
30
+ # Everything in this section will be available as an environment variable
31
+ db_username = "Jane"
32
+ db_password = "12345qwerty"
33
+
34
+ # You can also add other sections if you like.
35
+ # The contents of sections as shown below will not become environment
36
+ # variables, but they'll be easily accessible from within Streamlit anyway
37
+ # as we show later in this doc.
38
+ [my_cool_secrets]
39
+ things_i_like = ["Streamlit", "Python"]
40
+ ```
41
+
42
+ ### Use secrets in your app
43
+
44
+ Access your secrets as environment variables or by querying the `st.secrets` dict. For example, if you enter the secrets from the section above, the code below shows you how you can access them within your Streamlit app.
45
+
46
+ ```python
47
+ import streamlit as st
48
+ import os
49
+
50
+ # Everything is accessible via the st.secrets dict:
51
+ st.write("DB username:", st.secrets["db_username"])
52
+ st.write("DB password:", st.secrets["db_password"])
53
+ st.write("My cool secrets:", st.secrets["my_cool_secrets"]["things_i_like"])
54
+
55
+ # And the root-level secrets are also accessible as environment variables:
56
+ st.write(
57
+ "Has environment variables been set:",
58
+ os.environ["db_username"] == st.secrets["db_username"],
59
+ )
60
+ ```
61
+
62
+ <Tip>
63
+
64
+ You can access `st.secrets` via attribute notation (e.g. `st.secrets.key`) or key notation (e.g. `st.secrets["key"]`) &mdash; just like [`st.session_state`](/develop/api-reference/caching-and-state/st.session_state).
65
+
66
+ </Tip>
67
+
68
+ You can even use TOML sections to compactly pass multiple secrets as a single attribute.
69
+
70
+ Consider the following secrets:
71
+
72
+ ```toml
73
+ [db_credentials]
74
+ username = "my_username"
75
+ password = "my_password"
76
+ ```
77
+
78
+ Rather than passing each secret as attributes in a function, you can more compactly pass the section to achieve the same result. You can use Python's unpacking notation like the following example which uses the secrets above:
79
+
80
+ ```python
81
+ # Verbose version
82
+ my_db.connect(username=st.secrets.db_credentials.username, password=st.secrets.db_credentials.password)
83
+
84
+ # Far more compact version!
85
+ my_db.connect(**st.secrets.db_credentials)
86
+ ```
87
+
88
+ ### Edit your app's secrets
89
+
90
+ If you need to add or edit your secrets for an app that is already deployed, you can access advanced setting from your admin panel.
91
+
92
+ 1. Go to <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>.
93
+ 2. Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) for your app.
94
+ 3. Click "**Settings**".
95
+ ![Access your app settings from your workspace](/images/streamlit-community-cloud/workspace-app-settings.png)
96
+ 4. A modal will appear. Click "**Secrets**" on the left.
97
+ ![Access your secrets through your app settings](/images/streamlit-community-cloud/workspace-app-settings-secrets.png)
98
+ 5. After you edit your secrets, click "**Save**". It might take a minute for the update to be propagated to your app, but the new values will be reflected when the app re-runs.
99
+
100
+ ### Develop locally with secrets
101
+
102
+ When developing your app locally, add a file called `secrets.toml` in a folder called `.streamlit` at the root of your app repo, and copy/paste your secrets into that file. Further instructions are available in the Streamlit library [Secrets management](/develop/concepts/connections/secrets-management) documentation.
103
+
104
+ <Important>
105
+
106
+ Be sure to add this file to your `.gitignore` so you don't commit your secrets!
107
+
108
+ </Important>
109
+
110
+ ```bash
111
+ your-LOCAL-repository/
112
+ β”œβ”€β”€ .streamlit/
113
+ β”‚ β”œβ”€β”€ config.toml
114
+ β”‚ └── secrets.toml # Make sure to gitignore this!
115
+ β”œβ”€β”€ your_app.py
116
+ └─��� requirements.txt
117
+ ```
data/deploy/community-cloud/get-started/_index.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Get started with Streamlit Community Cloud
3
+ slug: /deploy/streamlit-community-cloud/get-started
4
+ ---
5
+
6
+ # Get started with Streamlit Community Cloud
7
+
8
+ Welcome to Streamlit Community Cloud, where you can share your Streamlit apps with the world! Whether you've already created your first Streamlit app or you're just getting started, you're in the right place.
9
+
10
+ First things first, you need to create your Streamlit Community Cloud account to start deploying apps.
11
+
12
+ <TileContainer>
13
+ <Tile
14
+ icon="rocket_launch"
15
+ title="Quickstart"
16
+ text="Create your account and deploy an example app as fast as possible. Jump right into coding with GitHub Codespaces."
17
+ link="/deploy/streamlit-community-cloud/get-started"
18
+ background="lightBlue-70"
19
+ />
20
+ <Tile
21
+ icon="person"
22
+ title="Create your account"
23
+ text="See all the options and get complete explanations as you create your Streamlit Community Cloud account."
24
+ link="/deploy/streamlit-community-cloud/get-started/create-your-account"
25
+ background="lightBlue-70"
26
+ />
27
+ <Tile
28
+ icon="security"
29
+ title="Trust and Security"
30
+ text="Security first! If you want to read up on how we handle your data before you get started, we've got you covered."
31
+ link="streamlit-community-cloud/get-started/trust-and-security"
32
+ background="lightBlue-70"
33
+ />
34
+ </TileContainer>
35
+
36
+ If you're looking for help to build your first Streamlit app, read our [Get started](/get-started) docs for the Streamlit library. If you want to fork an app and start with an example, check out our <a href="https://streamlit.io/gallery" target="_blank">App gallery</a>. Either way, it only takes a few minutes to create your first app.
data/deploy/community-cloud/get-started/connect-github.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Connect your GitHub account
3
+ slug: /deploy/streamlit-community-cloud/get-started/connect-your-github-account
4
+ ---
5
+
6
+ # Connect your GitHub account
7
+
8
+ Connecting GitHub to your Streamlit Community Cloud account allows you to deploy apps directly from the files you store in your repos. It also lets the system check for updates to those files and automatically update your app. There are two stages to this authorization: the first happens when you connect your account for the first time and the second happens when you deploy your first app.
9
+
10
+ Everyone is prompted to connect GitHub when they create an account. If you need to connect GitHub to an existing primary identity, see [Manage your GitHub connection](/deploy/streamlit-community-cloud/manage-your-account/manage-your-github-connection).
11
+
12
+ This page contains additional information about the authorization needed to connect GitHub. If you have just created your account, you are free to skip ahead and [Explore your workspace](/deploy/streamlit-community-cloud/get-started/explore-your-workspace). GitHub's authorization prompts occur automatically as needed.
13
+
14
+ ## Authorize your GitHub account
15
+
16
+ There are two different authorization prompts to grant access between Streamlit and your GitHub account. The first authorization&mdash;"Authorize Streamlit"&mdash;happens when you connect your GitHub account to Streamlit. The second authorization&mdash;"Streamlit is requesting additional permissions"&mdash;happens when you deploy your first app. You must click "**Authorize streamlit**" on both. If you are a member of any GitHub organizations, read below to understand the extras steps to [authorize an organization](#organization-access). Questions about GitHub permissions? Read some frequently asked questions about our [GitHub integration](/deploy/streamlit-community-cloud/troubleshooting#github-integration).
17
+
18
+ <Image alt="Authorize your GitHub account" src="/images/streamlit-community-cloud/GitHub-auth-none.png" />
19
+
20
+ <Important>
21
+
22
+ You must have **admin** permissions to your repo in order to deploy apps. If you don't have admin access, talk to the repo's owner or reach out to us on the <a href="https://discuss.streamlit.io/" target="_blank">Community forum</a>.
23
+
24
+ </Important>
25
+
26
+ ## Organization access
27
+
28
+ If you are working in a repository that is owned by an organization, authorization must be granted by that organization. If you are an owner or member of a GitHub organization when you connect your GitHub account, your authorization prompts will include an extra section labeled "Organization access".
29
+
30
+ ### Organizations you own
31
+
32
+ For any organization you own, if authorization has not been previously granted or denied you can click "**Grant**" before you click "**Authorize streamlit**".
33
+
34
+ <Image alt="Authorize your Streamlit on a GitHub organization you own" src="/images/streamlit-community-cloud/GitHub-auth-grant.png" />
35
+
36
+ ### Organizations owned by others
37
+
38
+ For an organization you don't own, if authorization has not been previously granted or denied you can click "**Request**" before you click "**Authorize streamlit**".
39
+
40
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
41
+ <Image alt="Authorize your Streamlit on a GitHub organization owned by others" src="/images/streamlit-community-cloud/GitHub-auth-request-XL.png" />
42
+ </div>
43
+
44
+ ### Previous or pending authorization
45
+
46
+ If someone has already started the process of authorizing Streamlit for your organization, different options and statuses will display accordingly.
47
+
48
+ #### Approved access
49
+
50
+ If an organization has already granted Streamlit access, a green check is shown.
51
+
52
+ <div style={{ maxWidth: '60%', margin: 'auto' }}>
53
+ <Image alt="Approved authorization for Streamlit on an organization" src="/images/streamlit-community-cloud/GitHub-auth-granted-XL.png" clean />
54
+ </div>
55
+
56
+ #### Pending access
57
+
58
+ If a request has been previously sent but not yet approved, a pending status shows.
59
+
60
+ <div style={{ maxWidth: '60%', margin: 'auto' }}>
61
+ <Image alt="Pending authorization for Streamlit on an organization" src="/images/streamlit-community-cloud/GitHub-auth-pending-XL.png" clean />
62
+ </div>
63
+
64
+ #### Denied access
65
+
66
+ If a request has been previously sent and denied, no option to grant or request access is shown. In this case, the organization owner will need to authorize Streamlit from GitHub. See GitHub's documentation on <a href="https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/authorizing-oauth-apps#oauth-apps-and-organizations" target="_blank">OAuth apps and organizations</a>.
67
+
68
+ <div style={{ maxWidth: '60%', margin: 'auto' }}>
69
+ <Image alt="Denied authorization for Streamlit on an organization" src="/images/streamlit-community-cloud/GitHub-auth-denied-XL.png" clean />
70
+ </div>
71
+
72
+ ## What's next?
73
+
74
+ Now that you have your account you can [Explore your workspace](/deploy/streamlit-community-cloud/get-started/explore-your-workspace). Or if you're ready to go, jump right in and [Deploy your app](/deploy/streamlit-community-cloud/deploy-your-app).
data/deploy/community-cloud/get-started/create-your-account.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Create your account
3
+ slug: /deploy/streamlit-community-cloud/get-started/create-your-account
4
+ ---
5
+
6
+ # Create your account
7
+
8
+ Before you can start deploying apps for the world to see, you need to sign up for your Streamlit Community Cloud account.
9
+
10
+ ![Sign up: Get started with Streamlit Community Cloud](/images/streamlit-community-cloud/sign-up.png)
11
+
12
+ Streamlit Community Cloud accounts have two underlying identities: primary and source control. Your primary identity is used for viewing analytics as well as viewing permissions. Your source-control identity is used for deploying and managing apps.
13
+
14
+ ## Sign up
15
+
16
+ Although you can begin the sign-up process with GitHub, we recommend starting with Google or email in order to have a complete account from the start.
17
+
18
+ - [Step 1: Primary identity](#step-1-primary-identity) (Google or email)
19
+ - [Step 2: Source control](#step-2-source-control) (GitHub)
20
+ - [Step 3: Set up your account](#step-3-set-up-your-account)
21
+
22
+ ### Step 1: Primary identity
23
+
24
+ Your primary identity is associated to an email. You can sign in through Google or through single-use, emailed links which are valid for 15 minutes once requested.
25
+
26
+ If you're sharing a private app, you will assign viewing permission by email. Therefore, your app's users will need to sign in with either Google or emailed links.
27
+
28
+ #### Primary identity option 1: Google
29
+
30
+ 1. Go to <a href="https://share.streamlit.io/signup" target="_blank">share.streamlit.io/signup</a>.
31
+ 2. Click "**Continue with Google**".
32
+
33
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
34
+ <Image alt="Sign up for Streamlit Community Cloud with Google" src="/images/streamlit-community-cloud/sign-up-Google-XL.png" />
35
+ </div>
36
+
37
+ 3. Enter your Google credentials and click "**Next**".
38
+
39
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
40
+ <Image alt="Enter your Google credentials" src="/images/streamlit-community-cloud/sign-in-Google-2.png" />
41
+ </div>
42
+
43
+ 4. If you will be deploying or managing any apps, click "**Connect GitHub account**" and proceed to [Step 2: Source Control](/deploy/streamlit-community-cloud/get-started/create-your-account#step-2-source-control). If you are only going to be viewing apps and will not be using GitHub, you can click "**Skip this step**" and proceed to [Step 3: Set up your account](#step-3-set-up-your-account).
44
+
45
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
46
+ <Image alt="Connect your GitHub account to Streamlit Community Cloud" src="/images/streamlit-community-cloud/sign-up-2.png" />
47
+ </div>
48
+
49
+ #### Primary identity option 2: email
50
+
51
+ 1. Go to <a href="https://share.streamlit.io/signup" target="_blank">share.streamlit.io/signup</a>.
52
+ 2. Enter your email address and click "**Continue with email**".
53
+
54
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
55
+ <Image alt="Sign up for Streamlit Community Cloud with email" src="/images/streamlit-community-cloud/sign-up-email-XL.png" />
56
+ </div>
57
+
58
+ 3. A confirmation screen will display, telling you to check your email.
59
+
60
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
61
+ <Image alt="Streamlit Community Cloud confirmation to check your email" src="/images/streamlit-community-cloud/sign-in-email-2.png" />
62
+ </div>
63
+
64
+ 4. Check your inbox for an email with the subject "Sign in to Streamlit Cloud". Click the link to sign in.
65
+
66
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
67
+ <Image alt="Streamlit Community Cloud sign-in email" src="/images/streamlit-community-cloud/sign-in-email-3.png" />
68
+ </div>
69
+
70
+ 5. If you will be deploying or managing any apps, click "**Connect GitHub account**" and proceed to [Step 2: Source control](/deploy/streamlit-community-cloud/get-started/create-your-account#step-2-source-control). If you are only going to be viewing apps and will not be using GitHub, you can click "**Skip this step**" and proceed to [Step 3: Set up your account](#step-3-set-up-your-account).
71
+
72
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
73
+ <Image alt="Connect your GitHub account to Streamlit Community Cloud" src="/images/streamlit-community-cloud/sign-up-2.png" />
74
+ </div>
75
+
76
+ ### Step 2: Source control
77
+
78
+ Streamlit Community Cloud is integrated with GitHub for source control. If you begin your sign-up process with GitHub, you will not be directly prompted to create a primary identity. However, you can attach a Google account later.
79
+
80
+ There are two different authorization requests to completely [Connect your GitHub account](/deploy/streamlit-community-cloud/get-started/connect-your-github-account). You will encounter the first authorization request when you begin connecting your GitHub account. A second authorization is needed the first time you deploy an app. If you will be deploying or managing any apps from a GitHub organization, your authorization requests will include additional options to allow [Organization access](/deploy/streamlit-community-cloud/get-started/connect-github#organization-access).
81
+
82
+ 1. After completing [Step 1: Primary identity](#step-1-primary-identity) or after clicking "**Continue with GitHub**" from the sign-up page, enter your GitHub credentials and click "**Sign in**".
83
+
84
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
85
+ <Image alt="Enter your GitHub credentials" src="/images/streamlit-community-cloud/sign-in-GitHub-2.png" />
86
+ </div>
87
+
88
+ 2. Click "**Authorize streamlit**".
89
+
90
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
91
+ <Image alt="Authorize streamlit to connect to your GitHub account" src="/images/streamlit-community-cloud/GitHub-auth1-none.png" />
92
+ </div>
93
+
94
+ 3. Continue to Step 3: Set up your account
95
+
96
+ ### Step 3: Set up your account
97
+
98
+ As a final step to account creation, please tell us about yourself and your experience with Streamlit. This is also when you can read and acknowledge our <a href="https://www.streamlit.io/sharing/terms-of-use" target="_blank">Terms of use</a> and <a href="https://streamlit.io/privacy-policy" target="_blank">Privacy notice</a>. The email you provide in this survey is not used as your account email.
99
+
100
+ 1. Fill in your information and click "**Continue**" at the bottom of the screen.
101
+
102
+ <div style={{ maxWidth: '70%', margin: 'auto' }}>
103
+ <Image alt="Fill out the Streamlit Community Cloud user survey" src="/images/streamlit-community-cloud/sign-up-3.png" />
104
+ </div>
105
+
106
+ 2. You will be taken to your workspace.
107
+
108
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
109
+ <Image alt="Your Streamlit Community Cloud workspace" src="/images/streamlit-community-cloud/workspace-empty-warning.png" />
110
+ </div>
111
+
112
+ ### Finish up
113
+
114
+ Congratulations on creating your Streamlit Community Cloud account! A warning icon (<i style={{ verticalAlign: "-.25em", color: "#ff8700" }} className={{ class: "material-icons-sharp" }}>warning</i>) next to "**Settings**" in the upper-right corner is expected; this indicates one of three things:
115
+
116
+ 1. You created a primary identity and skipped connecting GitHub.
117
+ 2. You started with GitHub and did not create a primary identity.
118
+ 3. You created both a primary identity and connected GitHub, but the second authorization for GitHub is still pending. You will be prompted with the second authorization when you deploy your first app.
119
+
120
+ ## What's next?
121
+
122
+ Now that you have your account you can [Explore your workspace](/deploy/streamlit-community-cloud/get-started/explore-your-workspace). Or if you're ready to go, jump right in and [Deploy your app](/deploy/streamlit-community-cloud/deploy-your-app).
data/deploy/community-cloud/get-started/explore-your-workspace.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Explore your workspace
3
+ slug: /deploy/streamlit-community-cloud/get-started/explore-your-workspace
4
+ ---
5
+
6
+ # Explore your workspace
7
+
8
+ If you just [created your account](/deploy/streamlit-community-cloud/get-started/create-your-account), congrats! You are now logged in and ready to go. If you are joining someone else's workspace you may already see apps populated in your workspace. If not, then you need to deploy an app! Check out our next section on how to [Deploy your app](/deploy/streamlit-community-cloud/deploy-your-app). If you need an app to deploy, check out our <a href="https://streamlit.io/gallery" target="_blank">App gallery</a> which includes apps for machine learning, data science, and business use cases.
9
+
10
+ ![Your Streamlit Community Cloud workspace](/images/streamlit-community-cloud/workspace-empty.png)
11
+
12
+ ## Switching workspaces
13
+
14
+ You may also find that you already have access to multiple Streamlit Community Cloud workspaces. Streamlit Community Cloud automatically groups your apps according to the corresponding GitHub repository's owner or organzation. In the upper-right corner you can see the workspaces you have access to. If apps have already been deployed from any of your repositories, then you will see those apps when you select the associated workspace in the upper-right corner. Learn more about how to [Manage your app from your workspace](/deploy/streamlit-community-cloud/manage-your-app#manage-your-app-from-your-workspace).
15
+
16
+ ![Switch between your Streamlit Community Cloud workspaces](/images/streamlit-community-cloud/workspace-empty-switch.png)
17
+
18
+ ## New app button
19
+
20
+ Your workspace is your base of operations to deploy apps and manage them. You can click on "**New app**" to [Deploy your app](/deploy/streamlit-community-cloud/deploy-your-app) from a repository where you have administrative privileges. If you want additional options, click the down arrow (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>expand_more</i>) to begin with a template.
21
+
22
+ - "**Use existing repo**" is the default to [Deploy your app](/deploy/streamlit-community-cloud/deploy-your-app) from a repository where you have administrative privileges.
23
+ - "**Create from sample app template**" will fork and deploy a <a href="https://github.com/streamlit/streamlit-example" target="_blank">simple, one-page Streamlit app</a>.
24
+ - "**Create new app with GitHub Codespaces**" will fork and deploy our multipage <a href="https://github.com/streamlit/streamlit-hello" target="_blank">Streamlit Hello</a> app and create a codespace. To jump quickly into GitHub Codespaces for any of your deployed apps, see [Edit your app with GitHub Codespaces](/deploy/streamlit-community-cloud/manage-your-app/edit-your-app#edit-your-app-with-github-codespaces) instead.
25
+
26
+ ![Options to deploy a new app from your workspace in Streamlit Community Cloud](/images/streamlit-community-cloud/deploy-menu.png)
27
+
28
+ ## Invite other developers to your workspace
29
+
30
+ Inviting other developers is simple, just invite them to your GitHub repository so that you can code on apps together, and then have them log in to <a href="https://share.streamlit.io/signup" target="_blank">share.streamlit.io/signup</a>. Read more about connecting to a GitHub organization in [Organization access](/deploy/streamlit-community-cloud/get-started/connect-your-github-account#organization-access).
31
+
32
+ Streamlit Community Cloud inherits developer permissions from GitHub so when others sign in, they will automatically see the workspaces they share with you. From there you can all deploy, manage, and share apps together.
33
+
34
+ <Note>
35
+
36
+ Once a user is added to a repository on GitHub, it will take at most 15 minutes before they can deploy the app on Cloud. If a user is removed from a repository on GitHub, it will take at most 15 minutes before their permissions to manage the app from that repository are revoked.
37
+
38
+ </Note>
39
+
40
+ And remember, whenever anyone on the team updates the code on GitHub, the app will also automatically update for you!
data/deploy/community-cloud/get-started/fork-and-edit.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Fork and edit a public app
3
+ slug: /deploy/streamlit-community-cloud/get-started/fork-and-edit-a-public-app
4
+ ---
5
+
6
+ # Fork and edit a public app
7
+
8
+ Community Cloud is all about learning, sharing, and exploring the world of Streamlit. For apps with public repositories, you can quickly fork copies to your GitHub account, deploy your own version, and jump into a codespace on GitHub to start editing and exploring Streamlit code &mdash; all in the cloud so you don't have to install anything.
9
+
10
+ 1. From a forkable app, in the upper-right corner, click "<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>fork_right</i> **Fork this app**."
11
+
12
+ ![Click Fork this app from a public app](/images/streamlit-community-cloud/fork-and-edit.png)
13
+
14
+ 2. Click "**Fork!**" The repository will be forked to your GitHub account. If you have already forked the repository or have another repository of the same name, the fork will fail. In this case, you can manually fork the repository on GitHub, then follow the instructions to [Deploy your app](/deploy/streamlit-community-cloud/deploy-your-app#deploy-your-app) and [Edit your app with GitHub Codespaces](/deploy/streamlit-community-cloud/manage-your-app/edit-your-app#edit-your-app-with-github-codespaces).
15
+
16
+ ![Click Fork to confirm](/images/streamlit-community-cloud/fork-codespace-1.png)
17
+
18
+ 3. Click "**Create codespace**" to confirm the creation of a codespace on your account. Read more about <a href="https://github.com/features/codespaces" target="_blank">GitHub Codespaces</a> to learn about monthly limits for free use and paid plans.
19
+
20
+ ![Create a codespace on your GitHub account](/images/streamlit-community-cloud/fork-codespace-2.png)
21
+
22
+ 4. Wait for GitHub to set up your codespace.
23
+
24
+ ![GitHub preparing your codespace](/images/streamlit-community-cloud/deploy-codespaces-3.png)
25
+
26
+ 5. GitHub will automatically execute the commands to launch your Streamlit app within your codespace. Your app will be visible in a "Simple Browser" on the right. This may take a minute to complete from when your codespace first appears on screen.
27
+
28
+ ![Your new GitHub Codespace](/images/streamlit-community-cloud/fork-cheatsheet-codespace.png)
29
+
30
+ You now have a copy the public app deployed from your account. You can edit and explore within your codespace and (if you choose) commit your changes to your deployed app to share with the world! 🌎 Learn more about editing your app in GitHub Codespaces, committing your edits to your repository, and shutting down your codespace in [Edit your app with GitHub Codespaces](/deploy/streamlit-community-cloud/manage-your-app/edit-your-app#edit-your-app-with-github-codespaces).
data/deploy/community-cloud/get-started/quickstart.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Quickstart
3
+ slug: /deploy/streamlit-community-cloud/get-started/quickstart
4
+ ---
5
+
6
+ # Quickstart
7
+
8
+ This is a concise set of steps to create your Streamlit Community Cloud account, deploy a sample app, and start editing it with GitHub Codespaces. For other options and complete explanations, start with [Create your account](/deploy/streamlit-community-cloud/get-started/create-your-account).
9
+
10
+ You will be signing in to your Google and GitHub accounts during this process. If you do not already have these accounts, you can create them before you begin. If you do not want to use a Google account, you can [create your account with any email](/deploy/streamlit-community-cloud/get-started/create-your-account#primary-identity-option-2-email).
11
+
12
+ ## Sign up for Streamlit Community Cloud
13
+
14
+ 1. Go to <a href="https://share.streamlit.io/signup" target="_blank">share.streamlit.io/signup</a>.
15
+ 2. Click "**Continue with Google**".
16
+
17
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
18
+ <Image alt="Sign up for Streamlit Community Cloud with Google" src="/images/streamlit-community-cloud/sign-up-Google-XL.png" />
19
+ </div>
20
+
21
+ 3. Enter your Google credentials and follow Google's authentication prompts.
22
+ 4. After authenticating with Google, click "**Connect GitHub account**".
23
+
24
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
25
+ <Image alt="Connect your GitHub account to Streamlit Community Cloud" src="/images/streamlit-community-cloud/sign-up-2.png" />
26
+ </div>
27
+
28
+ 5. Enter your GitHub credentials and follow GitHub's authentication prompts.
29
+ 6. Click "**Authorize streamlit**".
30
+
31
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
32
+ <Image alt="Authorize streamlit to connect to your GitHub account" src="/images/streamlit-community-cloud/GitHub-auth1-none.png" />
33
+ </div>
34
+
35
+ 7. To finish, fill in your information and click "**Continue**" at the bottom of the screen.
36
+
37
+ <div style={{ maxWidth: '70%', margin: 'auto' }}>
38
+ <Image alt="Set up your Streamlit Community Cloud account" src="/images/streamlit-community-cloud/sign-up-3.png" />
39
+ </div>
40
+
41
+ 8. You will be taken to your Streamlit workspace. If you see a warning icon (<i style={{ verticalAlign: "-.25em", color: "#ff8700" }} className={{ class: "material-icons-sharp" }}>warning</i>) next to "**Settings**" in the upper-right corner, this will be addressed in the next steps.
42
+
43
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
44
+ <Image alt="Your new workspace in Streamlit Community Cloud" src="/images/streamlit-community-cloud/workspace-empty-warning.png" />
45
+ </div>
46
+
47
+ ## Create a new app with GitHub Codespaces
48
+
49
+ 9. Click the down arrow (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>expand_more</i>) to expand the options under "**New App**".
50
+
51
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
52
+ <Image alt="Options to deploy a new app from your workspace in Streamlit Community Cloud" src="/images/streamlit-community-cloud/deploy-menu.png" />
53
+ </div>
54
+
55
+ 10. Click "**Create new app with GitHub Codespaces**".
56
+
57
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
58
+ <Image alt="Deploy a new app from a sample app template" src="/images/streamlit-community-cloud/deploy-codespaces.png" />
59
+ </div>
60
+
61
+ 11. You will be prompted that "Streamlit is requesting additional permissions". Click "**Authorize streamlit**".
62
+
63
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
64
+ <Image alt="Authorize streamlit to access private repositories" src="/images/streamlit-community-cloud/GitHub-auth2-none.png" />
65
+ </div>
66
+
67
+ 12. The <a href="https://github.com/streamlit/streamlit-hello" target="_blank">Streamlit Hello</a> repository will be forked to your GitHub account. Fill in a repository name and click "**Create!**"
68
+
69
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
70
+ <Image alt="Fork the sample Streamlit app" src="/images/streamlit-community-cloud/deploy-codespaces-1.png" />
71
+ </div>
72
+
73
+ 13. Click "**Create new codespace**" to confirm the creation of a codespace on your GitHub account. Read more about <a href="https://github.com/features/codespaces" target="_blank">GitHub Codespaces</a> the learn about monthly limits for free use and paid plans.
74
+
75
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
76
+ <Image alt="Create your GitHub Codespace" src="/images/streamlit-community-cloud/deploy-codespaces-2.png" />
77
+ </div>
78
+
79
+ 14. Wait for GitHub to set up your codespace.
80
+
81
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
82
+ <Image alt="GitHub preparing your Codespace" src="/images/streamlit-community-cloud/deploy-codespaces-3.png" />
83
+ </div>
84
+
85
+ 15. GitHub will automatically execute the commands to launch your Streamlit app within your codespace. Your app will be visible in a "Simple Browser" on the right. This may take a minute to complete from when your codespace first appears on screen.
86
+
87
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
88
+ <Image alt="Your new GitHub Codespace" src="/images/streamlit-community-cloud/deploy-hello-codespace.png" />
89
+ </div>
90
+
91
+ ## Edit your app in GitHub Codespaces
92
+
93
+ 16. Go to the app's main file (`Hello.py`) and add some text to the title in `st.write()`. Try typing ":balloon:" at the beginning.
94
+
95
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
96
+ <Image alt="Edit the title of your sample Streamlit app" src="/images/streamlit-community-cloud/deploy-hello-edit-title.png" />
97
+ </div>
98
+
99
+ 17. Files are automatically saved in your codespace with each edit. Click "**Always rerun**" in the upper-right corner of your app to automatically rerun with each edit.
100
+
101
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
102
+ <Image alt='Select "Always rerun" to automatically see edits in your running app' src="/images/streamlit-community-cloud/deploy-hello-edit-rerun.png" />
103
+ </div>
104
+
105
+ 18. See your edits and keep going!
106
+
107
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
108
+ <Image alt="See the results of your edit to your Streamlit app" src="/images/streamlit-community-cloud/deploy-hello-edit-result.png" />
109
+ </div>
110
+
111
+ ## Stop or delete your codespace
112
+
113
+ When you are done, remember to stop your codespace on GitHub to avoid any undesired use of your capacity.
114
+
115
+ 19. Go to <a href="https://github.com/codespaces" target="_blank">github.com/codespaces</a>. At the bottom of the page, all your codespaces are listed. Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_horiz</i>) for your codespace.
116
+
117
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
118
+ <Image alt="Stop or delete your GitHub Codespace" src="/images/streamlit-community-cloud/deploy-hello-codespace-manage.png" />
119
+ </div>
120
+
121
+ 20. Click "**Stop codespace**" if you'd like to return to your work later. Otherwise, click "**Delete**."
122
+
123
+ <Flex>
124
+ <div style={{ maxWidth: '40%', margin: 'auto' }}>
125
+ <Image alt="Stop your GitHub codespace" src="/images/streamlit-community-cloud/codespace-menu-stop.png" />
126
+ </div>
127
+ <div style={{ maxWidth: '40%', margin: 'auto' }}>
128
+ <Image alt="Delete your GitHub codespace" src="/images/streamlit-community-cloud/codespace-menu-delete.png" />
129
+ </div>
130
+ </Flex>
131
+
132
+ 21. Congratulations! You just deployed an app to Streamlit Community Cloud. πŸŽ‰ Head back to your workspace at <a href="https://share.streamlit.io/" target="_blank">share.streamlit.io/</a> and [deploy another Streamlit app](/deploy/streamlit-community-cloud/deploy-your-app).
133
+
134
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
135
+ <Image alt="See your deployed Streamlit app" src="/images/streamlit-community-cloud/deploy-hello-workspace.png" />
136
+ </div>
data/deploy/community-cloud/get-started/security-model.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Streamlit Trust and Security
3
+ slug: /deploy/streamlit-community-cloud/get-started/trust-and-security
4
+ ---
5
+
6
+ # Streamlit trust and security
7
+
8
+ Streamlit is a framework that turns Python scripts into interactive apps, giving data scientists the ability to quickly create data and model-based apps for the entire company.
9
+
10
+ A simple Streamlit app is:
11
+
12
+ ```python
13
+ import streamlit as st
14
+ number = st.slider("Pick a number: ", min_value=1, max_value=10)
15
+ st.text("Your number is " + str(number))
16
+ ```
17
+
18
+ When you `streamlit run my_app.py`, you start a web server that runs the interactive application on your local computer at `http://localhost:8501`. This is great for local development. When you want to share with your colleagues, Streamlit Community Cloud enables you to deploy and run these applications in the cloud. Streamlit Community Cloud handles the details of containerization and provides you an interface for easily managing your deployed apps.
19
+
20
+ This document provides an overview of the security safeguards we've implemented to protect you and your data. Security, however, is a shared responsibility and you are ultimately responsible for making appropriate use of Streamlit and the Streamlit Community Cloud, including implementation of appropriate user-configurable security safeguards and best practices.
21
+
22
+ ## Product security
23
+
24
+ ### Authentication
25
+
26
+ You must authenticate through GitHub to deploy or administer an app. Authentication through Google or single-use emailed links are required to view a private app when you don't have push or admin permissions on the associated GitHub repository. The single-use emailed links are valid for 15 minutes once requested.
27
+
28
+ ### Permissions
29
+
30
+ Streamlit Community Cloud inherits the permissions you have assigned in GitHub. Users with write access to a GitHub repository for a given app will be able to make changes in the Streamlit administrative console. However, only users with _admin access_ to a repository are able to **deploy and delete apps**.
31
+
32
+ ## Network and application security
33
+
34
+ ### Data hosting
35
+
36
+ Our physical infrastructure is hosted and managed within secure data centers maintained by infrastructure-as-a-service cloud providers. Streamlit leverages many of these platforms' built-in security, privacy, and redundancy features. Our cloud providers continually monitor their data centers for risk and undergo assessments to ensure compliance with industry standards.
37
+
38
+ ### Data deletion
39
+
40
+ Community Cloud users have the option to delete any apps they’ve deployed as well as their entire account.
41
+
42
+ When a user deletes their application from the admin console, we delete their source code, including any files copied from their GitHub repository or created within our system from the running app. However, we keep a record representing the application in our database. This record contains the coordinates of the application: the GitHub organization or user, the GitHub repository, the branch, and the path of the main module file.
43
+
44
+ When a user deletes their account, we perform a hard deletion of their data and a hard deletion of all the apps that belong to the GitHub identity associated with their account. In this case, we do not maintain the records of application coordinates described above. When an account is deleted, we also delete any HubSpot contact associated with the Community Cloud account.
45
+
46
+ ### Virtual private cloud
47
+
48
+ All of our servers are within a virtual private cloud (VPC) with firewalls and network access control lists (ACLs) to allow external access to a select few API endpoints; all other internal services are only accessible within the VPC.
49
+
50
+ ### Encryption
51
+
52
+ Streamlit apps are served entirely over HTTPS. We use only strong cipher suites and HTTP Strict Transport Security (HSTS) to ensure browsers interact with Streamlit apps over HTTPS.
53
+
54
+ All data sent to or from Streamlit over the public internet is encrypted in transit using 256-bit encryption. Our API and application endpoints use Transport Layer Security (TLS) 1.2 (or better). We also encrypt data at rest on disk using AES-256.
55
+
56
+ ### Permissions and authentication
57
+
58
+ Access to Community Cloud user account data is limited to authorized personnel. We run a zero-trust corporate network, utilize single sign-on and multi-factor authentication (MFA), and enforce strong password policies to ensure access to cloud-related services is protected.
59
+
60
+ ### Incident response
61
+
62
+ Our internal protocol for handling security events includes detection, analysis, response, escalation, and mitigation. Security advisories are made available at [https://streamlit.io/advisories](https://streamlit.io/advisories).
63
+
64
+ ### Penetration testing
65
+
66
+ Streamlit uses third-party security tools to scan for vulnerabilities on a regular basis. Our security teams conduct periodic, intensive penetration tests on the Streamlit platform. Our product development team responds to any identified issues or potential vulnerabilities to ensure the quality, security, and availability of Streamlit applications.
67
+
68
+ ### Vulnerability management
69
+
70
+ We keep our systems up-to-date with the latest security patches and continuously monitor for new vulnerabilities. This includes automated scanning of our code repositories for vulnerable dependencies.
71
+
72
+ If you discover a vulnerability in one of our products or websites, please report the issue to [HackerOne](https://hackerone.com/snowflake?type=team).
data/deploy/community-cloud/manage-your-account/_index.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Manage your account
3
+ slug: /deploy/streamlit-community-cloud/manage-your-account
4
+ ---
5
+
6
+ # Manage your account
7
+
8
+ You can [Update your email](/deploy/streamlit-community-cloud/manage-your-account/update-your-email) or [Delete your account](/deploy/streamlit-community-cloud/manage-your-account/delete-your-account) entirely through [Workspace settings](/deploy/streamlit-community-cloud/manage-your-account/workspace-settings).
9
+
10
+ When using Streamlit Community Cloud, you have two identities behind your account: a primary identity (Google or email) and source control (GitHub). Your primary identity allows other users to share private apps with you and grant you access to their analytics. Your source control identity allows you to deploy apps from GitHub repositories and manage them through your Streamlit Community Cloud workspace.
11
+
12
+ ## Access your workspace settings
13
+
14
+ To manage your account, sign in to <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and click "**Settings**" in the top right corner to access your workspace settings.
15
+
16
+ <div style={{ maxWidth: '75%', marginLeft: '3em' }}>
17
+ <Image src="/images/streamlit-community-cloud/account-settings-header.png" alt="Access your workspace settings from your workspace" />
18
+ </div>
19
+
20
+ Learn more about how to [Update your email](/deploy/streamlit-community-cloud/manage-your-account/update-your-email) and [Delete your account](/deploy/streamlit-community-cloud/manage-your-account/delete-your-account).
data/deploy/community-cloud/manage-your-account/delete-your-account.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Delete your account
3
+ slug: /deploy/streamlit-community-cloud/manage-your-account/delete-your-account
4
+ ---
5
+
6
+ # Delete your account
7
+
8
+ Deleting your Streamlit Community Cloud account is just as easy as creating it. When you delete your account, your information, account, and all your hosted apps are deleted as well. Read more about data deletion in [Streamlit trust and security](/deploy/streamlit-community-cloud/get-started/trust-and-security#data-deletion).
9
+
10
+ <Warning>
11
+
12
+ Deleting your account is permanent and cannot be undone. Make sure you really want to delete your account and all hosted apps before proceeding. Any app you've deployed will be deleted, regardless of the workspace it was deployed from.
13
+
14
+ </Warning>
15
+
16
+ ## How to delete your account
17
+
18
+ Follow these steps to delete your account:
19
+
20
+ 1. Sign in to Streamlit Community Cloud at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and access your [Workspace settings](/deploy/streamlit-community-cloud/manage-your-account/workspace-settings).
21
+
22
+ 2. From the "Linked accounts" section, click "**Delete account**".
23
+
24
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
25
+ <Image alt="Delete your Streamlit Community Cloud account from your workspace settings" src="/images/streamlit-community-cloud/account-delete.png" />
26
+ </div>
27
+
28
+ 3. A confirmation will display. Enter the confirmation string and click "**Delete account forever**"
29
+
30
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
31
+ <Image alt="Confirm your account deletion by typing the specified string" src="/images/streamlit-community-cloud/account-delete-confirm.png" />
32
+ </div>
33
+
34
+ 4. All your information and apps will be permanently deleted.
35
+ ![Your Streamlit Community Cloud account has been deleted.](/images/streamlit-community-cloud/account-deleted.png)
36
+
37
+ It's that simple! If you have any questions or run into issues deleting your account, please reach out to us on <a href="https://discuss.streamlit.io/c/community-cloud/13" target="_blank">our forum</a>. We're happy to help! 🎈
data/deploy/community-cloud/manage-your-account/manage-your-github-connection.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Manage your GitHub connection
3
+ slug: /deploy/streamlit-community-cloud/manage-your-account/manage-your-github-connection
4
+ ---
5
+
6
+ # Manage your GitHub connection
7
+
8
+ If you did not connect GitHub when you created your account or need to correct your GitHub authorization, this page is for you! If you just need to add an organization to your account, skip ahead to [Authorizing with an organization](#authorizing-with-an-organization).
9
+
10
+ If you are not fully logged in and authorized to both a primary identity (Google or email) and source control (GitHub), there will be a warning symbol in the upper-right corner of your workspace. This can mean one of three things:
11
+
12
+ - You are not signed in to a primary identity (Google or email).
13
+ - See [Connect Google to your account](/deploy/streamlit-community-cloud/manage-your-account/update-your-email#connect-google-to-your-account).
14
+ - You are not signed in to source control (GitHub.)
15
+ - See [Connecting GitHub to an existing primary identity](#connecting-github-to-an-existing-primary-identity).
16
+ - Your source control has incomplete permissions.
17
+ - Access your workspace settings see [Authorize Streamlit to access private repositories](#authorize-streamlit-to-access-private-repositories).
18
+
19
+ <Image alt="Authorize your GitHub account" src="/images/streamlit-community-cloud/workspace-empty-warning-annotated.png" />
20
+
21
+ ## Connecting GitHub to an existing primary identity
22
+
23
+ If you created your account without connecting GitHub or if you disconnected GitHub from your account, you can reconnect.
24
+
25
+ 1. Click "**Settings**" in the upper-right corner of your workspace.
26
+ 2. If you do not have GitHub connected, a warning is displayed saying, "**You are not signed in with a source control account**".
27
+
28
+ If instead you see "**Streamlit does not have access to private repos on this GitHub account**" skip to step 5. 3. Click "**Sign in with GitHub**".
29
+
30
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
31
+ <Image alt="Sign in with GitHub to connect GitHub to your Streamlit Community Cloud account" src="/images/streamlit-community-cloud/account-no-source.png" />
32
+ </div>
33
+
34
+ 4. Click "**Authorize streamlit**".
35
+
36
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
37
+ <Image alt="Authorize streamlit to connect to your GitHub account" src="/images/streamlit-community-cloud/GitHub-auth1-none.png" />
38
+ </div>
39
+
40
+ ### Authorize Streamlit to access private repositories
41
+
42
+ 5. After completing the first authorization, your workspace settings will still have a warning, "**Streamlit does not have access to private repos on this GitHub account**".
43
+
44
+ 6. Click "**Allow access**".
45
+
46
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
47
+ <Image alt="Click 'Allow access' to trigger the second GitHub authorization" src="/images/streamlit-community-cloud/account-unauthorized-source.png" />
48
+ </div>
49
+
50
+ 7. Click "**Authorize streamlit**".
51
+
52
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
53
+ <Image alt="Authorize streamlit to access private repositories" src="/images/streamlit-community-cloud/GitHub-auth2-none.png" />
54
+ </div>
55
+
56
+ GitHub is now connected to your account! πŸ₯³
57
+
58
+ ## Authorizing with an organization
59
+
60
+ If you are in an organization, you can grant or request access to that organization when you connect your GitHub account. Read more about [Organization access](/deploy/streamlit-community-cloud/get-started/connect-your-github-account#organization-access).
61
+
62
+ If your GitHub account is already connected, you can remove permissions in your GitHub settings and force Streamlit to reprompt for GitHub authorization the next time you sign into Streamlit Community Cloud.
63
+
64
+ ### Revoke and reauthorize
65
+
66
+ 1. From your workspace, click on your workspace name in the upper-right corner. Click "**Sign out**" to sign out of Streamlit Community Cloud.
67
+
68
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
69
+ <Image alt="Sign out of Streamlit Community Cloud" src="/images/streamlit-community-cloud/account-sign-out.png" />
70
+ </div>
71
+
72
+ 2. Go to your GitHub application settings at <a href="https://github.com/settings/applications" target="_blank">github.com/settings/applications</a>.
73
+ 3. Click on the three dots to open the overflow menu for "**Streamlit**" and click "**Revoke**".
74
+
75
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
76
+ <Image alt="Revoke access for Streamlit to access your GitHub account" src="/images/streamlit-community-cloud/GitHub-revoke.png" />
77
+ </div>
78
+
79
+ 4. Click "**I understand, revoke access**".
80
+
81
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
82
+ <Image alt="Confirm to revoke access for Streamlit to your GitHub account" src="/images/streamlit-community-cloud/GitHub-revoke-confirm.png" />
83
+ </div>
84
+
85
+ 5. Return to <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and sign in. You will be prompted to authorize GitHub as explained in [Connect GitHub](/deploy/streamlit-community-cloud/get-started/connect-your-github-account#organization-access).
86
+
87
+ ### Granting previously denied access
88
+
89
+ If an organization owner has restricted Streamlit's access or restricted all OAuth applications, they may need to directly modify their permissions in GitHub. If an organization has restricted Streamlit's access, a red "**X**" will appear next to the organization when you are prompted to authorize with your GitHub account.
90
+
91
+ <div style={{ maxWidth: '60%', margin: 'auto' }}>
92
+ <Image alt="Denied authorization for Streamlit to access your GitHub account" src="/images/streamlit-community-cloud/GitHub-auth-denied-XL.png" clean />
93
+ </div>
94
+
95
+ See GitHub's documentation on <a href="https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/authorizing-oauth-apps#oauth-apps-and-organizations" target="_blank">OAuth apps and organizations</a>.
data/deploy/community-cloud/manage-your-account/sign-in-sign-out.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Sign in & sign out
3
+ slug: /deploy/streamlit-community-cloud/manage-your-account/sign-in-sign-out
4
+ ---
5
+
6
+ # Sign in & sign out
7
+
8
+ Once you've created your account, you can sign in to <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and follow the steps below.
9
+
10
+ ![Sign in to Streamlit Community Cloud](/images/streamlit-community-cloud/sign-in.png)
11
+
12
+ ## Sign in with Google
13
+
14
+ 1. Visit <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and click "**Continue with Google**".
15
+
16
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
17
+ <Image src="/images/streamlit-community-cloud/sign-in-Google-1.png" alt="Sign in to Streamlit Community Cloud with Google" />
18
+ </div>
19
+
20
+ 2. Enter your Google account credentials.
21
+
22
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
23
+ <Image src="/images/streamlit-community-cloud/sign-in-Google-2.png" alt="Enter your Google credentials to sign in to Streamlit Community Cloud" />
24
+ </div>
25
+
26
+ 3. If your account is already linked to GitHub, you may be immediately prompted to sign in with GitHub. Once you have signed in, you can [Explore your workspace!](/deploy/streamlit-community-cloud/get-started/explore-your-workspace). 🎈
27
+
28
+ ## Sign in with GitHub
29
+
30
+ 1. Visit <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and click "**Continue with GitHub**".
31
+
32
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
33
+ <Image src="/images/streamlit-community-cloud/sign-in-GitHub-1.png" alt="GitHub sign-in" />
34
+ </div>
35
+
36
+ 2. Enter your GitHub credentials.
37
+
38
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
39
+ <Image src="/images/streamlit-community-cloud/sign-in-GitHub-2.png" alt="GitHub sign-in" />
40
+ </div>
41
+
42
+ 3. Once you have signed in to GitHub, you can [Explore your workspace!](/deploy/streamlit-community-cloud/get-started/explore-your-workspace). 🎈
43
+
44
+ ## Sign in with Email
45
+
46
+ 1. Visit <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and enter the email you used to create your Streamlit Community Cloud account. Click "**Continue with email**".
47
+
48
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
49
+ <Image src="/images/streamlit-community-cloud/sign-in-email-1.png" alt="Email sign-in" />
50
+ </div>
51
+
52
+ 2. You will see a confirmation message asking you to check your email.
53
+
54
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
55
+ <Image src="/images/streamlit-community-cloud/sign-in-email-2.png" alt="Email sign-in" />
56
+ </div>
57
+
58
+ 3. Check your inbox for an email with the subject "**Sign in to Streamlit Cloud**". Click the link in the email to sign in to Streamlit Community Cloud. Note that this link will expire in 15 minutes and can only be used once.
59
+
60
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
61
+ <Image src="/images/streamlit-community-cloud/sign-in-email-3.png" alt="Email sign-in" />
62
+ </div>
63
+
64
+ 4. Once you click the link in your email, you can [Explore your workspace!](/deploy/streamlit-community-cloud/get-started/explore-your-workspace). 🎈
65
+
66
+ ## Sign out of your account
67
+
68
+ From your workspace, click on your workspace name in the upper-right corner. Click "**Sign out**".
69
+
70
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
71
+ <Image alt="Sign out of Streamlit Community Cloud" src="/images/streamlit-community-cloud/account-sign-out.png" />
72
+ </div>
data/deploy/community-cloud/manage-your-account/update-your-email.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Update your email
3
+ slug: /deploy/streamlit-community-cloud/manage-your-account/update-your-email
4
+ ---
5
+
6
+ # Update your email
7
+
8
+ If you wish to update your email on Streamlit Community Cloud, you can do so via your [Workspace settings](/deploy/streamlit-community-cloud/manage-your-account/workspace-settings). Updating your email changes the primary identity of your account. Once updated, if your account's email is associated with a Google account, you can sign in with Google OAuth. Otherwise, you through emailed links. The latter involves typing in your email, after which we'll send you a unique, single-use link (valid for 15 minutes).
9
+
10
+ If you are signed in to GitHub and don't already have a primary identity on your account, see [Connect Google to your account](#connect-google-to-your-account).
11
+
12
+ ## How to update your email
13
+
14
+ 1. Sign in to Streamlit Community Cloud at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>.
15
+ 2. Click "**Settings**" in the page's top-right corner.
16
+ ![Access your workspace settings from your workspace](/images/streamlit-community-cloud/account-settings-header.png)
17
+
18
+ 3. Click "**Update email**" within the "**Linked accounts**" section.
19
+ ![Update your email from your workspace settings](/images/streamlit-community-cloud/account-change-email-1.png)
20
+
21
+ 4. Enter your new email and click "**Update email**."
22
+ ![Enter your new email address for your Streamlit Community Cloud account](/images/streamlit-community-cloud/account-change-email-2.png)
23
+
24
+ 5. You'll see a confirmation dialog asking you to check your email for a confirmation link. Click "**Done**."
25
+ ![Confirmation message after choosing a new email for your Streamlit Community Cloud account](/images/streamlit-community-cloud/account-change-email-3.png)
26
+
27
+ 6. Your account settings will show "**Update pending**" until you complete the next step.
28
+ ![Email update pending displayed in your workspace settings](/images/streamlit-community-cloud/account-change-email-4.png)
29
+
30
+ 7. Check your inbox for an email from Streamlit containing a "**Change email**" button and a confirmation link. This one-time link expires in 15 minutes. Click either one to confirm your new email address for Streamlit Community Cloud. Before doing so, ensure you access the link from the same browser session where you are logged in to Streamlit Community Cloud.
31
+
32
+ <Important>
33
+
34
+ If you access the confirmation link from a browser session where you are not logged in to Streamlit Community Cloud, the confirmation link will not complete the process. You will be prompted to sign in. If you try to sign in with your new email, you will create a second account instead. See [Troubleshooting](#troubleshooting).
35
+
36
+ </Important>
37
+
38
+ ![Click 'Change email' from the message sent to your email account](/images/streamlit-community-cloud/account-change-email-5.png)
39
+
40
+ 8. A confirmation will display to confirm your email update is complete! 🎈
41
+ ![Confirmation that your email has been changed on your Streamlit Community Cloud account](/images/streamlit-community-cloud/account-change-email-6.png)
42
+
43
+ ## Resend your confirmation link
44
+
45
+ If your confirmation link expires, don't worry! You can resend it by following these steps:
46
+
47
+ 1. Sign in to Streamlit Community Cloud at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a> and click "**Settings**" in the page's top-right corner.
48
+ 2. Click "**Update pending**"
49
+ ![Click 'Update pending' from your workspace settings](/images/streamlit-community-cloud/account-change-email-7.png)
50
+
51
+ 3. Click "**Resend email**"
52
+ ![Click 'Resend email' to resend the confirmation link to your email](/images/streamlit-community-cloud/account-change-email-8.png)
53
+
54
+ 4. Continue from step 4 of [How to update your email](#how-to-update-your-email).
55
+
56
+ ## Troubleshooting
57
+
58
+ If you click the confirmation link in a browser session where you are not signed in, you will be informed that "Sign in is required." If you try to sign in with your new email, you will create a second account instead. You cannot resend your confirmation link while you have this second account. If you accidentally created a second account, you can follow the steps to [Delete your account](/deploy/streamlit-community-cloud/manage-your-account/delete-your-account) to get rid of the duplicate. Afterwards, [Resend your confirmation link](#resend-your-confirmation-link) from your first account.
59
+
60
+ ## Connect Google to your account
61
+
62
+ 1. If you signed up with GitHub and did not create a primary identity, your workspace will show a warning icon in the upper right corner. Click "**Settings**" to access your workspace settings.
63
+
64
+ ![Your workspace without a primary identity](/images/streamlit-community-cloud/account-settings-header-warning.png)
65
+
66
+ 2. When you access your workspace settings, a warning is displayed: "You are not signed in with a primary identity account." Click "**Sign in with Google**" and follow Google's authentication prompts.
67
+
68
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
69
+ <Image alt="Sign in with Google to connect your email to your Streamlit Community Cloud account" src="/images/streamlit-community-cloud/account-no-primary.png" />
70
+ </div>
71
+
72
+ 3. Your account now has both a primary identity and source control account.
73
+
74
+ <div style={{ maxWidth: '75%', margin: 'auto' }}>
75
+ <Image alt="A fully signed-in Streamlit Community Cloud account" src="/images/streamlit-community-cloud/account-primary-identity-and-source-control.png" />
76
+ </div>
data/deploy/community-cloud/manage-your-account/workspace-settings.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Workspace settings
3
+ slug: /deploy/streamlit-community-cloud/manage-your-account/workspace-settings
4
+ ---
5
+
6
+ # Workspace settings
7
+
8
+ From your workspace settings you can [Manage your account](/deploy/streamlit-community-cloud/manage-your-account), see your [App resources and limits](/deploy/streamlit-community-cloud/manage-your-app#app-resources-and-limits) and access support resources.
9
+
10
+ ## Access your workspace settings
11
+
12
+ From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click "**Settings**" in the upper-right corner.
13
+
14
+ ![Access your workspace settings](/images/streamlit-community-cloud/account-settings-header.png)
15
+
16
+ ## Linked accounts
17
+
18
+ The "**Linked accounts**" section shows your current primary identity and source control account. To learn more, see [Manage your account](/deploy/streamlit-community-cloud/manage-your-account).
19
+
20
+ ![Manage your linked accounts in workspace settings](/images/streamlit-community-cloud/account-primary-identity-and-source-control.png)
21
+
22
+ ## Limits
23
+
24
+ The "**Limits**" section shows your current resources and limits. To learn more, see [App resources and limits](/deploy/streamlit-community-cloud/manage-your-app#app-resources-and-limits).
25
+
26
+ ![Resource limits displayed in workspace settings](/images/streamlit-community-cloud/workspace-limits.png)
27
+
28
+ ## Support
29
+
30
+ The "**Support**" section provides a convenient list of useful resources so you know where to go for help.
31
+
32
+ ![Support options available through workspace settings](/images/streamlit-community-cloud/workspace-support.png)
data/deploy/community-cloud/manage-your-app/_index.md ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Manage your app
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app
4
+ ---
5
+
6
+ # Manage your app
7
+
8
+ You can manage your deployed app from your workspace atΒ <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>Β or directly from `<your-custom-subdomain>.streamlit.app`. You can view, deploy, delete, reboot, or favorite an app.
9
+
10
+ ## Manage your app from your workspace
11
+
12
+ Streamlit Community Cloud is organized into workspaces, which automatically group your apps according to the corresponding GitHub repository's owner. Your workspace is indicated in the upper-right corner. You will have one workspace that matches your GitHub username and additional workspaces for any GitHub organization or user who has granted you access.
13
+
14
+ Additionally, if you have view-only access to an app, you will be able to see that app's workspace. When you do not have developer access to an app, your management options for that app will be restricted as shown in the following sections.
15
+
16
+ To deploy or manage any app, always switch to the workspace matching the repository's owner first.
17
+
18
+ ![Switching between app workspaces in Streamlit Community Cloud](/images/streamlit-community-cloud/workspace-switch.png)
19
+
20
+ At the top of your workspace, "**Analytics**" is a shortcut to [App analytics](/deploy/streamlit-community-cloud/manage-your-app/app-analytics) and "**Settings**" links to your [Workspace settings](/deploy/streamlit-community-cloud/manage-your-account/workspace-settings) (not to be confused with [App settings](/deploy/streamlit-community-cloud/manage-your-app/app-settings) for each of your apps).
21
+
22
+ ### App overflow menus
23
+
24
+ Each app has a menu accessible from the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) to the right.
25
+
26
+ - **Copy URL** &mdash; See [Copy your app's URL](/deploy/streamlit-community-cloud/share-your-app#copy-your-apps-url)
27
+ - **Edit** &mdash; See [Edit your app with GitHub Codespaces](/deploy/streamlit-community-cloud/manage-your-app/edit-your-app#edit-your-app-with-github-codespaces)
28
+ - **Favorite** &mdash; See [Favorite your app](/deploy/streamlit-community-cloud/manage-your-app/favorite-your-app)
29
+ - **Analytics** &mdash; See [App analytics](/deploy/streamlit-community-cloud/manage-your-app/app-analytics)
30
+ - **Reboot** &mdash; See [Reboot your app](/deploy/streamlit-community-cloud/manage-your-app/reboot-your-app)
31
+ - **Delete** &mdash; See [Delete your app](/deploy/streamlit-community-cloud/manage-your-app/delete-your-app)
32
+ - **Settings** &mdash; See [App settings](/deploy/streamlit-community-cloud/manage-your-app/app-settings)
33
+
34
+ ![App overflow menu in your workspace](/images/streamlit-community-cloud/workspace-app-overflow.png)
35
+
36
+ If you have view-only access to an app, options will be restricted in that app's menu.
37
+
38
+ ![View-only app overflow menu in your workspace](/images/streamlit-community-cloud/workspace-view-only.png)
39
+
40
+ ## Manage your app directly from your app
41
+
42
+ You can manage your deployed app directly from the app itself! Just make sure you are signed in to Streamlit Community Cloud then visit your app.
43
+
44
+ ### Streamlit Community Cloud logs
45
+
46
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Manage app**" in the lower-right corner.
47
+
48
+ ![Access Cloud logs from Manage app in the lower-right corner of your app](/images/streamlit-community-cloud/cloud-logs-open.png)
49
+
50
+ 2. Once you've clicked on "**Manage app**", you will be able to view your app's logs. This is your primary place to troubleshoot any issues with your app.
51
+
52
+ ![Streamlit Community Cloud logs](/images/streamlit-community-cloud/cloud-logs.png)
53
+
54
+ 3. You can access more developer options by clicking the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) at the bottom of your Cloud logs. To conveniently download your logs, click "**Download log**".
55
+
56
+ ![Download your Streamlit Community Cloud logs](/images/streamlit-community-cloud/cloud-logs-menu-download.png)
57
+
58
+ <Flex>
59
+
60
+ <div>
61
+
62
+ Other options accessible from Cloud logs are:
63
+
64
+ - **Analytics** &mdash; See [App analytics](/deploy/streamlit-community-cloud/manage-your-app/app-analytics).
65
+ - **Reboot app** &mdash; See [Reboot your app](/deploy/streamlit-community-cloud/manage-your-app/reboot-your-app).
66
+ - **Delete app** &mdash; See [Delete your app](/deploy/streamlit-community-cloud/manage-your-app/delete-your-app).
67
+ - **Settings** &mdash; See [App settings](/deploy/streamlit-community-cloud/manage-your-app/app-settings).
68
+ - **Your apps** &mdash; Takes you to your [app workspace](#manage-your-app-from-your-workspace).
69
+ - **Documentation** &mdash; Takes you to our documentation.
70
+ - **Support** &mdash; Takes you to <a href="https://discuss.streamlit.io/" target="_blank">our forums</a>!
71
+
72
+ </div>
73
+
74
+ <div style={{ maxWidth: '30%', margin: "auto" }}>
75
+ <Image src="/images/streamlit-community-cloud/cloud-logs-menu-XL.png" clean />
76
+ </div>
77
+
78
+ </Flex>
79
+
80
+ ### App menus
81
+
82
+ From your app at `<your-custom-subdomain>.streamlit.app`, you can always access your [app's menu](/develop/concepts/architecture/app-chrome) just like you can when developing locally. The option to deploy your app is removed, but you can still clear your cache from here.
83
+
84
+ ![App menus in Streamlit Community Cloud](/images/streamlit-community-cloud/app-menu.png)
85
+
86
+ ## Manage your app in GitHub
87
+
88
+ ### Update your app
89
+
90
+ Your GitHub repository is the source for the app, so that means that any time you push an update to your repo you'll see it reflected in the app in almost real time. Try it out!
91
+
92
+ Streamlit also smartly detects whether you touched your dependencies, in which case it will automatically do a full redeploy for youβ€”which will take a little more time. But since most updates don't involve dependency changes, you should usually see your app update in real time.
93
+
94
+ ### Add or remove dependencies
95
+
96
+ You can add/remove dependencies at any point by updatingΒ `requirements.txt`Β (Python dependenciess) orΒ `packages.txt`Β (Linux dependencies) and committing the changes to your repository on GitHub. This will cause Streamlit Community Cloud to detect there was a change in your dependencies and automatically trigger (re)installation.
97
+
98
+ It is best practice to pin your Streamlit version inΒ `requirements.txt`. Otherwise, the version may be auto-upgraded at any point without your knowledge, which could lead to undesired results (e.g. when we deprecate a feature in Streamlit).
99
+
100
+ ## App resources and limits
101
+
102
+ ### Resource limits
103
+
104
+ All Streamlit Community Cloud users have access to the same resources and are subject to the same limits. These limits may change at any time without notice. If your app meets or exceeds its limits, it may slow down from throttling or become nonfunctional. The limits as of February 2024 are approximately as follows:
105
+
106
+ - CPU: 0.078 cores minimum, 2 cores maximum
107
+ - Memory: 690MB minimum, 2.7GBs maximum
108
+ - Storage: No minimum, 50GB maximum
109
+
110
+ Symptoms that your app is running out of resources include the following:
111
+
112
+ - Your app is running slowly.
113
+ - Your app displays "🀯 This app has gone over its resource limits."
114
+ - Your app displays "😦 Oh no."
115
+
116
+ ### Good for the world
117
+
118
+ Streamlit offers increased resources for apps with good-for-the-world use cases. Generally, these apps are used by an educational institution or nonprofit organization, are part of an open-source project, or benefit the world in some way. If your app is **not** primarily used by a for-profit company you can [apply for increased resources](https://share.hsforms.com/1DzDGAjUmSPy_2nUzBj3rlQ3wudj).
119
+
120
+ If you are an educator or student looking to deploy additional private apps, please [apply to our education program](https://share.hsforms.com/1M_e2WDcSRFuKzA2iteoAIg3wudj) instead.
121
+
122
+ ### Optimizing your app
123
+
124
+ If your app is running slow or showing the error pages mentioned above, we first highly recommend going through and implementing the suggestions in the following blog posts to prevent your app from hitting the resource limits and to detect if your Streamlit app leaks memory:
125
+
126
+ - <a href="https://blog.streamlit.io/common-app-problems-resource-limits/" target="_blank">Common app problems: Resource limits</a>
127
+ - <a href="https://blog.streamlit.io/3-steps-to-fix-app-memory-leaks/" target="_blank">3 steps to fix app memory leaks</a>
128
+
129
+ If your app exceeds its resource limits, developers and viewers alike will see "😦 Oh no."
130
+
131
+ <div style={{ maxWidth: '70%', margin: 'auto' }}>
132
+ <Image alt="App state: Oh no. Error running your app." src="/images/streamlit-community-cloud/app-state-oh-no.png" />
133
+ </div>
134
+
135
+ If see "😦 Oh no." when viewing your app, first check your Cloud logs for any specific errors. If there are no errors in your Cloud logs you are likely dealing with a resource issue.
136
+
137
+ #### Developer view
138
+
139
+ If you are logged into a developer account for an app over its limits, you can access "**Manage app**" from the lower-right corner of the app to reboot it and clear its memory. "**Manage app**" will be red and have a warning icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>error</i>).
140
+
141
+ ![Developer view: Oh no. Error running your app.](/images/streamlit-community-cloud/app-state-oh-no-developer.png)
142
+
143
+ ### App hibernation
144
+
145
+ All apps without traffic for 7 consecutive days will automatically go to sleep. This is done to alleviate resources and allow the best communal use of the platform! If you would like to keep your app awake, simply visit the app to create traffic or commit your app's repository, even if it's an empty commit!
146
+
147
+ If left alone your app will go to sleep at the 7 day mark. When someone visits the app after this, they will see the sleeping page:
148
+
149
+ <div style={{ maxWidth: '80%', margin: 'auto' }}>
150
+ <Image alt="App state: Zzzz. This app has gone to sleep due to inactivity." src="/images/streamlit-community-cloud/app-state-zzzz.png" />
151
+ </div>
152
+
153
+ To wake the app up, click "**Yes, get this app back up!**" This can be done byΒ *anyone*Β who has access to view the app, not just the app developer!
154
+
155
+ You can see which of your apps are asleep from your workspace. Sleeping apps have a moon icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>bedtime</i>) to the right.
156
+
157
+ ![App state: Zzzz. This app has gone to sleep due to inactivity](/images/streamlit-community-cloud/app-state-zzzz-workspace.png)
data/deploy/community-cloud/manage-your-app/app-analytics.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: App analytics
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app/app-analytics
4
+ ---
5
+
6
+ # App analytics
7
+
8
+ Streamlit Community Cloud allows you to see the viewership of each of your apps. Specifically, you can see:
9
+
10
+ - The total viewers count of your app (counted from April 2022).
11
+ - The most recent unique viewers (capped up to your last 20 viewers).
12
+ - A relative timestamp of each unique viewer's last visit.
13
+
14
+ ![App analytics on Streamlit Community Cloud](/images/streamlit-community-cloud/workspace-app-analytics-viewers.png)
15
+
16
+ ## Access your app analytics
17
+
18
+ You can get to your app's analytics:
19
+
20
+ - [From your workspace](#access-app-analytics-from-your-workspace).
21
+ - [From your Cloud logs](#access-app-analytics-from-your-cloud-logs).
22
+
23
+ ### Access app analytics from your workspace
24
+
25
+ From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) next to your app. Click "**Analytics**".
26
+
27
+ ![Access app analytics from your workspace through your app overflow menu](/images/streamlit-community-cloud/workspace-app-analytics.png)
28
+
29
+ Alternatively, from the top of your workspace, click "**Analytics**".
30
+
31
+ ![Access app analytics from your workspace](/images/streamlit-community-cloud/workspace-analytics.png)
32
+
33
+ ### Access app analytics from your Cloud logs
34
+
35
+ From your app at `<your-custom-subdomain>.streamlit.app`, click "**Manage app**" in the lower-right corner.
36
+
37
+ ![Access Streamlit Community Cloud logs from your app](/images/streamlit-community-cloud/cloud-logs-open.png)
38
+
39
+ Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) and click "**Analytics**".
40
+
41
+ ![Access app analytics from your Cloud logs](/images/streamlit-community-cloud/cloud-logs-menu-analytics.png)
42
+
43
+ ## Switch between apps
44
+
45
+ Once you are in the analytics modal, you can switch between apps in your workspace from the drop-down list. Remember to switch workspaces if you want to view analytics for an app in another workspace.
46
+
47
+ ![Switch between apps with app analytics](/images/streamlit-community-cloud/workspace-app-analytics-switch.png)
48
+
49
+ ## App viewers
50
+
51
+ For public apps, we anonymize all viewers outside your workspace to protect their privacy and display anonymous viewers as random pseudonyms. You'll still be able to see the identities of fellow members in your workspace, including any viewers you've invited (once they've accepted).
52
+
53
+ <Important>
54
+
55
+ When you invite a viewer to an app, they gain access to analytics as well. Additionally, if someone is invited as a viewer to _any_ app in your workspace, they can see analytics for all public apps in your workspace and invite additional viewers themselves. A viewer in your workspace may see the emails of developers and other viewers in your workspace through analytics.
56
+
57
+ </Important>
58
+
59
+ Meanwhile, for private apps where you control who has access, you will be able to see the specific users who recently viewed your apps.
60
+
61
+ Additionally, you may occasionally see anonymous users in a private app. Rest assured, these anonymous users _do_ have authorized view access granted by you or your workspace members.
62
+
63
+ Common reasons why users show up anonymously are:
64
+
65
+ 1. The app was previously public.
66
+ 2. The given viewer viewed the app in April 2022, when the Streamlit team was honing user identification for this feature.
67
+ 3. The given viewer previously disconnected their primary identity (Google or email) and source control identity (GitHub).
68
+
69
+ See Streamlit's general <a href="https://streamlit.io/privacy-policy" target="_blank">Privacy Notice</a>.
data/deploy/community-cloud/manage-your-app/app-settings.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: App settings
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app/app-settings
4
+ ---
5
+
6
+ # App settings
7
+
8
+ This page is about your app settings on Streamlit Community Cloud. From your app settings you can [view or modify your app's URL](/deploy/streamlit-community-cloud/deploy-your-app#custom-subdomains), [manage public or private access to your apps](/deploy/streamlit-community-cloud/share-your-app) and [update your saved secrets for your apps](/deploy/streamlit-community-cloud/deploy-your-app/secrets-management).
9
+
10
+ If you access "**Settings**" from your [App menu](/develop/concepts/architecture/app-chrome) in the upper-right corner of your running app, you can access features to control the appearance of your app while its running.
11
+
12
+ ## Access your app settings
13
+
14
+ You can get to your app's settings:
15
+
16
+ - [From your workspace](#access-app-settings-from-your-workspace).
17
+ - [From your Cloud logs](#access-app-settings-from-your-cloud-logs).
18
+
19
+ ### Access app settings from your workspace
20
+
21
+ From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) next to your app. Click "**Settings**".
22
+
23
+ ![Access app settings from your workspace](/images/streamlit-community-cloud/workspace-app-settings.png)
24
+
25
+ ### Access app settings from your Cloud logs
26
+
27
+ From your app at `<your-custom-subdomain>.streamlit.app`, click "**Manage app**" in the lower-right corner.
28
+
29
+ ![Access Streamlit Community Cloud logs from your app](/images/streamlit-community-cloud/cloud-logs-open.png)
30
+
31
+ Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) and click "**Settings**".
32
+
33
+ ![Access app settings from your Cloud logs](/images/streamlit-community-cloud/cloud-logs-menu-settings.png)
34
+
35
+ ## Change your app settings
36
+
37
+ ### View or change your app's URL
38
+
39
+ Read more about [Custom subdomains](/deploy/streamlit-community-cloud/deploy-your-app#custom-subdomains).
40
+
41
+ ![General app settings on Streamlit Community Cloud: Custom subdomain](/images/streamlit-community-cloud/workspace-app-settings-general.png)
42
+
43
+ ### Update your app's share settings
44
+
45
+ Learn how to [Share your app](/deploy/streamlit-community-cloud/share-your-app).
46
+
47
+ ![Share settings on Streamlit Community Cloud](/images/streamlit-community-cloud/workspace-app-settings-sharing.png)
48
+
49
+ ### Update your secrets
50
+
51
+ Learn more about [Secrets management](/deploy/streamlit-community-cloud/deploy-your-app/secrets-management).
52
+
53
+ ![Secrets settings on Streamlit Community Cloud](/images/streamlit-community-cloud/workspace-app-settings-secrets.png)
data/deploy/community-cloud/manage-your-app/delete-your-app.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Delete your app
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app/delete-your-app
4
+ ---
5
+
6
+ # Delete your app
7
+
8
+ If you need to delete your app, it's simple and easy. There are several cases where you may need to delete your app:
9
+
10
+ - You have finished playing around with an example app.
11
+ - You want to deploy from a private repository but already have a private app.
12
+ - You want to change the Python version for your app or otherwise redeploy your app.
13
+
14
+ If you delete your app and intend to immediately redploy it, your custom subdomain should be immediately available for reuse. Read more about data deletion in [Streamlit trust and security](/deploy/streamlit-community-cloud/get-started/trust-and-security#data-deletion).
15
+
16
+ You can delete your app:
17
+
18
+ - [From your workspace](#delete-your-app-from-your-workspace).
19
+ - [From your Cloud logs](#delete-your-app-from-your-cloud-logs).
20
+
21
+ ### Delete your app from your workspace
22
+
23
+ 1. From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) next to your app. Click "**Delete**".
24
+
25
+ ![Delete your app from your workspace](/images/streamlit-community-cloud/workspace-app-delete.png)
26
+
27
+ 2. A confirmation will display. Enter the required confirmation string and click "**Delete**".
28
+
29
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
30
+ <Image alt="Confirm deleting your app from Streamlit Community Cloud" src="/images/streamlit-community-cloud/workspace-app-delete-confirm.png" clean />
31
+ </div>
32
+
33
+ ### Delete your app from your Cloud logs
34
+
35
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Manage app**" in the lower-right corner.
36
+
37
+ ![Access Streamlit Community Cloud logs from your app](/images/streamlit-community-cloud/cloud-logs-open.png)
38
+
39
+ 2. Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) and click "**Delete app**".
40
+
41
+ ![Delete your app from your Cloud logs](/images/streamlit-community-cloud/cloud-logs-menu-delete.png)
42
+
43
+ 3. A confirmation will display. Enter the required confirmation string and click "**Delete**".
44
+
45
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
46
+ <Image alt="Confirm deleting your app from Streamlit Community Cloud" src="/images/streamlit-community-cloud/workspace-app-delete-confirm.png" clean />
47
+ </div>
data/deploy/community-cloud/manage-your-app/edit-your-app.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Edit your app
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app/edit-your-app
4
+ ---
5
+
6
+ # Edit your app
7
+
8
+ You can edit your app from any development environment of your choice. Community Cloud will monitor your repository and automatically copy any file changes you commit. You will immediately see commits reflected in your deployed app for most changes (such as edits to your app's Python files).
9
+
10
+ Community Cloud also makes it easy to skip the work of setting up a development environment. With a few simple clicks, you can configure a development environment using GitHub Codespaces.
11
+
12
+ ## Edit your app with GitHub Codespaces
13
+
14
+ Spin up a cloud-based development environment for your deployed app in minutes. You can run your app within your codespace to enjoy experimenting in a safe, sandboxed environment. When you are done editing your code, you can commit your changes to your repo or just leave them in your codespace to return to later.
15
+
16
+ ### Create a codespace for your deployed app
17
+
18
+ 1. From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) next to your app. Click "**Edit**."
19
+
20
+ ![Edit your app with GitHub Codespaces](/images/streamlit-community-cloud/workspace-app-edit.png)
21
+
22
+ 2. A `.devcontainer/devcontainer.json` file will be added to your repository. If you already have a file of the same name in your repository, it will not be changed. You may delete or rename your existing devcontainer configuration if you would like your repository to receive the instance created by Streamlit Community Cloud.
23
+
24
+ ![Adding a devcontainer file to your repository](/images/streamlit-community-cloud/workspace-app-edit-preparing.png)
25
+
26
+ 3. Click "**Create codespace**" to confirm the creation of a codespace on your account. Read more about <a href="https://github.com/features/codespaces" target="_blank">GitHub Codespaces</a> to learn about monthly limits for free use and paid plans.
27
+
28
+ ![Create your GitHub Codespace](/images/streamlit-community-cloud/deploy-codespaces-2.png)
29
+
30
+ 4. Wait for GitHub to set up your codespace.
31
+
32
+ ![GitHub preparing your codespace](/images/streamlit-community-cloud/deploy-codespaces-3.png)
33
+
34
+ 5. GitHub will automatically execute the commands to launch your Streamlit app within your codespace. Your app will be visible in a "Simple Browser" on the right. This may take a minute to complete from when your codespace first appears on screen.
35
+
36
+ ![Your new GitHub Codespace](/images/streamlit-community-cloud/deploy-sample-codespace.png)
37
+
38
+ 6. When you make changes to your app, the file is automatically saved within your codespace. Your edits do not affect your repository unless you choose to commit those changes. We will describe committing your changes in a later step.
39
+
40
+ In order to see updates automatically reflected on the right, click "**Always rerun**" when prompted after an edit.
41
+
42
+ ![Edit the title of your sample Streamlit app](/images/streamlit-community-cloud/deploy-sample-edit-title.png)
43
+ ![Select "Always rerun" to automatically see edits in your running app](/images/streamlit-community-cloud/deploy-sample-edit-rerun.png)
44
+
45
+ 7. See your edits appear within the "Simple Browser" tab and keep going with more!
46
+
47
+ ![See the results of your edit to your Streamlit app](/images/streamlit-community-cloud/deploy-sample-edit-result.png)
48
+
49
+ ### Commit your changes to your repository (optional)
50
+
51
+ After making edits to your app, you can choose to commit your edits to your repository to update your deployed app instantly. If you just want to keep your edits in your codespace to return to later, skip to [Stop or delete your codespace](#stop-or-delete-your-codespace).
52
+
53
+ 8. In the left navigation bar, click the source control icon.
54
+
55
+ ![Click on the source control icon](/images/streamlit-community-cloud/deploy-sample-edit-commit-1.png)
56
+
57
+ 9. Fill out your desired commit message and click "**Commit**."
58
+
59
+ ![Commit your changes](/images/streamlit-community-cloud/deploy-sample-edit-commit-2.png)
60
+
61
+ 10. Click "**Yes**" to stage and commit all your changes. To learn more about source control in GitHub Codespaces, check out <a href="https://docs.github.com/en/codespaces/developing-in-codespaces/using-source-control-in-your-codespace" target="_blank">Source control</a> in GitHub Docs.
62
+
63
+ <div style={{ maxWidth: '70%', margin: 'auto' }}>
64
+ <Image alt="Confirm to stage all changes and commit" src="/images/streamlit-community-cloud/deploy-sample-edit-commit-3.png" />
65
+ </div>
66
+
67
+ ### Stop or delete your codespace
68
+
69
+ When you are done, remember to stop your codespace on GitHub to avoid any undesired use of your capacity.
70
+
71
+ 11. Go to <a href="https://github.com/codespaces" target="_blank">github.com/codespaces</a>. At the bottom of the page, all your codespaces are listed. Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_horiz</i>) for your codespace.
72
+
73
+ <div style={{ maxWidth: '90%', margin: 'auto' }}>
74
+ <Image alt="Stop or delete your GitHub Codespace" src="/images/streamlit-community-cloud/deploy-sample-codespace-manage.png" />
75
+ </div>
76
+
77
+ 12. Click "**Stop codespace**" if you'd like to return to your work later. Otherwise, click "**Delete**."
78
+
79
+ <Flex>
80
+ <div style={{ maxWidth: '40%', margin: 'auto' }}>
81
+ <Image alt="Stop your GitHub codespace" src="/images/streamlit-community-cloud/codespace-menu-stop.png" />
82
+ </div>
83
+ <div style={{ maxWidth: '40%', margin: 'auto' }}>
84
+ <Image alt="Delete your GitHub codespace" src="/images/streamlit-community-cloud/codespace-menu-delete.png" />
85
+ </div>
86
+ </Flex>
data/deploy/community-cloud/manage-your-app/favorite-your-app.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Favorite your app
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app/favorite-your-app
4
+ ---
5
+
6
+ # Favorite your app
7
+
8
+ Streamlit Community Cloud supports a "favorite" feature that lets you quickly access your apps from your workspace. Favorited apps appear at the top of their workspace with a yellow star (<i style={{ verticalAlign: "-.25em", color: "#faca2b" }} className={{ class: "material-icons-sharp" }}>star</i>) beside them. You can favorite and unfavorite apps in any workspace to which you have access as a developer or invited viewer.
9
+
10
+ ![Favorite apps appear on top in Streamlit Community Cloud](/images/streamlit-community-cloud/workspace-app-favorites-top.png)
11
+
12
+ <Note>
13
+
14
+ Favorites are specific to your account. Other members of your workspace cannot see which apps you have favorited.
15
+
16
+ </Note>
17
+
18
+ ## Favoriting and unfavoriting your app
19
+
20
+ You can favorite your app:
21
+
22
+ - [From your workspace](#favorite-your-app-from-your-workspace).
23
+ - [From your app](#favorite-your-app-from-your-app-toolbar)!
24
+
25
+ ### Favorite your app from your workspace
26
+
27
+ 1. From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) next to your app. Click "**Favorite**".
28
+
29
+ ![Favorite your app from your workspace](/images/streamlit-community-cloud/workspace-app-favorite.png)
30
+
31
+ 2. Your favorited app will move to the top of your list (with other favorited apps if you have them) and display with a yellow star.
32
+
33
+ ![Favorited app in your workspace](/images/streamlit-community-cloud/workspace-app-favorited.png)
34
+
35
+ - Once favorited, from the same menu, click "**Unfavorite**" to remove the star.
36
+
37
+ ![Unfavorite your app from your workspace](/images/streamlit-community-cloud/workspace-app-unfavorite.png)
38
+
39
+ Alternatively, you can favorite and unfavorite apps by clicking directly on the star next to their names. (Hover over an unfavorited app to reveal an empty star icon next to its name.)
40
+
41
+ ### Favorite your app from your app toolbar
42
+
43
+ From your app at `<your-custom-subdomain>.streamlit.app`, click the star (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>star_border</i>/<i style={{ verticalAlign: "-.25em", color: "#faca2b" }} className={{ class: "material-icons-sharp" }}>star</i>) in the upper-right corner to toggle your app's favorite status.
44
+
45
+ ![Favorite your app directly from your live app](/images/streamlit-community-cloud/favorite-select.png)
data/deploy/community-cloud/manage-your-app/reboot-your-app.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Reboot your app
3
+ slug: /deploy/streamlit-community-cloud/manage-your-app/reboot-your-app
4
+ ---
5
+
6
+ # Reboot your app
7
+
8
+ If you need to clear your app's memory or force a fresh build after modifying a file that Streamlit Community Cloud doesn't monitor, you may need to reboot your app. This will interrupt any user who may currently be using your app and may take a few minutes for your app to re-deploy. Anyone visiting your app will see "Your app is in the oven" during a reboot.
9
+
10
+ Rebooting your app on Streamlit Community Cloud is easy! You can reboot your app:
11
+
12
+ - [From your workspace](#reboot-your-app-from-your-workspace).
13
+ - [From your Cloud logs](#reboot-your-app-from-your-cloud-logs).
14
+
15
+ ### Reboot your app from your workspace
16
+
17
+ 1. From your workspace at <a href="https://share.streamlit.io" target="_blank">share.streamlit.io</a>, click the overflow icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) next to your app. Click "**Reboot**".
18
+
19
+ ![Reboot your app from your workspace](/images/streamlit-community-cloud/workspace-app-reboot.png)
20
+
21
+ 2. A confirmation will display. Click "**Reboot**".
22
+
23
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
24
+ <Image alt="Confirm rebooting your app in Streamlit Community Cloud" src="/images/streamlit-community-cloud/workspace-app-reboot-confirm.png" clean />
25
+ </div>
26
+
27
+ ### Reboot your app from your Cloud logs
28
+
29
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Manage app**" in the lower-right corner.
30
+
31
+ ![Access Streamlit Community Cloud logs from your app](/images/streamlit-community-cloud/cloud-logs-open.png)
32
+
33
+ 2. Click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) and click "**Reboot app**".
34
+
35
+ ![Reboot your app from your Cloud logs](/images/streamlit-community-cloud/cloud-logs-menu-reboot.png)
36
+
37
+ 3. A confirmation will display. Click "**Reboot**".
38
+
39
+ <div style={{ maxWidth: '50%', margin: 'auto' }}>
40
+ <Image alt="Confirm rebooting your app in Streamlit Community Cloud" src="/images/streamlit-community-cloud/workspace-app-reboot-confirm.png" clean />
41
+ </div>
data/deploy/community-cloud/share-your-app/_index.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Share your app
3
+ slug: /deploy/streamlit-community-cloud/share-your-app
4
+ ---
5
+
6
+ # Share your app
7
+
8
+ Now that your app is deployed you can easily share it and collaborate on it. But first, let's take a moment and do a little joy dance for getting that app deployed! πŸ•ΊπŸ’ƒ
9
+
10
+ Your app is now live at a fixed URL, so go wild and share it with whomever you want. Your app will inherit permissions from your GitHub repo, meaning that if your repo is private your app will be private and if your repo is public your app will be public. If you want to change that you can simply do so from the app settings menu.
11
+
12
+ You are only allowed one private app at a time. If you've deployed from a private repository, you will have to make that app public or delete it before you can deploy another app from a private repository. Only developers can change your app between public and private.
13
+
14
+ - [Make your app public or private](#make-your-app-public-or-private)
15
+ - [Share your public app](#share-your-public-app)
16
+ - [Share your private app](#share-your-private-app)
17
+
18
+ ## Make your app public or private
19
+
20
+ If you deployed your app from a public repository, your app will be public by default. If you deployed your app from a private repository, you will need to make the app public if you want to freely share it with the community at large.
21
+
22
+ ### Set privacy from your app settings
23
+
24
+ 1. Access your [App settings](/deploy/streamlit-community-cloud/manage-your-app/app-settings) and go to the "**Sharing**" section.
25
+
26
+ ![Share settings on Streamlit Community Cloud](/images/streamlit-community-cloud/workspace-app-settings-sharing.png)
27
+
28
+ 2. Set your app's privacy under "Who can view this app." Select "**This app is public and searchable**" to make your app public. Select "**Only specific people can view this app**" to make your app private.
29
+
30
+ ![Set your app's privacy in share settings](/images/streamlit-community-cloud/workspace-app-settings-sharing-change.png)
31
+
32
+ ### Set privacy from the share button
33
+
34
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Share**" in the upper-right corner.
35
+
36
+ ![Access the share button from your app](/images/streamlit-community-cloud/share-open.png)
37
+
38
+ 2. Toggle your app between public and private by clicking "**Make this app public**".
39
+
40
+ ![Toggle your app between public and private from the share button](/images/streamlit-community-cloud/share-menu-public-toggle.png)
41
+
42
+ ## Share your public app
43
+
44
+ Once your app is public, just give anyone your app's URL and they view it! Streamlit Community Cloud has several convenient shortcuts for sharing your app.
45
+
46
+ ### Share your app on social media
47
+
48
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Share**" in the upper-right corner.
49
+ 2. Click "**Social**" to access convenient social media share buttons.
50
+
51
+ ![Social media sharing links from the share button](/images/streamlit-community-cloud/share-menu-social.png)
52
+
53
+ <Tip>
54
+
55
+ Use the social media sharing buttons to post your app on our forum! We'd love to see what you make and perhaps feature your app as our app of the month. πŸ’–
56
+
57
+ </Tip>
58
+
59
+ ### Invite viewers by email
60
+
61
+ Whether your app is public or private, you can send an email invite to your app directly from Streamlit Community Cloud. This grants the viewer access to analytics for all your public apps and the ability to invite other viewers to your workspace. Developers and invited viewers are identified by their email in analytics instead of appearing anonymously (if they view any of your apps while logged in). Read more about viewers in [App analytics](/deploy/streamlit-community-cloud/manage-your-app/app-analytics).
62
+
63
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Share**" in the upper-right corner.
64
+ 2. Enter an email address and click "**Invite**".
65
+
66
+ ![Invite viewers from the share button](/images/streamlit-community-cloud/share-invite-public.png)
67
+
68
+ 3. Invited users will get a direct link to your app in their inbox.
69
+
70
+ ![Invitation email sent to viewers](/images/streamlit-community-cloud/share-invite-email.png)
71
+
72
+ ### Copy your app's URL
73
+
74
+ You can convenitiently copy your app's URL from the share menu or from your workspace.
75
+
76
+ - From your app click "**Share**" in the upper-right corner then click "**Copy link**".
77
+
78
+ ![Copy your app's URL from the share button](/images/streamlit-community-cloud/share-copy.png)
79
+
80
+ - From your workspace click the overflow menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>) then click "**Copy URL**".
81
+
82
+ ![Copy your app's URL from your workspace](/images/streamlit-community-cloud/workspace-app-copy.png)
83
+
84
+ ### Add a badge to your GitHub repository
85
+
86
+ To help others find and play with your Streamlit app, you can add Streamlit's GitHub badge to your repo. Below is an enlarged example of what the badge looks like. Clicking on the badge takes you to&mdash;in this case&mdash;Streamlit's Roadmap.
87
+
88
+ <div style={{ marginBottom: '2em' }}>
89
+ <div style={{ width: 'fit-content', margin: 'auto' }}>
90
+ <a href="https://roadmap.streamlit.app/" target="_blank">
91
+ <Image alt="Open in Streamlit badge for GitHub" src="/images/streamlit-community-cloud/github-badge.svg" pure />
92
+ </a>
93
+ </div>
94
+ </div>
95
+
96
+ Once you deploy your app, you can embed this badge right into your GitHub README.md by adding the following Markdown:
97
+
98
+ ```markdown
99
+ [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://<your-custom-subdomain>.streamlit.app)
100
+ ```
101
+
102
+ <Note>
103
+
104
+ Be sure to replace `https://<your-custom-subdomain>.streamlit.app` with the URL of your deployed app!
105
+
106
+ </Note>
107
+
108
+ ## Share your private app
109
+
110
+ By default an app deployed from a private repository will be private to the developers in the workspace. A private app will not be visible to anyone else unless you grant them explicit permission. You can grant permission by adding them as a developer on GitHub or by adding them as a viewer on Streamlit Community Cloud.
111
+
112
+ Once you have added someone's email address to your app's viewer list, that person will be able to sign in and view your private app. If their email is associated to a Google account, they will be able to sign in with Google OAuth. Otherwise, they will be able to sign in with single-use, emailed links. Streamlit sends an email invitation with a link to your app every time you invite someone.
113
+
114
+ <Important>
115
+
116
+ When you add a viewer to any app in your workspace, they are granted access to analytics for that app as well as analytics for all your public apps. They can also pass these permissions to others by inviting more viewers. All viewers and developers in your workspace are identified by their email in analytics. Furthermore, their emails show in analytics for every app in your workspace and not just apps they are explicitly invited to. Read more about viewers in [App analytics](/deploy/streamlit-community-cloud/manage-your-app/app-analytics)
117
+
118
+ </Important>
119
+
120
+ ### Invite viewers from the share button
121
+
122
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Share**" in the upper-right corner.
123
+
124
+ ![Access the share button from your app](/images/streamlit-community-cloud/share-open.png)
125
+
126
+ 2. Enter the email to send an invitation to and click "**Invite**".
127
+
128
+ ![Invite viewers from the share button](/images/streamlit-community-cloud/share-invite.png)
129
+
130
+ 3. Invited users appear in the list below.
131
+
132
+ ![View invited users from the share button](/images/streamlit-community-cloud/share-invited.png)
133
+
134
+ 4. Invited users will get a direct link to your app in their inbox.
135
+
136
+ ![Invitation email sent to viewers](/images/streamlit-community-cloud/share-invite-email.png)
137
+
138
+ - To remove a viewer, simply access the share menu as above and click the <i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>close</i> next to their name.
139
+
140
+ ![Remove viewers from the share button](/images/streamlit-community-cloud/share-remove.png)
141
+
142
+ ### Invite viewers from your app settings
143
+
144
+ 1. Access your [App settings](/deploy/streamlit-community-cloud/manage-your-app/app-settings) and go to the "**Sharing**" section.
145
+
146
+ ![Access sharing settings from your app settings](/images/streamlit-community-cloud/workspace-app-settings-sharing.png)
147
+
148
+ 2. Add or remove users from the list of viewers. Click "**Save**".
149
+
150
+ ![Invite and remove viewers from your app settings](/images/streamlit-community-cloud/workspace-app-settings-sharing-invite.png)
data/deploy/community-cloud/share-your-app/embed-your-app.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Embed your app
3
+ slug: /deploy/streamlit-community-cloud/share-your-app/embed-your-app
4
+ ---
5
+
6
+ # Embed your app
7
+
8
+ Embedding Streamlit Community Cloud apps enriches your content by integrating interactive, data-driven applications directly within your pages. Whether you're writing a blog post, a technical document, or sharing resources on platforms like Medium, Notion, or even StackOverflow, embedding Streamlit apps adds a dynamic component to your content. This allows your audience to interact with your ideas, rather than merely reading about them or looking at screenshots.
9
+
10
+ Streamlit Community Cloud supports both [iframe](#embedding-with-iframes) and [oEmbed](#embedding-with-oembed) methods for embedding **public** apps. This flexibility enables you to share your apps across a wide array of platforms, broadening your app's visibility and impact. In this guide, we'll cover how to use both methods effectively to share your Streamlit apps with the world.
11
+
12
+ ## Embedding with iframes
13
+
14
+ Streamlit Community Cloud supports embeddingΒ **public**Β apps using the subdomain scheme. To embed a public app, add the query parameterΒ `/?embed=true`Β to the end of theΒ `*.streamlit.app`Β URL.
15
+
16
+ For example, say you want to embed the <a href="https://30days.streamlit.app/" target="_blank">30DaysOfStreamlit app</a>. The URL to include in your iframe is: `https://30days.streamlit.app/?embed=true`:
17
+
18
+ ```javascript
19
+ <iframe
20
+ src="https://30days.streamlit.app/?embed=true"
21
+ height="450"
22
+ style={{ width: "100%", border: "none" }}
23
+ ></iframe>
24
+ ```
25
+
26
+ <Cloud src="https://30days.streamlit.app/?embed=true" />
27
+
28
+ <Important>
29
+
30
+ There will be no official support for embedding private apps.
31
+
32
+ </Important>
33
+
34
+ In addition to allowing you to embed apps via iframes, theΒ `?embed=true`Β query parameter also does the following:
35
+
36
+ - Removes the toolbar with the app menu icon (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>).
37
+ - Removes the padding at the top and bottom of the app.
38
+ - Removes the footer.
39
+ - Removes the colored line from the top of the app.
40
+
41
+ For granular control over the embedding behavior, Streamlit allows you to specify one or more instances of the `?embed_options` query parameter (e.g. to show the toolbar, open the app in dark theme, etc). [Click here for a full list of Embed options.](#embed-options)
42
+
43
+ ## Embedding with oEmbed
44
+
45
+ Streamlit's oEmbed support allows for a simpler embedding experience. You can directly drop a Streamlit app's URL into a Medium, Ghost, or Notion page (or any of more than 700 content providers that supports oEmbed or <a href="https://embed.ly/" target="_blank">embed.ly</a>). The embedded app will automatically appear! This helps Streamlit Community Cloud apps seamlessly integrate into these platforms, improving the visibility and accessibility of your apps.
46
+
47
+ ### Example
48
+
49
+ When creating content in a Notion page, Medium article, or Ghost blog, you only need to paste the app's URL and hit "**Enter**". The app will then render automatically at that spot in your content. You can use your undecorated app URL without the `?embed=true` query parameter.
50
+
51
+ ```
52
+ https://30days.streamlit.app/
53
+ ```
54
+
55
+ Here's an example of <a href="https://github.com/chrieke" target="_blank">@chrieke</a>'s <a href="https://chrieke-prettymapp-streamlit-prettymappapp-1k0qxh.streamlit.app/" target="_blank">Prettymapp app</a> embedded in a Medium article:
56
+
57
+ <Image src="/images/streamlit-community-cloud/oembed.gif" alt="Example: Embed an app in a Medium article with oEmbed" clean />
58
+
59
+ <Tip>
60
+
61
+ Ensure the platform hosting the embedded Streamlit app supports oEmbed or <a href="https://embed.ly/" target="_blank">embed.ly</a>.
62
+
63
+ </Tip>
64
+
65
+ ### Key Sites for oEmbed
66
+
67
+ oEmbed should work out of the box for several platforms including but not limited to:
68
+
69
+ - <a target="_blank" href="https://medium.com/">Medium</a>
70
+ - <a target="_blank" href="https://notion.so/">Notion</a>
71
+ - <a target="_blank" href="https://www.looker.com/">Looker</a>
72
+ - <a target="_blank" href="https://www.tableau.com/">Tableau</a>
73
+ - <a target="_blank" href="https://ghost.org/">Ghost</a>
74
+ - <a target="_blank" href="https://www.discourse.org/">Discourse</a>
75
+ - <a target="_blank" href="https://stackoverflow.com/">StackOverflow</a>
76
+ - <a target="_blank" href="https://www.w3schools.com/">W3</a>
77
+ - <a target="_blank" href="https://www.reddit.com/">Reddit</a>
78
+
79
+ Please check the specific platform's documentation to verify support for oEmbed.
80
+
81
+ ### iframe versus oEmbed
82
+
83
+ The only noteworthy differences between the methods is that iframing allows you to customize the app's embedding behavior (e.g. showing the toolbar, opening the app in dark theme, etc) using the various `?embed_options` described in the next section.
84
+
85
+ ## Embed options
86
+
87
+ When [Embedding with iframes](#embedding-with-iframes), Streamlit allows you to specify one or more instances of the `?embed_options` query parameter for granular control over the embedding behavior.
88
+
89
+ BothΒ `?embed`Β andΒ `?embed_options`Β are invisible toΒ [`st.query_params`](/develop/api-reference/caching-and-state/st.query_params) and its precursors, [`st.experimental_get_query_params`](/develop/api-reference/caching-and-state/st.experimental_get_query_params) andΒ [`st.experimental_set_query_params`](/develop/api-reference/caching-and-state/st.experimental_set_query_params). You can't get or set their values.
90
+
91
+ The supported values forΒ `?embed_options`Β are listed below:
92
+
93
+ 1. Show the toolbar at the top right of the app which includes the app menu (<i style={{ verticalAlign: "-.25em" }} className={{ class: "material-icons-sharp" }}>more_vert</i>), running man, and link to GitHub.
94
+
95
+ ```javascript
96
+ /?embed=true&embed_options=show_toolbar
97
+ ```
98
+
99
+ 2. Show padding at the top and bottom of the app.
100
+
101
+ ```javascript
102
+ /?embed=true&embed_options=show_padding
103
+ ```
104
+
105
+ 3. Show the footer reading "Made with Streamlit." (This doesn't apply to Streamlit versions 1.29.0 and later since the footer was removed from the library.)
106
+
107
+ ```javascript
108
+ /?embed=true&embed_options=show_footer
109
+ ```
110
+
111
+ 4. Show the colored line at the top of the app.
112
+
113
+ ```javascript
114
+ /?embed=true&embed_options=show_colored_line
115
+ ```
116
+
117
+ 5. Hide the "skeleton" that appears while an app is loading.
118
+
119
+ ```javascript
120
+ /?embed=true&embed_options=hide_loading_screen
121
+ ```
122
+
123
+ 6. Disable scrolling for the main body of the app. (The sidebar will still be scrollable.)
124
+
125
+ ```javascript
126
+ /?embed=true&embed_options=disable_scrolling
127
+ ```
128
+
129
+ 7. Open the app with light theme.
130
+
131
+ ```javascript
132
+ /?embed=true&embed_options=light_theme
133
+ ```
134
+
135
+ 8. Open the app with dark theme.
136
+
137
+ ```javascript
138
+ /?embed=true&embed_options=dark_theme
139
+ ```
140
+
141
+ You can also combine the params:
142
+
143
+ ```javascript
144
+ /?embed=true&embed_options=show_toolbar&embed_options=show_padding&embed_options=show_footer&embed_options=show_colored_line&embed_options=disable_scrolling
145
+ ```
146
+
147
+ ### Build an embed link
148
+
149
+ You can conveniently build an embed link for your app &mdash; right from your app!
150
+
151
+ 1. From your app at `<your-custom-subdomain>.streamlit.app`, click "**Share**" in the upper-right corner.
152
+ 2. Click "**Embed**" to access a list of selectable embed options.
153
+
154
+ ![Access embed options from the share button](/images/streamlit-community-cloud/share-menu-embed.png)
155
+
156
+ 3. Select your embed options and click "**Get embed link**" to copy the embed link to your clipboard.
157
+
158
+ ![Build a customized embed link for your app from the share button](/images/streamlit-community-cloud/share-menu-embed-url.png)
data/deploy/community-cloud/share-your-app/indexability.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: SEO and search indexability
3
+ slug: /deploy/streamlit-community-cloud/share-your-app/indexability
4
+ ---
5
+
6
+ # SEO and search indexability
7
+
8
+ When you deploy a public app to Streamlit Community Cloud, it is automatically indexed by search engines like Google and Bing on a weekly basis. 🎈 This means that anyone can find your app by <a href="https://www.google.com/search?q=traingenerator.streamlit.app" target="_blank">searching for its custom subdomain</a> (e.g. "traingenerator.streamlit.app") or by searching for the app's title.
9
+
10
+ ## Get the most out of app indexability
11
+
12
+ Here are some tips to help you get the most out of app indexability:
13
+
14
+ 1. [Make sure your app is public](#make-sure-your-app-is-public)
15
+ 2. [Choose a custom subdomain early](#choose-a-custom-subdomain-early)
16
+ 3. [Choose a descriptive app title](#choose-a-descriptive-app-title)
17
+ 4. [Customize your app's meta description](#customize-your-apps-meta-description)
18
+
19
+ ### Make sure your app is public
20
+
21
+ All public apps hosted on Streamlit Community Cloud are indexed by search engines. If your app is private, it will not be indexed by search engines. To make your private app public, read [Share your app](/deploy/streamlit-community-cloud/share-your-app).
22
+
23
+ ### Choose a custom subdomain early
24
+
25
+ Streamlit Community Cloud automatically generates a random subdomain for your app. However, subdomains are customizable! Custom subdomains modify your app URLs to reflect your app content, personal branding, or whatever you’d like. Read more about custom subdomains in [Custom subdomains](/deploy/streamlit-community-cloud/deploy-your-app#custom-subdomains).
26
+
27
+ By choosing a custom subdomain, you can use it to help people find your app. For example, if you're deploying an app that generates training data, you might choose a subdomain like `traingenerator.streamlit.app`. This makes it easy for people to find your app by searching for "training generator" or "train generator streamlit app."
28
+
29
+ We recommend choosing a custom subdomain when you deploy your app. This ensures that your app is indexed by search engines using your custom subdomain, rather than the automatically generated one. If you choose a custom subdomain later, your app may be indexed multiple times&mdash;once using the default subdomain and once using your custom subdomain. In this case, your old URL will result in a 404 error which can confuse users who are searching for your app.
30
+
31
+ ### Choose a descriptive app title
32
+
33
+ The meta title of your app is the text that appears in search engine results. It is also the text that appears in the browser tab when your app is open. By default, the meta title of your app is the same as the title of your app. However, you can customize the meta title of your app by setting the [`st.set_page_config`](/develop/api-reference/configuration/st.set_page_config) parameter `page_title` to a custom string. For example:
34
+
35
+ ```python
36
+ st.set_page_config(page_title="Traingenerator")
37
+ ```
38
+
39
+ This will change the meta title of your app to "Traingenerator." This makes it easier for people to find your app by searching for "Traingenerator" or "train generator streamlit app":
40
+
41
+ <Image src="/images/streamlit-community-cloud/indexability-app-title.png" caption='Google search results for "train generator streamlit app"' />
42
+
43
+ ### Customize your app's meta description
44
+
45
+ Meta descriptions are the short descriptions that appear in search engine results. Search engines use the meta description to help users understand what your app is about.
46
+
47
+ From our observations, search engines seem to favor the content in both `st.header` and `st.text` over `st.title`. If you put a description at the top of your app under `st.header` or `st.text`, there’s a good chance search engines will use this for the meta description.
48
+
49
+ ## What does my indexed app look like?
50
+
51
+ If you're curious about what your app looks like in search engine results, you can type the following into Google Search:
52
+
53
+ ```
54
+ site:<your-custom-subdomain>.streamlit.app
55
+ ```
56
+
57
+ Example: `site:traingenerator.streamlit.app`
58
+
59
+ <Image src="/images/streamlit-community-cloud/indexability-search-result.png" caption='Google search results for "site:traingenerator.streamlit.app"' />
60
+
61
+ ## What if I don't want my app to be indexed?
62
+
63
+ If you don't want your app to be indexed by search engines, you can make it private. Read [Share your app](/deploy/streamlit-community-cloud/share-your-app) to learn more about making your app private. Note: each workspace can only have one private app. If you want to make your app private, you must first delete any other private app in your workspace or make it public.
64
+
65
+ That said, Streamlit Community Cloud is an open and free platform for the community to deploy, discover, and share Streamlit apps and code with each other. As such, we encourage you to make your app public so that it can be indexed by search engines and discovered by other Streamlit users and community members.
data/deploy/community-cloud/share-your-app/share-previews.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Share previews
3
+ slug: /deploy/streamlit-community-cloud/share-your-app/share-previews
4
+ ---
5
+
6
+ # Share previews
7
+
8
+ Social media sites generate a card with a title, preview image, and description when you share a link. This feature is called a "share preview." In the same way, when you share a link to a public Streamlit app on social media, a share preview is also generated. Here's an example of a share preview for a public Streamlit app posted on Twitter:
9
+
10
+ <div style={{ marginLeft: '3em' }}>
11
+ <Flex>
12
+ <Image caption="Share preview for a public Streamlit app" src="/images/streamlit-community-cloud/share-preview-twitter-annotated.png" />
13
+ </Flex>
14
+ </div>
15
+
16
+ <Note>
17
+
18
+ Share previews are generated only for public apps deployed on Streamlit Community Cloud.
19
+
20
+ </Note>
21
+
22
+ ## Titles
23
+
24
+ The title is the text that appears at the top of the share preview. The text also appears in the browser tab when you visit the app. You should set the title to something that will make sense to your app's audience and describe what the app does. It is best practice to keep the title concise, ideally under 60 characters.
25
+
26
+ There are two ways to set the title of a share preview:
27
+
28
+ 1. Set the `page_title` parameter in [`st.set_page_config()`](/develop/api-reference/configuration/st.set_page_config) to your desired title. E.g.:
29
+
30
+ ```python
31
+ import streamlit as st
32
+
33
+ st.set_page_config(page_title="My App")
34
+
35
+ # ... rest of your app
36
+ ```
37
+
38
+ 2. If you don't set the `page_title` parameter, the title of the share preview will be the name of your app's GitHub repository. For example, the default title for an app hosted on GitHub at <a href="https://github.com/jrieke/traingenerator" target="_blank">github.com/jrieke/traingenerator</a> will be "traingenerator".
39
+
40
+ ## Descriptions
41
+
42
+ The description is the text that appears below the title in the share preview. The description should summarize what the app does and ideally should be under 100 characters.
43
+
44
+ Streamlit pulls the description from the README in the app's GitHub repository. If there is no README, the description will default to:
45
+
46
+ _This app was built in Streamlit! Check it out and visit https://streamlit.io for more awesome community apps. 🎈_
47
+
48
+ <div style={{ marginLeft: '6em' }}>
49
+ <Flex>
50
+ <Image caption="Default share preview when a description is missing" src="/images/streamlit-community-cloud/share-preview-private-app.png" />
51
+ </Flex>
52
+ </div>
53
+
54
+ If you want your share previews to look great and want users to share your app and click on your links, you should write a good description in the README of your app’s GitHub repository.
55
+
56
+ ## Preview images
57
+
58
+ Streamlit Community Cloud takes a screenshot of your app once a day and uses it as the preview image, unlike titles and descriptions which are pulled directly from your app's code or GitHub repository. This screenshot may take up to 24 hours to update.
59
+
60
+ ### Switching your app from public to private
61
+
62
+ If you initially made your app public and later decided to make it private, we will stop generating share previews for the app. However, it may take up to 24 hours for the share previews to stop appearing.
data/deploy/community-cloud/troubleshooting.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Troubleshooting
3
+ slug: /deploy/streamlit-community-cloud/troubleshooting
4
+ ---
5
+
6
+ # Troubleshooting
7
+
8
+ Sorry to hear you're having issues! Please take a look at some frequently asked questions and issues below. If you cannot find an answer to your issue, please post on our [Community forum](http://discuss.streamlit.io) so that our engineers or community members can help you.
9
+
10
+ ## Table of contents
11
+
12
+ 1. [General help](#general-help)
13
+ 2. [Deploying apps](#deploying-apps)
14
+ 3. [Sharing and accessing apps](/deploy/streamlit-community-cloud/troubleshooting#sharing-and-accessing-apps)
15
+ 4. [Data and app security](/deploy/streamlit-community-cloud/troubleshooting#data-and-app-security)
16
+ 5. [GitHub integration](/deploy/streamlit-community-cloud/troubleshooting#github-integration)
17
+ 6. [Limitations and known issues](/deploy/streamlit-community-cloud/troubleshooting#limitations-and-known-issues)
18
+
19
+ ## General help
20
+
21
+ ### How can I get help with my app?
22
+
23
+ If you have any questions, feedback, run into any issues, or need to reach us, you can ask on our [Community forum](https://discuss.streamlit.io/). This is best suited for any questions related to the open source library and Community Cloud - debugging code, deployment, resource limits, etc.
24
+
25
+ ## Deploying apps
26
+
27
+ ### My repo isn't showing on the Deploy page
28
+
29
+ It's possible it just isn't showing up even though it is already there. Try typing it in. If we don't recognize it, you'll see the message below with a link to click and give access.
30
+
31
+ ![Troubleshooting deploy page](/images/streamlit-community-cloud/troubleshooting-deploy-page.png)
32
+
33
+ If for some reason that doesn't work, please try logging out and back in again to make sure the change took effect. And if that doesn't work - please let us know and we'll get you sorted!
34
+
35
+ ### It won't let me deploy the app
36
+
37
+ To deploy an app for the first time you must have admin-level access to the repo in GitHub. Please check with your administrator to make sure you have that access. If not, please ask them to deploy for the first time (we need this in order to establish webhooks for continuous integration) and from there you can then push updates to the app.
38
+
39
+ ### I need to set a specific Python version for my app
40
+
41
+ When deploying an app, under advanced settings, you can choose which version of Python you wish your app to use.
42
+
43
+ ![Streamlit Community Cloud Advanced settings](/images/streamlit-community-cloud/deploy-an-app-advanced.png)
44
+
45
+ ### How do I store files locally?
46
+
47
+ If you want to store your data locally as opposed to in a database, you can store the file in your GitHub repository. Streamlit is just python, so you can read the file using:
48
+
49
+ `pandas.read_csv("data.csv")` or `open("data.csv")`
50
+
51
+ <Tip>
52
+
53
+ If you have really big or binary data that you change frequently, and git is feeling slow, you might want to check out [Git Large File Store (LFS)](https://git-lfs.github.com/) as a better way to store large files in GitHub. You don't need to make any changes to your app to start using it. If your GitHub repo uses LFS, it will now _just work_ with Streamlit.
54
+
55
+ </Tip>
56
+
57
+ ### My app is running into issues while deploying
58
+
59
+ Check your Cloud logs by clicking on the "Manage app" expander in the bottom right corner of your screen. Often the trouble is due to a dependency not being declared. See here for [more information on dependency management](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies).
60
+
61
+ If that's not the issue, then please send the logs and warning you are seeing to our [Community forum](https://discuss.streamlit.io/) and we'll help get you sorted!
62
+
63
+ ### My app is hitting resource limits / my app is running very slowly
64
+
65
+ If your app is running slowly or you're hitting the 'Argh' page, we first highly recommend going through and implementing the suggestions in the following blog posts to prevent your app from hitting the resource limits and to detect if your Streamlit app leaks memory:
66
+
67
+ - [Common app problems: Resource limits](https://blog.streamlit.io/common-app-problems-resource-limits/)
68
+ - [3 steps to fix app memory leaks](https://blog.streamlit.io/3-steps-to-fix-app-memory-leaks/)
69
+
70
+ If you're still having issues, click [here](/deploy/streamlit-community-cloud/manage-your-app#app-resources-and-limits) to learn more about resource limits.
71
+
72
+ ### Can I get a custom URL for my app?
73
+
74
+ Yes! You can find [instructions for setting a custom subdomain here](/knowledge-base/deploy/custom-subdomains).
75
+
76
+ ## Sharing and accessing apps
77
+
78
+ Don't have SSO? No problem! You can sign in to Streamlit with your email address. [Click here](/deploy/streamlit-community-cloud/get-started#sign-in-with-email) for step-by-step instructions on how to sign in with email. \*/}
79
+
80
+ ### How do I add viewers to my Streamlit apps?
81
+
82
+ Viewer auth allows you to restrict the viewers of your private app. To access your app, users have to authenticate using an email-based passwordless login or Google OAuth. To learn more about how to share your public and private apps with viewers, click [here](/deploy/streamlit-community-cloud/share-your-app).
83
+
84
+ ### Do viewers need access to the GitHub repo?
85
+
86
+ Nope! You only need access to the GitHub repo if you want to push changes to the app.
87
+
88
+ ### What will unauthorized/logged out viewers see when they view my app?
89
+
90
+ A 404 error is displayed to unauthorized viewers to avoid providing any unnecessary information about your app to unintended viewers. Users who satisfy any of the following conditions will see a 404 error when attempting to view your app after you have configured viewer auth:
91
+
92
+ - User is not logged in with their primary identity.
93
+ - User is not included in the [list of allowed viewers](/deploy/streamlit-community-cloud/share-your-app#share-your-private-app) provided in the app settings.
94
+ - User lacks read access to your app's GitHub repo.
95
+ - User has read access to your app's GitHub repo but is not enrolled in Streamlit Community Cloud.
96
+
97
+ ![Four Oh Four](/images/streamlit-community-cloud/404.png)
98
+
99
+ ### I've added someone to the viewer list but they still see a 404 error when attempting to view the app
100
+
101
+ If a user is still seeing a 404 error after their email address has been added to the viewer list, we recommend that you:
102
+
103
+ - Check that the user did not log into a different Google account via Single Sign-On (if you have added their work email address to the viewer list, ask the user to check that they are not logged into their personal Google account, and vice versa).
104
+ - Check that the user has navigated to the correct URL.
105
+ - Check that the user's email address has been entered correctly in the viewer list.
106
+ - Reach out on our [Community forum](https://discuss.streamlit.io/) and we will be happy to help.
107
+
108
+ ## Data and app security
109
+
110
+ ### How will Streamlit secure my data?
111
+
112
+ Streamlit takes a number of industry best-practice measures to ensure your code, data, and apps are all secure. Read more in our [Trust and Security memo](/deploy/streamlit-community-cloud/get-started/trust-and-security).
113
+
114
+ ### How do I set up SSO for my organization?
115
+
116
+ Community Cloud uses Google OAuth, by default. If you use Google for authentication you're all set.
117
+
118
+ ## Billing and administration
119
+
120
+ The Community Cloud is a free service. You don't have to worry about setting up billing or being charged.
121
+
122
+ ## GitHub integration
123
+
124
+ ### Why does Streamlit require additional OAuth scope?
125
+
126
+ In order to deploy your app, Streamlit requires access to your app's source code in GitHub and also the ability to manage the public keys associated with the repositories. The default GitHub OAuth scopes are sufficient to work with apps in public GitHub repositories. However, in order to work with apps in private GitHub repositories, Streamlit requires the additional `repo` OAuth scope from GitHub. We recognize that this scope provides Streamlit with extra permissions that we do not really need, and which, as people who prize security, we'd rather not even be granted. Alas, we need to work with the APIs we are provided by GitHub.
127
+
128
+ ### After deploying my private-repo app, I received an email from GitHub saying a new public key was added to my repo. Is this expected?
129
+
130
+ **This is the expected behavior**. When you try to deploy an app that lives in a private repo, Streamlit Community Cloud needs to get access to that repo somehow. For this, we create a read-only [GitHub Deploy Key](https://docs.github.com/en/free-pro-team@latest/developers/overview/managing-deploy-keys#deploy-keys) then access your repo using a public SSH key. When we set this up, GitHub notifies admins of the repo that the key was created as a security measure.
131
+
132
+ ### What happens when a user's permissions change on GitHub?
133
+
134
+ Once a user is added to a repository on GitHub, it will take at most 15 minutes before they can deploy the app on Cloud. If a user is removed from a repository on GitHub, it will take at most 15 minutes before their permissions to manage the app from that repository are revoked.
135
+
136
+ ## Limitations and known issues
137
+
138
+ Here are some limitations and known issues that we're actively working to resolve.
139
+
140
+ - When you print something to the Cloud logs, you may need to do aΒ `sys.stdout.flush()`Β before it shows up.
141
+ - MatplotlibΒ [doesn't work well with threads](https://matplotlib.org/3.3.2/faq/howto_faq.html#working-with-threads). So if you're using Matplotlib you should wrap your code with locks as shown in the snippet below. This Matplotlib bug is more prominent when you share your app apps since you're more likely to get more concurrent users then.
142
+
143
+ ```python
144
+ from matplotlib.backends.backend_agg import RendererAgg
145
+ _lock = RendererAgg.lock
146
+
147
+ with _lock:
148
+ fig.title('This is a figure)')
149
+ fig.plot([1,20,3,40])
150
+ st.pyplot(fig)
151
+ ```
152
+
153
+ - All apps are hosted in the United States. This is currently not configurable.
data/deploy/concepts/_index.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Deployment concepts
3
+ slug: /deploy/concepts
4
+ ---
5
+
6
+ # Deployment concepts
7
+
8
+ Learn the fundamental concepts of app deployment. There are three main processes involved in deploying apps.
9
+
10
+ - Install Python, Streamlit, and other dependencies in your deployment environment.
11
+ - Securely handle your secrets and private information.
12
+ - Remote start your app (`streamlit run`).
13
+
14
+ If you're using Streamlit Community Cloud, we'll do most of the work for you!
15
+
16
+ <InlineCalloutContainer>
17
+ <InlineCallout
18
+ color="lightBlue-70"
19
+ icon="build_circle"
20
+ bold="Dependencies."
21
+ href="/deploy/concepts/dependencies"
22
+ >Understand the basics of configuring your deployment environment.</InlineCallout>
23
+ <InlineCallout
24
+ color="lightBlue-70"
25
+ icon="password"
26
+ bold="Secrets."
27
+ href="/deploy/concepts/secrets"
28
+ >Understand the basics of secret management.</InlineCallout>
29
+ </InlineCalloutContainer>
data/deploy/concepts/dependencies.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Managing dependencies when deploying your app
3
+ slug: /deploy/concepts/dependencies
4
+ ---
5
+
6
+ # Managing dependencies when deploying your app
7
+
8
+ Before you began developing your app, you set up and configured your development environment by installing Python and Streamlit. When you deploy your app, you need to set up and configure your deployment environment in the same way. When you deploy your app to a cloud service, your app's [Python server](/develop/concepts/architecture/architecture#python-backend-server) will be running on a remote machine. This remote machine will not have access all the files and programs on your personal computer.
9
+
10
+ All Streamlit apps have at least two dependencies: Python and Streamlit. Your app may have additional dependencies in the form of Python packages or software that must be installed to properly execute your script. If you are using a service like Streamlit Community Cloud which is designed for Streamlit apps, we'll take care of Python and Streamlit for you!
11
+
12
+ ## Install Python and other software
13
+
14
+ If you are using Streamlit Community Cloud, Python is already installed. You can just pick the version in the deployment dialog. If you need to install Python yourself or you have other non-Python software to install, follow your platform's instructions to install additional software. You will commonly use a package management tool to do this.
15
+ For example, Streamlit Community Cloud uses Advanced Package Tool (`apt`) for Debian-based Linux systems. For more information about installing non-Python depencies on Streamlit Community Cloud, see [`apt-get` dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#apt-get-dependencies).
16
+
17
+ ## Install Python packages
18
+
19
+ Once you have Python installed in your deployment environment, you'll need to install all the necessary Python packages, including Streamlit! With each `import` of an installed package, you add a Python dependency to your script. You need to install those dependencies in your deployment environment through a Python package manager.
20
+
21
+ If you are using Streamlit Community Cloud, you'll have the latest version of Streamlit and all of its dependencies installed by default. So, if you're making a simple app and don't need additional dependencies, you won't have to do anything at all!
22
+
23
+ ### `pip` and `requirements.txt`
24
+
25
+ Since `pip` comes by default with Python, the most common way to configure your Python environment is with a `requirements.txt` file. Each line of a `requirements.txt` file is a package to `pip install`. You should _not_ include <a href="https://docs.python.org/3/py-modindex.html" target="_blank">built-in Python libraries</a> like `math` or `random` in your `requirements.txt` file. These are a part of Python and aren't installed separately.
26
+
27
+ If you have a script like the following, you would only need to install Streamlit. No extra dependencies would be needed since `pandas` and `numpy` are installed as direct dependencies of `streamlit`. Similarly, `math` and `random` are built into Python.
28
+
29
+ ```python
30
+ import streamlit as st
31
+ import pandas as pd
32
+ import numpy as np
33
+ import math
34
+ import random
35
+
36
+ st.write('Hi!')
37
+ ```
38
+
39
+ However, it's a best practice accurately record packages you use, so the recommended `requirements.txt` file would be:
40
+
41
+ ```none
42
+ streamlit
43
+ pandas
44
+ numpy
45
+ ```
46
+
47
+ If you needed to specify certain versions, another valid example would be:
48
+
49
+ ```none
50
+ streamlit==1.24.1
51
+ pandas>2.0
52
+ numpy<=1.25.1
53
+ ```
54
+
55
+ A `requirements.txt` file is commonly saved in the root of your repository or file directory. If you are using Streamlit Community Cloud, see [Add Python dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#add-python-dependencies) for more information. Otherwise, check your platform's documentation.
data/deploy/concepts/secrets.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Managing secrets when deploying your app
3
+ slug: /deploy/concepts/secrets
4
+ ---
5
+
6
+ # Managing secrets when deploying your app
7
+
8
+ If you are connecting to data sources or external services, you will likely be handling secret information like credentials or keys. Secret information should be stored and transmitted in a secure manner. When you deploy your app, ensure that you understand your platform's features and mechanisms for handling secrets so you can follow best practice.
9
+
10
+ Avoid saving secrets directly in your code and keep `.gitignore` updated to prevent accidentally committing a local secret to your repository. For helpful reminders, see [Security reminders](/develop/concepts/connections/security-reminders).
11
+
12
+ If you are using Streamlit Community Cloud, [Secrets management](/deploy/streamlit-community-cloud/deploy-your-app/secrets-management) allows you save environment variables and store secrets outside of your code. If you are using another platform designed for Streamlit, check if they have a built-in mechanism for working with secrets. In some cases, they may even support `st.secrets` or securely uploading your `secrets.toml` file.
13
+
14
+ For information about using `st.connection` with environment variables, see [Global secrets, managing multiple apps and multiple data stores](/develop/concepts/connections/connecting-to-data#global-secrets-managing-multiple-apps-and-multiple-data-stores).
data/deploy/tutorials/_index.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Deployment tutorials
3
+ slug: /deploy/tutorials
4
+ ---
5
+
6
+ # Deployment tutorials
7
+
8
+ This sections contains step-by-step guides on how to deploy Streamlit apps to various cloud platforms and services. We have deployment guides for:
9
+
10
+ <DataSourcesContainer>
11
+ <DataSourcesCard href="/deploy/streamlit-community-cloud/get-started">
12
+
13
+ <Image pure alt="screenshot" src="/images/deploy/streamlit-cloud.png" />
14
+
15
+ <h5 align="center">Streamlit Community Cloud</h5>
16
+
17
+ </DataSourcesCard>
18
+
19
+ <DataSourcesCard href="/deploy/tutorials/docker">
20
+
21
+ <Image pure alt="screenshot" src="/images/deploy/docker.png" />
22
+
23
+ <h5 align="center">Docker</h5>
24
+
25
+ </DataSourcesCard>
26
+
27
+ <DataSourcesCard href="/deploy/tutorials/kubernetes">
28
+
29
+ <Image pure alt="screenshot" src="/images/deploy/kubernetes.png" />
30
+
31
+ <h5 align="center">Kubernetes</h5>
32
+
33
+ </DataSourcesCard>
34
+ </DataSourcesContainer>
35
+
36
+ While we work on official Streamlit deployment guides for other hosting providers, here are some user-submitted tutorials for different cloud services:
37
+
38
+ - [How to Deploy Streamlit to a Free **Amazon EC2** instance](https://towardsdatascience.com/how-to-deploy-a-streamlit-app-using-an-amazon-free-ec2-instance-416a41f69dc3), by Rahul Agarwal.
39
+ - [Host Streamlit on **Azure**](https://towardsdatascience.com/deploying-a-streamlit-web-app-with-azure-app-service-1f09a2159743), by Richard Peterson.
40
+ - [How to deploy Streamlit apps to **Google App Engine**](https://dev.to/whitphx/how-to-deploy-streamlit-apps-to-google-app-engine-407o), by [Yuichiro Tachibana (Tsuchiya)](https://discuss.streamlit.io/u/whitphx/summary).
41
+ - [Host Streamlit on **Heroku**](https://towardsdatascience.com/quickly-build-and-deploy-an-application-with-streamlit-988ca08c7e83), by Maarten Grootendorst.
42
+ - [Deploy Streamlit on **Ploomber Cloud**](https://docs.cloud.ploomber.io/en/latest/apps/streamlit.html), by Ido Michael.
43
+ - [Host Streamlit on **21YunBox**](https://www.21yunbox.com/docs/#/deploy-streamlit), by Toby Lei.
44
+ - [Community-supported deployment wiki](https://discuss.streamlit.io/t/streamlit-deployment-guide-wiki/5099).
data/deploy/tutorials/docker.md ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Deploy Streamlit using Docker
3
+ slug: /deploy/tutorials/docker
4
+ ---
5
+
6
+ # Deploy Streamlit using Docker
7
+
8
+ ## Introduction
9
+
10
+ So you have an amazing app and you want to start sharing it with other people, what do you do? You have a few options. First, where do you want to run your Streamlit app, and how do you want to access it?
11
+
12
+ - **On your corporate network**Β - Most corporate networks are closed to the outside world. You typically use a VPN to log onto your corporate network and access resources there. You could run your Streamlit app on a server in your corporate network for security reasons, to ensure that only folks internal to your company can access it.
13
+ - **On the cloud**Β - If you'd like to access your Streamlit app from outside of a corporate network, or share your app with folks outside of your home network or laptop, you might choose this option. In this case, it'll depend on your hosting provider. We have [community-submitted guides](/knowledge-base/deploy/deploy-streamlit-heroku-aws-google-cloud) from Heroku, AWS, and other providers.
14
+
15
+ Wherever you decide to deploy your app, you will first need to containerize it. This guide walks you through using Docker to deploy your app. If you prefer Kubernetes see [Deploy Streamlit using Kubernetes](/deploy/tutorials/kubernetes).
16
+
17
+ ## Prerequisites
18
+
19
+ 1. [Install Docker Engine](#install-docker-engine)
20
+ 2. [Check network port accessibility](#check-network-port-accessibility)
21
+
22
+ ### Install Docker Engine
23
+
24
+ If you haven't already done so, install [Docker](https://docs.docker.com/engine/install/#server) on your server. Docker providesΒ `.deb` andΒ `.rpm` packages from many Linux distributions, including:
25
+
26
+ - [Debian](https://docs.docker.com/engine/install/debian/)
27
+ - [Ubuntu](https://docs.docker.com/engine/install/ubuntu/)
28
+
29
+ Verify that Docker Engine is installed correctly by running theΒ `hello-world` Docker image:
30
+
31
+ ```bash
32
+ sudo docker run hello-world
33
+ ```
34
+
35
+ <Tip>
36
+
37
+ Follow Docker's official [post-installation steps for Linux](https://docs.docker.com/engine/install/linux-postinstall/) to run Docker as a non-root user, so that you don't have to preface the `docker` command with `sudo`.
38
+
39
+ </Tip>
40
+
41
+ ### Check network port accessibility
42
+
43
+ As you and your users are behind your corporate VPN, you need to make sure all of you can access a certain network port. Let's say port `8501`, as it is the default port used by Streamlit. Contact your IT team and request access to port `8501` for you and your users.
44
+
45
+ ## Create a Dockerfile
46
+
47
+ Docker builds images by reading the instructions from aΒ `Dockerfile`. AΒ `Dockerfile` is a text document that contains all the commands a user could call on the command line to assemble an image. Learn more in the [Dockerfile reference](https://docs.docker.com/engine/reference/builder/). TheΒ [docker build](https://docs.docker.com/engine/reference/commandline/build/) command builds an image from aΒ `Dockerfile`. The [docker run](https://docs.docker.com/engine/reference/commandline/run/) command first creates a container over the specified image, and then starts it using the specified command.
48
+
49
+ Here's an example `Dockerfile` that you can add to the root of your directory. i.e. in `/app/`
50
+
51
+ ```docker
52
+ # app/Dockerfile
53
+
54
+ FROM python:3.9-slim
55
+
56
+ WORKDIR /app
57
+
58
+ RUN apt-get update && apt-get install -y \
59
+ build-essential \
60
+ curl \
61
+ software-properties-common \
62
+ git \
63
+ && rm -rf /var/lib/apt/lists/*
64
+
65
+ RUN git clone https://github.com/streamlit/streamlit-example.git .
66
+
67
+ RUN pip3 install -r requirements.txt
68
+
69
+ EXPOSE 8501
70
+
71
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
72
+
73
+ ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
74
+ ```
75
+
76
+ ### Dockerfile walkthrough
77
+
78
+ Let’s walk through each line of the Dockerfile :
79
+
80
+ 1. A `Dockerfile` must start with aΒ [`FROM`](https://docs.docker.com/engine/reference/builder/#from) instruction. It sets the [Base Image](https://docs.docker.com/glossary/#base-image) (think OS) for the container:
81
+
82
+ ```docker
83
+ FROM python:3.9-slim
84
+ ```
85
+
86
+ Docker has a number of official Docker base images based on various Linux distributions. They also have base images that come with language-specific modules such as [Python](https://hub.docker.com/_/python). The `python` images come in many flavors, each designed for a specific use case. Here, we use the `python:3.9-slim` image which is a lightweight image that comes with the latest version of Python 3.9.
87
+
88
+ <Tip>
89
+
90
+ You can also use your own base image, provided the image you use contains a [supported version of Python](/knowledge-base/using-streamlit/sanity-checks#check-0-are-you-using-a-streamlit-supported-version-of-python) for Streamlit. There is no one-size-fits-all approach to using any specific base image, nor is there an official Streamlit-specific base image.
91
+
92
+ </Tip>
93
+
94
+ 2. TheΒ `WORKDIR` instruction sets the working directory for anyΒ `RUN`,Β `CMD`,Β `ENTRYPOINT`,Β `COPY` andΒ `ADD` instructions that follow it in theΒ `Dockerfile` . Let’s set it to `app/` :
95
+
96
+ ```docker
97
+ WORKDIR /app
98
+ ```
99
+
100
+ <Important>
101
+
102
+ As mentioned in [Development flow](/get-started/fundamentals/main-concepts#development-flow), for Streamlit version 1.10.0 and higher, Streamlit apps cannot be run from the root directory of Linux distributions. Your main script should live in a directory other than the root directory. If you try to run a Streamlit app from the root directory, Streamlit will throw a `FileNotFoundError: [Errno 2] No such file or directory` error. For more information, see GitHub issue [#5239](https://github.com/streamlit/streamlit/issues/5239).
103
+
104
+ If you are using Streamlit version 1.10.0 or higher, you must set the `WORKDIR` to a directory other than the root directory. For example, you can set the `WORKDIR` to `/app` as shown in the example `Dockerfile` above.
105
+ </Important>
106
+
107
+ 3. Install `git` so that we can clone the app code from a remote repo:
108
+
109
+ ```docker
110
+ RUN apt-get update && apt-get install -y \
111
+ build-essential \
112
+ curl \
113
+ software-properties-common \
114
+ git \
115
+ && rm -rf /var/lib/apt/lists/*
116
+ ```
117
+
118
+ 4. Clone your code that lives in a remote repo to `WORKDIR`:
119
+
120
+ a. If your code is in a public repo:
121
+
122
+ ```docker
123
+ RUN git clone https://github.com/streamlit/streamlit-example.git .
124
+ ```
125
+
126
+ Once cloned, the directory of `WORKDIR` will look like the following:
127
+
128
+ ```bash
129
+ app/
130
+ - requirements.txt
131
+ - streamlit_app.py
132
+ ```
133
+
134
+ where `requirements.txt` file contains all your [Python dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#add-python-dependencies). E.g
135
+
136
+ ```
137
+ altair
138
+ pandas
139
+ streamlit
140
+ ```
141
+
142
+ and `streamlit_app.py` is your main script. E.g.
143
+
144
+ ```python
145
+ from collections import namedtuple
146
+ import altair as alt
147
+ import math
148
+ import pandas as pd
149
+ import streamlit as st
150
+
151
+ """
152
+ # Welcome to Streamlit!
153
+
154
+ Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:
155
+
156
+ If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
157
+ forums](https://discuss.streamlit.io).
158
+
159
+ In the meantime, below is an example of what you can do with just a few lines of code:
160
+ """
161
+
162
+ with st.echo(code_location='below'):
163
+ total_points = st.slider("Number of points in spiral", 1, 5000, 2000)
164
+ num_turns = st.slider("Number of turns in spiral", 1, 100, 9)
165
+
166
+ Point = namedtuple('Point', 'x y')
167
+ data = []
168
+
169
+ points_per_turn = total_points / num_turns
170
+
171
+ for curr_point_num in range(total_points):
172
+ curr_turn, i = divmod(curr_point_num, points_per_turn)
173
+ angle = (curr_turn + 1) * 2 * math.pi * i / points_per_turn
174
+ radius = curr_point_num / total_points
175
+ x = radius * math.cos(angle)
176
+ y = radius * math.sin(angle)
177
+ data.append(Point(x, y))
178
+
179
+ st.altair_chart(alt.Chart(pd.DataFrame(data), height=500, width=500)
180
+ .mark_circle(color='#0068c9', opacity=0.5)
181
+ .encode(x='x:Q', y='y:Q'))
182
+ ```
183
+
184
+ b. If your code is in a private repo, please read [Using SSH to access private data in builds](https://docs.docker.com/develop/develop-images/build_enhancements/#using-ssh-to-access-private-data-in-builds) and modify the Dockerfile accordingly -- to install an SSH client, download the public key for [github.com](https://github.com), and clone your private repo. If you use an alternative VCS such as GitLab or Bitbucket, please consult the documentation for that VCS on how to copy your code to the `WORKDIR` of the Dockerfile.
185
+
186
+ c. If your code lives in the same directory as the Dockerfile, copy all your app files from your server into the container, including `streamlit_app.py`, `requirements.txt`, etc, by replacing the `git clone` line with:
187
+
188
+ ```docker
189
+ COPY . .
190
+ ```
191
+
192
+ More generally, the idea is copy your app code from wherever it may live on your server into the container. If the code is not in the same directory as the Dockerfile, modify the above command to include the path to the code.
193
+
194
+ 5. Install your app’s [Python dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#add-python-dependencies) from the cloned `requirements.txt` in the container:
195
+
196
+ ```docker
197
+ RUN pip3 install -r requirements.txt
198
+ ```
199
+
200
+ 6. TheΒ [`EXPOSE`](https://docs.docker.com/engine/reference/builder/#expose) instruction informs Docker that the container listens on the specified network ports at runtime. Your container needs to listen to Streamlit’s (default) port 8501:
201
+
202
+ ```docker
203
+ EXPOSE 8501
204
+ ```
205
+
206
+ 7. TheΒ [`HEALTHCHECK`](https://docs.docker.com/engine/reference/builder/#expose) instruction tells Docker how to test a container to check that it is still working. Your container needs to listen to Streamlit’s (default) port 8501:
207
+
208
+ ```docker
209
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
210
+ ```
211
+
212
+ 8. AnΒ [`ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint)Β allows you to configure a container that will run as an executable. Here, it also contains the entire `streamlit run` command for your app, so you don’t have to call it from the command line:
213
+
214
+ ```docker
215
+ ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
216
+ ```
217
+
218
+ ## Build a Docker image
219
+
220
+ TheΒ [`docker build`](https://docs.docker.com/engine/reference/commandline/build/) command builds an image from aΒ `Dockerfile` . Run the following command from the `app/` directory on your server to build the image:
221
+
222
+ ```docker
223
+ docker build -t streamlit .
224
+ ```
225
+
226
+ The `-t` flag is used to tag the image. Here, we have tagged the image `streamlit`. If you run:
227
+
228
+ ```docker
229
+ docker images
230
+ ```
231
+
232
+ You should see a `streamlit` image under the REPOSITORY column. For example:
233
+
234
+ ```
235
+ REPOSITORY TAG IMAGE ID CREATED SIZE
236
+ streamlit latest 70b0759a094d About a minute ago 1.02GB
237
+ ```
238
+
239
+ ## Run the Docker container
240
+
241
+ Now that you have built the image, you can run the container by executing:
242
+
243
+ ```docker
244
+ docker run -p 8501:8501 streamlit
245
+ ```
246
+
247
+ The `-p` flag publishes the container’s port 8501 to your server’s 8501 port.
248
+
249
+ If all went well, you should see an output similar to the following:
250
+
251
+ ```
252
+ docker run -p 8501:8501 streamlit
253
+
254
+ You can now view your Streamlit app in your browser.
255
+
256
+ URL: http://0.0.0.0:8501
257
+ ```
258
+
259
+ To view your app, users can browse to `http://0.0.0.0:8501` or `http://localhost:8501`
260
+
261
+ <Note>
262
+
263
+ Based on your server's network configuration, you could map to port 80/443 so that users can view your app using the server IP or hostname. For example: `http://your-server-ip:80` or `http://your-hostname:443`.
264
+
265
+ </Note>
data/deploy/tutorials/kubernetes.md ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Deploy Streamlit using Kubernetes
3
+ slug: /deploy/tutorials/kubernetes
4
+ ---
5
+
6
+ # Deploy Streamlit using Kubernetes
7
+
8
+ ## Introduction
9
+
10
+ So you have an amazing app and you want to start sharing it with other people, what do you do? You have a few options. First, where do you want to run your Streamlit app, and how do you want to access it?
11
+
12
+ - **On your corporate network**Β - Most corporate networks are closed to the outside world. You typically use a VPN to log onto your corporate network and access resources there. You could run your Streamlit app on a server in your corporate network for security reasons, to ensure that only folks internal to your company can access it.
13
+ - **On the cloud**Β - If you'd like to access your Streamlit app from outside of a corporate network, or share your app with folks outside of your home network or laptop, you might choose this option. In this case, it'll depend on your hosting provider. We have [community-submitted guides](/knowledge-base/deploy/deploy-streamlit-heroku-aws-google-cloud) from Heroku, AWS, and other providers.
14
+
15
+ Wherever you decide to deploy your app, you will first need to containerize it. This guide walks you through using Kubernetes to deploy your app. If you prefer Docker see [Deploy Streamlit using Docker](/deploy/tutorials/docker).
16
+
17
+ ## Prerequisites
18
+
19
+ 1. [Install Docker Engine](#install-docker-engine)
20
+ 2. [Install the gcloud CLI](#install-the-gcloud-cli)
21
+
22
+ ### Install Docker Engine
23
+
24
+ If you haven't already done so, install [Docker](https://docs.docker.com/engine/install/#server) on your server. Docker providesΒ `.deb` andΒ `.rpm` packages from many Linux distributions, including:
25
+
26
+ - [Debian](https://docs.docker.com/engine/install/debian/)
27
+ - [Ubuntu](https://docs.docker.com/engine/install/ubuntu/)
28
+
29
+ Verify that Docker Engine is installed correctly by running theΒ `hello-world` Docker image:
30
+
31
+ ```bash
32
+ sudo docker run hello-world
33
+ ```
34
+
35
+ <Tip>
36
+
37
+ Follow Docker's official [post-installation steps for Linux](https://docs.docker.com/engine/install/linux-postinstall/) to run Docker as a non-root user, so that you don't have to preface the `docker` command with `sudo`.
38
+
39
+ </Tip>
40
+
41
+ ### Install the gcloud CLI
42
+
43
+ In this guide, we will orchestrate Docker containers with Kubernetes and host docker images on the Google Container Registry (GCR). As GCR is a Google-supported Docker registry, we need to registerΒ [`gcloud`](https://cloud.google.com/sdk/gcloud/reference) as the Docker credential helper.
44
+
45
+ Follow the official documentation to [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install) and initialize it.
46
+
47
+ ## Create a Docker container
48
+
49
+ We need to create a docker container which contains all the dependencies and the application code. Below you can see the entrypoint, i.e. the command run when the container starts, and the Dockerfile definition.
50
+
51
+ ### Create an entrypoint script
52
+
53
+ Create a `run.sh` script containing the following:
54
+
55
+ ```bash
56
+ #!/bin/bash
57
+
58
+ APP_PID=
59
+ stopRunningProcess() {
60
+ # Based on https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script
61
+ if test ! "${APP_PID}" = '' && ps -p ${APP_PID} > /dev/null ; then
62
+ > /proc/1/fd/1 echo "Stopping ${COMMAND_PATH} which is running with process ID ${APP_PID}"
63
+
64
+ kill -TERM ${APP_PID}
65
+ > /proc/1/fd/1 echo "Waiting for ${COMMAND_PATH} to process SIGTERM signal"
66
+
67
+ wait ${APP_PID}
68
+ > /proc/1/fd/1 echo "All processes have stopped running"
69
+ else
70
+ > /proc/1/fd/1 echo "${COMMAND_PATH} was not started when the signal was sent or it has already been stopped"
71
+ fi
72
+ }
73
+
74
+ trap stopRunningProcess EXIT TERM
75
+
76
+ source ${VIRTUAL_ENV}/bin/activate
77
+
78
+ streamlit run ${HOME}/app/streamlit_app.py &
79
+ APP_ID=${!}
80
+
81
+ wait ${APP_ID}
82
+ ```
83
+
84
+ ### Create a Dockerfile
85
+
86
+ Docker builds images by reading the instructions from aΒ `Dockerfile`. AΒ `Dockerfile` is a text document that contains all the commands a user could call on the command line to assemble an image. Learn more in the [Dockerfile reference](https://docs.docker.com/engine/reference/builder/). TheΒ [docker build](https://docs.docker.com/engine/reference/commandline/build/) command builds an image from aΒ `Dockerfile`. The [docker run](https://docs.docker.com/engine/reference/commandline/run/) command first creates a container over the specified image, and then starts it using the specified command.
87
+
88
+ Here's an example `Dockerfile` that you can add to the root of your directory.
89
+
90
+ ```docker
91
+ FROM python:3.8-slim
92
+
93
+ RUN groupadd --gid 1000 appuser \
94
+ && useradd --uid 1000 --gid 1000 -ms /bin/bash appuser
95
+
96
+ RUN pip3 install --no-cache-dir --upgrade \
97
+ pip \
98
+ virtualenv
99
+
100
+ RUN apt-get update && apt-get install -y \
101
+ build-essential \
102
+ software-properties-common \
103
+ git
104
+
105
+ USER appuser
106
+ WORKDIR /home/appuser
107
+
108
+ RUN git clone https://github.com/streamlit/streamlit-example.git app
109
+
110
+ ENV VIRTUAL_ENV=/home/appuser/venv
111
+ RUN virtualenv ${VIRTUAL_ENV}
112
+ RUN . ${VIRTUAL_ENV}/bin/activate && pip install -r app/requirements.txt
113
+
114
+ EXPOSE 8501
115
+
116
+ COPY run.sh /home/appuser
117
+ ENTRYPOINT ["./run.sh"]
118
+ ```
119
+
120
+ <Important>
121
+
122
+ As mentioned in [Development flow](/get-started/fundamentals/main-concepts#development-flow), for Streamlit version 1.10.0 and higher, Streamlit apps cannot be run from the root directory of Linux distributions. Your main script should live in a directory other than the root directory. If you try to run a Streamlit app from the root directory, Streamlit will throw a `FileNotFoundError: [Errno 2] No such file or directory` error. For more information, see GitHub issue [#5239](https://github.com/streamlit/streamlit/issues/5239).
123
+
124
+ If you are using Streamlit version 1.10.0 or higher, you must set the `WORKDIR` to a directory other than the root directory. For example, you can set the `WORKDIR` to `/home/appuser` as shown in the example `Dockerfile` above.
125
+ </Important>
126
+
127
+ ### Build a Docker image
128
+
129
+ Put the above files (`run.sh` and `Dockerfile`) in the same folder and build the docker image:
130
+
131
+ ```docker
132
+ docker build --platform linux/amd64 -t gcr.io/$GCP_PROJECT_ID/k8s-streamlit:test .
133
+ ```
134
+
135
+ <Important>
136
+
137
+ Replace `$GCP_PROJECT_ID` in the above command with the name of your Google Cloud project.
138
+
139
+ </Important>
140
+
141
+ ### Upload the Docker image to a container registry
142
+
143
+ The next step is to upload the Docker image to a container registry. In this example, we will use the [Google Container Registry (GCR)](https://cloud.google.com/container-registry). Start by enabling the Container Registry API. Sign in to Google Cloud and navigate to your project’s **Container Registry** and click **Enable**.
144
+
145
+ We can now build the Docker image from the previous step and push it to our project’s GCR. Be sure to replace `$GCP_PROJECT_ID` in the docker push command with the name of your project:
146
+
147
+ ```bash
148
+ gcloud auth configure-docker
149
+ docker push gcr.io/$GCP_PROJECT_ID/k8s-streamlit:test
150
+ ```
151
+
152
+ ## Create a Kubernetes deployment
153
+
154
+ For this step you will need a:
155
+
156
+ - Running Kubernetes service
157
+ - Custom domain for which you can generate a TLS certificate
158
+ - DNS service where you can configure your custom domain to point to the application IP
159
+
160
+ As the image was uploaded to the container registry in the previous step, we can run it in Kubernetes using the below configurations.
161
+
162
+ ### Install and run Kubernetes
163
+
164
+ Make sure your [Kubernetes client](https://kubernetes.io/docs/tasks/tools/#kubectl), `kubectl`, is installed and running on your machine.
165
+
166
+ ### Configure a Google OAuth Client and oauth2-proxy
167
+
168
+ For configuring the Google OAuth Client, please see [Google Auth Provider](https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider#google-auth-provider). Configure oauth2-proxy to use the desired [OAuth Provider Configuration](https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider) and update the oath2-proxy config in the config map.
169
+
170
+ The below configuration contains a ouath2-proxy sidecar container which handles the authentication with Google. You can learn more from the [oauth2-proxy repository](https://github.com/oauth2-proxy/oauth2-proxy).
171
+
172
+ ### Create a Kubernetes configuration file
173
+
174
+ Create a [YAML](https://yaml.org/) [configuration file](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#organizing-resource-configurations) named `k8s-streamlit.yaml`:
175
+
176
+ ```yaml
177
+ apiVersion: v1
178
+ kind: ConfigMap
179
+ metadata:
180
+ name: streamlit-configmap
181
+ data:
182
+ oauth2-proxy.cfg: |-
183
+ http_address = "0.0.0.0:4180"
184
+ upstreams = ["http://127.0.0.1:8501/"]
185
+ email_domains = ["*"]
186
+ client_id = "<GOOGLE_CLIENT_ID>"
187
+ client_secret = "<GOOGLE_CLIENT_SECRET>"
188
+ cookie_secret = "<16, 24, or 32 bytes>"
189
+ redirect_url = <REDIRECT_URL>
190
+
191
+ ---
192
+ apiVersion: apps/v1
193
+ kind: Deployment
194
+ metadata:
195
+ name: streamlit-deployment
196
+ labels:
197
+ app: streamlit
198
+ spec:
199
+ replicas: 1
200
+ selector:
201
+ matchLabels:
202
+ app: streamlit
203
+ template:
204
+ metadata:
205
+ labels:
206
+ app: streamlit
207
+ spec:
208
+ containers:
209
+ - name: oauth2-proxy
210
+ image: quay.io/oauth2-proxy/oauth2-proxy:v7.2.0
211
+ args: ["--config", "/etc/oauth2-proxy/oauth2-proxy.cfg"]
212
+ ports:
213
+ - containerPort: 4180
214
+ livenessProbe:
215
+ httpGet:
216
+ path: /ping
217
+ port: 4180
218
+ scheme: HTTP
219
+ readinessProbe:
220
+ httpGet:
221
+ path: /ping
222
+ port: 4180
223
+ scheme: HTTP
224
+ volumeMounts:
225
+ - mountPath: "/etc/oauth2-proxy"
226
+ name: oauth2-config
227
+ - name: streamlit
228
+ image: gcr.io/GCP_PROJECT_ID/k8s-streamlit:test
229
+ imagePullPolicy: Always
230
+ ports:
231
+ - containerPort: 8501
232
+ livenessProbe:
233
+ httpGet:
234
+ path: /_stcore/health
235
+ port: 8501
236
+ scheme: HTTP
237
+ timeoutSeconds: 1
238
+ readinessProbe:
239
+ httpGet:
240
+ path: /_stcore/health
241
+ port: 8501
242
+ scheme: HTTP
243
+ timeoutSeconds: 1
244
+ resources:
245
+ limits:
246
+ cpu: 1
247
+ memory: 2Gi
248
+ requests:
249
+ cpu: 100m
250
+ memory: 745Mi
251
+ volumes:
252
+ - name: oauth2-config
253
+ configMap:
254
+ name: streamlit-configmap
255
+
256
+ ---
257
+ apiVersion: v1
258
+ kind: Service
259
+ metadata:
260
+ name: streamlit-service
261
+ spec:
262
+ type: LoadBalancer
263
+ selector:
264
+ app: streamlit
265
+ ports:
266
+ - name: streamlit-port
267
+ protocol: TCP
268
+ port: 80
269
+ targetPort: 4180
270
+ ```
271
+
272
+ <Important>
273
+
274
+ While the above configurations can be copied verbatim, you will have to configure the `oauth2-proxy` yourself and use the correct `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_ID`, `GCP_PROJECT_ID`, and `REDIRECT_URL`.
275
+
276
+ </Important>
277
+
278
+ Now create the configuration from the file in Kubernetes with the [`kubectl create`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#create) command:
279
+
280
+ ```bash
281
+ kubctl create -f k8s-streamlit.yaml
282
+ ```
283
+
284
+ ### Set up TLS support
285
+
286
+ Since you are using the Google authentication, you will need to set up TLS support. Find out how in [TLS Configuration](https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/tls).
287
+
288
+ ### Verify the deployment
289
+
290
+ Once the deployment and the service are created, we need to wait a couple of minutes for the public IP address to become available. We can check when that is ready by running:
291
+
292
+ ```bash
293
+ kubectl get service streamlit-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
294
+ ```
295
+
296
+ After the public IP is assigned, you will need to configure in your DNS service an `A record` pointing to the above IP address.
data/develop/_index.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Develop
3
+ slug: /develop
4
+ ---
5
+
6
+ # Develop
7
+
8
+ Get all the information you need to build beautiful, performant web apps with Streamlit!
9
+
10
+ <InlineCalloutContainer>
11
+ <InlineCallout
12
+ color="indigo-70"
13
+ icon="book"
14
+ bold="Concepts."
15
+ href="/develop/concepts"
16
+ >Learn how Streamlit works with in-depth guides to our execution model and features.</InlineCallout>
17
+ <InlineCallout
18
+ color="indigo-70"
19
+ icon="list"
20
+ bold="API reference."
21
+ href="/develop/api-reference"
22
+ >Learn about our API with function definitions and examples.</InlineCallout>
23
+ <InlineCallout
24
+ color="indigo-70"
25
+ icon="auto_awesome"
26
+ bold="Tutorials."
27
+ href="/develop/tutorials"
28
+ >Follow step-by-step instructions to build example apps and useful snippets.</InlineCallout>
29
+ <InlineCallout
30
+ color="indigo-70"
31
+ icon="bolt"
32
+ bold="Quick references."
33
+ href="/develop/quick-reference"
34
+ >Check out our quick references for easy access to convenient information like our changelog, cheat sheet, pre-release features, and roadmap.</InlineCallout>
35
+ </InlineCalloutContainer>
data/develop/api-reference/_index.md ADDED
@@ -0,0 +1,2701 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: API Reference
3
+ slug: /develop/api-reference
4
+ ---
5
+
6
+ # API reference
7
+
8
+ Streamlit makes it easy for you to visualize, mutate, and share data. The API
9
+ reference is organized by activity type, like displaying data or optimizing
10
+ performance. Each section includes methods associated with the activity type,
11
+ including examples.
12
+
13
+ Browse our API below and click to learn more about any of our available commands! 🎈
14
+
15
+ ## Display almost anything
16
+
17
+ ### Write and magic
18
+
19
+ <br />
20
+
21
+ <TileContainer>
22
+
23
+ <RefCard href="/develop/api-reference/write-magic/st.write">
24
+
25
+ <h4>st.write</h4>
26
+
27
+ Write arguments to the app.
28
+
29
+ ```python
30
+ st.write("Hello **world**!")
31
+ st.write(my_data_frame)
32
+ st.write(my_mpl_figure)
33
+ ```
34
+
35
+ </RefCard>
36
+ <RefCard href="/develop/api-reference/write-magic/st.write_stream">
37
+
38
+ <h4>st.write_stream</h4>
39
+
40
+ Write generators or streams to the app with a typewriter effect.
41
+
42
+ ```python
43
+ st.write_stream(my_generator)
44
+ st.write_stream(my_llm_stream)
45
+ ```
46
+
47
+ </RefCard>
48
+ <RefCard href="/develop/api-reference/write-magic/magic">
49
+
50
+ <h4>Magic</h4>
51
+
52
+ Any time Streamlit sees either a variable or literal value on its own line, it automatically writes that to your app using `st.write`
53
+
54
+ ```python
55
+ "Hello **world**!"
56
+ my_data_frame
57
+ my_mpl_figure
58
+ ```
59
+
60
+ </RefCard>
61
+ </TileContainer>
62
+
63
+ ### Text elements
64
+
65
+ <br />
66
+
67
+ <TileContainer>
68
+ <RefCard href="/develop/api-reference/text/st.markdown">
69
+
70
+ <Image pure alt="screenshot" src="/images/api/markdown.jpg" />
71
+
72
+ <h4>Markdown</h4>
73
+
74
+ Display string formatted as Markdown.
75
+
76
+ ```python
77
+ st.markdown("Hello **world**!")
78
+ ```
79
+
80
+ </RefCard>
81
+ <RefCard href="/develop/api-reference/text/st.title">
82
+
83
+ <Image pure alt="screenshot" src="/images/api/title.jpg" />
84
+
85
+ <h4>Title</h4>
86
+
87
+ Display text in title formatting.
88
+
89
+ ```python
90
+ st.title("The app title")
91
+ ```
92
+
93
+ </RefCard>
94
+ <RefCard href="/develop/api-reference/text/st.header">
95
+
96
+ <Image pure alt="screenshot" src="/images/api/header.jpg" />
97
+
98
+ <h4>Header</h4>
99
+
100
+ Display text in header formatting.
101
+
102
+ ```python
103
+ st.header("This is a header")
104
+ ```
105
+
106
+ </RefCard>
107
+ <RefCard href="/develop/api-reference/text/st.subheader">
108
+
109
+ <Image pure alt="screenshot" src="/images/api/subheader.jpg" />
110
+
111
+ <h4>Subheader</h4>
112
+
113
+ Display text in subheader formatting.
114
+
115
+ ```python
116
+ st.subheader("This is a subheader")
117
+ ```
118
+
119
+ </RefCard>
120
+ <RefCard href="/develop/api-reference/text/st.caption">
121
+
122
+ <Image pure alt="screenshot" src="/images/api/caption.jpg" />
123
+
124
+ <h4>Caption</h4>
125
+
126
+ Display text in small font.
127
+
128
+ ```python
129
+ st.caption("This is written small caption text")
130
+ ```
131
+
132
+ </RefCard>
133
+ <RefCard href="/develop/api-reference/text/st.code">
134
+
135
+ <Image pure alt="screenshot" src="/images/api/code.jpg" />
136
+
137
+ <h4>Code block</h4>
138
+
139
+ Display a code block with optional syntax highlighting.
140
+
141
+ ```python
142
+ st.code("a = 1234")
143
+ ```
144
+
145
+ </RefCard>
146
+ <RefCard href="/develop/api-reference/text/st.echo">
147
+
148
+ <Image pure alt="screenshot" src="/images/api/code.jpg" />
149
+
150
+ <h4>Echo</h4>
151
+
152
+ Display some code in the app, then execute it. Useful for tutorials.
153
+
154
+ ```python
155
+ with st.echo():
156
+ st.write('This code will be printed')
157
+ ```
158
+
159
+ </RefCard>
160
+ <RefCard href="/develop/api-reference/text/st.latex">
161
+
162
+ <Image pure alt="screenshot" src="/images/api/latex.jpg" />
163
+
164
+ <h4>LaTeX</h4>
165
+
166
+ Display mathematical expressions formatted as LaTeX.
167
+
168
+ ```python
169
+ st.latex("\int a x^2 \,dx")
170
+ ```
171
+
172
+ </RefCard>
173
+ <RefCard href="/develop/api-reference/text/st.text">
174
+
175
+ <Image pure alt="screenshot" src="/images/api/text.jpg" />
176
+
177
+ <h4>Preformatted text</h4>
178
+
179
+ Write fixed-width and preformatted text.
180
+
181
+ ```python
182
+ st.text("Hello world")
183
+ ```
184
+
185
+ </RefCard>
186
+ <RefCard href="/develop/api-reference/text/st.divider">
187
+
188
+ <Image pure alt="screenshot" src="/images/api/divider.jpg" />
189
+
190
+ <h4>Divider</h4>
191
+
192
+ Display a horizontal rule.
193
+
194
+ ```python
195
+ st.divider()
196
+ ```
197
+
198
+ </RefCard>
199
+ </TileContainer>
200
+
201
+ <ComponentSlider>
202
+ <ComponentCard href="https://github.com/tvst/st-annotated-text">
203
+
204
+ <Image pure alt="screenshot" src="/images/api/components/annotated-text.jpg" />
205
+
206
+ <h4>Annotated text</h4>
207
+
208
+ Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst).
209
+
210
+ ```python
211
+ annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".")
212
+ ```
213
+
214
+ </ComponentCard>
215
+
216
+ <ComponentCard href="https://github.com/andfanilo/streamlit-drawable-canvas">
217
+
218
+ <Image pure alt="screenshot" src="/images/api/components/drawable-canvas.jpg" />
219
+
220
+ <h4>Drawable Canvas</h4>
221
+
222
+ Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo).
223
+
224
+ ```python
225
+ st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",)
226
+ ```
227
+
228
+ </ComponentCard>
229
+
230
+ <ComponentCard href="https://github.com/gagan3012/streamlit-tags">
231
+
232
+ <Image pure alt="screenshot" src="/images/api/components/tags.jpg" />
233
+
234
+ <h4>Tags</h4>
235
+
236
+ Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012).
237
+
238
+ ```python
239
+ st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1')
240
+ ```
241
+
242
+ </ComponentCard>
243
+
244
+ <ComponentCard href="https://github.com/JohnSnowLabs/nlu">
245
+
246
+ <Image pure alt="screenshot" src="/images/api/components/nlu.jpg" />
247
+
248
+ <h4>NLU</h4>
249
+
250
+ Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/).
251
+
252
+ ```python
253
+ nlu.load('sentiment').predict('I love NLU! <3')
254
+ ```
255
+
256
+ </ComponentCard>
257
+
258
+ <ComponentCard href="https://extras.streamlit.app/">
259
+
260
+ <Image pure alt="screenshot" src="/images/api/components/extras-mentions.jpg" />
261
+
262
+ <h4>Streamlit Extras</h4>
263
+
264
+ A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
265
+
266
+ ```python
267
+ mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",)
268
+ ```
269
+
270
+ </ComponentCard>
271
+ </ComponentSlider>
272
+
273
+ ### Data elements
274
+
275
+ <br />
276
+
277
+ <TileContainer>
278
+ <RefCard href="/develop/api-reference/data/st.dataframe">
279
+ <Image pure alt="screenshot" src="/images/api/dataframe.jpg" />
280
+
281
+ <h4>Dataframes</h4>
282
+
283
+ Display a dataframe as an interactive table.
284
+
285
+ ```python
286
+ st.dataframe(my_data_frame)
287
+ ```
288
+
289
+ </RefCard>
290
+ <RefCard href="/develop/api-reference/data/st.data_editor">
291
+
292
+ <Image pure alt="screenshot" src="/images/api/data_editor.jpg" />
293
+
294
+ <h4>Data editor</h4>
295
+
296
+ Display a data editor widget.
297
+
298
+ ```python
299
+ edited = st.data_editor(df, num_rows="dynamic")
300
+ ```
301
+
302
+ </RefCard>
303
+ <RefCard href="/develop/api-reference/data/st.column_config">
304
+
305
+ <Image pure alt="screenshot" src="/images/api/column_config.jpg" />
306
+
307
+ <h4>Column configuration</h4>
308
+
309
+ Configure the display and editing behavior of dataframes and data editors.
310
+
311
+ ```python
312
+ st.column_config.NumberColumn("Price (in USD)", min_value=0, format="$%d")
313
+ ```
314
+
315
+ </RefCard>
316
+
317
+ <RefCard href="/develop/api-reference/data/st.table">
318
+ <Image pure alt="screenshot" src="/images/api/table.jpg" />
319
+
320
+ <h4>Static tables</h4>
321
+
322
+ Display a static table.
323
+
324
+ ```python
325
+ st.table(my_data_frame)
326
+ ```
327
+
328
+ </RefCard>
329
+ <RefCard href="/develop/api-reference/data/st.metric">
330
+ <Image pure alt="screenshot" src="/images/api/metric.jpg" />
331
+
332
+ <h4>Metrics</h4>
333
+
334
+ Display a metric in big bold font, with an optional indicator of how the metric changed.
335
+
336
+ ```python
337
+ st.metric("My metric", 42, 2)
338
+ ```
339
+
340
+ </RefCard>
341
+ <RefCard href="/develop/api-reference/data/st.json">
342
+ <Image pure alt="screenshot" src="/images/api/json.jpg" />
343
+
344
+ <h4>Dicts and JSON</h4>
345
+
346
+ Display object or string as a pretty-printed JSON string.
347
+
348
+ ```python
349
+ st.json(my_dict)
350
+ ```
351
+
352
+ </RefCard>
353
+ </TileContainer>
354
+
355
+ <ComponentSlider>
356
+
357
+ <ComponentCard href="https://github.com/PablocFonseca/streamlit-aggrid">
358
+
359
+ <Image pure alt="screenshot" src="/images/api/components/aggrid.jpg" />
360
+
361
+ <h4>Streamlit Aggrid</h4>
362
+
363
+ Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca).
364
+
365
+ ```python
366
+ df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]})
367
+ grid_return = AgGrid(df, editable=True)
368
+
369
+ new_df = grid_return['data']
370
+ ```
371
+
372
+ </ComponentCard>
373
+
374
+ <ComponentCard href="https://github.com/randyzwitch/streamlit-folium">
375
+
376
+ <Image pure alt="screenshot" src="/images/api/components/folium.jpg" />
377
+
378
+ <h4>Streamlit Folium</h4>
379
+
380
+ Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch).
381
+
382
+ ```python
383
+ m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
384
+ folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m)
385
+
386
+ st_data = st_folium(m, width=725)
387
+ ```
388
+
389
+ </ComponentCard>
390
+
391
+ <ComponentCard href="https://github.com/okld/streamlit-pandas-profiling">
392
+
393
+ <Image pure alt="screenshot" src="/images/api/components/pandas-profiling.jpg" />
394
+
395
+ <h4>Pandas Profiling</h4>
396
+
397
+ Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/).
398
+
399
+ ```python
400
+ df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv")
401
+ pr = df.profile_report()
402
+
403
+ st_profile_report(pr)
404
+ ```
405
+
406
+ </ComponentCard>
407
+
408
+ <ComponentCard href="https://github.com/blackary/streamlit-image-coordinates">
409
+
410
+ <Image pure alt="screenshot" src="/images/api/components/image-coordinates.jpg" />
411
+
412
+ <h4>Image Coordinates</h4>
413
+
414
+ Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/).
415
+
416
+ ```python
417
+ from streamlit_image_coordinates import streamlit_image_coordinates
418
+ value = streamlit_image_coordinates("https://placekitten.com/200/300")
419
+
420
+ st.write(value)
421
+ ```
422
+
423
+ </ComponentCard>
424
+
425
+ <ComponentCard href="https://github.com/null-jones/streamlit-plotly-events">
426
+
427
+ <Image pure alt="screenshot" src="/images/api/components/plotly-events.jpg" />
428
+
429
+ <h4>Plotly Events</h4>
430
+
431
+ Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/).
432
+
433
+ ```python
434
+ from streamlit_plotly_events import plotly_events
435
+ fig = px.line(x=[1], y=[1])
436
+
437
+ selected_points = plotly_events(fig)
438
+ ```
439
+
440
+ </ComponentCard>
441
+
442
+ <ComponentCard href="https://extras.streamlit.app/">
443
+
444
+ <Image pure alt="screenshot" src="/images/api/components/extras-metric-cards.jpg" />
445
+
446
+ <h4>Streamlit Extras</h4>
447
+
448
+ A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
449
+
450
+ ```python
451
+ from streamlit_extras.metric_cards import style_metric_cards
452
+ col3.metric(label="No Change", value=5000, delta=0)
453
+
454
+ style_metric_cards()
455
+ ```
456
+
457
+ </ComponentCard>
458
+
459
+ </ComponentSlider>
460
+
461
+ ### Chart elements
462
+
463
+ <br />
464
+
465
+ <TileContainer>
466
+
467
+ <RefCard href="/develop/api-reference/charts/st.area_chart">
468
+ <Image pure alt="screenshot" src="/images/api/area_chart.jpg" />
469
+
470
+ <h4>Simple area charts</h4>
471
+
472
+ Display an area chart.
473
+
474
+ ```python
475
+ st.area_chart(my_data_frame)
476
+ ```
477
+
478
+ </RefCard>
479
+ <RefCard href="/develop/api-reference/charts/st.bar_chart">
480
+ <Image pure alt="screenshot" src="/images/api/bar_chart.jpg" />
481
+
482
+ <h4>Simple bar charts</h4>
483
+
484
+ Display a bar chart.
485
+
486
+ ```python
487
+ st.bar_chart(my_data_frame)
488
+ ```
489
+
490
+ </RefCard>
491
+ <RefCard href="/develop/api-reference/charts/st.line_chart">
492
+ <Image pure alt="screenshot" src="/images/api/line_chart.jpg" />
493
+
494
+ <h4>Simple line charts</h4>
495
+
496
+ Display a line chart.
497
+
498
+ ```python
499
+ st.line_chart(my_data_frame)
500
+ ```
501
+
502
+ </RefCard>
503
+ <RefCard href="/develop/api-reference/charts/st.scatter_chart">
504
+ <Image pure alt="screenshot" src="/images/api/scatter_chart.svg" />
505
+
506
+ <h4>Simple scatter charts</h4>
507
+
508
+ Display a line chart.
509
+
510
+ ```python
511
+ st.scatter_chart(my_data_frame)
512
+ ```
513
+
514
+ </RefCard>
515
+ <RefCard href="/develop/api-reference/charts/st.map">
516
+ <Image pure alt="screenshot" src="/images/api/map.jpg" />
517
+
518
+ <h4>Scatterplots on maps</h4>
519
+
520
+ Display a map with points on it.
521
+
522
+ ```python
523
+ st.map(my_data_frame)
524
+ ```
525
+
526
+ </RefCard>
527
+ <RefCard href="/develop/api-reference/charts/st.pyplot">
528
+ <Image pure alt="screenshot" src="/images/api/pyplot.jpg" />
529
+
530
+ <h4>Matplotlib</h4>
531
+
532
+ Display a matplotlib.pyplot figure.
533
+
534
+ ```python
535
+ st.pyplot(my_mpl_figure)
536
+ ```
537
+
538
+ </RefCard>
539
+ <RefCard href="/develop/api-reference/charts/st.altair_chart">
540
+ <Image pure alt="screenshot" src="/images/api/vega_lite_chart.jpg" />
541
+
542
+ <h4>Altair</h4>
543
+
544
+ Display a chart using the Altair library.
545
+
546
+ ```python
547
+ st.altair_chart(my_altair_chart)
548
+ ```
549
+
550
+ </RefCard>
551
+ <RefCard href="/develop/api-reference/charts/st.vega_lite_chart">
552
+ <Image pure alt="screenshot" src="/images/api/vega_lite_chart.jpg" />
553
+
554
+ <h4>Vega-Lite</h4>
555
+
556
+ Display a chart using the Vega-Lite library.
557
+
558
+ ```python
559
+ st.vega_lite_chart(my_vega_lite_chart)
560
+ ```
561
+
562
+ </RefCard>
563
+ <RefCard href="/develop/api-reference/charts/st.plotly_chart">
564
+ <Image pure alt="screenshot" src="/images/api/plotly_chart.jpg" />
565
+
566
+ <h4>Plotly</h4>
567
+
568
+ Display an interactive Plotly chart.
569
+
570
+ ```python
571
+ st.plotly_chart(my_plotly_chart)
572
+ ```
573
+
574
+ </RefCard>
575
+ <RefCard href="/develop/api-reference/charts/st.bokeh_chart">
576
+ <Image pure alt="screenshot" src="/images/api/bokeh_chart.jpg" />
577
+
578
+ <h4>Bokeh</h4>
579
+
580
+ Display an interactive Bokeh chart.
581
+
582
+ ```python
583
+ st.bokeh_chart(my_bokeh_chart)
584
+ ```
585
+
586
+ </RefCard>
587
+ <RefCard href="/develop/api-reference/charts/st.pydeck_chart">
588
+ <Image pure alt="screenshot" src="/images/api/pydeck_chart.jpg" />
589
+
590
+ <h4>PyDeck</h4>
591
+
592
+ Display a chart using the PyDeck library.
593
+
594
+ ```python
595
+ st.pydeck_chart(my_pydeck_chart)
596
+ ```
597
+
598
+ </RefCard>
599
+ <RefCard href="/develop/api-reference/charts/st.graphviz_chart">
600
+ <Image pure alt="screenshot" src="/images/api/graphviz_chart.jpg" />
601
+
602
+ <h4>GraphViz</h4>
603
+
604
+ Display a graph using the dagre-d3 library.
605
+
606
+ ```python
607
+ st.graphviz_chart(my_graphviz_spec)
608
+ ```
609
+
610
+ </RefCard>
611
+ </TileContainer>
612
+
613
+ <ComponentSlider>
614
+
615
+ <ComponentCard href="https://github.com/tvst/plost">
616
+
617
+ <Image pure alt="screenshot" src="/images/api/components/plost.jpg" />
618
+
619
+ <h4>Plost</h4>
620
+
621
+ A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst).
622
+
623
+ ```python
624
+ import plost
625
+ plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',)
626
+ ```
627
+
628
+ </ComponentCard>
629
+
630
+ <ComponentCard href="https://github.com/facebookresearch/hiplot">
631
+
632
+ <Image pure alt="screenshot" src="/images/api/components/hiplot.jpg" />
633
+
634
+ <h4>HiPlot</h4>
635
+
636
+ High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch).
637
+
638
+ ```python
639
+ data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}]
640
+ hip.Experiment.from_iterable(data).display()
641
+ ```
642
+
643
+ </ComponentCard>
644
+
645
+ <ComponentCard href="https://github.com/andfanilo/streamlit-echarts">
646
+
647
+ <Image pure alt="screenshot" src="/images/api/components/echarts.jpg" />
648
+
649
+ <h4>ECharts</h4>
650
+
651
+ High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo).
652
+
653
+ ```python
654
+ from streamlit_echarts import st_echarts
655
+ st_echarts(options=options)
656
+ ```
657
+
658
+ </ComponentCard>
659
+
660
+ <ComponentCard href="https://github.com/randyzwitch/streamlit-folium">
661
+
662
+ <Image pure alt="screenshot" src="/images/api/components/folium.jpg" />
663
+
664
+ <h4>Streamlit Folium</h4>
665
+
666
+ Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch).
667
+
668
+ ```python
669
+ m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
670
+ st_data = st_folium(m, width=725)
671
+ ```
672
+
673
+ </ComponentCard>
674
+
675
+ <ComponentCard href="https://github.com/explosion/spacy-streamlit">
676
+
677
+ <Image pure alt="screenshot" src="/images/api/components/spacy.jpg" />
678
+
679
+ <h4>Spacy-Streamlit</h4>
680
+
681
+ spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion).
682
+
683
+ ```python
684
+ models = ["en_core_web_sm", "en_core_web_md"]
685
+ spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.")
686
+ ```
687
+
688
+ </ComponentCard>
689
+
690
+ <ComponentCard href="https://github.com/ChrisDelClea/streamlit-agraph">
691
+
692
+ <Image pure alt="screenshot" src="/images/api/components/agraph.jpg" />
693
+
694
+ <h4>Streamlit Agraph</h4>
695
+
696
+ A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea).
697
+
698
+ ```python
699
+ from streamlit_agraph import agraph, Node, Edge, Config
700
+ agraph(nodes=nodes, edges=edges, config=config)
701
+ ```
702
+
703
+ </ComponentCard>
704
+
705
+ <ComponentCard href="https://github.com/andfanilo/streamlit-lottie">
706
+
707
+ <Image pure alt="screenshot" src="/images/api/components/lottie.jpg" />
708
+
709
+ <h4>Streamlit Lottie</h4>
710
+
711
+ Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo).
712
+
713
+ ```python
714
+ lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json")
715
+ st_lottie(lottie_hello, key="hello")
716
+ ```
717
+
718
+ </ComponentCard>
719
+
720
+ <ComponentCard href="https://github.com/null-jones/streamlit-plotly-events">
721
+
722
+ <Image pure alt="screenshot" src="/images/api/components/plotly-events.jpg" />
723
+
724
+ <h4>Plotly Events</h4>
725
+
726
+ Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/).
727
+
728
+ ```python
729
+ fig = px.line(x=[1], y=[1])
730
+ selected_points = plotly_events(fig)
731
+ ```
732
+
733
+ </ComponentCard>
734
+
735
+ <ComponentCard href="https://extras.streamlit.app/">
736
+
737
+ <Image pure alt="screenshot" src="/images/api/components/extras-chart-annotations.jpg" />
738
+
739
+ <h4>Streamlit Extras</h4>
740
+
741
+ A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
742
+
743
+ ```python
744
+ chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],)
745
+ st.altair_chart(chart, use_container_width=True)
746
+ ```
747
+
748
+ </ComponentCard>
749
+
750
+ </ComponentSlider>
751
+
752
+ ### Input widgets
753
+
754
+ <br />
755
+
756
+ <TileContainer>
757
+ <RefCard href="/develop/api-reference/widgets/st.button">
758
+
759
+ <Image pure alt="screenshot" src="/images/api/button.svg" />
760
+
761
+ <h4>Button</h4>
762
+
763
+ Display a button widget.
764
+
765
+ ```python
766
+ clicked = st.button("Click me")
767
+ ```
768
+
769
+ </RefCard>
770
+ <RefCard href="/develop/api-reference/widgets/st.download_button">
771
+
772
+ <Image pure alt="screenshot" src="/images/api/download_button.svg" />
773
+
774
+ <h4>Download button</h4>
775
+
776
+ Display a download button widget.
777
+
778
+ ```python
779
+ st.download_button("Download file", file)
780
+ ```
781
+
782
+ </RefCard>
783
+ <RefCard href="/develop/api-reference/execution-flow/st.form_submit_button">
784
+
785
+ <Image pure alt="screenshot" src="/images/api/form_submit_button.svg" />
786
+
787
+ <h4>Form button</h4>
788
+
789
+ Display a form submit button. For use with `st.form`.
790
+
791
+ ```python
792
+ st.form_submit_button("Sign up")
793
+ ```
794
+
795
+ </RefCard>
796
+ <RefCard href="/develop/api-reference/widgets/st.link_button">
797
+
798
+ <Image pure alt="screenshot" src="/images/api/link_button.svg" />
799
+
800
+ <h4>Link button</h4>
801
+
802
+ Display a link button.
803
+
804
+ ```python
805
+ st.link_button("Go to gallery", url)
806
+ ```
807
+
808
+ </RefCard>
809
+ <RefCard href="/develop/api-reference/widgets/st.page_link">
810
+
811
+ <Image pure alt="screenshot" src="/images/api/page_link.jpg" />
812
+
813
+ <h4>Page link</h4>
814
+
815
+ Display a link to another page in a multipage app.
816
+
817
+ ```python
818
+ st.page_link("app.py", label="Home", icon="🏠")
819
+ st.page_link("pages/profile.py", label="My profile")
820
+ ```
821
+
822
+ </RefCard>
823
+ <RefCard href="/develop/api-reference/widgets/st.checkbox">
824
+
825
+ <Image pure alt="screenshot" src="/images/api/checkbox.jpg" />
826
+
827
+ <h4>Checkbox</h4>
828
+
829
+ Display a checkbox widget.
830
+
831
+ ```python
832
+ selected = st.checkbox("I agree")
833
+ ```
834
+
835
+ </RefCard>
836
+ <RefCard href="/develop/api-reference/widgets/st.color_picker">
837
+
838
+ <Image pure alt="screenshot" src="/images/api/color_picker.jpg" />
839
+
840
+ <h4>Color picker</h4>
841
+
842
+ Display a color picker widget.
843
+
844
+ ```python
845
+ color = st.color_picker("Pick a color")
846
+ ```
847
+
848
+ </RefCard>
849
+ <RefCard href="/develop/api-reference/widgets/st.multiselect">
850
+
851
+ <Image pure alt="screenshot" src="/images/api/multiselect.jpg" />
852
+
853
+ <h4>Multiselect</h4>
854
+
855
+ Display a multiselect widget. The multiselect widget starts as empty.
856
+
857
+ ```python
858
+ choices = st.multiselect("Buy", ["milk", "apples", "potatoes"])
859
+ ```
860
+
861
+ </RefCard>
862
+ <RefCard href="/develop/api-reference/widgets/st.radio">
863
+
864
+ <Image pure alt="screenshot" src="/images/api/radio.jpg" />
865
+
866
+ <h4>Radio</h4>
867
+
868
+ Display a radio button widget.
869
+
870
+ ```python
871
+ choice = st.radio("Pick one", ["cats", "dogs"])
872
+ ```
873
+
874
+ </RefCard>
875
+ <RefCard href="/develop/api-reference/widgets/st.selectbox">
876
+
877
+ <Image pure alt="screenshot" src="/images/api/selectbox.jpg" />
878
+
879
+ <h4>Selectbox</h4>
880
+
881
+ Display a select widget.
882
+
883
+ ```python
884
+ choice = st.selectbox("Pick one", ["cats", "dogs"])
885
+ ```
886
+
887
+ </RefCard>
888
+ <RefCard href="/develop/api-reference/widgets/st.select_slider">
889
+
890
+ <Image pure alt="screenshot" src="/images/api/select_slider.jpg" />
891
+
892
+ <h4>Select-slider</h4>
893
+
894
+ Display a slider widget to select items from a list.
895
+
896
+ ```python
897
+ size = st.select_slider("Pick a size", ["S", "M", "L"])
898
+ ```
899
+
900
+ </RefCard>
901
+ <RefCard href="/develop/api-reference/widgets/st.toggle">
902
+
903
+ <Image pure alt="screenshot" src="/images/api/toggle.jpg" />
904
+
905
+ <h4>Toggle</h4>
906
+
907
+ Display a toggle widget.
908
+
909
+ ```python
910
+ activated = st.toggle("Activate")
911
+ ```
912
+
913
+ </RefCard>
914
+ <RefCard href="/develop/api-reference/widgets/st.number_input">
915
+
916
+ <Image pure alt="screenshot" src="/images/api/number_input.jpg" />
917
+
918
+ <h4>Number input</h4>
919
+
920
+ Display a numeric input widget.
921
+
922
+ ```python
923
+ choice = st.number_input("Pick a number", 0, 10)
924
+ ```
925
+
926
+ </RefCard>
927
+ <RefCard href="/develop/api-reference/widgets/st.slider">
928
+
929
+ <Image pure alt="screenshot" src="/images/api/slider.jpg" />
930
+
931
+ <h4>Slider</h4>
932
+
933
+ Display a slider widget.
934
+
935
+ ```python
936
+ number = st.slider("Pick a number", 0, 100)
937
+ ```
938
+
939
+ </RefCard>
940
+ <RefCard href="/develop/api-reference/widgets/st.date_input">
941
+
942
+ <Image pure alt="screenshot" src="/images/api/date_input.jpg" />
943
+
944
+ <h4>Date input</h4>
945
+
946
+ Display a date input widget.
947
+
948
+ ```python
949
+ date = st.date_input("Your birthday")
950
+ ```
951
+
952
+ </RefCard>
953
+ <RefCard href="/develop/api-reference/widgets/st.time_input">
954
+
955
+ <Image pure alt="screenshot" src="/images/api/time_input.jpg" />
956
+
957
+ <h4>Time input</h4>
958
+
959
+ Display a time input widget.
960
+
961
+ ```python
962
+ time = st.time_input("Meeting time")
963
+ ```
964
+
965
+ </RefCard>
966
+ <RefCard href="/develop/api-reference/chat/st.chat_input">
967
+
968
+ <Image pure alt="screenshot" src="/images/api/chat_input.jpg" />
969
+
970
+ <h4>Chat input</h4>
971
+
972
+ Display a chat input widget.
973
+
974
+ ```python
975
+ prompt = st.chat_input("Say something")
976
+ if prompt:
977
+ st.write(f"The user has sent: {prompt}")
978
+ ```
979
+
980
+ </RefCard>
981
+ <RefCard href="/develop/api-reference/widgets/st.text_area">
982
+
983
+ <Image pure alt="screenshot" src="/images/api/text_area.jpg" />
984
+
985
+ <h4>Text-area</h4>
986
+
987
+ Display a multi-line text input widget.
988
+
989
+ ```python
990
+ text = st.text_area("Text to translate")
991
+ ```
992
+
993
+ </RefCard>
994
+ <RefCard href="/develop/api-reference/widgets/st.text_input">
995
+
996
+ <Image pure alt="screenshot" src="/images/api/text_input.jpg" />
997
+
998
+ <h4>Text input</h4>
999
+
1000
+ Display a single-line text input widget.
1001
+
1002
+ ```python
1003
+ name = st.text_input("First name")
1004
+ ```
1005
+
1006
+ </RefCard>
1007
+ <RefCard href="/develop/api-reference/data/st.data_editor">
1008
+
1009
+ <Image pure alt="screenshot" src="/images/api/data_editor.jpg" />
1010
+
1011
+ <h4>Data editor</h4>
1012
+
1013
+ Display a data editor widget.
1014
+
1015
+ ```python
1016
+ edited = st.experimental_data_editor(df, num_rows="dynamic")
1017
+ ```
1018
+
1019
+ </RefCard>
1020
+ <RefCard href="/develop/api-reference/widgets/st.file_uploader">
1021
+
1022
+ <Image pure alt="screenshot" src="/images/api/file_uploader.jpg" />
1023
+
1024
+ <h4>File Uploader</h4>
1025
+
1026
+ Display a file uploader widget.
1027
+
1028
+ ```python
1029
+ data = st.file_uploader("Upload a CSV")
1030
+ ```
1031
+
1032
+ </RefCard>
1033
+ <RefCard href="/develop/api-reference/widgets/st.camera_input">
1034
+
1035
+ <Image pure alt="screenshot" src="/images/api/camera_input.jpg" />
1036
+
1037
+ <h4>Camera input</h4>
1038
+
1039
+ Display a widget that allows users to upload images directly from a camera.
1040
+
1041
+ ```python
1042
+ image = st.camera_input("Take a picture")
1043
+ ```
1044
+
1045
+ </RefCard>
1046
+ </TileContainer>
1047
+
1048
+ <ComponentSlider>
1049
+
1050
+ <ComponentCard href="https://github.com/okld/streamlit-elements">
1051
+
1052
+ <Image pure alt="screenshot" src="/images/api/components/elements.jpg" />
1053
+
1054
+ <h4>Streamlit Elements</h4>
1055
+
1056
+ Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls).
1057
+
1058
+ ```python
1059
+ from streamlit_elements import elements, mui, html
1060
+
1061
+ with elements("new_element"):
1062
+ mui.Typography("Hello world")
1063
+ ```
1064
+
1065
+ </ComponentCard>
1066
+
1067
+ <ComponentCard href="https://github.com/gagan3012/streamlit-tags">
1068
+
1069
+ <Image pure alt="screenshot" src="/images/api/components/tags.jpg" />
1070
+
1071
+ <h4>Tags</h4>
1072
+
1073
+ Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012).
1074
+
1075
+ ```python
1076
+ from streamlit_tags import st_tags
1077
+
1078
+ st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'],
1079
+ suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1')
1080
+ ```
1081
+
1082
+ </ComponentCard>
1083
+
1084
+ <ComponentCard href="https://github.com/Wirg/stqdm">
1085
+
1086
+ <Image pure alt="screenshot" src="/images/api/components/stqdm.jpg" />
1087
+
1088
+ <h4>Stqdm</h4>
1089
+
1090
+ The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg).
1091
+
1092
+ ```python
1093
+ from stqdm import stqdm
1094
+
1095
+ for _ in stqdm(range(50)):
1096
+ sleep(0.5)
1097
+ ```
1098
+
1099
+ </ComponentCard>
1100
+
1101
+ <ComponentCard href="https://github.com/innerdoc/streamlit-timeline">
1102
+
1103
+ <Image pure alt="screenshot" src="/images/api/components/timeline.jpg" />
1104
+
1105
+ <h4>Timeline</h4>
1106
+
1107
+ Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc).
1108
+
1109
+ ```python
1110
+ from streamlit_timeline import timeline
1111
+
1112
+ with open('example.json', "r") as f:
1113
+ timeline(f.read(), height=800)
1114
+ ```
1115
+
1116
+ </ComponentCard>
1117
+
1118
+ <ComponentCard href="https://github.com/blackary/streamlit-camera-input-live">
1119
+
1120
+ <Image pure alt="screenshot" src="/images/api/components/camera-live.jpg" />
1121
+
1122
+ <h4>Camera input live</h4>
1123
+
1124
+ Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary).
1125
+
1126
+ ```python
1127
+ from camera_input_live import camera_input_live
1128
+
1129
+ image = camera_input_live()
1130
+ st.image(value)
1131
+ ```
1132
+
1133
+ </ComponentCard>
1134
+
1135
+ <ComponentCard href="https://github.com/okld/streamlit-ace">
1136
+
1137
+ <Image pure alt="screenshot" src="/images/api/components/ace.jpg" />
1138
+
1139
+ <h4>Streamlit Ace</h4>
1140
+
1141
+ Ace editor component for Streamlit. Created by [@okld](https://github.com/okld).
1142
+
1143
+ ```python
1144
+ from streamlit_ace import st_ace
1145
+
1146
+ content = st_ace()
1147
+ content
1148
+ ```
1149
+
1150
+ </ComponentCard>
1151
+
1152
+ <ComponentCard href="https://github.com/AI-Yash/st-chat">
1153
+
1154
+ <Image pure alt="screenshot" src="/images/api/components/chat.jpg" />
1155
+
1156
+ <h4>Streamlit Chat</h4>
1157
+
1158
+ Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash).
1159
+
1160
+ ```python
1161
+ from streamlit_chat import message
1162
+
1163
+ message("My message")
1164
+ message("Hello bot!", is_user=True) # align's the message to the right
1165
+ ```
1166
+
1167
+ </ComponentCard>
1168
+
1169
+ <ComponentCard href="https://github.com/victoryhb/streamlit-option-menu">
1170
+
1171
+ <Image pure alt="screenshot" src="/images/api/components/option-menu.jpg" />
1172
+
1173
+ <h4>Streamlit Option Menu</h4>
1174
+
1175
+ Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb).
1176
+
1177
+ ```python
1178
+ from streamlit_option_menu import option_menu
1179
+
1180
+ option_menu("Main Menu", ["Home", 'Settings'],
1181
+ icons=['house', 'gear'], menu_icon="cast", default_index=1)
1182
+ ```
1183
+
1184
+ </ComponentCard>
1185
+
1186
+ <ComponentCard href="https://extras.streamlit.app/">
1187
+
1188
+ <Image pure alt="screenshot" src="/images/api/components/extras-toggle.jpg" />
1189
+
1190
+ <h4>Streamlit Extras</h4>
1191
+
1192
+ A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
1193
+
1194
+ ```python
1195
+ from streamlit_extras.stoggle import stoggle
1196
+
1197
+ stoggle(
1198
+ "Click me!", """πŸ₯· Surprise! Here's some additional content""",)
1199
+ ```
1200
+
1201
+ </ComponentCard>
1202
+
1203
+ </ComponentSlider>
1204
+
1205
+ ### Media elements
1206
+
1207
+ <br />
1208
+
1209
+ <TileContainer>
1210
+ <RefCard href="/develop/api-reference/media/st.image">
1211
+
1212
+ <Image pure alt="screenshot" src="/images/api/image.jpg" />
1213
+
1214
+ <h4>Image</h4>
1215
+
1216
+ Display an image or list of images.
1217
+
1218
+ ```python
1219
+ st.image(numpy_array)
1220
+ st.image(image_bytes)
1221
+ st.image(file)
1222
+ st.image("https://example.com/myimage.jpg")
1223
+ ```
1224
+
1225
+ </RefCard>
1226
+ <RefCard href="/develop/api-reference/media/st.audio">
1227
+
1228
+ <Image pure alt="screenshot" src="/images/api/audio.jpg" />
1229
+
1230
+ <h4>Audio</h4>
1231
+
1232
+ Display an audio player.
1233
+
1234
+ ```python
1235
+ st.audio(numpy_array)
1236
+ st.audio(audio_bytes)
1237
+ st.audio(file)
1238
+ st.audio("https://example.com/myaudio.mp3", format="audio/mp3")
1239
+ ```
1240
+
1241
+ </RefCard>
1242
+ <RefCard href="/develop/api-reference/media/st.video">
1243
+
1244
+ <Image pure alt="screenshot" src="/images/api/video.jpg" />
1245
+
1246
+ <h4>Video</h4>
1247
+
1248
+ Display a video player.
1249
+
1250
+ ```python
1251
+ st.video(numpy_array)
1252
+ st.video(video_bytes)
1253
+ st.video(file)
1254
+ st.video("https://example.com/myvideo.mp4", format="video/mp4")
1255
+ ```
1256
+
1257
+ </RefCard>
1258
+ </TileContainer>
1259
+
1260
+ <ComponentSlider>
1261
+
1262
+ <ComponentCard href="https://github.com/whitphx/streamlit-webrtc">
1263
+
1264
+ <Image pure alt="screenshot" src="/images/api/components/webrtc.jpg" />
1265
+
1266
+ <h4>Streamlit Webrtc</h4>
1267
+
1268
+ Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx).
1269
+
1270
+ ```python
1271
+ from streamlit_webrtc import webrtc_streamer
1272
+
1273
+ webrtc_streamer(key="sample")
1274
+ ```
1275
+
1276
+ </ComponentCard>
1277
+
1278
+ <ComponentCard href="https://github.com/andfanilo/streamlit-drawable-canvas">
1279
+
1280
+ <Image pure alt="screenshot" src="/images/api/components/drawable-canvas.jpg" />
1281
+
1282
+ <h4>Drawable Canvas</h4>
1283
+
1284
+ Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo).
1285
+
1286
+ ```python
1287
+ from streamlit_drawable_canvas import st_canvas
1288
+
1289
+ st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",)
1290
+ ```
1291
+
1292
+ </ComponentCard>
1293
+
1294
+ <ComponentCard href="https://github.com/fcakyon/streamlit-image-comparison">
1295
+
1296
+ <Image pure alt="screenshot" src="/images/api/components/image-comparison.jpg" />
1297
+
1298
+ <h4>Image Comparison</h4>
1299
+
1300
+ Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon).
1301
+
1302
+ ```python
1303
+ from streamlit_image_comparison import image_comparison
1304
+
1305
+ image_comparison(img1="image1.jpg", img2="image2.jpg",)
1306
+ ```
1307
+
1308
+ </ComponentCard>
1309
+
1310
+ <ComponentCard href="https://github.com/turner-anderson/streamlit-cropper">
1311
+
1312
+ <Image pure alt="screenshot" src="/images/api/components/cropper.jpg" />
1313
+
1314
+ <h4>Streamlit Cropper</h4>
1315
+
1316
+ A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson).
1317
+
1318
+ ```python
1319
+ from streamlit_cropper import st_cropper
1320
+
1321
+ st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio)
1322
+ ```
1323
+
1324
+ </ComponentCard>
1325
+
1326
+ <ComponentCard href="https://github.com/blackary/streamlit-image-coordinates">
1327
+
1328
+ <Image pure alt="screenshot" src="/images/api/components/image-coordinates.jpg" />
1329
+
1330
+ <h4>Image Coordinates</h4>
1331
+
1332
+ Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/).
1333
+
1334
+ ```python
1335
+ from streamlit_image_coordinates import streamlit_image_coordinates
1336
+
1337
+ streamlit_image_coordinates("https://placekitten.com/200/300")
1338
+ ```
1339
+
1340
+ </ComponentCard>
1341
+
1342
+ <ComponentCard href="https://github.com/andfanilo/streamlit-lottie">
1343
+
1344
+ <Image pure alt="screenshot" src="/images/api/components/lottie.jpg" />
1345
+
1346
+ <h4>Streamlit Lottie</h4>
1347
+
1348
+ Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo).
1349
+
1350
+ ```python
1351
+ lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json")
1352
+
1353
+ st_lottie(lottie_hello, key="hello")
1354
+ ```
1355
+
1356
+ </ComponentCard>
1357
+
1358
+ </ComponentSlider>
1359
+
1360
+ ### Layouts and containers
1361
+
1362
+ <br />
1363
+
1364
+ <TileContainer>
1365
+ <RefCard href="/develop/api-reference/layout/st.columns">
1366
+
1367
+ <Image pure alt="screenshot" src="/images/api/columns.jpg" />
1368
+
1369
+ <h4>Columns</h4>
1370
+
1371
+ Insert containers laid out as side-by-side columns.
1372
+
1373
+ ```python
1374
+ col1, col2 = st.columns(2)
1375
+ col1.write("this is column 1")
1376
+ col2.write("this is column 2")
1377
+ ```
1378
+
1379
+ </RefCard>
1380
+ <RefCard href="/develop/api-reference/layout/st.container">
1381
+
1382
+ <Image pure alt="screenshot" src="/images/api/container.jpg" />
1383
+
1384
+ <h4>Container</h4>
1385
+
1386
+ Insert a multi-element container.
1387
+
1388
+ ```python
1389
+ c = st.container()
1390
+ st.write("This will show last")
1391
+ c.write("This will show first")
1392
+ c.write("This will show second")
1393
+ ```
1394
+
1395
+ </RefCard>
1396
+ <RefCard href="/develop/api-reference/execution-flow/st.dialog">
1397
+
1398
+ <Image pure alt="screenshot" src="/images/api/dialog.jpg" />
1399
+
1400
+ <h4>Modal dialogs</h4>
1401
+
1402
+ Insert a modal dialog that can rerun independently from the rest of the script.
1403
+
1404
+ ```python
1405
+ @st.experimental_dialog()
1406
+ def email_form():
1407
+ name = st.text_input("Name")
1408
+ email = st.text_input("Email")
1409
+ ```
1410
+
1411
+ </RefCard>
1412
+ <RefCard href="/develop/api-reference/layout/st.empty">
1413
+
1414
+ <Image pure alt="screenshot" src="/images/api/empty.jpg" />
1415
+
1416
+ <h4>Empty</h4>
1417
+
1418
+ Insert a single-element container.
1419
+
1420
+ ```python
1421
+ c = st.empty()
1422
+ st.write("This will show last")
1423
+ c.write("This will be replaced")
1424
+ c.write("This will show first")
1425
+ ```
1426
+
1427
+ </RefCard>
1428
+ <RefCard href="/develop/api-reference/layout/st.expander">
1429
+
1430
+ <Image pure alt="screenshot" src="/images/api/expander.jpg" />
1431
+
1432
+ <h4>Expander</h4>
1433
+
1434
+ Insert a multi-element container that can be expanded/collapsed.
1435
+
1436
+ ```python
1437
+ with st.expander("Open to see more"):
1438
+ st.write("This is more content")
1439
+ ```
1440
+
1441
+ </RefCard>
1442
+ <RefCard href="/develop/api-reference/layout/st.popover">
1443
+
1444
+ <Image pure alt="screenshot" src="/images/api/popover.svg" />
1445
+
1446
+ <h4>Popover</h4>
1447
+
1448
+ Insert a multi-element popover container that can be opened/closed.
1449
+
1450
+ ```python
1451
+ with st.popover("Settings"):
1452
+ st.checkbox("Show completed")
1453
+ ```
1454
+
1455
+ </RefCard>
1456
+ <RefCard href="/develop/api-reference/layout/st.sidebar">
1457
+
1458
+ <Image pure alt="screenshot" src="/images/api/sidebar.jpg" />
1459
+
1460
+ <h4>Sidebar</h4>
1461
+
1462
+ Display items in a sidebar.
1463
+
1464
+ ```python
1465
+ st.sidebar.write("This lives in the sidebar")
1466
+ st.sidebar.button("Click me!")
1467
+ ```
1468
+
1469
+ </RefCard>
1470
+ <RefCard href="/develop/api-reference/layout/st.tabs">
1471
+
1472
+ <Image pure alt="screenshot" src="/images/api/tabs.jpg" />
1473
+
1474
+ <h4>Tabs</h4>
1475
+
1476
+ Insert containers separated into tabs.
1477
+
1478
+ ```python
1479
+ tab1, tab2 = st.tabs(["Tab 1", "Tab2"])
1480
+ tab1.write("this is tab 1")
1481
+ tab2.write("this is tab 2")
1482
+ ```
1483
+
1484
+ </RefCard>
1485
+ </TileContainer>
1486
+
1487
+ <ComponentSlider>
1488
+
1489
+ <ComponentCard href="https://github.com/okld/streamlit-elements">
1490
+
1491
+ <Image pure alt="screenshot" src="/images/api/components/elements.jpg" />
1492
+
1493
+ <h4>Streamlit Elements</h4>
1494
+
1495
+ Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls).
1496
+
1497
+ ```python
1498
+ from streamlit_elements import elements, mui, html
1499
+
1500
+ with elements("new_element"):
1501
+ mui.Typography("Hello world")
1502
+ ```
1503
+
1504
+ </ComponentCard>
1505
+
1506
+ <ComponentCard href="https://github.com/lukasmasuch/streamlit-pydantic">
1507
+
1508
+ <Image pure alt="screenshot" src="/images/api/components/pydantic.jpg" />
1509
+
1510
+ <h4>Pydantic</h4>
1511
+
1512
+ Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch).
1513
+
1514
+ ```python
1515
+ import streamlit_pydantic as sp
1516
+
1517
+ sp.pydantic_form(key="my_form",
1518
+ model=ExampleModel)
1519
+ ```
1520
+
1521
+ </ComponentCard>
1522
+
1523
+ <ComponentCard href="https://github.com/blackary/st_pages">
1524
+
1525
+ <Image pure alt="screenshot" src="/images/api/components/pages.jpg" />
1526
+
1527
+ <h4>Streamlit Pages</h4>
1528
+
1529
+ An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary).
1530
+
1531
+ ```python
1532
+ from st_pages import Page, show_pages, add_page_title
1533
+
1534
+ show_pages([ Page("streamlit_app.py", "Home", "🏠"),
1535
+ Page("other_pages/page2.py", "Page 2", ":books:"), ])
1536
+ ```
1537
+
1538
+ </ComponentCard>
1539
+
1540
+ </ComponentSlider>
1541
+
1542
+ ### Chat elements
1543
+
1544
+ <br />
1545
+
1546
+ Streamlit provides a few commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately.
1547
+
1548
+ `st.chat_message` lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. `st.chat_input` lets you display a chat input widget so the user can type in a message.
1549
+
1550
+ <TileContainer>
1551
+ <RefCard href="/develop/api-reference/chat/st.chat_input">
1552
+
1553
+ <Image pure alt="screenshot" src="/images/api/chat_input.jpg" />
1554
+
1555
+ <h4>Chat input</h4>
1556
+
1557
+ Display a chat input widget.
1558
+
1559
+ ```python
1560
+ prompt = st.chat_input("Say something")
1561
+ if prompt:
1562
+ st.write(f"The user has sent: {prompt}")
1563
+ ```
1564
+
1565
+ </RefCard>
1566
+ <RefCard href="/develop/api-reference/chat/st.chat_message">
1567
+
1568
+ <Image pure alt="screenshot" src="/images/api/chat_message.jpg" />
1569
+
1570
+ <h4>Chat message</h4>
1571
+
1572
+ Insert a chat message container.
1573
+
1574
+ ```python
1575
+ import numpy as np
1576
+ with st.chat_message("user"):
1577
+ st.write("Hello πŸ‘‹")
1578
+ st.line_chart(np.random.randn(30, 3))
1579
+ ```
1580
+
1581
+ </RefCard>
1582
+ <RefCard href="/develop/api-reference/status/st.status">
1583
+
1584
+ <Image pure alt="screenshot" src="/images/api/status.jpg" />
1585
+
1586
+ <h4>Status container</h4>
1587
+
1588
+ Display output of long-running tasks in a container.
1589
+
1590
+ ```python
1591
+ with st.status('Running'):
1592
+ do_something_slow()
1593
+ ```
1594
+
1595
+ </RefCard>
1596
+ <RefCard href="/develop/api-reference/write-magic/st.write_stream">
1597
+
1598
+ <h4>st.write_stream</h4>
1599
+
1600
+ Write generators or streams to the app with a typewriter effect.
1601
+
1602
+ ```python
1603
+ st.write_stream(my_generator)
1604
+ st.write_stream(my_llm_stream)
1605
+ ```
1606
+
1607
+ </RefCard>
1608
+ </TileContainer>
1609
+
1610
+ ### Status elements
1611
+
1612
+ <br />
1613
+
1614
+ <TileContainer>
1615
+ <RefCard href="/develop/api-reference/status/st.progress">
1616
+
1617
+ <Image pure alt="screenshot" src="/images/api/progress.jpg" />
1618
+
1619
+ <h4>Progress bar</h4>
1620
+
1621
+ Display a progress bar.
1622
+
1623
+ ```python
1624
+ for i in range(101):
1625
+ st.progress(i)
1626
+ do_something_slow()
1627
+ ```
1628
+
1629
+ </RefCard>
1630
+ <RefCard href="/develop/api-reference/status/st.spinner">
1631
+
1632
+ <Image pure alt="screenshot" src="/images/api/spinner.jpg" />
1633
+
1634
+ <h4>Spinner</h4>
1635
+
1636
+ Temporarily displays a message while executing a block of code.
1637
+
1638
+ ```python
1639
+ with st.spinner("Please wait..."):
1640
+ do_something_slow()
1641
+ ```
1642
+
1643
+ </RefCard>
1644
+ <RefCard href="/develop/api-reference/status/st.status">
1645
+
1646
+ <Image pure alt="screenshot" src="/images/api/status.jpg" />
1647
+
1648
+ <h4>Status container</h4>
1649
+
1650
+ Display output of long-running tasks in a container.
1651
+
1652
+ ```python
1653
+ with st.status('Running'):
1654
+ do_something_slow()
1655
+ ```
1656
+
1657
+ </RefCard>
1658
+ <RefCard href="/develop/api-reference/status/st.toast">
1659
+
1660
+ <Image pure alt="screenshot" src="/images/api/toast.jpg" />
1661
+
1662
+ <h4>Toast</h4>
1663
+
1664
+ Briefly displays a toast message in the bottom-right corner.
1665
+
1666
+ ```python
1667
+ st.toast('Butter!', icon='🧈')
1668
+ ```
1669
+
1670
+ </RefCard>
1671
+ <RefCard href="/develop/api-reference/status/st.balloons">
1672
+
1673
+ <Image pure alt="screenshot" src="/images/api/balloons.jpg" />
1674
+
1675
+ <h4>Balloons</h4>
1676
+
1677
+ Display celebratory balloons!
1678
+
1679
+ ```python
1680
+ do_something()
1681
+
1682
+ # Celebrate when all done!
1683
+ st.balloons()
1684
+ ```
1685
+
1686
+ </RefCard>
1687
+ <RefCard href="/develop/api-reference/status/st.snow">
1688
+
1689
+ <Image pure alt="screenshot" src="/images/api/snow.jpg" />
1690
+
1691
+ <h4>Snowflakes</h4>
1692
+
1693
+ Display celebratory snowflakes!
1694
+
1695
+ ```python
1696
+ do_something()
1697
+
1698
+ # Celebrate when all done!
1699
+ st.snow()
1700
+ ```
1701
+
1702
+ </RefCard>
1703
+ <RefCard href="/develop/api-reference/status/st.success">
1704
+
1705
+ <Image pure alt="screenshot" src="/images/api/success.jpg" />
1706
+
1707
+ <h4>Success box</h4>
1708
+
1709
+ Display a success message.
1710
+
1711
+ ```python
1712
+ st.success("Match found!")
1713
+ ```
1714
+
1715
+ </RefCard>
1716
+ <RefCard href="/develop/api-reference/status/st.info">
1717
+
1718
+ <Image pure alt="screenshot" src="/images/api/info.jpg" />
1719
+
1720
+ <h4>Info box</h4>
1721
+
1722
+ Display an informational message.
1723
+
1724
+ ```python
1725
+ st.info("Dataset is updated every day at midnight.")
1726
+ ```
1727
+
1728
+ </RefCard>
1729
+ <RefCard href="/develop/api-reference/status/st.warning">
1730
+
1731
+ <Image pure alt="screenshot" src="/images/api/warning.jpg" />
1732
+
1733
+ <h4>Warning box</h4>
1734
+
1735
+ Display warning message.
1736
+
1737
+ ```python
1738
+ st.warning("Unable to fetch image. Skipping...")
1739
+ ```
1740
+
1741
+ </RefCard>
1742
+ <RefCard href="/develop/api-reference/status/st.error">
1743
+
1744
+ <Image pure alt="screenshot" src="/images/api/error.jpg" />
1745
+
1746
+ <h4>Error box</h4>
1747
+
1748
+ Display error message.
1749
+
1750
+ ```python
1751
+ st.error("We encountered an error")
1752
+ ```
1753
+
1754
+ </RefCard>
1755
+ <RefCard href="/develop/api-reference/status/st.exception">
1756
+
1757
+ <Image pure alt="screenshot" src="/images/api/exception.jpg" />
1758
+
1759
+ <h4>Exception output</h4>
1760
+
1761
+ Display an exception.
1762
+
1763
+ ```python
1764
+ e = RuntimeError("This is an exception of type RuntimeError")
1765
+ st.exception(e)
1766
+ ```
1767
+
1768
+ </RefCard>
1769
+
1770
+ </TileContainer>
1771
+
1772
+ <ComponentSlider>
1773
+
1774
+ <ComponentCard href="https://github.com/Wirg/stqdm">
1775
+
1776
+ <Image pure alt="screenshot" src="/images/api/components/stqdm.jpg" />
1777
+
1778
+ <h4>Stqdm</h4>
1779
+
1780
+ The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg).
1781
+
1782
+ ```python
1783
+ from stqdm import stqdm
1784
+
1785
+ for _ in stqdm(range(50)):
1786
+ sleep(0.5)
1787
+ ```
1788
+
1789
+ </ComponentCard>
1790
+
1791
+ <ComponentCard href="https://github.com/Socvest/streamlit-custom-notification-box">
1792
+
1793
+ <Image pure alt="screenshot" src="/images/api/components/custom-notification-box.jpg" />
1794
+
1795
+ <h4>Custom notification box</h4>
1796
+
1797
+ A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest).
1798
+
1799
+ ```python
1800
+ from streamlit_custom_notification_box import custom_notification_box
1801
+
1802
+ styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}}
1803
+ custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo")
1804
+ ```
1805
+
1806
+ </ComponentCard>
1807
+
1808
+ <ComponentCard href="https://extras.streamlit.app/">
1809
+
1810
+ <Image pure alt="screenshot" src="/images/api/components/extras-emojis.jpg" />
1811
+
1812
+ <h4>Streamlit Extras</h4>
1813
+
1814
+ A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
1815
+
1816
+ ```python
1817
+ from streamlit_extras.let_it_rain import rain
1818
+
1819
+ rain(emoji="🎈", font_size=54,
1820
+ falling_speed=5, animation_length="infinite",)
1821
+ ```
1822
+
1823
+ </ComponentCard>
1824
+
1825
+ </ComponentSlider>
1826
+
1827
+ ## App logic and configuration
1828
+
1829
+ ### Navigation and pages
1830
+
1831
+ <br />
1832
+
1833
+ <TileContainer>
1834
+
1835
+ <RefCard href="/develop/api-reference/navigation/st.switch_page">
1836
+
1837
+ <h4>Switch page</h4>
1838
+
1839
+ Programmatically navigates to a specified page.
1840
+
1841
+ ```python
1842
+ st.switch_page("pages/my_page.py")
1843
+ ```
1844
+
1845
+ </RefCard>
1846
+
1847
+ <RefCard href="/develop/api-reference/widgets/st.page_link">
1848
+
1849
+ <Image pure alt="screenshot" src="/images/api/page_link.jpg" />
1850
+
1851
+ <h4>Page link</h4>
1852
+
1853
+ Display a link to another page in a multipage app.
1854
+
1855
+ ```python
1856
+ st.page_link("app.py", label="Home", icon="🏠")
1857
+ st.page_link("pages/profile.py", label="My profile")
1858
+ ```
1859
+
1860
+ </RefCard>
1861
+
1862
+ </TileContainer>
1863
+
1864
+ ### Execution flow
1865
+
1866
+ <br />
1867
+
1868
+ <TileContainer>
1869
+ <RefCard href="/develop/api-reference/execution-flow/st.dialog" size="full">
1870
+
1871
+ <Image pure alt="screenshot" src="/images/api/dialog.jpg" />
1872
+
1873
+ <h4>Modal dialogs</h4>
1874
+
1875
+ Insert a modal dialog that can rerun independently from the rest of the script.
1876
+
1877
+ ```python
1878
+ @st.experimental_dialog()
1879
+ def email_form():
1880
+ name = st.text_input("Name")
1881
+ email = st.text_input("Email")
1882
+ ```
1883
+
1884
+ </RefCard>
1885
+ <RefCard href="/develop/api-reference/execution-flow/st.form" size="half">
1886
+
1887
+ <h4>Forms</h4>
1888
+
1889
+ Create a form that batches elements together with a β€œSubmit" button.
1890
+
1891
+ ```python
1892
+ with st.form(key='my_form'):
1893
+ name = st.text_input("Name")
1894
+ email = st.text_input("Email")
1895
+ st.form_submit_button("Sign up")
1896
+ ```
1897
+
1898
+ </RefCard>
1899
+ <RefCard href="/develop/api-reference/execution-flow/st.fragment" size="half">
1900
+
1901
+ <h4>Partial reruns</h4>
1902
+
1903
+ Define a fragment to rerun independently from the rest of the script.
1904
+
1905
+ ```python
1906
+ @st.experimental_fragment(run_every="10s")
1907
+ def fragment():
1908
+ df = get_data()
1909
+ st.line_chart(df)
1910
+ ```
1911
+
1912
+ </RefCard>
1913
+ <RefCard href="/develop/api-reference/execution-flow/st.rerun">
1914
+
1915
+ <h4>Rerun script</h4>
1916
+
1917
+ Rerun the script immediately.
1918
+
1919
+ ```python
1920
+ st.rerun()
1921
+ ```
1922
+
1923
+ </RefCard>
1924
+ <RefCard href="/develop/api-reference/execution-flow/st.stop">
1925
+
1926
+ <h4>Stop execution</h4>
1927
+
1928
+ Stops execution immediately.
1929
+
1930
+ ```python
1931
+ st.stop()
1932
+ ```
1933
+
1934
+ </RefCard>
1935
+ </TileContainer>
1936
+
1937
+ <ComponentSlider>
1938
+
1939
+ <ComponentCard href="https://github.com/kmcgrady/streamlit-autorefresh">
1940
+
1941
+ <Image pure alt="screenshot" src="/images/api/components/autorefresh.jpg" />
1942
+
1943
+ <h4>Autorefresh</h4>
1944
+
1945
+ Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady).
1946
+
1947
+ ```python
1948
+ from streamlit_autorefresh import st_autorefresh
1949
+
1950
+ st_autorefresh(interval=2000, limit=100,
1951
+ key="fizzbuzzcounter")
1952
+ ```
1953
+
1954
+ </ComponentCard>
1955
+
1956
+ <ComponentCard href="https://github.com/lukasmasuch/streamlit-pydantic">
1957
+
1958
+ <Image pure alt="screenshot" src="/images/api/components/pydantic.jpg" />
1959
+
1960
+ <h4>Pydantic</h4>
1961
+
1962
+ Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch).
1963
+
1964
+ ```python
1965
+ import streamlit_pydantic as sp
1966
+
1967
+ sp.pydantic_form(key="my_form",
1968
+ model=ExampleModel)
1969
+ ```
1970
+
1971
+ </ComponentCard>
1972
+
1973
+ <ComponentCard href="https://github.com/blackary/st_pages">
1974
+
1975
+ <Image pure alt="screenshot" src="/images/api/components/pages.jpg" />
1976
+
1977
+ <h4>Streamlit Pages</h4>
1978
+
1979
+ An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary).
1980
+
1981
+ ```python
1982
+ from st_pages import Page, show_pages, add_page_title
1983
+
1984
+ show_pages([ Page("streamlit_app.py", "Home", "🏠"),
1985
+ Page("other_pages/page2.py", "Page 2", ":books:"), ])
1986
+ ```
1987
+
1988
+ </ComponentCard>
1989
+
1990
+ </ComponentSlider>
1991
+
1992
+ ### Caching and state
1993
+
1994
+ <br />
1995
+
1996
+ <TileContainer>
1997
+ <RefCard href="/develop/api-reference/caching-and-state/st.cache_data" size="half">
1998
+
1999
+ <h4>Cache data</h4>
2000
+
2001
+ Function decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).
2002
+
2003
+ ```python
2004
+ @st.cache_data
2005
+ def long_function(param1, param2):
2006
+ # Perform expensive computation here or
2007
+ # fetch data from the web here
2008
+ return data
2009
+ ```
2010
+
2011
+ </RefCard>
2012
+
2013
+ <RefCard href="/develop/api-reference/caching-and-state/st.cache_resource" size="half">
2014
+
2015
+ <h4>Cache resource</h4>
2016
+
2017
+ Function decorator to cache functions that return global resources (e.g. database connections, ML models).
2018
+
2019
+ ```python
2020
+ @st.cache_resource
2021
+ def init_model():
2022
+ # Return a global resource here
2023
+ return pipeline(
2024
+ "sentiment-analysis",
2025
+ model="distilbert-base-uncased-finetuned-sst-2-english"
2026
+ )
2027
+ ```
2028
+
2029
+ </RefCard>
2030
+
2031
+ <RefCard href="/develop/api-reference/caching-and-state/st.session_state">
2032
+
2033
+ <h4>Session state</h4>
2034
+
2035
+ Session state is a way to share variables between reruns, for each user session.
2036
+
2037
+ ```python
2038
+ st.session_state['key'] = value
2039
+ ```
2040
+
2041
+ </RefCard>
2042
+
2043
+ <RefCard href="/develop/api-reference/caching-and-state/st.query_params">
2044
+
2045
+ <h4>Query parameters</h4>
2046
+
2047
+ Get, set, or clear the query parameters that are shown in the browser's URL bar.
2048
+
2049
+ ```python
2050
+ st.query_params[key] = value
2051
+ st.query_params.clear()
2052
+ ```
2053
+
2054
+ </RefCard>
2055
+
2056
+ </TileContainer>
2057
+
2058
+ ### Connections and databases
2059
+
2060
+ #### Setup your connection
2061
+
2062
+ <TileContainer>
2063
+ <RefCard href="/develop/api-reference/connections/st.connection" size="half">
2064
+
2065
+ <Image pure alt="screenshot" src="/images/api/connection.svg" />
2066
+
2067
+ <h4>Create a connection</h4>
2068
+
2069
+ Connect to a data source or API
2070
+
2071
+ ```python
2072
+ conn = st.connection('pets_db', type='sql')
2073
+ pet_owners = conn.query('select * from pet_owners')
2074
+ st.dataframe(pet_owners)
2075
+ ```
2076
+
2077
+ </RefCard>
2078
+ </TileContainer>
2079
+
2080
+ #### Built-in connections
2081
+
2082
+ <TileContainer>
2083
+
2084
+ <RefCard href="/develop/api-reference/connections/st.connections.snowflakeconnection" size="half">
2085
+
2086
+ <Image pure alt="screenshot" src="/images/api/connections.SnowflakeConnection.svg" />
2087
+
2088
+ <h4>SnowflakeConnection</h4>
2089
+
2090
+ A connection to Snowflake.
2091
+
2092
+ ```python
2093
+ conn = st.connection('snowflake')
2094
+ ```
2095
+
2096
+ </RefCard>
2097
+
2098
+ <RefCard href="/develop/api-reference/connections/st.connections.sqlconnection" size="half">
2099
+
2100
+ <Image pure alt="screenshot" src="/images/api/connections.SQLConnection.svg" />
2101
+
2102
+ <h4>SQLConnection</h4>
2103
+
2104
+ A connection to a SQL database using SQLAlchemy.
2105
+
2106
+ ```python
2107
+ conn = st.connection('sql')
2108
+ ```
2109
+
2110
+ </RefCard>
2111
+ </TileContainer>
2112
+
2113
+ #### Build your own connections
2114
+
2115
+ <TileContainer>
2116
+ <RefCard href="/develop/api-reference/connections/st.connections.baseconnection" size="half">
2117
+
2118
+ <h4>Connection base class</h4>
2119
+
2120
+ Build your own connection with `BaseConnection`.
2121
+
2122
+ ```python
2123
+ class MyConnection(BaseConnection[myconn.MyConnection]):
2124
+ def _connect(self, **kwargs) -> MyConnection:
2125
+ return myconn.connect(**self._secrets, **kwargs)
2126
+ def query(self, query):
2127
+ return self._instance.query(query)
2128
+ ```
2129
+
2130
+ </RefCard>
2131
+
2132
+ </TileContainer>
2133
+
2134
+ #### Secrets management
2135
+
2136
+ <TileContainer>
2137
+
2138
+ <RefCard href="/develop/api-reference/connections/st.secrets" size="half">
2139
+
2140
+ <h4>Secrets singleton</h4>
2141
+
2142
+ Access secrets from a local TOML file.
2143
+
2144
+ ```python
2145
+ key = st.secrets["OpenAI_key"]
2146
+ ```
2147
+
2148
+ </RefCard>
2149
+ <RefCard href="/develop/api-reference/connections/secrets.toml" size="half">
2150
+
2151
+ <h4>Secrets file</h4>
2152
+
2153
+ Save your secrets in a per-project or per-profile TOML file.
2154
+
2155
+ ```python
2156
+ OpenAI_key = "<YOUR_SECRET_KEY>"
2157
+ ```
2158
+
2159
+ </RefCard>
2160
+
2161
+ </TileContainer>
2162
+
2163
+ <ComponentSlider>
2164
+
2165
+ <ComponentCard href="https://github.com/mkhorasani/Streamlit-Authenticator">
2166
+
2167
+ <Image pure alt="screenshot" src="/images/api/components/authenticator.jpg" />
2168
+
2169
+ <h4>Authenticator</h4>
2170
+
2171
+ A secure authentication module to validate user credentials. Created by [@mkhorasani](https://github.com/mkhorasani).
2172
+
2173
+ ```python
2174
+ import streamlit_authenticator as stauth
2175
+
2176
+ authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'],
2177
+ config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized'])
2178
+ ```
2179
+
2180
+ </ComponentCard>
2181
+
2182
+ <ComponentCard href="https://github.com/gagangoku/streamlit-ws-localstorage">
2183
+
2184
+ <Image pure alt="screenshot" src="/images/api/components/localstorage.jpg" />
2185
+
2186
+ <h4>WS localStorage</h4>
2187
+
2188
+ A simple synchronous way of accessing localStorage from your app. Created by [@gagangoku](https://github.com/gagangoku).
2189
+
2190
+ ```python
2191
+ from streamlit_ws_localstorage import injectWebsocketCode
2192
+
2193
+ ret = conn.setLocalStorageVal(key='k1', val='v1')
2194
+ st.write('ret: ' + ret)
2195
+ ```
2196
+
2197
+ </ComponentCard>
2198
+
2199
+ <ComponentCard href="https://github.com/conradbez/streamlit-auth0">
2200
+
2201
+ <Image pure alt="screenshot" src="/images/api/components/auth0.jpg" />
2202
+
2203
+ <h4>Streamlit Auth0</h4>
2204
+
2205
+ The fastest way to provide comprehensive login inside Streamlit. Created by [@conradbez](https://github.com/conradbez).
2206
+
2207
+ ```python
2208
+ from auth0_component import login_button
2209
+
2210
+ user_info = login_button(clientId, domain = domain)
2211
+ st.write(user_info)
2212
+ ```
2213
+
2214
+ </ComponentCard>
2215
+
2216
+ </ComponentSlider>
2217
+
2218
+ ### Custom Components
2219
+
2220
+ <br />
2221
+
2222
+ <TileContainer>
2223
+
2224
+ <RefCard href="/develop/api-reference/custom-components/st.components.v1.declare_component">
2225
+
2226
+ <h4>Declare a component</h4>
2227
+
2228
+ Create and register a custom component.
2229
+
2230
+ ```python
2231
+ st.components.v1.declare_component(
2232
+ "custom_slider",
2233
+ "/frontend",
2234
+ )
2235
+ ```
2236
+
2237
+ </RefCard>
2238
+
2239
+ <RefCard href="/develop/api-reference/custom-components/st.components.v1.html">
2240
+
2241
+ <h4>HTML</h4>
2242
+
2243
+ Display an HTML string in an iframe.
2244
+
2245
+ ```python
2246
+ st.components.v1.html(
2247
+ "<p>Foo bar.</p>"
2248
+ )
2249
+ ```
2250
+
2251
+ </RefCard>
2252
+
2253
+ <RefCard href="/develop/api-reference/custom-components/st.components.v1.iframe">
2254
+
2255
+ <h4>iframe</h4>
2256
+
2257
+ Load a remote URL in an iframe.
2258
+
2259
+ ```python
2260
+ st.components.v1.iframe(
2261
+ "docs.streamlit.io"
2262
+ )
2263
+ ```
2264
+
2265
+ </RefCard>
2266
+
2267
+ </TileContainer>
2268
+
2269
+ ### Utilities and user info
2270
+
2271
+ <br />
2272
+
2273
+ <TileContainer>
2274
+ <RefCard href="/develop/api-reference/utilities/st.experimental_user">
2275
+
2276
+ <h4>User info</h4>
2277
+
2278
+ `st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.
2279
+
2280
+ ```python
2281
+ if st.experimental_user.email == "[email protected]":
2282
+ st.write("Welcome back, ", st.experimental_user.email)
2283
+ else:
2284
+ st.write("You are not authorized to view this page.")
2285
+ ```
2286
+
2287
+ </RefCard>
2288
+ <RefCard href="/develop/api-reference/utilities/st.help">
2289
+
2290
+ <h4>Get help</h4>
2291
+
2292
+ Display object’s doc string, nicely formatted.
2293
+
2294
+ ```python
2295
+ st.help(st.write)
2296
+ st.help(pd.DataFrame)
2297
+ ```
2298
+
2299
+ </RefCard>
2300
+ <RefCard href="/develop/api-reference/utilities/st.html">
2301
+
2302
+ <h4>Render HTML</h4>
2303
+
2304
+ Renders HTML strings to your app.
2305
+
2306
+ ```python
2307
+ css = """
2308
+ <style>
2309
+ p { color: red; }
2310
+ </style>
2311
+ """
2312
+ st.html(css)
2313
+ ```
2314
+
2315
+ </RefCard>
2316
+ </TileContainer>
2317
+
2318
+ ### Configuration
2319
+
2320
+ <br />
2321
+
2322
+ <TileContainer>
2323
+ <RefCard href="/develop/api-reference/configuration/config.toml">
2324
+
2325
+ <h4>Configuration file</h4>
2326
+
2327
+ Configures the default settings for your app.
2328
+
2329
+ ```
2330
+ your-project/
2331
+ β”œβ”€β”€ .streamlit/
2332
+ β”‚ └── config.toml
2333
+ └── your_app.py
2334
+ ```
2335
+
2336
+ </RefCard>
2337
+ <RefCard href="/develop/api-reference/configuration/st.set_page_config">
2338
+
2339
+ <h4>Set page title, favicon, and more</h4>
2340
+
2341
+ Configures the default settings of the page.
2342
+
2343
+ ```python
2344
+ st.set_page_config(
2345
+ page_title="My app",
2346
+ page_icon=":shark:",
2347
+ )
2348
+ ```
2349
+
2350
+ </RefCard>
2351
+ </TileContainer>
2352
+
2353
+ ## Developer tools
2354
+
2355
+ ### App testing
2356
+
2357
+ <br />
2358
+
2359
+ <TileContainer>
2360
+
2361
+ <RefCard href="/develop/api-reference/app-testing/st.testing.v1.apptest" size="full">
2362
+
2363
+ <h4>st.testing.v1.AppTest</h4>
2364
+
2365
+ `st.testing.v1.AppTest` simulates a running Streamlit app for testing.
2366
+
2367
+ ```python
2368
+ from streamlit.testing.v1 import AppTest
2369
+
2370
+ at = AppTest.from_file("streamlit_app.py")
2371
+ at.secrets["WORD"] = "Foobar"
2372
+ at.run()
2373
+ assert not at.exception
2374
+
2375
+ at.text_input("word").input("Bazbat").run()
2376
+ assert at.warning[0].value == "Try again."
2377
+ ```
2378
+
2379
+ </RefCard>
2380
+
2381
+ <RefCard href="/develop/api-reference/app-testing/st.testing.v1.apptest#apptestfrom_file" size="full">
2382
+
2383
+ <h4>AppTest.from_file</h4>
2384
+
2385
+ `st.testing.v1.AppTest.from_file` initializes a simulated app from a file.
2386
+
2387
+ ```python
2388
+ from streamlit.testing.v1 import AppTest
2389
+
2390
+ at = AppTest.from_file("streamlit_app.py")
2391
+ at.run()
2392
+ ```
2393
+
2394
+ </RefCard>
2395
+
2396
+ <RefCard href="/develop/api-reference/app-testing/st.testing.v1.apptest#apptestfrom_string" size="full">
2397
+
2398
+ <h4>AppTest.from_string</h4>
2399
+
2400
+ `st.testing.v1.AppTest.from_string` initializes a simulated app from a string.
2401
+
2402
+ ```python
2403
+ from streamlit.testing.v1 import AppTest
2404
+
2405
+ at = AppTest.from_string(app_script_as_string)
2406
+ at.run()
2407
+ ```
2408
+
2409
+ </RefCard>
2410
+
2411
+ <RefCard href="/develop/api-reference/app-testing/st.testing.v1.apptest#apptestfrom_function" size="full">
2412
+
2413
+ <h4>AppTest.from_function</h4>
2414
+
2415
+ `st.testing.v1.AppTest.from_function` initializes a simulated app from a function.
2416
+
2417
+ ```python
2418
+ from streamlit.testing.v1 import AppTest
2419
+
2420
+ at = AppTest.from_function(app_script_as_callable)
2421
+ at.run()
2422
+ ```
2423
+
2424
+ </RefCard>
2425
+
2426
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treeblock" size="half">
2427
+
2428
+ <h4>Block</h4>
2429
+
2430
+ A representation of container elements, including:
2431
+
2432
+ - `st.chat_message`
2433
+ - `st.columns`
2434
+ - `st.sidebar`
2435
+ - `st.tabs`
2436
+ - The main body of the app.
2437
+
2438
+ ```python
2439
+ # at.sidebar returns a Block
2440
+ at.sidebar.button[0].click().run()
2441
+ assert not at.exception
2442
+ ```
2443
+
2444
+ </RefCard>
2445
+
2446
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treeelement" size="half">
2447
+
2448
+ <h4>Element</h4>
2449
+
2450
+ The base class for representation of all elements, including:
2451
+
2452
+ - `st.title`
2453
+ - `st.header`
2454
+ - `st.markdown`
2455
+ - `st.dataframe`
2456
+
2457
+ ```python
2458
+ # at.title returns a sequence of Title
2459
+ # Title inherits from Element
2460
+ assert at.title[0].value == "My awesome app"
2461
+ ```
2462
+
2463
+ </RefCard>
2464
+
2465
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treebutton" size="third">
2466
+
2467
+ <h4>Button</h4>
2468
+
2469
+ A representation of `st.button` and `st.form_submit_button`.
2470
+
2471
+ ```python
2472
+ at.button[0].click().run()
2473
+ ```
2474
+
2475
+ </RefCard>
2476
+
2477
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treechatinput" size="third">
2478
+
2479
+ <h4>ChatInput</h4>
2480
+
2481
+ A representation of `st.chat_input`.
2482
+
2483
+ ```python
2484
+ at.chat_input[0].set_value("What is Streamlit?").run()
2485
+ ```
2486
+
2487
+ </RefCard>
2488
+
2489
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treecheckbox" size="third">
2490
+
2491
+ <h4>Checkbox</h4>
2492
+
2493
+ A representation of `st.checkbox`.
2494
+
2495
+ ```python
2496
+ at.checkbox[0].check().run()
2497
+ ```
2498
+
2499
+ </RefCard>
2500
+
2501
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treecolorpicker" size="third">
2502
+
2503
+ <h4>ColorPicker</h4>
2504
+
2505
+ A representation of `st.color_picker`.
2506
+
2507
+ ```python
2508
+ at.color_picker[0].pick("#FF4B4B").run()
2509
+ ```
2510
+
2511
+ </RefCard>
2512
+
2513
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treedateinput" size="third">
2514
+
2515
+ <h4>DateInput</h4>
2516
+
2517
+ A representation of `st.date_input`.
2518
+
2519
+ ```python
2520
+ release_date = datetime.date(2023, 10, 26)
2521
+ at.date_input[0].set_value(release_date).run()
2522
+ ```
2523
+
2524
+ </RefCard>
2525
+
2526
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treemultiselect" size="third">
2527
+
2528
+ <h4>Multiselect</h4>
2529
+
2530
+ A representation of `st.multiselect`.
2531
+
2532
+ ```python
2533
+ at.multiselect[0].select("New York").run()
2534
+ ```
2535
+
2536
+ </RefCard>
2537
+
2538
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treenumberinput" size="third">
2539
+
2540
+ <h4>NumberInput</h4>
2541
+
2542
+ A representation of `st.number_input`.
2543
+
2544
+ ```python
2545
+ at.number_input[0].increment().run()
2546
+ ```
2547
+
2548
+ </RefCard>
2549
+
2550
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treeradio" size="third">
2551
+
2552
+ <h4>Radio</h4>
2553
+
2554
+ A representation of `st.radio`.
2555
+
2556
+ ```python
2557
+ at.radio[0].set_value("New York").run()
2558
+ ```
2559
+
2560
+ </RefCard>
2561
+
2562
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treeselectslider" size="third">
2563
+
2564
+ <h4>SelectSlider</h4>
2565
+
2566
+ A representation of `st.select_slider`.
2567
+
2568
+ ```python
2569
+ at.select_slider[0].set_range("A","C").run()
2570
+ ```
2571
+
2572
+ </RefCard>
2573
+
2574
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treeselectbox" size="third">
2575
+
2576
+ <h4>Selectbox</h4>
2577
+
2578
+ A representation of `st.selectbox`.
2579
+
2580
+ ```python
2581
+ at.selectbox[0].select("New York").run()
2582
+ ```
2583
+
2584
+ </RefCard>
2585
+
2586
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treeslider" size="third">
2587
+
2588
+ <h4>Slider</h4>
2589
+
2590
+ A representation of `st.slider`.
2591
+
2592
+ ```python
2593
+ at.slider[0].set_range(2,5).run()
2594
+ ```
2595
+
2596
+ </RefCard>
2597
+
2598
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treetextarea" size="third">
2599
+
2600
+ <h4>TextArea</h4>
2601
+
2602
+ A representation of `st.text_area`.
2603
+
2604
+ ```python
2605
+ at.text_area[0].input("Streamlit is awesome!").run()
2606
+ ```
2607
+
2608
+ </RefCard>
2609
+
2610
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treetextinput" size="third">
2611
+
2612
+ <h4>TextInput</h4>
2613
+
2614
+ A representation of `st.text_input`.
2615
+
2616
+ ```python
2617
+ at.text_input[0].input("Streamlit").run()
2618
+ ```
2619
+
2620
+ </RefCard>
2621
+
2622
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treetimeinput" size="third">
2623
+
2624
+ <h4>TimeInput</h4>
2625
+
2626
+ A representation of `st.time_input`.
2627
+
2628
+ ```python
2629
+ at.time_input[0].increment().run()
2630
+ ```
2631
+
2632
+ </RefCard>
2633
+
2634
+ <RefCard href="/develop/api-reference/app-testing/testing-element-classes#sttestingv1element_treetoggle" size="third">
2635
+
2636
+ <h4>Toggle</h4>
2637
+
2638
+ A representation of `st.toggle`.
2639
+
2640
+ ```python
2641
+ at.toggle[0].set_value("True").run()
2642
+ ```
2643
+
2644
+ </RefCard>
2645
+
2646
+ </TileContainer>
2647
+
2648
+ <ComponentSlider>
2649
+
2650
+ <ComponentCard href="https://github.com/okld/streamlit-pandas-profiling">
2651
+
2652
+ <Image pure alt="screenshot" src="/images/api/components/pandas-profiling.jpg" />
2653
+
2654
+ <h4>Pandas Profiling</h4>
2655
+
2656
+ Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/).
2657
+
2658
+ ```python
2659
+ df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv")
2660
+ pr = df.profile_report()
2661
+
2662
+ st_profile_report(pr)
2663
+ ```
2664
+
2665
+ </ComponentCard>
2666
+
2667
+ <ComponentCard href="https://github.com/okld/streamlit-ace">
2668
+
2669
+ <Image pure alt="screenshot" src="/images/api/components/ace.jpg" />
2670
+
2671
+ <h4>Streamlit Ace</h4>
2672
+
2673
+ Ace editor component for Streamlit. Created by [@okld](https://github.com/okld).
2674
+
2675
+ ```python
2676
+ from streamlit_ace import st_ace
2677
+
2678
+ content = st_ace()
2679
+ content
2680
+ ```
2681
+
2682
+ </ComponentCard>
2683
+
2684
+ <ComponentCard href="https://github.com/jrieke/streamlit-analytics">
2685
+
2686
+ <Image pure alt="screenshot" src="/images/api/components/analytics.jpg" />
2687
+
2688
+ <h4>Streamlit Analytics</h4>
2689
+
2690
+ Track & visualize user interactions with your streamlit app. Created by [@jrieke](https://github.com/jrieke).
2691
+
2692
+ ```python
2693
+ import streamlit_analytics
2694
+
2695
+ with streamlit_analytics.track():
2696
+ st.text_input("Write something")
2697
+ ```
2698
+
2699
+ </ComponentCard>
2700
+
2701
+ </ComponentSlider>
data/develop/api-reference/caching-and-state/_index.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Caching and state
3
+ slug: /develop/api-reference/caching-and-state
4
+ ---
5
+
6
+ # Caching and state
7
+
8
+ Optimize performance and add statefulness to your app!
9
+
10
+ ## Caching
11
+
12
+ Streamlit provides powerful [cache primitives](/develop/concepts/architecture/caching) for data and global resources. They allow your app to stay performant even when loading data from the web, manipulating large datasets, or performing expensive computations.
13
+
14
+ <TileContainer>
15
+
16
+ <RefCard href="/develop/api-reference/caching-and-state/st.cache_data" size="half">
17
+
18
+ <h4>Cache data</h4>
19
+
20
+ Function decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).
21
+
22
+ ```python
23
+ @st.cache_data
24
+ def long_function(param1, param2):
25
+ # Perform expensive computation here or
26
+ # fetch data from the web here
27
+ return data
28
+ ```
29
+
30
+ </RefCard>
31
+
32
+ <RefCard href="/develop/api-reference/caching-and-state/st.cache_resource" size="half">
33
+
34
+ <h4>Cache resource</h4>
35
+
36
+ Function decorator to cache functions that return global resources (e.g. database connections, ML models).
37
+
38
+ ```python
39
+ @st.cache_resource
40
+ def init_model():
41
+ # Return a global resource here
42
+ return pipeline(
43
+ "sentiment-analysis",
44
+ model="distilbert-base-uncased-finetuned-sst-2-english"
45
+ )
46
+ ```
47
+
48
+ </RefCard>
49
+
50
+ </TileContainer>
51
+
52
+ ## Manage state
53
+
54
+ Streamlit re-executes your script with each user interaction. Widgets have built-in statefulness between reruns, but Session State lets you do more!
55
+
56
+ <TileContainer>
57
+ <RefCard href="/develop/api-reference/caching-and-state/st.session_state" size="half" >
58
+
59
+ <h4>Session State</h4>
60
+
61
+ Save data between reruns and across pages.
62
+
63
+ ```python
64
+ st.session_state["foo"] = "bar"
65
+ ```
66
+
67
+ </RefCard>
68
+ <RefCard href="/develop/api-reference/caching-and-state/st.query_params" size="half">
69
+
70
+ <h4>Query parameters</h4>
71
+
72
+ Get, set, or clear the query parameters that are shown in the browser's URL bar.
73
+
74
+ ```python
75
+ st.query_params[key] = value
76
+ st.query_params.clear()
77
+ ```
78
+
79
+ </RefCard>
80
+
81
+ </TileContainer>
82
+
83
+ ## Deprecated commands
84
+
85
+ <TileContainer>
86
+
87
+ <RefCard href="/develop/api-reference/caching-and-state/st.cache" deprecated={true}>
88
+
89
+ > This command was deprecated in version 1.18.0. Use `st.cache_data` or `st.cache_resource` instead.
90
+
91
+ <h4>Caching</h4>
92
+
93
+ Function decorator to memoize function executions.
94
+
95
+ ```python
96
+ @st.cache(ttl=3600)
97
+ def run_long_computation(arg1, arg2):
98
+ # Do stuff here
99
+ return computation_output
100
+ ```
101
+
102
+ </RefCard>
103
+
104
+ <RefCard href="/develop/api-reference/caching-and-state/st.experimental_memo" deprecated={true}>
105
+
106
+ > This command was deprecated in version 1.18.0. Use `st.cache_data` instead.
107
+
108
+ <h4>Memo</h4>
109
+
110
+ Experimental function decorator to memoize function executions.
111
+
112
+ ```python
113
+ @st.experimental_memo
114
+ def fetch_and_clean_data(url):
115
+ # Fetch data from URL here, and then clean it up.
116
+ return data
117
+ ```
118
+
119
+ </RefCard>
120
+
121
+ <RefCard href="/develop/api-reference/caching-and-state/st.experimental_singleton" deprecated={true}>
122
+
123
+ > This command was deprecated in version 1.18.0. Use `st.cache_resource` instead.
124
+
125
+ <h4>Singleton</h4>
126
+
127
+ Experimental function decorator to store singleton objects.
128
+
129
+ ```python
130
+ @st.experimental_singleton
131
+ def get_database_session(url):
132
+ # Create a database session object that points to the URL.
133
+ return session
134
+ ```
135
+
136
+ </RefCard>
137
+ <RefCard href="/develop/api-reference/caching-and-state/st.experimental_get_query_params" size="half" deprecated={true}>
138
+
139
+ <h4>Get query parameters</h4>
140
+
141
+ Get query parameters that are shown in the browser's URL bar.
142
+
143
+ ```python
144
+ param_dict = st.experimental_get_query_params()
145
+ ```
146
+
147
+ </RefCard>
148
+ <RefCard href="/develop/api-reference/caching-and-state/st.experimental_set_query_params" size="half" deprecated={true}>
149
+
150
+ <h4>Set query parameters</h4>
151
+
152
+ Set query parameters that are shown in the browser's URL bar.
153
+
154
+ ```python
155
+ st.experimental_set_query_params(
156
+ {"show_all"=True, "selected"=["asia", "america"]}
157
+ )
158
+ ```
159
+
160
+ </RefCard>
161
+ </TileContainer>
data/develop/api-reference/caching-and-state/cache-data.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.cache_data
3
+ slug: /develop/api-reference/caching-and-state/st.cache_data
4
+ description: st.cache_data is used to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).
5
+ ---
6
+
7
+ <Tip>
8
+
9
+ This page only contains information on the `st.cache_data` API. For a deeper dive into caching and how to use it, check out [Caching](/develop/concepts/architecture/caching).
10
+
11
+ </Tip>
12
+
13
+ <Autofunction function="streamlit.cache_data" oldName="streamlit.experimental_memo" />
14
+
15
+ <Warning>
16
+
17
+ `st.cache_data` implicitly uses the `pickle` module, which is known to be insecure. Anything your cached function returns is pickled and stored, then unpickled on retrieval. Ensure your cached functions return trusted values because it is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. **Only load data you trust**.
18
+
19
+ </Warning>
20
+
21
+ <Autofunction function="streamlit.cache_data.clear" oldName="streamlit.experimental_memo.clear" />
22
+
23
+ #### Example
24
+
25
+ In the example below, pressing the "Clear All" button will clear memoized values from all functions decorated with `@st.cache_data`.
26
+
27
+ ```python
28
+ import streamlit as st
29
+
30
+ @st.cache_data
31
+ def square(x):
32
+ return x**2
33
+
34
+ @st.cache_data
35
+ def cube(x):
36
+ return x**3
37
+
38
+ if st.button("Clear All"):
39
+ # Clear values from *all* all in-memory and on-disk data caches:
40
+ # i.e. clear values from both square and cube
41
+ st.cache_data.clear()
42
+ ```
43
+
44
+ <Autofunction function="CachedFunc.clear" />
45
+
46
+ ## Using Streamlit commands in cached functions
47
+
48
+ ### Static elements
49
+
50
+ Since version 1.16.0, cached functions can contain Streamlit commands! For example, you can do this:
51
+
52
+ ```python
53
+ @st.cache_data
54
+ def get_api_data():
55
+ data = api.get(...)
56
+ st.success("Fetched data from API!") # πŸ‘ˆ Show a success message
57
+ return data
58
+ ```
59
+
60
+ As we know, Streamlit only runs this function if it hasn’t been cached before. On this first run, the `st.success` message will appear in the app. But what happens on subsequent runs? It still shows up! Streamlit realizes that there is an `st.` command inside the cached function, saves it during the first run, and replays it on subsequent runs. Replaying static elements works for both caching decorators.
61
+
62
+ You can also use this functionality to cache entire parts of your UI:
63
+
64
+ ```python
65
+ @st.cache_data
66
+ def show_data():
67
+ st.header("Data analysis")
68
+ data = api.get(...)
69
+ st.success("Fetched data from API!")
70
+ st.write("Here is a plot of the data:")
71
+ st.line_chart(data)
72
+ st.write("And here is the raw data:")
73
+ st.dataframe(data)
74
+ ```
75
+
76
+ ### Input widgets
77
+
78
+ You can also use [interactive input widgets](/develop/api-reference/widgets) like `st.slider` or `st.text_input` in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the `experimental_allow_widgets` parameter:
79
+
80
+ ```python
81
+ @st.cache_data(experimental_allow_widgets=True) # πŸ‘ˆ Set the parameter
82
+ def get_data():
83
+ num_rows = st.slider("Number of rows to get") # πŸ‘ˆ Add a slider
84
+ data = api.get(..., num_rows)
85
+ return data
86
+ ```
87
+
88
+ Streamlit treats the slider like an additional input parameter to the cached function. If you change the slider position, Streamlit will see if it has already cached the function for this slider value. If yes, it will return the cached value. If not, it will rerun the function using the new slider value.
89
+
90
+ Using widgets in cached functions is extremely powerful because it lets you cache entire parts of your app. But it can be dangerous! Since Streamlit treats the widget value as an additional input parameter, it can easily lead to excessive memory usage. Imagine your cached function has five sliders and returns a 100 MB DataFrame. Then we’ll add 100 MB to the cache for _every permutation_ of these five slider values – even if the sliders do not influence the returned data! These additions can make your cache explode very quickly. Please be aware of this limitation if you use widgets in cached functions. We recommend using this feature only for isolated parts of your UI where the widgets directly influence the cached return value.
91
+
92
+ <Warning>
93
+
94
+ Support for widgets in cached functions is currently experimental. We may change or remove it anytime without warning. Please use it with care!
95
+ </Warning>
96
+
97
+ <Note>
98
+
99
+ Two widgets are currently not supported in cached functions: `st.file_uploader` and `st.camera_input`. We may support them in the future. Feel free to [open a GitHub issue](https://github.com/streamlit/streamlit/issues) if you need them!
100
+ </Note>
data/develop/api-reference/caching-and-state/cache-resource.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.cache_resource
3
+ slug: /develop/api-reference/caching-and-state/st.cache_resource
4
+ description: st.cache_resource is used to cache functions that return shared global resources (e.g. database connections, ML models).
5
+ ---
6
+
7
+ <Tip>
8
+
9
+ This page only contains information on the `st.cache_resource` API. For a deeper dive into caching and how to use it, check out [Caching](/develop/concepts/architecture/caching).
10
+
11
+ </Tip>
12
+
13
+ <Autofunction function="streamlit.cache_resource" oldName="streamlit.experimental_singleton" />
14
+
15
+ <Autofunction function="streamlit.cache_resource.clear" oldName="streamlit.experimental_singleton.clear" />
16
+
17
+ #### Example
18
+
19
+ In the example below, pressing the "Clear All" button will clear _all_ cache_resource caches. i.e. Clears cached global resources from all functions decorated with `@st.cache_resource`.
20
+
21
+ ```python
22
+ import streamlit as st
23
+ from transformers import BertModel
24
+
25
+ @st.cache_resource
26
+ def get_database_session(url):
27
+ # Create a database session object that points to the URL.
28
+ return session
29
+
30
+ @st.cache_resource
31
+ def get_model(model_type):
32
+ # Create a model of the specified type.
33
+ return BertModel.from_pretrained(model_type)
34
+
35
+ if st.button("Clear All"):
36
+ # Clears all st.cache_resource caches:
37
+ st.cache_resource.clear()
38
+ ```
39
+
40
+ <Autofunction function="CachedFunc.clear" />
41
+
42
+ ## Using Streamlit commands in cached functions
43
+
44
+ ### Static elements
45
+
46
+ Since version 1.16.0, cached functions can contain Streamlit commands! For example, you can do this:
47
+
48
+ ```python
49
+ from transformers import pipeline
50
+
51
+ @st.cache_resource
52
+ def load_model():
53
+ model = pipeline("sentiment-analysis")
54
+ st.success("Loaded NLP model from Hugging Face!") # πŸ‘ˆ Show a success message
55
+ return model
56
+ ```
57
+
58
+ As we know, Streamlit only runs this function if it hasn’t been cached before. On this first run, the `st.success` message will appear in the app. But what happens on subsequent runs? It still shows up! Streamlit realizes that there is an `st.` command inside the cached function, saves it during the first run, and replays it on subsequent runs. Replaying static elements works for both caching decorators.
59
+
60
+ You can also use this functionality to cache entire parts of your UI:
61
+
62
+ ```python
63
+ @st.cache_resource
64
+ def load_model():
65
+ st.header("Data analysis")
66
+ model = torchvision.models.resnet50(weights=ResNet50_Weights.DEFAULT)
67
+ st.success("Loaded model!")
68
+ st.write("Turning on evaluation mode...")
69
+ model.eval()
70
+ st.write("Here's the model:")
71
+ return model
72
+ ```
73
+
74
+ ### Input widgets
75
+
76
+ You can also use [interactive input widgets](/develop/api-reference/widgets) like `st.slider` or `st.text_input` in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the `experimental_allow_widgets` parameter:
77
+
78
+ ```python
79
+ @st.cache_resource(experimental_allow_widgets=True) # πŸ‘ˆ Set the parameter
80
+ def load_model():
81
+ pretrained = st.checkbox("Use pre-trained model:") # πŸ‘ˆ Add a checkbox
82
+ model = torchvision.models.resnet50(weights=ResNet50_Weights.DEFAULT, pretrained=pretrained)
83
+ return model
84
+ ```
85
+
86
+ Streamlit treats the checkbox like an additional input parameter to the cached function. If you uncheck it, Streamlit will see if it has already cached the function for this checkbox state. If yes, it will return the cached value. If not, it will rerun the function using the new slider value.
87
+
88
+ Using widgets in cached functions is extremely powerful because it lets you cache entire parts of your app. But it can be dangerous! Since Streamlit treats the widget value as an additional input parameter, it can easily lead to excessive memory usage. Imagine your cached function has five sliders and returns a 100 MB DataFrame. Then we’ll add 100 MB to the cache for _every permutation_ of these five slider values – even if the sliders do not influence the returned data! These additions can make your cache explode very quickly. Please be aware of this limitation if you use widgets in cached functions. We recommend using this feature only for isolated parts of your UI where the widgets directly influence the cached return value.
89
+
90
+ <Warning>
91
+
92
+ Support for widgets in cached functions is currently experimental. We may change or remove it anytime without warning. Please use it with care!
93
+ </Warning>
94
+
95
+ <Note>
96
+
97
+ Two widgets are currently not supported in cached functions: `st.file_uploader` and `st.camera_input`. We may support them in the future. Feel free to [open a GitHub issue](https://github.com/streamlit/streamlit/issues) if you need them!
98
+ </Note>
data/develop/api-reference/caching-and-state/query_params.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.query_params
3
+ slug: /develop/api-reference/caching-and-state/st.query_params
4
+ description: st.query_params reads and manipulates query parameters in the browser's URL bar.
5
+ ---
6
+
7
+ ## st.query_params
8
+
9
+ `st.query_params` provides a dictionary-like interface to access query parameters in your app's URL and is available as of Streamlit 1.30.0. It behaves similarly to `st.session_state` with the notable exception that keys may be repeated in an app's URL. Handling of repeated keys requires special consideration as explained below.
10
+
11
+ `st.query_params` can be used with both key and attribute notation. For example, `st.query_params.my_key` and `st.query_params["my_key"]`. All keys and values will be set and returned as strings. When you write to `st.query_params`, key-value pair prefixed with `?` is added to the end of your app's URL. Each additional pair is prefixed with `&` instead of `?`. Query parameters are cleared when navigating between pages in a multipage app.
12
+
13
+ For example, consider the following URL:
14
+
15
+ ```javascript
16
+ https://your_app.streamlit.app/?first_key=1&second_key=two&third_key=true
17
+ ```
18
+
19
+ The parameters in the URL above will be accessible in `st.query_params` as:
20
+
21
+ ```python
22
+ {
23
+ "first_key" : "1",
24
+ "second_key" : "two",
25
+ "third_key" : "true"
26
+ }
27
+ ```
28
+
29
+ This means you can use those parameters in your app like this:
30
+
31
+ ```python
32
+ # You can read query params using key notation
33
+ if st.query_params["first_key"] == "1":
34
+ do_something()
35
+
36
+ # ...or using attribute notation
37
+ if st.query_params.second_key == "two":
38
+ do_something_else()
39
+
40
+ # And you can change a param by just writing to it
41
+ st.query_params.first_key = 2 # This gets converted to str automatically
42
+ ```
43
+
44
+ ### Repeated keys
45
+
46
+ When a key is repeated in your app's URL (`?a=1&a=2&a=3`), dict-like methods will return only the last value. In this example, `st.query_params["a"]` returns `"3"`. To get all keys as a list, use the [`.get_all()`](/develop/api-reference/caching-and-state/st.query_params#stquery_paramsget_all) method shown below. To set the value of a repeated key, assign the values as a list. For example, `st.query_params.a = ["1", "2", "3"]` produces the repeated key given at the beginning of this paragraph.
47
+
48
+ ### Limitation
49
+
50
+ `st.query_params` can't get or set embedding settings as described in [Embed your app](/deploy/streamlit-community-cloud/share-your-app/embed-your-app#embed-options). `st.query_params.embed` and `st.query_params.embed_options` will raise an `AttributeError` or `StreamlitAPIException` when trying to get or set their values, respectively.
51
+
52
+ <Autofunction function="streamlit.query_params.clear" />
53
+
54
+ <Autofunction function="streamlit.query_params.from_dict" />
55
+
56
+ <Autofunction function="streamlit.query_params.get_all" />
57
+
58
+ <Autofunction function="streamlit.query_params.to_dict" />
data/develop/api-reference/caching-and-state/session_state.md ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Session State
3
+ slug: /develop/api-reference/caching-and-state/st.session_state
4
+ description: st.session_state is a way to share variables between reruns, for each user session.
5
+ ---
6
+
7
+ # Session State
8
+
9
+ Session State is a way to share variables between reruns, for each user session. In addition to the ability to store and persist state, Streamlit also exposes the ability to manipulate state using Callbacks. Session state also persists across apps inside a [multipage app](/develop/concepts/multipage-apps).
10
+
11
+ Check out this Session State basics tutorial video by Streamlit Developer Advocate Dr. Marisa Smith to get started:
12
+
13
+ <YouTube videoId="92jUAXBmZyU" />
14
+
15
+ ### Initialize values in Session State
16
+
17
+ The Session State API follows a field-based API, which is very similar to Python dictionaries:
18
+
19
+ ```python
20
+ # Initialization
21
+ if 'key' not in st.session_state:
22
+ st.session_state['key'] = 'value'
23
+
24
+ # Session State also supports attribute based syntax
25
+ if 'key' not in st.session_state:
26
+ st.session_state.key = 'value'
27
+ ```
28
+
29
+ ### Reads and updates
30
+
31
+ Read the value of an item in Session State and display it by passing to `st.write` :
32
+
33
+ ```python
34
+ # Read
35
+ st.write(st.session_state.key)
36
+
37
+ # Outputs: value
38
+ ```
39
+
40
+ Update an item in Session State by assigning it a value:
41
+
42
+ ```python
43
+ st.session_state.key = 'value2' # Attribute API
44
+ st.session_state['key'] = 'value2' # Dictionary like API
45
+ ```
46
+
47
+ Curious about what is in Session State? Use `st.write` or magic:
48
+
49
+ ```python
50
+ st.write(st.session_state)
51
+
52
+ # With magic:
53
+ st.session_state
54
+ ```
55
+
56
+ Streamlit throws a handy exception if an uninitialized variable is accessed:
57
+
58
+ ```python
59
+ st.write(st.session_state['value'])
60
+
61
+ # Throws an exception!
62
+ ```
63
+
64
+ ![state-uninitialized-exception](/images/state_uninitialized_exception.png)
65
+
66
+ ### Delete items
67
+
68
+ Delete items in Session State using the syntax to delete items in any Python dictionary:
69
+
70
+ ```python
71
+ # Delete a single key-value pair
72
+ del st.session_state[key]
73
+
74
+ # Delete all the items in Session state
75
+ for key in st.session_state.keys():
76
+ del st.session_state[key]
77
+ ```
78
+
79
+ Session State can also be cleared by going to Settings β†’ Clear Cache, followed by Rerunning the app.
80
+
81
+ ![state-clear-cache](/images/clear_cache.png)
82
+
83
+ ### Session State and Widget State association
84
+
85
+ Every widget with a key is automatically added to Session State:
86
+
87
+ ```python
88
+ st.text_input("Your name", key="name")
89
+
90
+ # This exists now:
91
+ st.session_state.name
92
+ ```
93
+
94
+ ### Use Callbacks to update Session State
95
+
96
+ A callback is a python function which gets called when an input widget changes.
97
+
98
+ **Order of execution**: When updating Session state in response to **events**, a callback function gets executed first, and then the app is executed from top to bottom.
99
+
100
+ Callbacks can be used with widgets using the parameters `on_change` (or `on_click`), `args`, and `kwargs`:
101
+
102
+ **Parameters**
103
+
104
+ - **on_change** or **on_click** - The function name to be used as a callback
105
+ - **args** (_tuple_) - List of arguments to be passed to the callback function
106
+ - **kwargs** (_dict_) - Named arguments to be passed to the callback function
107
+
108
+ Widgets which support the `on_change` event:
109
+
110
+ - `st.checkbox`
111
+ - `st.color_picker`
112
+ - `st.date_input`
113
+ - `st.data_editor`
114
+ - `st.file_uploader`
115
+ - `st.multiselect`
116
+ - `st.number_input`
117
+ - `st.radio`
118
+ - `st.select_slider`
119
+ - `st.selectbox`
120
+ - `st.slider`
121
+ - `st.text_area`
122
+ - `st.text_input`
123
+ - `st.time_input`
124
+ - `st.toggle`
125
+
126
+ Widgets which support the `on_click` event:
127
+
128
+ - `st.button`
129
+ - `st.download_button`
130
+ - `st.form_submit_button`
131
+
132
+ To add a callback, define a callback function **above** the widget declaration and pass it to the widget via the `on_change` (or `on_click` ) parameter.
133
+
134
+ ### Forms and Callbacks
135
+
136
+ Widgets inside a form can have their values be accessed and set via the Session State API. `st.form_submit_button` can have a callback associated with it. The callback gets executed upon clicking on the submit button. For example:
137
+
138
+ ```python
139
+ def form_callback():
140
+ st.write(st.session_state.my_slider)
141
+ st.write(st.session_state.my_checkbox)
142
+
143
+ with st.form(key='my_form'):
144
+ slider_input = st.slider('My slider', 0, 10, 5, key='my_slider')
145
+ checkbox_input = st.checkbox('Yes or No', key='my_checkbox')
146
+ submit_button = st.form_submit_button(label='Submit', on_click=form_callback)
147
+ ```
148
+
149
+ ### Serializable Session State
150
+
151
+ Serialization refers to the process of converting an object or data structure into a format that can be persisted and shared, and allowing you to recover the data’s original structure. Python’s built-in [pickle](https://docs.python.org/3/develop/pickle.html) module serializes Python objects to a byte stream ("pickling") and deserializes the stream into an object ("unpickling").
152
+
153
+ By default, Streamlit’s [Session State](/develop/concepts/architecture/session-state) allows you to persist any Python object for the duration of the session, irrespective of the object’s pickle-serializability. This property lets you store Python primitives such as integers, floating-point numbers, complex numbers and booleans, dataframes, and even [lambdas](https://docs.python.org/3/reference/expressions.html#lambda) returned by functions. However, some execution environments may require serializing all data in Session State, so it may be useful to detect incompatibility during development, or when the execution environment will stop supporting it in the future.
154
+
155
+ To that end, Streamlit provides a `runner.enforceSerializableSessionState` [configuration option](/develop/concepts/configuration) that, when set to `true`, only allows pickle-serializable objects in Session State. To enable the option, either create a global or project config file with the following or use it as a command-line flag:
156
+
157
+ ```toml
158
+ # .streamlit/config.toml
159
+ [runner]
160
+ enforceSerializableSessionState = true
161
+ ```
162
+
163
+ By "_pickle-serializable_", we mean calling `pickle.dumps(obj)` should not raise a [`PicklingError`](https://docs.python.org/3/develop/pickle.html#pickle.PicklingError) exception. When the config option is enabled, adding unserializable data to session state should result in an exception. E.g.,
164
+
165
+ ```python
166
+ import streamlit as st
167
+
168
+ def unserializable_data():
169
+ return lambda x: x
170
+
171
+ #πŸ‘‡ results in an exception when enforceSerializableSessionState is on
172
+ st.session_state.unserializable = unserializable_data()
173
+ ```
174
+
175
+ <Image alt="UnserializableSessionStateError" src="/images/unserializable-session-state-error.png" clean />
176
+
177
+ <Warning>
178
+
179
+ When `runner.enforceSerializableSessionState` is set to `true`, Session State implicitly uses the `pickle` module, which is known to be insecure. Ensure all data saved and retrieved from Session State is trusted because it is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. **Only load data you trust**.
180
+
181
+ </Warning>
182
+
183
+ ### Caveats and limitations
184
+
185
+ - Only the `st.form_submit_button` has a callback in forms. Other widgets inside a form are not allowed to have callbacks.
186
+ - `on_change` and `on_click` events are only supported on input type widgets.
187
+ - Modifying the value of a widget via the Session state API, after instantiating it, is not allowed and will raise a `StreamlitAPIException`. For example:
188
+
189
+ ```python
190
+ slider = st.slider(
191
+ label='My Slider', min_value=1,
192
+ max_value=10, value=5, key='my_slider')
193
+
194
+ st.session_state.my_slider = 7
195
+
196
+ # Throws an exception!
197
+ ```
198
+
199
+ ![state-modified-instantiated-exception](/images/state_modified_instantiated_exception.png)
200
+
201
+ - Setting the widget state via the Session State API and using the `value` parameter in the widget declaration is not recommended, and will throw a warning on the first run. For example:
202
+
203
+ ```python
204
+ st.session_state.my_slider = 7
205
+
206
+ slider = st.slider(
207
+ label='Choose a Value', min_value=1,
208
+ max_value=10, value=5, key='my_slider')
209
+ ```
210
+
211
+ ![state-value-api-exception](/images/state_value_api_exception.png)
212
+
213
+ - Setting the state of button-like widgets: `st.button`, `st.download_button`, and `st.file_uploader` via the Session State API is not allowed. Such type of widgets are by default _False_ and have ephemeral _True_ states which are only valid for a single run. For example:
214
+
215
+ ```python
216
+ if 'my_button' not in st.session_state:
217
+ st.session_state.my_button = True
218
+
219
+ st.button('My button', key='my_button')
220
+
221
+ # Throws an exception!
222
+ ```
223
+
224
+ ![state-button-exception](/images/state_button_exception.png)
data/develop/api-reference/charts/_index.md ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Chart elements
3
+ slug: /develop/api-reference/charts
4
+ ---
5
+
6
+ # Chart elements
7
+
8
+ Streamlit supports several different charting libraries, and our goal is to
9
+ continually add support for more. Right now, the most basic library in our
10
+ arsenal is [Matplotlib](https://matplotlib.org/). Then there are also
11
+ interactive charting libraries like [Vega
12
+ Lite](https://vega.github.io/vega-lite/) (2D charts) and
13
+ [deck.gl](https://github.com/uber/deck.gl) (maps and 3D charts). And
14
+ finally we also provide a few chart types that are "native" to Streamlit,
15
+ like `st.line_chart` and `st.area_chart`.
16
+
17
+ ## Simple chart elements
18
+
19
+ <TileContainer>
20
+ <RefCard href="/develop/api-reference/charts/st.area_chart">
21
+ <Image pure alt="screenshot" src="/images/api/area_chart.jpg" />
22
+
23
+ <h4>Simple area charts</h4>
24
+
25
+ Display an area chart.
26
+
27
+ ```python
28
+ st.area_chart(my_data_frame)
29
+ ```
30
+
31
+ </RefCard>
32
+ <RefCard href="/develop/api-reference/charts/st.bar_chart">
33
+ <Image pure alt="screenshot" src="/images/api/bar_chart.jpg" />
34
+
35
+ <h4>Simple bar charts</h4>
36
+
37
+ Display a bar chart.
38
+
39
+ ```python
40
+ st.bar_chart(my_data_frame)
41
+ ```
42
+
43
+ </RefCard>
44
+ <RefCard href="/develop/api-reference/charts/st.line_chart">
45
+ <Image pure alt="screenshot" src="/images/api/line_chart.jpg" />
46
+
47
+ <h4>Simple line charts</h4>
48
+
49
+ Display a line chart.
50
+
51
+ ```python
52
+ st.line_chart(my_data_frame)
53
+ ```
54
+
55
+ </RefCard>
56
+ <RefCard href="/develop/api-reference/charts/st.scatter_chart">
57
+ <Image pure alt="screenshot" src="/images/api/scatter_chart.svg" />
58
+
59
+ <h4>Simple scatter charts</h4>
60
+
61
+ Display a line chart.
62
+
63
+ ```python
64
+ st.scatter_chart(my_data_frame)
65
+ ```
66
+
67
+ </RefCard>
68
+ <RefCard href="/develop/api-reference/charts/st.map">
69
+ <Image pure alt="screenshot" src="/images/api/map.jpg" />
70
+
71
+ <h4>Scatterplots on maps</h4>
72
+
73
+ Display a map with points on it.
74
+
75
+ ```python
76
+ st.map(my_data_frame)
77
+ ```
78
+
79
+ </RefCard>
80
+ </TileContainer>
81
+
82
+ ## Advanced chart elements
83
+
84
+ <TileContainer>
85
+ <RefCard href="/develop/api-reference/charts/st.pyplot">
86
+ <Image pure alt="screenshot" src="/images/api/pyplot.jpg" />
87
+
88
+ <h4>Matplotlib</h4>
89
+
90
+ Display a matplotlib.pyplot figure.
91
+
92
+ ```python
93
+ st.pyplot(my_mpl_figure)
94
+ ```
95
+
96
+ </RefCard>
97
+ <RefCard href="/develop/api-reference/charts/st.altair_chart">
98
+ <Image pure alt="screenshot" src="/images/api/vega_lite_chart.jpg" />
99
+
100
+ <h4>Altair</h4>
101
+
102
+ Display a chart using the Altair library.
103
+
104
+ ```python
105
+ st.altair_chart(my_altair_chart)
106
+ ```
107
+
108
+ </RefCard>
109
+ <RefCard href="/develop/api-reference/charts/st.vega_lite_chart">
110
+ <Image pure alt="screenshot" src="/images/api/vega_lite_chart.jpg" />
111
+
112
+ <h4>Vega-Lite</h4>
113
+
114
+ Display a chart using the Vega-Lite library.
115
+
116
+ ```python
117
+ st.vega_lite_chart(my_vega_lite_chart)
118
+ ```
119
+
120
+ </RefCard>
121
+ <RefCard href="/develop/api-reference/charts/st.plotly_chart">
122
+ <Image pure alt="screenshot" src="/images/api/plotly_chart.jpg" />
123
+
124
+ <h4>Plotly</h4>
125
+
126
+ Display an interactive Plotly chart.
127
+
128
+ ```python
129
+ st.plotly_chart(my_plotly_chart)
130
+ ```
131
+
132
+ </RefCard>
133
+ <RefCard href="/develop/api-reference/charts/st.bokeh_chart">
134
+ <Image pure alt="screenshot" src="/images/api/bokeh_chart.jpg" />
135
+
136
+ <h4>Bokeh</h4>
137
+
138
+ Display an interactive Bokeh chart.
139
+
140
+ ```python
141
+ st.bokeh_chart(my_bokeh_chart)
142
+ ```
143
+
144
+ </RefCard>
145
+ <RefCard href="/develop/api-reference/charts/st.pydeck_chart">
146
+ <Image pure alt="screenshot" src="/images/api/pydeck_chart.jpg" />
147
+
148
+ <h4>PyDeck</h4>
149
+
150
+ Display a chart using the PyDeck library.
151
+
152
+ ```python
153
+ st.pydeck_chart(my_pydeck_chart)
154
+ ```
155
+
156
+ </RefCard>
157
+ <RefCard href="/develop/api-reference/charts/st.graphviz_chart">
158
+ <Image pure alt="screenshot" src="/images/api/graphviz_chart.jpg" />
159
+
160
+ <h4>GraphViz</h4>
161
+
162
+ Display a graph using the dagre-d3 library.
163
+
164
+ ```python
165
+ st.graphviz_chart(my_graphviz_spec)
166
+ ```
167
+
168
+ </RefCard>
169
+ </TileContainer>
170
+
171
+ <ComponentSlider>
172
+
173
+ <ComponentCard href="https://github.com/tvst/plost">
174
+
175
+ <Image pure alt="screenshot" src="/images/api/components/plost.jpg" />
176
+
177
+ <h4>Plost</h4>
178
+
179
+ A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst).
180
+
181
+ ```python
182
+ import plost
183
+ plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',)
184
+ ```
185
+
186
+ </ComponentCard>
187
+
188
+ <ComponentCard href="https://github.com/facebookresearch/hiplot">
189
+
190
+ <Image pure alt="screenshot" src="/images/api/components/hiplot.jpg" />
191
+
192
+ <h4>HiPlot</h4>
193
+
194
+ High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch).
195
+
196
+ ```python
197
+ data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}]
198
+ hip.Experiment.from_iterable(data).display()
199
+ ```
200
+
201
+ </ComponentCard>
202
+
203
+ <ComponentCard href="https://github.com/andfanilo/streamlit-echarts">
204
+
205
+ <Image pure alt="screenshot" src="/images/api/components/echarts.jpg" />
206
+
207
+ <h4>ECharts</h4>
208
+
209
+ High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo).
210
+
211
+ ```python
212
+ from streamlit_echarts import st_echarts
213
+ st_echarts(options=options)
214
+ ```
215
+
216
+ </ComponentCard>
217
+
218
+ <ComponentCard href="https://github.com/randyzwitch/streamlit-folium">
219
+
220
+ <Image pure alt="screenshot" src="/images/api/components/folium.jpg" />
221
+
222
+ <h4>Streamlit Folium</h4>
223
+
224
+ Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch).
225
+
226
+ ```python
227
+ m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
228
+ st_data = st_folium(m, width=725)
229
+ ```
230
+
231
+ </ComponentCard>
232
+
233
+ <ComponentCard href="https://github.com/explosion/spacy-streamlit">
234
+
235
+ <Image pure alt="screenshot" src="/images/api/components/spacy.jpg" />
236
+
237
+ <h4>Spacy-Streamlit</h4>
238
+
239
+ spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion).
240
+
241
+ ```python
242
+ models = ["en_core_web_sm", "en_core_web_md"]
243
+ spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.")
244
+ ```
245
+
246
+ </ComponentCard>
247
+
248
+ <ComponentCard href="https://github.com/ChrisDelClea/streamlit-agraph">
249
+
250
+ <Image pure alt="screenshot" src="/images/api/components/agraph.jpg" />
251
+
252
+ <h4>Streamlit Agraph</h4>
253
+
254
+ A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea).
255
+
256
+ ```python
257
+ from streamlit_agraph import agraph, Node, Edge, Config
258
+ agraph(nodes=nodes, edges=edges, config=config)
259
+ ```
260
+
261
+ </ComponentCard>
262
+
263
+ <ComponentCard href="https://github.com/andfanilo/streamlit-lottie">
264
+
265
+ <Image pure alt="screenshot" src="/images/api/components/lottie.jpg" />
266
+
267
+ <h4>Streamlit Lottie</h4>
268
+
269
+ Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo).
270
+
271
+ ```python
272
+ lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json")
273
+ st_lottie(lottie_hello, key="hello")
274
+ ```
275
+
276
+ </ComponentCard>
277
+
278
+ <ComponentCard href="https://github.com/null-jones/streamlit-plotly-events">
279
+
280
+ <Image pure alt="screenshot" src="/images/api/components/plotly-events.jpg" />
281
+
282
+ <h4>Plotly Events</h4>
283
+
284
+ Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/).
285
+
286
+ ```python
287
+ fig = px.line(x=[1], y=[1])
288
+ selected_points = plotly_events(fig)
289
+ ```
290
+
291
+ </ComponentCard>
292
+
293
+ <ComponentCard href="https://extras.streamlit.app/">
294
+
295
+ <Image pure alt="screenshot" src="/images/api/components/extras-chart-annotations.jpg" />
296
+
297
+ <h4>Streamlit Extras</h4>
298
+
299
+ A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
300
+
301
+ ```python
302
+ chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],)
303
+ st.altair_chart(chart, use_container_width=True)
304
+ ```
305
+
306
+ </ComponentCard>
307
+
308
+ </ComponentSlider>
data/develop/api-reference/charts/altair_chart.md ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.altair_chart
3
+ slug: /develop/api-reference/charts/st.altair_chart
4
+ description: st.altair_chart displays a chart using the Altair library.
5
+ ---
6
+
7
+ <Autofunction function="streamlit.altair_chart" />
8
+
9
+ ### Theming
10
+
11
+ Altair charts are displayed using the Streamlit theme by default. This theme is sleek, user-friendly, and incorporates Streamlit's color palette. The added benefit is that your charts better integrate with the rest of your app's design.
12
+
13
+ The Streamlit theme is available from Streamlit 1.16.0 through the `theme="streamlit"` keyword argument. To disable it, and use Altair's native theme, use `theme=None` instead.
14
+
15
+ Let's look at an example of charts with the Streamlit theme and the native Altair theme:
16
+
17
+ ```python
18
+ import altair as alt
19
+ from vega_datasets import data
20
+
21
+ source = data.cars()
22
+
23
+ chart = alt.Chart(source).mark_circle().encode(
24
+ x='Horsepower',
25
+ y='Miles_per_Gallon',
26
+ color='Origin',
27
+ ).interactive()
28
+
29
+ tab1, tab2 = st.tabs(["Streamlit theme (default)", "Altair native theme"])
30
+
31
+ with tab1:
32
+ # Use the Streamlit theme.
33
+ # This is the default. So you can also omit the theme argument.
34
+ st.altair_chart(chart, theme="streamlit", use_container_width=True)
35
+ with tab2:
36
+ # Use the native Altair theme.
37
+ st.altair_chart(chart, theme=None, use_container_width=True)
38
+ ```
39
+
40
+ Click the tabs in the interactive app below to see the charts with the Streamlit theme enabled and disabled.
41
+
42
+ <Cloud src="https://doc-altair-chart.streamlit.app/?embed=true" height="500" />
43
+
44
+ If you're wondering if your own customizations will still be taken into account, don't worry! You can still make changes to your chart configurations. In other words, although we now enable the Streamlit theme by default, you can overwrite it with custom colors or fonts. For example, if you want a chart line to be green instead of the default red, you can do it!
45
+
46
+ Here's an example of an Altair chart where manual color passing is done and reflected:
47
+
48
+ <Collapse title="See the code">
49
+
50
+ ```python
51
+ import altair as alt
52
+ import streamlit as st
53
+ from vega_datasets import data
54
+
55
+ source = data.seattle_weather()
56
+
57
+ scale = alt.Scale(
58
+ domain=["sun", "fog", "drizzle", "rain", "snow"],
59
+ range=["#e7ba52", "#a7a7a7", "#aec7e8", "#1f77b4", "#9467bd"],
60
+ )
61
+ color = alt.Color("weather:N", scale=scale)
62
+
63
+ # We create two selections:
64
+ # - a brush that is active on the top panel
65
+ # - a multi-click that is active on the bottom panel
66
+ brush = alt.selection_interval(encodings=["x"])
67
+ click = alt.selection_multi(encodings=["color"])
68
+
69
+ # Top panel is scatter plot of temperature vs time
70
+ points = (
71
+ alt.Chart()
72
+ .mark_point()
73
+ .encode(
74
+ alt.X("monthdate(date):T", title="Date"),
75
+ alt.Y(
76
+ "temp_max:Q",
77
+ title="Maximum Daily Temperature (C)",
78
+ scale=alt.Scale(domain=[-5, 40]),
79
+ ),
80
+ color=alt.condition(brush, color, alt.value("lightgray")),
81
+ size=alt.Size("precipitation:Q", scale=alt.Scale(range=[5, 200])),
82
+ )
83
+ .properties(width=550, height=300)
84
+ .add_selection(brush)
85
+ .transform_filter(click)
86
+ )
87
+
88
+ # Bottom panel is a bar chart of weather type
89
+ bars = (
90
+ alt.Chart()
91
+ .mark_bar()
92
+ .encode(
93
+ x="count()",
94
+ y="weather:N",
95
+ color=alt.condition(click, color, alt.value("lightgray")),
96
+ )
97
+ .transform_filter(brush)
98
+ .properties(
99
+ width=550,
100
+ )
101
+ .add_selection(click)
102
+ )
103
+
104
+ chart = alt.vconcat(points, bars, data=source, title="Seattle Weather: 2012-2015")
105
+
106
+ tab1, tab2 = st.tabs(["Streamlit theme (default)", "Altair native theme"])
107
+
108
+ with tab1:
109
+ st.altair_chart(chart, theme="streamlit", use_container_width=True)
110
+ with tab2:
111
+ st.altair_chart(chart, theme=None, use_container_width=True)
112
+ ```
113
+
114
+ </Collapse>
115
+
116
+ Notice how the custom colors are still reflected in the chart, even when the Streamlit theme is enabled πŸ‘‡
117
+
118
+ <Cloud src="https://doc-altair-custom-colors.streamlit.app/?embed=true" height="675" />
119
+
120
+ For many more examples of Altair charts with and without the Streamlit theme, check out the [altair.streamlit.app](https://altair.streamlit.app).
121
+
122
+ ### Annotating charts
123
+
124
+ Altair also allows you to annotate your charts with text, images, and emojis. You can do this by creating [layered charts](https://altair-viz.github.io/user_guide/compound_charts.html#layered-charts), which let you overlay two different charts on top of each other. The idea is to use the first chart to show the data, and the second chart to show the annotations. The second chart can then be overlaid on top of the first chart using the `+` operator to create a layered chart.
125
+
126
+ Let's walk through an example of annotating a time-series chart with text and an emoji.
127
+
128
+ #### Step 1: Create the base chart
129
+
130
+ In this example, we create a time-series chart to track the evolution of stock prices. The chart is interactive and contains a multi-line tooltip. Click [here](https://altair-viz.github.io/gallery/multiline_tooltip.html) to learn more about multi-line tooltips in Altair.
131
+
132
+ First, we import the required libraries and load the example stocks dataset using the [`vega_datasets`](https://pypi.org/project/vega-datasets/) package:
133
+
134
+ ```python
135
+ import altair as alt
136
+ import pandas as pd
137
+ import streamlit as st
138
+ from vega_datasets import data
139
+
140
+ # We use @st.cache_data to keep the dataset in cache
141
+ @st.cache_data
142
+ def get_data():
143
+ source = data.stocks()
144
+ source = source[source.date.gt("2004-01-01")]
145
+ return source
146
+
147
+ source = get_data()
148
+ ```
149
+
150
+ Next, we define a function `get_chart()` to create the interactive time-series chart of the stock prices with a multi-line tooltip. The x-axis represents the date, and the y-axis represents the stock price.
151
+
152
+ We then invoke `get_chart()` that takes the stock prices dataframe as an input and returns a chart object. This is going to be our base chart on which we will overlay the annotations in [Step 2](/develop/api-reference/charts/st.altair_chart#step-2-annotate-the-chart).
153
+
154
+ ```python
155
+ # Define the base time-series chart.
156
+ def get_chart(data):
157
+ hover = alt.selection_single(
158
+ fields=["date"],
159
+ nearest=True,
160
+ on="mouseover",
161
+ empty="none",
162
+ )
163
+
164
+ lines = (
165
+ alt.Chart(data, title="Evolution of stock prices")
166
+ .mark_line()
167
+ .encode(
168
+ x="date",
169
+ y="price",
170
+ color="symbol",
171
+ )
172
+ )
173
+
174
+ # Draw points on the line, and highlight based on selection
175
+ points = lines.transform_filter(hover).mark_circle(size=65)
176
+
177
+ # Draw a rule at the location of the selection
178
+ tooltips = (
179
+ alt.Chart(data)
180
+ .mark_rule()
181
+ .encode(
182
+ x="yearmonthdate(date)",
183
+ y="price",
184
+ opacity=alt.condition(hover, alt.value(0.3), alt.value(0)),
185
+ tooltip=[
186
+ alt.Tooltip("date", title="Date"),
187
+ alt.Tooltip("price", title="Price (USD)"),
188
+ ],
189
+ )
190
+ .add_selection(hover)
191
+ )
192
+ return (lines + points + tooltips).interactive()
193
+
194
+ chart = get_chart(source)
195
+ ```
196
+
197
+ #### Step 2: Annotate the chart
198
+
199
+ Now that we have our first chart that shows the data, we can annotate it with text and an emoji. Let's overlay the ⬇ emoji on top of the time-series chart at specifc points of interest. We want users to hover over the ⬇ emoji to see the associated annotation text.
200
+
201
+ For simplicity, let's annotate four specific dates and set the height of the annotations at constant value of `10`.
202
+
203
+ <Tip>
204
+
205
+ You can vary the horizontal and vertical postions of the annotations by replacing the hard-coded values with the output of Streamlit widgets! Click [here](/develop/api-reference/charts/st.altair_chart#interactive-example) to jump to a live example below, and develop an intuition for the ideal horizontal and vertical positions of the annotations by playing with Streamlit widgets.
206
+
207
+ </Tip>
208
+
209
+ To do so, we create a dataframe `annotations_df` containing the dates, annotation text, and the height of the annotations:
210
+
211
+ ```python
212
+ # Add annotations
213
+ ANNOTATIONS = [
214
+ ("Mar 01, 2008", "Pretty good day for GOOG"),
215
+ ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"),
216
+ ("Nov 01, 2008", "Market starts again thanks to..."),
217
+ ("Dec 01, 2009", "Small crash for GOOG after..."),
218
+ ]
219
+ annotations_df = pd.DataFrame(ANNOTATIONS, columns=["date", "event"])
220
+ annotations_df.date = pd.to_datetime(annotations_df.date)
221
+ annotations_df["y"] = 10
222
+ ```
223
+
224
+ Using this dataframe, we create a scatter plot with the x-axis representing the date, and the y-axis representing the height of the annotation. The data point at the specific date and height is represented by the ⬇ emoji, using Altair's `mark_text()` [mark](https://altair-viz.github.io/user_guide/marks.html).
225
+
226
+ The annotation text is displayed as a tooltip when users hover over the ⬇ emoji. This is achieved using Altair's `encode()` method to map the `event` column containing the annotation text to the visual attribute ⬇ of the plot.
227
+
228
+ ```python
229
+ annotation_layer = (
230
+ alt.Chart(annotations_df)
231
+ .mark_text(size=20, text="⬇", dx=-8, dy=-10, align="left")
232
+ .encode(
233
+ x="date:T",
234
+ y=alt.Y("y:Q"),
235
+ tooltip=["event"],
236
+ )
237
+ .interactive()
238
+ )
239
+ ```
240
+
241
+ Finally, we overlay the annotations on top of the base chart using the `+` operator to create the final layered chart! 🎈
242
+
243
+ ```python
244
+ st.altair_chart(
245
+ (chart + annotation_layer).interactive(),
246
+ use_container_width=True
247
+ )
248
+ ```
249
+
250
+ <Image src="/images/api/altair-annotation.png" />
251
+
252
+ To use images instead of emojis, replace the line containing `.mark_text()` with `.mark_image()`, and replace `image_url` below with the URL of the image:
253
+
254
+ ```python
255
+ .mark_image(
256
+ width=12,
257
+ height=12,
258
+ url="image_url",
259
+ )
260
+ ```
261
+
262
+ #### Interactive example
263
+
264
+ Now that you've learned how to annotate charts, the sky's the limit! We've extended the above example to let you interactively paste your favorite emoji and set its position on the chart with Streamlit widgets. πŸ‘‡
265
+
266
+ <Cloud src="https://example-time-series-annotation.streamlit.app/?embed=true" height="700" />
data/develop/api-reference/charts/area_chart.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.area_chart
3
+ slug: /develop/api-reference/charts/st.area_chart
4
+ description: st.area_chart displays an area chart.
5
+ ---
6
+
7
+ <Autofunction function="streamlit.area_chart" />
8
+
9
+ <Autofunction function="DeltaGenerator.add_rows" />
data/develop/api-reference/charts/bar_chart.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.bar_chart
3
+ slug: /develop/api-reference/charts/st.bar_chart
4
+ description: st.bar_chart displays a bar chart.
5
+ ---
6
+
7
+ <Autofunction function="streamlit.bar_chart" />
8
+
9
+ <Autofunction function="DeltaGenerator.add_rows" />
data/develop/api-reference/charts/bokeh_chart.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.bokeh_chart
3
+ slug: /develop/api-reference/charts/st.bokeh_chart
4
+ description: st.bokeh_chart displays an interactive Bokeh chart.
5
+ ---
6
+
7
+ <Autofunction function="streamlit.bokeh_chart" />
data/develop/api-reference/charts/graphviz_chart.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: st.graphviz_chart
3
+ slug: /develop/api-reference/charts/st.graphviz_chart
4
+ description: st.graphviz_chart displays a graph using the dagre-d3 library.
5
+ ---
6
+
7
+ <Autofunction function="streamlit.graphviz_chart" />