Skip to content

Commit

Permalink
Miscellaneous small fixes and clarifications (#1083)
Browse files Browse the repository at this point in the history
* Update default light theme colors

* Correct widget-key creation algorithm

* Broken link to deploy tutorials

* Caching data vs resource

* Explicitly state command line and env variable config

* Add Page not found error to page text

* Note configuration limitations for community cloud

* Add tip about Snowflake account identifier

* Update release notes URL

* Include "Page not found" text for search

* Delete old image

* Add updated image

---------

Co-authored-by: Johannes Rieke <[email protected]>
  • Loading branch information
sfc-gh-dmatthews and jrieke authored Jun 24, 2024
1 parent fdf4252 commit dff6f40
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 13 deletions.
2 changes: 1 addition & 1 deletion content/deploy/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Get all the information you need to deploy your app and share it with your users
color="lightBlue-70"
icon="bolt"
bold="Other platforms."
href="/develop/quick-reference"
href="/deploy/tutorials"
>Learn how to deploy your app on a variety of platforms with our convenient collection of tutorials.</InlineCallout>
</InlineCalloutContainer>
19 changes: 19 additions & 0 deletions content/deploy/community-cloud/status-and-limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ You can deploy multiple apps from your repository, and your entrypoint file(s) m
- If you pin `streamlit< 1.20.0`, you must also pin `altair<5`. Earlier versions of Streamlit did not correctly restrict Altair's version. A workaround script running on Community Cloud will forcibly install `altair<5` if a newer version is detected. This could unintentionally upgrade Altair's dependencies in violation of your environment configuration. Newer versions of Streamlit support Altair version 5.
- Community Cloud only supports released versions of Python that are still receiving security updates. You may not use end-of-life, prerelease, or feature versions of Python. For more information, see [Status of Python versions](https://devguide.python.org/versions/).

## Configuration

The following configuration options are set within Community Cloud and will override any contrary setting in your `config.toml` file:

```toml
[client]
showErrorDetails = false

[runner]
fastReruns = true

[server]
runOnSave = true
enableXsrfProtection = true

[browser]
gatherUsageStats = true
```

## Other limitations

- When you print something to the Cloud logs, you may need to do a `sys.stdout.flush()` before it shows up.
Expand Down
6 changes: 3 additions & 3 deletions content/develop/concepts/architecture/caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Streamlit runs your script from top to bottom at every user interaction or code
1. Long-running functions run again and again, which slows down your app.
2. Objects get recreated again and again, which makes it hard to persist them across reruns or sessions.

But don't worry! Streamlit lets you tackle both issues with its built-in caching mechanism. Caching stores the results of slow function calls, so they only need to run once. This makes your app much faster and helps with persisting objects across reruns.
But don't worry! Streamlit lets you tackle both issues with its built-in caching mechanism. Caching stores the results of slow function calls, so they only need to run once. This makes your app much faster and helps with persisting objects across reruns. Cached values are available to all users of your app. If you need to save results that should only be accessible within a session, use [Session State](/develop/concepts/architecture/session-stat) instead.

<Collapse title="Table of contents" expanded={true}>

Expand Down Expand Up @@ -55,7 +55,7 @@ As mentioned, there are two caching decorators:

### st.cache_data

`st.cache_data` is your go-to command for all functions that return data – whether DataFrames, NumPy arrays, str, int, float, or other serializable types. It's the right command for almost all use cases!
`st.cache_data` is your go-to command for all functions that return data – whether DataFrames, NumPy arrays, str, int, float, or other serializable types. It's the right command for almost all use cases! Within each user session, an `@st.cache_data`-decorated function returns a _copy_ of the cached return value (if the value is already cached).

#### Usage

Expand Down Expand Up @@ -177,7 +177,7 @@ def run_model(inputs):

### st.cache_resource

`st.cache_resource` is the right command to cache “resources" that should be available globally across all users, sessions, and reruns. It has more limited use cases than `st.cache_data`, especially for caching database connections and ML models.
`st.cache_resource` is the right command to cache “resources" that should be available globally across all users, sessions, and reruns. It has more limited use cases than `st.cache_data`, especially for caching database connections and ML models. Within each user session, an `@st.cache_resource`-decorated function returns the cached instance of the return value (if the value is already cached). Therefore, objects cached by `st.cache_resource` act like singletons and can mutate.

#### Usage

Expand Down
6 changes: 3 additions & 3 deletions content/develop/concepts/architecture/widget-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ As mentioned earlier, Streamlit determines a widget's ID based on parameters suc

If your script rerun calls a widget function with changed parameters or calls a widget function that wasn't used on the last script run:

1. Streamlit will build the frontend and backend parts of the widget.
1. Streamlit will build the frontend and backend parts of the widget, using its default value.
2. If the widget has been assigned a key, Streamlit will check if that key already exists in Session State.
a. If it exists and is not currently associated with another widget, Streamlit will attach to that key and take on its value for the widget.
a. If it exists and is not currently associated with another widget, Streamlit will assign that key's value to the widget.
b. Otherwise, it will assign the default value to the key in `st.session_state` (creating a new key-value pair or overwriting an existing one).
3. If there are args or kwargs for a callback function, they are computed and saved at this point in time.
4. The default value is then returned by the function.
4. The widget value is then returned by the function.

Step 2 can be tricky. If you have a widget:

Expand Down
18 changes: 18 additions & 0 deletions content/develop/concepts/configuration/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ If you change theme settings in `.streamlit/config.toml` _while_ the app is runn
streamlit run your_script.py --server.port 80
```

## Available options

All available configuration options are documented in [`config.toml`](/develop/api-reference/configuration/config.toml). These options may be declared in a TOML file, as environment variables, or as command line options.

When using environment variables to override `config.toml`, convert the variable (including its section header) to upper snake case and add a `STREAMLIT_` prefix. For example, `STREAMLIT_CLIENT_SHOW_ERROR_DETAILS` is equivalent to the following in TOML:

```toml
[client]
showErrorDetails = true
```

When using command line options to override `config.toml` and environment variables, use the same case as you would in the TOML file and include the section header as a period-separated prefix. For example, the command line option `--server.enableStaticServing true` is equivalent to the following:

```toml
[server]
enableStaticServing = true
```

## Telemetry

As mentioned during the installation process, Streamlit collects usage statistics. You can find out
Expand Down
4 changes: 2 additions & 2 deletions content/develop/concepts/configuration/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ in the `[theme]` section of a `.streamlit/config.toml` file.

```toml
[theme]
primaryColor="#F63366"
primaryColor="#FF4B4B"
backgroundColor="#FFFFFF"
secondaryBackgroundColor="#F0F2F6"
textColor="#262730"
textColor="#31333F"
font="sans serif"
```

Expand Down
2 changes: 1 addition & 1 deletion content/develop/concepts/multipage-apps/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Users can also navigate between pages using URLs as noted above. When multiple f
Navigating between pages by URL creates a new browser session. In particular, clicking markdown links to other pages resets ``st.session_state``. In order to retain values in ``st.session_state``, handle page switching through Streamlit navigation commands and widgets, like ``st.navigation``, ``st.switch_page``, ``st.page_link``, and the built-in navigation menu.
</Important>

If a user tries to access a URL for a page that does not exist, they will see a modal like the one below, saying the user has requested a page that was not found.
If a user tries to access a URL for a page that does not exist, they will see a modal like the one below, saying "Page not found."

<div style={{ maxWidth: '75%', margin: 'auto' }}>
<Image alt="Page not found" src="/images/mpa-page-not-found.png" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Release notes
slug: /develop/quick-reference/changelog
slug: /develop/quick-reference/release-notes
description: A changelog of highlights and fixes for each version of Streamlit.
keywords: changelog, release notes, version history
---
Expand Down
6 changes: 6 additions & 0 deletions content/develop/tutorials/databases/snowflake.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ schema = "xxx"
client_session_keep_alive = true
```

<Tip>

Make sure your account name is in the format `<my_organization>-<my_account>`. This is the general-purpose identifier format and not the `.`-separated format used for SQL commands.

</Tip>

If you created the database from the previous step, the names of your database and schema are `PETS` and `PUBLIC`, respectively. Streamlit will also use **Snowflake config and credentials** from a [SnowSQL config file](https://docs.snowflake.com/en/user-guide/snowsql-config#snowsql-config-file) if available.

<Important>
Expand Down
2 changes: 1 addition & 1 deletion content/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ site_menu:
- category: Develop / Quick reference / Cheat sheet
url: /develop/quick-reference/cheat-sheet
- category: Develop / Quick reference / Release notes
url: /develop/quick-reference/changelog
url: /develop/quick-reference/release-notes
- category: Develop / Quick reference / Release notes (historical)
url: /develop/quick-reference/older-versions
visible: false
Expand Down
3 changes: 2 additions & 1 deletion public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,9 @@
/develop/concepts/architecture/st.cache /develop/concepts/architecture/caching
/develop/concepts/architecture/experimental-cache-primitives /develop/concepts/architecture/caching
/develop/api-reference/caching-and-state/st.cache /develop/api-reference/caching-and-state/st.cache_data
/develop/quick-reference/changelog /develop/quick-reference/release-notes

# Deep links included in streamlit/streamlit source code
/st.connections.snowflakeconnection-configuration /develop/api-reference/connections/st.connections.snowflakeconnection#configuration
/st.page.automatic-page-labels /develop/concepts/multipage-apps/overview#how-streamlit-converts-filenames-into-labels-and-titles
/st.page.automatic-page-urls /develop/concepts/multipage-apps/overview#how-streamlit-converts-filenames-into-url-pathnames
/st.page.automatic-page-urls /develop/concepts/multipage-apps/overview#how-streamlit-converts-filenames-into-url-pathnames
Binary file modified public/images/theme_config_options/primaryColor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dff6f40

Please sign in to comment.