Skip to content

Commit

Permalink
Release 1.34.0 (#1050)
Browse files Browse the repository at this point in the history
* Add st.dialog

* Update generate.py

* Add CachedFunc.clear

* Add query_params.from_dict

* Update streamlit.json

* Release notes

* What's new

* Update api-cheat-sheet.md

* Update dialog app URL

* Update embedded apps to 1.34.0

* Update markdown example

* Add background color feature demo to release notes

* Add tip about stream object compatibility in st.write_stream
  • Loading branch information
sfc-gh-dmatthews authored May 2, 2024
1 parent 8df1cbc commit 1d07661
Show file tree
Hide file tree
Showing 28 changed files with 9,504 additions and 58 deletions.
32 changes: 32 additions & 0 deletions content/develop/api-reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,22 @@ c.write("This will show first")
c.write("This will show second")
```

</RefCard>
<RefCard href="/develop/api-reference/execution-flow/st.dialog">

<Image pure alt="screenshot" src="/images/api/dialog.jpg" />

<h4>Modal dialogs</h4>

Insert a modal dialog that can rerun independently from the rest of the script.

```python
@st.experimental_dialog()
def email_form():
name = st.text_input("Name")
email = st.text_input("Email")
```

</RefCard>
<RefCard href="/develop/api-reference/layout/st.empty">

Expand Down Expand Up @@ -1850,6 +1866,22 @@ st.page_link("pages/profile.py", label="My profile")
<br />

<TileContainer>
<RefCard href="/develop/api-reference/execution-flow/st.dialog" size="full">

<Image pure alt="screenshot" src="/images/api/dialog.jpg" />

<h4>Modal dialogs</h4>

Insert a modal dialog that can rerun independently from the rest of the script.

```python
@st.experimental_dialog()
def email_form():
name = st.text_input("Name")
email = st.text_input("Email")
```

</RefCard>
<RefCard href="/develop/api-reference/execution-flow/st.form" size="half">

<h4>Forms</h4>
Expand Down
2 changes: 2 additions & 0 deletions content/develop/api-reference/caching-and-state/cache-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ if st.button("Clear All"):
st.cache_data.clear()
```

<Autofunction function="CachedFunc.clear" />

## Using Streamlit commands in cached functions

### Static elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ if st.button("Clear All"):
st.cache_resource.clear()
```

<Autofunction function="CachedFunc.clear" />

## Using Streamlit commands in cached functions

### Static elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if st.query_params["first_key"] == "1":
if st.query_params.second_key == "two":
do_something_else()

# And you can change a param by just writing to it
# And you can change a param by just writing to it
st.query_params.first_key = 2 # This gets converted to str automatically
```

Expand All @@ -49,8 +49,10 @@ When a key is repeated in your app's URL (`?a=1&a=2&a=3`), dict-like methods wil

`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.

<Autofunction function="streamlit.query_params.get_all" />

<Autofunction function="streamlit.query_params.clear" />

<Autofunction function="streamlit.query_params.from_dict" />

<Autofunction function="streamlit.query_params.get_all" />

<Autofunction function="streamlit.query_params.to_dict" />
17 changes: 17 additions & 0 deletions content/develop/api-reference/control-flow/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ By default, Streamlit apps execute the script entirely, but we allow some functi

<TileContainer>

<RefCard href="/develop/api-reference/execution-flow/st.dialog" size="full">

<Image pure alt="screenshot" src="/images/api/dialog.jpg" />

<h4>Modal dialogs</h4>

Insert a modal dialog that can rerun independently from the rest of the script.

```python
@st.experimental_dialog()
def email_form():
name = st.text_input("Name")
email = st.text_input("Email")
```

</RefCard>

<RefCard href="/develop/api-reference/execution-flow/st.fragment">

<h4>Partial reruns</h4>
Expand Down
7 changes: 7 additions & 0 deletions content/develop/api-reference/control-flow/dialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: st.experimental_dialog
slug: /develop/api-reference/execution-flow/st.dialog
description: st.experimental_dialog opens a multi-element modal overlay
---

<Autofunction function="streamlit.experimental_dialog" />
16 changes: 16 additions & 0 deletions content/develop/api-reference/layout/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ c.write("This will show first")
c.write("This will show second")
```

</RefCard>
<RefCard href="/develop/api-reference/execution-flow/st.dialog">

<Image pure alt="screenshot" src="/images/api/dialog.jpg" />

<h4>Modal dialogs</h4>

Insert a modal dialog that can rerun independently from the rest of the script.

```python
@st.experimental_dialog()
def email_form():
name = st.text_input("Name")
email = st.text_input("Email")
```

</RefCard>
<RefCard href="/develop/api-reference/layout/st.empty">

Expand Down
6 changes: 6 additions & 0 deletions content/develop/api-reference/write-magic/write_stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ description: st.write_stream writes arguments to the app using a typewriter effe
---

<Autofunction function="streamlit.write_stream" />

<Tip>

If your stream object is not compatible with `st.write_stream`, define a wrapper around your stream object to create a compatible generator function. For example, Streamlit version 1.32.0 added support for stream objects with empty chunks. If you use `openai.AzureOpenAI` with Streamlit version 1.31.0, you'd need to define a wrapper to manually handle empty chunks to use `st.write_stream`.

</Tip>
14 changes: 13 additions & 1 deletion content/develop/quick-references/api-cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ slug: /develop/quick-reference/cheat-sheet

# Streamlit API cheat sheet

This is a summary of the docs, as of [Streamlit v1.33.0](https://pypi.org/project/streamlit/1.33.0/).
This is a summary of the docs, as of [Streamlit v1.34.0](https://pypi.org/project/streamlit/1.34.0/).

<Masonry>

Expand Down Expand Up @@ -231,6 +231,13 @@ st.switch_page("pages/my_page.py")
>>> password = st.text_input("Password")
>>> st.form_submit_button("Login")

# Define a dialog function
>>> @st.experimental_dialog
>>> def modal_dialog():
>>> st.write("Hello")
>>>
>>> modal_dialog()

# Define a fragment
>>> @st.experimental_fragment
>>> def fragment_function():
Expand Down Expand Up @@ -355,6 +362,7 @@ st.get_option(key)
st.set_option(key, value)
st.set_page_config(layout="wide")
st.query_params[key]
st.query_params.from_dict(params_dict)
st.query_params.get_all(key)
st.query_params.clear()
st.html("<p>Hi!</p>")
Expand Down Expand Up @@ -399,6 +407,8 @@ conn = st.connection("snowflake")
>>> d2 = foo(ref1)
# Different arg, so function foo executes
>>> d3 = foo(ref2)
# Clear the cached value for foo(ref1)
>>> foo.clear(ref1)
# Clear all cached entries for this function
>>> foo.clear()
# Clear values from *all* in-memory or on-disk cached functions
Expand All @@ -420,6 +430,8 @@ conn = st.connection("snowflake")
>>> s2 = foo(ref1)
# Different arg, so function foo executes
>>> s3 = foo(ref2)
# Clear the cached value for foo(ref1)
>>> foo.clear(ref1)
# Clear all cached entries for this function
>>> foo.clear()
# Clear all global resources from cache
Expand Down
46 changes: 44 additions & 2 deletions content/develop/quick-references/changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
title: Changelog
title: Release notes
slug: /develop/quick-reference/changelog
description: Changelog, release notes, version history
---

# Changelog
# Release notes

This page lists highlights, bug fixes, and known issues for official Streamlit releases. If you're looking for information about nightly releases, beta features, or experimental features, see [Try pre-release features](/develop/quick-reference/prerelease).

Expand All @@ -17,6 +18,47 @@ pip install --upgrade streamlit

</Tip>

## **Version 1.34.0**

_Release date: May 2, 2024_

**Highlights**

- 🍿 Introducing `st.experimental_dialog`! Create a modal overlay that can also rerun independently from the rest of your app. Check out the [docs](/develop/api-reference/execution-flow/st.dialog) to learn how.

**Notable Changes**

- 🔣 `st.toast`, `st.chat_message`, `st.set_page_config`, `st.info`, `st.success`, `st.error`, and `st.warning` can use Google Material Symbols for their icons.
- 🌈 [Markdown](/develop/api-reference/text/st.markdown) supports background colors for text. Check out the [feature demo app](https://background-colors.streamlit.app/).
- 🎥 [`st.audio`](/develop/api-reference/media/st.audio) and [`st.video`](/develop/api-reference/media/st.video) can now be set to autoplay. `st.video` can be muted.
- 🗃️ You can [clear specific cached values](/develop/api-reference/caching-and-state/st.cache_data#cachedfuncclear) for a cached function. Thanks, [OscarSaharoy](https://github.com/OscarSaharoy)!
- ❓ You can now set all query parameters with a single call to [`st.query_params.from_dict`](/develop/api-reference/caching-and-state/st.query_params#stquery_paramsfrom_dict). Thanks, [Asaurus1](https://github.com/Asaurus1)!

**Other Changes**

- 🔲 Streamlit supports Modin and Snowpark pandas DataFrames and Series ([#8506](https://github.com/streamlit/streamlit/pull/8506)).
- ⏱️ Improved support for `period` data types in `st.dataframe` and `st.data_editor` ([#7987](https://github.com/streamlit/streamlit/pull/7987)).
- 🗺️ Streamlit supports using `pydeck-carto` with `st.pydeck_chart` ([#8422](https://github.com/streamlit/streamlit/pull/8422)).
- ❄️ Additional `snowflake` requirements were updated to allow Python versions 3.8 to 3.11 ([#8538](https://github.com/streamlit/streamlit/pull/8538)).
- 🍞 `st.toast` received visual improvements and now appears in the top right ([#8433](https://github.com/streamlit/streamlit/pull/8433)).
- 🦋 Visual tweaks for dialogs and modals.
- 🦀 Bug fix: `st.write_stream` returns an empty string when passed a generator with no yield ([#8560](https://github.com/streamlit/streamlit/pull/8560)).
- 🦎 Bug fix: Widgets that support `None` values can be correctly set to `None` through Session State ([#8529](https://github.com/streamlit/streamlit/pull/8529), [#7649](https://github.com/streamlit/streamlit/issues/7649)).
- 🐌 Bug fix: If the initial value for `st.date_input` is not set and today’s date falls outside the declared minimum or maximum, then the minimum or maximum will be used instead, whichever is closer ([#8519](https://github.com/streamlit/streamlit/pull/8519), [#6167](https://github.com/streamlit/streamlit/issues/6167)).
- 🕸️ Bug fix: Altair’s `resolve_scale` method is handled correctly ([#8497](https://github.com/streamlit/streamlit/pull/8497), [#1667](https://github.com/streamlit/streamlit/issues/1667)).
- 🦗 Bug fix: `st.multiselects` correctly handles sets when passed to `options` or `default` ([#8471](https://github.com/streamlit/streamlit/pull/8471), [#8466](https://github.com/streamlit/streamlit/issues/8466)).
- 🦂 Bug fix: `st.status` does not show the expander toggle when empty ([#8369](https://github.com/streamlit/streamlit/pull/8369)).
- 🦟 Bug fix: The width of `vconcat` charts in Vega and Altair is set correctly ([#8498](https://github.com/streamlit/streamlit/pull/8498), [#2751](https://github.com/streamlit/streamlit/issues/2751)).
- 🦠 Bug fix: Apps print beautifully and no longer show excessive whitespace ([#8502](https://github.com/streamlit/streamlit/pull/8502), [#7815](https://github.com/streamlit/streamlit/issues/7815)).
- 🪰 Bug fix: Invalid escape sequences were removed to avoid warnings from `pytest` ([#8510](https://github.com/streamlit/streamlit/pull/8510), [#8501](https://github.com/streamlit/streamlit/issues/8501)).
- 🪳 Bug fix: `st.file_uploader` callback is correctly executed once per file selection after the first selection ([#8493](https://github.com/streamlit/streamlit/pull/8493), [#4877](https://github.com/streamlit/streamlit/issues/4877)).
- 🕷️ Bug fix: Streamlit is compatible down to `pillow` version 7.1.0 instead of 9.1.0 ([#8492](https://github.com/streamlit/streamlit/pull/8492), [#8486](https://github.com/streamlit/streamlit/issues/8486)).
- 🐞 Bug fix: Widget values are correctly dropped when a script run is interrupted by switching pages ([#8425](https://github.com/streamlit/streamlit/pull/8425), [#7338](https://github.com/streamlit/streamlit/issues/7338)).
- 🐝 Bug fix: Apps in dark mode will return to dark mode after printing ([#8469](https://github.com/streamlit/streamlit/pull/8469), [#7879](https://github.com/streamlit/streamlit/issues/7879)).
- 🐜 Bug fix: Component ready state is dynamic to avoid race conditions that caused blank apps in Safari ([#8434](https://github.com/streamlit/streamlit/pull/8434), [#8362](https://github.com/streamlit/streamlit/issues/8362)).
- 🪲 Bug fix: `st.slider` yields a Python error when `min_value` is less than or equal to `max_value` ([#8413](https://github.com/streamlit/streamlit/pull/8413), [#8342](https://github.com/streamlit/streamlit/issues/8342)).
- 🐛 Bug fix: Time is offset correctly for Vega and Altair ([#8278](https://github.com/streamlit/streamlit/pull/8278), [#4342](https://github.com/streamlit/streamlit/issues/4342)).

## **Version 1.33.0**

_Release date: April 4, 2024_
Expand Down
8 changes: 7 additions & 1 deletion content/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ site_menu:
- category: Develop / API reference / Layouts and containers / st.container
url: /develop/api-reference/layout/st.container
isVersioned: true
- category: Develop / API reference / Layouts and containers / st.dialog
url: https://docs.streamlit.io/develop/api-reference/execution-flow/st.dialog
isVersioned: true
- category: Develop / API reference / Layouts and containers / st.empty
url: /develop/api-reference/layout/st.empty
isVersioned: true
Expand Down Expand Up @@ -454,6 +457,9 @@ site_menu:
isVersioned: true
- category: Develop / API reference / Execution flow
url: /develop/api-reference/execution-flow
- category: Develop / API reference / Execution flow / st.dialog
url: /develop/api-reference/execution-flow/st.dialog
isVersioned: true
- category: Develop / API reference / Execution flow / st.form
url: /develop/api-reference/execution-flow/st.form
isVersioned: true
Expand Down Expand Up @@ -650,7 +656,7 @@ site_menu:
url: /develop/quick-reference
- category: Develop / Quick reference / Cheat sheet
url: /develop/quick-reference/cheat-sheet
- category: Develop / Quick reference / Changelog
- category: Develop / Quick reference / Release notes
url: /develop/quick-reference/changelog
- category: Develop / Quick reference / Pre-release features
url: /develop/quick-reference/prerelease
Expand Down
71 changes: 33 additions & 38 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,74 +192,69 @@ export default function Home({ window, menu }) {
<TileContainer>
<RefCard
size="third"
href="/develop/concepts/architecture/fragments"
href="/develop/api-reference/execution-flow/st.dialog"
>
<i className="material-icons-sharp">repartition</i>
<h4>Introducing fragments!</h4>
<i className="material-icons-sharp">crop_7_5</i>
<h4>Modal dialogs</h4>
<p>
Use the <code>st.experimental_fragment</code> decorator to
turn functions into fragments that can rerun independently
from the rest of your app.
Introducing <code>st.experimental_dialog</code> to create
modal dialogs that can rerun independently from the rest of
your app.
</p>
</RefCard>
<RefCard
size="third"
href="/develop/api-reference/utilities/st.html"
href="https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined"
>
<i className="material-icons-sharp">html</i>
<h4>
Introducing <code>st.html</code>!
</h4>
<p>Render custom HTML in your app without an iframe.</p>
<i className="material-icons-sharp">info</i>
<h4>Google Material Symbols</h4>
<p>
<code>st.toast</code>, <code>st.chat_message</code>, and alert
messages now support Material Symbols for their icons.
</p>
</RefCard>
<RefCard
size="third"
href="/develop/api-reference/media/st.audio"
href="/develop/api-reference/text/st.markdown"
>
<i className="material-icons-sharp">videocam</i>
<h4>Set looping and end times for media elements</h4>
<i className="material-icons-sharp">highlight</i>
<h4>Markdown support for text highlighting</h4>
<p>
You can enable looping for <code>st.audio</code> and
<code>st.video</code>. You can also set a start and end time.
You can set the background color for you text in markdown.
</p>
</RefCard>
<RefCard
size="third"
href="/develop/api-reference/app-testing/st.testing.v1.apptest#apptestswitch_page"
href="/develop/api-reference/media/st.video"
>
<i className="material-icons-sharp">science</i>
<h4>
Switch pages within <code>st.AppTest</code>
</h4>
<i className="material-icons-sharp">videocam</i>
<h4>Media autoplay</h4>
<p>
Switch pages in your tests using{" "}
<code>AppTest.switch_page()</code>.
You can enable autoplay for <code>st.audio</code> and
<code>st.video</code>. You can also mute videos.
</p>
</RefCard>
<RefCard
size="third"
href="/develop/api-reference/data/st.column_config/st.column_config.linechartcolumn"
href="/develop/api-reference/caching-and-state/st.cache_data#cachedfuncclear"
>
<i className="material-icons-sharp">show_chart</i>
<h4>
<code>LineChartColumn</code>'s new look
</h4>
<i className="material-icons-sharp">cached</i>
<h4>Clear specific cached values</h4>
<p>
<code>LineChartColumn</code> no longer has an area fill. We've
also added
<code>AreaChartColumn</code> so you can still have area-filled
curves.
When clearing cached values for a function, you can now pass
function arguments to clear a specific cached value.
</p>
</RefCard>
<RefCard
size="third"
href="/develop/api-reference/layout/st.popover"
href="/develop/api-reference/caching-and-state/st.query_params#stquery_paramsfrom_dict"
>
<i className="material-icons-sharp">layers</i>
<h4>New popover element</h4>
<i className="material-icons-sharp">question_mark</i>
<h4>
<code>st.query_params.from_dict()</code>
</h4>
<p>
Introducing <code>st.popover</code> to create popover elements
in your Streamlit apps.
You can now set all query parameters with a single command.
</p>
</RefCard>
{/* <Tile
Expand Down
Binary file added public/images/api/dialog.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1d07661

Please sign in to comment.