Skip to content

Commit

Permalink
Release 1.37.0 (#1122)
Browse files Browse the repository at this point in the history
* API pages and docstrings (#1117)

* Update generate.py

* Update streamlit.json

* Add st.feedback page

* fragment and dialog GA

* Update generate.py

* Update streamlit.json

* Add st.context page

* Update streamlit.json

* Update streamlit.json

* API reference cards

* Release notes

* Cheat sheet

* Remove commented code

Reference usage of components is available in style-guide.js

* What's new

* Remove curly quotes

* Update streamlit version

* Add workaround for context properties

* Existing app updates (#1120)

* Update config-toml.md (#1123)
  • Loading branch information
sfc-gh-dmatthews authored Jul 25, 2024
1 parent d630dac commit 12ec72b
Show file tree
Hide file tree
Showing 32 changed files with 10,038 additions and 182 deletions.
55 changes: 39 additions & 16 deletions content/develop/api-reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,19 @@ Display a download button widget.
st.download_button("Download file", file)
```

</RefCard>
<RefCard href="/develop/api-reference/widgets/st.feedback">

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

<h4>Feedback</h4>

Display a rating or sentiment button group.

```python
st.feedback("stars")
```

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

Expand Down Expand Up @@ -2277,7 +2290,8 @@ st.write(user_info)
Create and register a custom component.

```python
st.components.v1.declare_component(
from st.components.v1 import declare_component
declare_component(
"custom_slider",
"/frontend",
)
Expand All @@ -2292,7 +2306,8 @@ st.components.v1.declare_component(
Display an HTML string in an iframe.

```python
st.components.v1.html(
from st.components.v1 import html
html(
"<p>Foo bar.</p>"
)
```
Expand All @@ -2306,7 +2321,8 @@ st.components.v1.html(
Load a remote URL in an iframe.

```python
st.components.v1.iframe(
from st.components.v1 import iframe
iframe(
"docs.streamlit.io"
)
```
Expand All @@ -2320,17 +2336,15 @@ st.components.v1.iframe(
<br />

<TileContainer>
<RefCard href="/develop/api-reference/utilities/st.experimental_user">
<RefCard href="/develop/api-reference/utilities/st.context">

<h4>User info</h4>
<h4>Context</h4>

`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.
`st.context` provides a read-only interface to access cookies and headers.

```python
if st.experimental_user.email == "[email protected]":
st.write("Welcome back, ", st.experimental_user.email)
else:
st.write("You are not authorized to view this page.")
st.context.cookies
st.context.headers
```

</RefCard>
Expand All @@ -2353,12 +2367,21 @@ st.help(pd.DataFrame)
Renders HTML strings to your app.

```python
css = """
<style>
p { color: red; }
</style>
"""
st.html(css)
st.html("<p>Foo bar.</p>")
```

</RefCard>
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="full">

<h4>User info</h4>

`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.

```python
if st.experimental_user.email == "[email protected]":
st.write("Welcome back, ", st.experimental_user.email)
else:
st.write("You are not authorized to view this page.")
```

</RefCard>
Expand Down
87 changes: 13 additions & 74 deletions content/develop/api-reference/configuration/config-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ streamlit config show
```toml
[global]

# ***DEPRECATED***
# global.disableWatchdogWarning has been deprecated and will be removed in a
# future version. This option will be removed on or after 2024-01-20.
# ****************
# By default, Streamlit checks if the Python watchdog module is available
# and, if not, prints a warning asking for you to install it. The watchdog
# module is not required, but highly recommended. It improves Streamlit's
# ability to detect changes to files in your filesystem.
# If you'd like to turn off this warning, set this to True.
# Default: false
disableWatchdogWarning = false

# By default, Streamlit displays a warning when a user sets both a widget
# default value in the function defining the widget and a widget value via
# the widget's key in `st.session_state`.
Expand All @@ -78,7 +66,7 @@ level = "info"
# String format for logging messages. If logger.datetimeFormat is set,
# logger messages will default to `%(asctime)s.%(msecs)03d %(message)s`. See
# Python's documentation for available attributes:
# https://docs.python.org/2.6/develop/logging.html#formatter-objects
# https://docs.python.org/2.6/library/logging.html#formatter-objects
# Default: "%(asctime)s %(message)s"
messageFormat = "%(asctime)s %(message)s"
```
Expand All @@ -88,28 +76,10 @@ messageFormat = "%(asctime)s %(message)s"
```toml
[client]

# ***DEPRECATED***
# client.caching has been deprecated and is not required anymore for our new
# caching commands. This option will be removed on or after 2024-01-20.
# ****************
# Whether to enable st.cache. This does not affect st.cache_data or
# st.cache_resource.
# Default: true
caching = true

# ***DEPRECATED***
# client.displayEnabled has been deprecated and will be removed in a future
# version. This option will be removed on or after 2024-01-20.
# ****************
# If false, makes your Streamlit script not draw to a Streamlit app.
# Default: true
displayEnabled = true

# Controls whether uncaught app exceptions and deprecation warnings
# are displayed in the browser. By default, this is set to True and
# Streamlit displays app exceptions and associated tracebacks, and
# deprecation warnings, in the browser.
#
# If set to False, deprecation warnings and full exception messages
# will print to the console only. Exceptions will still display in the
# browser with a generic error message. For now, the exception type and
Expand All @@ -132,8 +102,9 @@ showErrorDetails = true
# Default: "auto"
toolbarMode = "auto"

# Controls whether the default sidebar page navigation in a multipage app is
# displayed.
# Controls whether to display the default sidebar page navigation in a
# multi-page app. This only applies when app's pages are defined by the
# `pages/` directory.
# Default: true
showSidebarNavigation = true
```
Expand All @@ -148,25 +119,6 @@ showSidebarNavigation = true
# Default: true
magicEnabled = true

# ***DEPRECATED***
# runner.installTracer has been deprecated and will be removed in a future
# version. This option will be removed on or after 2024-01-20.
# ****************
# Install a Python tracer to allow you to stop or pause your script at
# any point and introspect it. As a side-effect, this slows down your
# script's execution.
# Default: false
installTracer = false

# ***DEPRECATED***
# runner.fixMatplotlib has been deprecated and will be removed in a future
# version. This option will be removed on or after 2024-01-20.
# ****************
# Sets the MPLBACKEND environment variable to Agg inside Streamlit to
# prevent Python crashing.
# Default: true
fixMatplotlib = true

# Handle script rerun requests immediately, rather than waiting for script
# execution to reach a yield point. This makes Streamlit much more
# responsive to user interaction, but it can lead to race conditions in
Expand All @@ -186,7 +138,6 @@ enforceSerializableSessionState = false
# multiselect coerce Enum members when the Enum class gets
# re-defined during a script re-run. For more information, check out the docs:
# https://docs.streamlit.io/develop/concepts/design/custom-classes#enums
#
# Allowed values:
# * "off" : Disables Enum coercion.
# * "nameOnly" : Enum classes can be coerced if their member names match.
Expand All @@ -201,8 +152,7 @@ enumCoercion = "nameOnly"
```toml
[server]

# List of folders that should not be watched for changes. This
# impacts both "Run on Save" and @st.cache.
# List of folders that should not be watched for changes.
# Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
Expand Down Expand Up @@ -290,15 +240,15 @@ enableStaticServing = false
# security audits or performance tests. For the production environment, we
# recommend performing SSL termination by the load balancer or the reverse
# proxy.']
# sslCertFile =
sslCertFile =

# Cryptographic key file for connecting via HTTPS.
# Must be set at the same time as "server.sslCertFile".
# ['DO NOT USE THIS OPTION IN A PRODUCTION ENVIRONMENT. It has not gone through
# security audits or performance tests. For the production environment, we
# recommend performing SSL termination by the load balancer or the reverse
# proxy.']
# sslKeyFile =
sslKeyFile =
```

#### Browser
Expand Down Expand Up @@ -345,39 +295,28 @@ serverPort = 8501
token = ""
```

#### Deprecation

```toml
[deprecation]

# Set to false to disable the deprecation warning for using the global pyplot
# instance.
# Default: true
showPyplotGlobalUse = true
```

#### Theme

```toml
[theme]

# The preset Streamlit theme that your custom theme inherits from.
# One of "light" or "dark".
# base =
base =

# Primary accent color for interactive elements.
# primaryColor =
primaryColor =

# Background color for the main content area.
# backgroundColor =
backgroundColor =

# Background color used for the sidebar and most interactive widgets.
# secondaryBackgroundColor =
secondaryBackgroundColor =

# Color used for almost all text.
# textColor =
textColor =

# Font family for all text in the app, except code blocks. One of "sans serif",
# "serif", or "monospace".
# font =
font =
```
2 changes: 1 addition & 1 deletion content/develop/api-reference/control-flow/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ slug: /develop/api-reference/execution-flow/st.dialog
description: st.experimental_dialog opens a multi-element modal overlay
---

<Autofunction function="streamlit.experimental_dialog" />
<Autofunction function="streamlit.dialog" oldName="streamlit.experimental_dialog" />
2 changes: 1 addition & 1 deletion content/develop/api-reference/control-flow/fragment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ slug: /develop/api-reference/execution-flow/st.fragment
description: st.fragment is a decorator that allows a function to rerun independently
---

<Autofunction function="streamlit.experimental_fragment" />
<Autofunction function="streamlit.fragment" oldName="streamlit.experimental_fragment" />
9 changes: 6 additions & 3 deletions content/develop/api-reference/custom-components/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ slug: /develop/api-reference/custom-components
Create and register a custom component.

```python
st.components.v1.declare_component(
from st.components.v1 import declare_component
declare_component(
"custom_slider",
"/frontend",
)
Expand All @@ -29,7 +30,8 @@ st.components.v1.declare_component(
Display an HTML string in an iframe.

```python
st.components.v1.html(
from st.components.v1 import html
html(
"<p>Foo bar.</p>"
)
```
Expand All @@ -43,7 +45,8 @@ st.components.v1.html(
Load a remote URL in an iframe.

```python
st.components.v1.iframe(
from st.components.v1 import iframe
iframe(
"docs.streamlit.io"
)
```
Expand Down
33 changes: 20 additions & 13 deletions content/develop/api-reference/utilities/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ There are a handful of methods that allow you to create placeholders in your
app, provide help using doc strings, get and modify configuration options and query parameters.

<TileContainer>
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="half">
<RefCard href="/develop/api-reference/utilities/st.context" size="half">

<h4>User info</h4>
<h4>Context</h4>

`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.
`st.context` provides a read-only interface to access cookies and headers.

```python
if st.experimental_user.email == "[email protected]":
st.write("Welcome back, ", st.experimental_user.email)
else:
st.write("You are not authorized to view this page.")
st.context.cookies
st.context.headers
```

</RefCard>
Expand All @@ -42,12 +40,21 @@ st.help(pd.DataFrame)
Renders HTML strings to your app.

```python
css = """
<style>
p { color: red; }
</style>
"""
st.html(css)
st.html("<p>Foo bar.</p>")
```

</RefCard>
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="half">

<h4>User info</h4>

`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.

```python
if st.experimental_user.email == "[email protected]":
st.write("Welcome back, ", st.experimental_user.email)
else:
st.write("You are not authorized to view this page.")
```

</RefCard>
Expand Down
11 changes: 11 additions & 0 deletions content/develop/api-reference/utilities/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: st.context
slug: /develop/api-reference/utilities/st.context
description: st.context displays a read-only dict of cookies and headers
---

<Autofunction function="streamlit.context" />

<Autofunction function="context.cookies" />

<Autofunction function="context.headers" />
Loading

0 comments on commit 12ec72b

Please sign in to comment.