Skip to content

Commit e76db3e

Browse files
Merge branch 'main' into test-sis
Former-commit-id: 0a0ceae
2 parents 075381d + 14aaad7 commit e76db3e

File tree

44 files changed

+371
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+371
-201
lines changed

components/blocks/callout.module.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
@apply text-gray-90 !important;
88
}
99

10-
.Container p > code {
11-
@apply border border-gray-40 text-red-70 rounded-md px-1 mx-1 break-words;
12-
}
13-
1410
.Container p:only-child,
1511
.Container p:last-child,
1612
.Container section:last-child,

components/layouts/flex.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import styles from "./flex.module.css";
2+
import classNames from "classnames";
23

34
// Simple horizontal flex container used for MDX.
4-
const Flex = ({ children }) => {
5-
return <section className={styles.Container}>{children}</section>;
5+
const Flex = ({ wrap = false, children }) => {
6+
return (
7+
<section
8+
className={classNames(styles.Container, wrap ? styles.wrapContainer : "")}
9+
>
10+
{children}
11+
</section>
12+
);
613
};
714

815
export default Flex;

components/layouts/flex.module.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
.Container {
2-
@apply flex flex-col lg:flex-row;
2+
@apply flex flex-col lg:flex-row text-gray-90;
3+
}
4+
5+
:global(.dark) .Container {
6+
@apply text-gray-40;
7+
}
8+
9+
.wrapContainer {
10+
@apply flex-wrap flex-row;
311
}

content/deploy/community-cloud/deploy-your-app/app-dependencies.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ directory as your app's entrypoint file.
2323

2424
With each `import` statement in your script, you are bringing in a Python dependency. You need to tell Community Cloud how to install those dependencies through a Python package manager. We recommend using a `requirements.txt` file, which is based on `pip`.
2525

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, 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.
26+
You should _not_ include <a href="https://docs.python.org/3/py-modindex.html" target="_blank">built-in Python libraries</a> like `math`, `random`, or `distutils` in your `requirements.txt` file. These are a part of Python and aren't installed separately. Also, 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+
<Important>
29+
30+
The version of Python you use is important! Built-in libraries change between versions of Python and other libraries may have specific version requirements, too. Whenever Streamlit supports a new version of Python, Community Cloud quickly follows to default to that new version of Python. Always develop your app in the same version of Python you will use to deploy it. For more information about setting the version of Python when you deploy your app, see [Optional: Configure secrets and Python version](/deploy/streamlit-community-cloud/deploy-your-app/deploy#optional-configure-secrets-and-python-version).
31+
32+
</Important>
2733

2834
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.
2935

@@ -100,7 +106,7 @@ You should only use one dependency file for your app. If you include more than o
100106

101107
## apt-get dependencies
102108

103-
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, you need a `packages.txt` file. Community Cloud is built on Debian Linux. Anything you want to `apt-get install` must go in your `packages.txt` file.
109+
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, you need a `packages.txt` file. Community Cloud is built on Debian Linux. Anything you want to `apt-get install` must go in your `packages.txt` file. To browse available packages that can be installed, see the Debian 11 ("bullseye") [package list](https://packages.debian.org/bullseye/).
104110

105111
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>.
106112

content/deploy/community-cloud/status-and-limitations.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ You can deploy multiple apps from your repository, and your entrypoint file(s) m
2626
- Community Cloud only recognizes one `.streamlit/configuration.toml` file at the root (of each branch) of your repository.
2727
- You must declare image, video, and audio file paths for Streamlit commands relative to the root of your repository. For example, `st.image`, `st.logo`, and the `page_icon` parameter in `st.set_page_config` expect file locations relative to your working directory (i.e. where you execute `streamlit run`).
2828

29+
## Linux environments
30+
31+
Community Cloud is built on Debian Linux.
32+
33+
- Community Cloud uses Debian 11 ("bullseye"). To browse available packages that can be installed, see the [package list](https://packages.debian.org/bullseye/).
34+
- All file paths must use forward-slash path separators.
35+
2936
## Python environments
3037

3138
- You cannot mix and match Python package managers for a single app. Community Cloud configures your app's Python environment based on the first environment configuration file it finds. For more information, see [Other Python package managers](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#other-python-package-managers).
@@ -62,7 +69,7 @@ If you need to whitelist IP addresses for a connection, Community Cloud is curre
6269

6370
</Warning>
6471

65-
<div style={{ display: "flex", flexWrap: "wrap", flexDirection: "row", alignItems: "start" }}>
72+
<Flex wrap >
6673
<div style={{ width: "150px" }}>35.230.127.150</div>
6774
<div style={{ width: "150px" }}>35.203.151.101</div>
6875
<div style={{ width: "150px" }}>34.19.100.134</div>
@@ -81,11 +88,10 @@ If you need to whitelist IP addresses for a connection, Community Cloud is curre
8188
<div style={{ width: "150px" }}>35.227.190.87</div>
8289
<div style={{ width: "150px" }}>35.199.156.97</div>
8390
<div style={{ width: "150px" }}>34.82.135.155</div>
84-
</div>
91+
</Flex>
8592

8693
## Other limitations
8794

8895
- When you print something to the Cloud logs, you may need to do a `sys.stdout.flush()` before it shows up.
8996
- Community Cloud hosts all apps in the United States. This is currently not configurable.
90-
- Community Cloud is built on Debian Linux. All file paths must use forward-slash path separators.
9197
- Community Cloud rate limits app updates from GitHub to no more than five per minute.

content/deploy/concepts/dependencies.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ If you are using Streamlit Community Cloud, you'll have the latest version of St
2222

2323
### `pip` and `requirements.txt`
2424

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.
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`, `random`, or `distutils` in your `requirements.txt` file. These are a part of Python and aren't installed separately.
26+
27+
<Tip>
28+
29+
Since dependencies may rely on a specific version of Python, always be aware of the Python version used in your development environment, and select the same version for your deployment environment.
30+
31+
</Tip>
2632

2733
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.
2834

content/deploy/snowflake/_index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Host your apps alongside your data in a single, global platform. Snowflake provi
1818
<Tile
1919
icon="code"
2020
title="Examples"
21-
text="Explore a plethora of example apps in Snowflake Labs' snowflake-demo-streamlit repository."
21+
text="Explore a wide variety of example apps in Snowflake Labs' snowflake-demo-streamlit repository."
2222
link="https://github.com/Snowflake-Labs/snowflake-demo-streamlit"
2323
background="lightBlue-70"
2424
/>
@@ -31,27 +31,27 @@ Host your apps alongside your data in a single, global platform. Snowflake provi
3131
/>
3232
</TileContainer>
3333

34-
There are three ways to host Streamlit apps in Snowflake.
34+
There are three ways to host Streamlit apps in Snowflake:
3535

3636
<InlineCalloutContainer>
3737
<InlineCallout
3838
color="lightBlue-70"
3939
icon="bolt"
4040
bold="Streamlit in Snowflake."
4141
href="https://docs.snowflake.com/developer-guide/streamlit/about-streamlit"
42-
>Run your Streamlit app as a native object in Snowflake. Enjoy an in-browser editor and minimal work to configure your environment. Share your app with other users in your Snowflake account through role-based access control. This is a great way to deploy apps internally for your business. Check out Snowflake docs!</InlineCallout>
42+
>Run your Streamlit app as a native object in Snowflake. Enjoy an in-browser editor and minimal work to configure your environment. Share your app with other users in your Snowflake account through role-based access control (RBAC). This is a great way to deploy apps internally for your business. Check out Snowflake docs!</InlineCallout>
4343
<InlineCallout
4444
color="lightBlue-70"
4545
icon="ac_unit"
4646
bold="Snowflake Native Apps."
4747
href="https://docs.snowflake.com/en/developer-guide/native-apps/adding-streamlit"
48-
>Package your app with data and share it with other Snowflake accounts. This is a great way to share apps and their underlying data with other organizations who use Snowflake so they can run it in their own account. Check out Snowflake docs!</InlineCallout>
48+
>Package your app with data and share it with other Snowflake accounts. This is a great way to share apps and their underlying data with other organizations who use Snowflake. Check out Snowflake docs!</InlineCallout>
4949
<InlineCallout
5050
color="lightBlue-70"
5151
icon="web_asset"
5252
bold="Snowpark Container Services."
5353
href="https://docs.snowflake.com/en/developer-guide/snowpark-container-services/overview"
54-
>Deploy your app in a container that's optimized to run in Snowflake. This is the most flexible option where you can use any library. Share your app publicly or privately. Check out Snowflake docs!</InlineCallout>
54+
>Deploy your app in a container that's optimized to run in Snowflake. This is the most flexible option, where you can use any library and assign a public URL to your app. Manage your allowed viewers through your Snowflake account. Check out Snowflake docs!</InlineCallout>
5555
</InlineCalloutContainer>
5656

5757
<Note>

content/deploy/tutorials/kubernetes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Docker builds images by reading the instructions from a `Dockerfile`. A `Docke
8888
Here's an example `Dockerfile` that you can add to the root of your directory.
8989

9090
```docker
91-
FROM python:3.8-slim
91+
FROM python:3.9-slim
9292
9393
RUN groupadd --gid 1000 appuser \
9494
&& useradd --uid 1000 --gid 1000 -ms /bin/bash appuser

content/develop/api-reference/configuration/config-toml.md

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To define your configuration globally, you must first locate your global `.strea
2121

2222
```toml
2323
[client]
24-
showErrorDetails = false
24+
showErrorDetails = "none"
2525

2626
[theme]
2727
primaryColor = "#F63366"
@@ -69,7 +69,7 @@ level = "info"
6969
# Python's documentation for available attributes:
7070
# https://docs.python.org/3/library/logging.html#formatter-objects
7171
# Default: "%(asctime)s %(message)s"
72-
messageFormat = "%(asctime)s %(levelname) -7s %(name)s: %(message)s"
72+
messageFormat = "%(asctime)s %(message)s"
7373
```
7474

7575
#### Client
@@ -78,26 +78,39 @@ messageFormat = "%(asctime)s %(levelname) -7s %(name)s: %(message)s"
7878
[client]
7979

8080
# Controls whether uncaught app exceptions and deprecation warnings
81-
# are displayed in the browser. By default, this is set to True and
82-
# Streamlit displays app exceptions and associated tracebacks, and
83-
# deprecation warnings, in the browser.
84-
# If set to False, deprecation warnings and full exception messages
85-
# will print to the console only. Exceptions will still display in the
86-
# browser with a generic error message. For now, the exception type and
87-
# traceback show in the browser also, but they will be removed in the
88-
# future.
89-
# Default: true
90-
showErrorDetails = true
81+
# are displayed in the browser. This can be one of the following:
82+
# - "full" : In the browser, Streamlit displays app deprecation
83+
# warnings and exceptions, including exception types,
84+
# exception messages, and associated tracebacks.
85+
# - "stacktrace" : In the browser, Streamlit displays exceptions,
86+
# including exception types, generic exception messages,
87+
# and associated tracebacks. Deprecation warnings and
88+
# full exception messages will only print to the
89+
# console.
90+
# - "type" : In the browser, Streamlit displays exception types and
91+
# generic exception messages. Deprecation warnings, full
92+
# exception messages, and associated tracebacks only
93+
# print to the console.
94+
# - "none" : In the browser, Streamlit displays generic exception
95+
# messages. Deprecation warnings, full exception
96+
# messages, associated tracebacks, and exception types
97+
# will only print to the console.
98+
# - True : This is deprecated. Streamlit displays "full"
99+
# error details.
100+
# - False : This is deprecated. Streamlit displays "stacktrace"
101+
# error details.
102+
# Default: "full"
103+
showErrorDetails = "full"
91104

92105
# Change the visibility of items in the toolbar, options menu,
93106
# and settings dialog (top right of the app).
94107
# Allowed values:
95-
# * "auto" : Show the developer options if the app is accessed through
108+
# - "auto" : Show the developer options if the app is accessed through
96109
# localhost or through Streamlit Community Cloud as a developer.
97110
# Hide them otherwise.
98-
# * "developer" : Show the developer options.
99-
# * "viewer" : Hide the developer options.
100-
# * "minimal" : Show only options set externally (e.g. through
111+
# - "developer" : Show the developer options.
112+
# - "viewer" : Hide the developer options.
113+
# - "minimal" : Show only options set externally (e.g. through
101114
# Streamlit Community Cloud) or through st.set_page_config.
102115
# If there are no options left, hide the menu.
103116
# Default: "auto"
@@ -140,9 +153,9 @@ enforceSerializableSessionState = false
140153
# during a script re-run. For more information, check out the docs:
141154
# https://docs.streamlit.io/develop/concepts/design/custom-classes#enums
142155
# Allowed values:
143-
# * "off" : Disables Enum coercion.
144-
# * "nameOnly" : Enum classes can be coerced if their member names match.
145-
# * "nameAndValue" : Enum classes can be coerced if their member names AND
156+
# - "off" : Disables Enum coercion.
157+
# - "nameOnly" : Enum classes can be coerced if their member names match.
158+
# - "nameAndValue" : Enum classes can be coerced if their member names AND
146159
# member values match.
147160
# Default: "nameOnly"
148161
enumCoercion = "nameOnly"
@@ -162,11 +175,11 @@ folderWatchBlacklist = []
162175
# Change the type of file watcher used by Streamlit, or turn it off
163176
# completely.
164177
# Allowed values:
165-
# * "auto" : Streamlit will attempt to use the watchdog module, and
178+
# - "auto" : Streamlit will attempt to use the watchdog module, and
166179
# falls back to polling if watchdog is not available.
167-
# * "watchdog" : Force Streamlit to use the watchdog module.
168-
# * "poll" : Force Streamlit to always use polling.
169-
# * "none" : Streamlit will not watch files.
180+
# - "watchdog" : Force Streamlit to use the watchdog module.
181+
# - "poll" : Force Streamlit to always use polling.
182+
# - "none" : Streamlit will not watch files.
170183
# Default: "auto"
171184
fileWatcherType = "auto"
172185

@@ -201,19 +214,17 @@ port = 8501
201214
# Default: ""
202215
baseUrlPath = ""
203216

204-
# Enables support for Cross-Origin Resource Sharing (CORS) protection, for
205-
# added security.
206-
# Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is
207-
# on and `server.enableCORS` is off at the same time, we will prioritize
208-
# `server.enableXsrfProtection`.
217+
# Enables support for Cross-Origin Resource Sharing (CORS) protection,
218+
# for added security.
219+
# If XSRF protection is enabled and CORS protection is disabled at the
220+
# same time, Streamlit will enable them both instead.
209221
# Default: true
210222
enableCORS = true
211223

212224
# Enables support for Cross-Site Request Forgery (XSRF) protection, for
213225
# added security.
214-
# Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is
215-
# on and `server.enableCORS` is off at the same time, we will prioritize
216-
# `server.enableXsrfProtection`.
226+
# If XSRF protection is enabled and CORS protection is disabled at the
227+
# same time, Streamlit will enable them both instead.
217228
# Default: true
218229
enableXsrfProtection = true
219230

content/develop/concepts/app-design/button-behavior-and-examples.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,8 @@ if 'processed' not in st.session_state:
365365
if st.button('Process'):
366366
result = expensive_process(option, add)
367367
st.session_state.processed[option] = result
368-
369-
if option in st.session_state.processed:
370368
st.write(f'Option {option} processed with add {add}')
371-
st.write(st.session_state.processed[option][0])
369+
result[0]
372370
```
373371

374372
Astute observers may think, "This feels a little like caching." We are only saving results relative to one parameter, but the pattern could easily be expanded to save results relative to both parameters. In that sense, yes, it has some similarities to caching, but also some important differences. When you save results in `st.session_state`, the results are only available to the current user in their current session. If you use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) instead, the results are available to all users across all sessions. Furthermore, if you want to update a saved result, you have to clear all saved results for that function to do so.

0 commit comments

Comments
 (0)