From e8e640fa68383527039833dc03d3ab8f71561f8d Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Mon, 15 Jul 2024 14:04:22 -0700 Subject: [PATCH 01/40] Initial POC for SiS version exceptions --- components/blocks/autofunction.js | 57 +- components/blocks/iconHeader.js | 22 +- components/blocks/note.js | 15 +- components/blocks/note.module.css | 4 + pages/[...slug].js | 16 +- python/snowflake.json | 570 +++++ python/streamlit.json | 3601 ----------------------------- 7 files changed, 667 insertions(+), 3618 deletions(-) create mode 100644 python/snowflake.json diff --git a/components/blocks/autofunction.js b/components/blocks/autofunction.js index 81144614a..846da5c27 100644 --- a/components/blocks/autofunction.js +++ b/components/blocks/autofunction.js @@ -1,8 +1,11 @@ import React, { useEffect, useState, useRef } from "react"; +import ReactDOMServer from "react-dom/server"; +import Markdown from "react-markdown"; import reverse from "lodash/reverse"; import classNames from "classnames"; import Table from "./table"; import { H2, H3 } from "./headers"; +import Note from "./note"; import Warning from "./warning"; import Deprecation from "./deprecation"; import { withRouter, useRouter } from "next/router"; @@ -27,6 +30,7 @@ const Autofunction = ({ versions, streamlitFunction, streamlit, + exceptions, slug, hideHeader, deprecated, @@ -165,7 +169,9 @@ const Autofunction = ({ const returns = []; const versionList = reverse(versions.slice()); let functionObject; + let functionException; let functionDescription; + let functionDescriptionPrefix = ""; let header; let headerTitle; let body; @@ -177,8 +183,17 @@ const Autofunction = ({ if (streamlitFunction in streamlit || oldStreamlitFunction in streamlit) { functionObject = streamlit[streamlitFunction] ?? streamlit[oldStreamlitFunction]; + functionException = + streamlitFunction in streamlit + ? exceptions[streamlitFunction] ?? {} + : oldStreamlitFunction in streamlit + ? exceptions[oldStreamlitFunction] ?? {} + : {}; isClass = functionObject.is_class; isAttributeDict = functionObject.is_attribute_dict ?? false; + if ("_" in functionException && "content" in functionException["_"]) { + functionDescriptionPrefix = functionException["_"]["content"]; + } if ( functionObject.description !== undefined && functionObject.description @@ -288,6 +303,13 @@ const Autofunction = ({ ) : ( "" )} + {functionDescriptionPrefix ? ( + + + + ) : ( + "" + )}
` : ""; + const paramPrefix = functionException[param.name] + ? functionException[param.name]["content"] + : ""; const description = param.description ? param.description : `

No description

`; @@ -348,6 +373,15 @@ const Autofunction = ({ `; row["body"] = ` ${deprecatedMarkup} + ${ + paramPrefix + ? ReactDOMServer.renderToString( + + + , + ) + : "" + } ${description} `; } else { @@ -362,6 +396,15 @@ const Autofunction = ({ `; row["body"] = ` ${deprecatedMarkup} + ${ + paramPrefix + ? ReactDOMServer.renderToString( + + + , + ) + : "" + } ${description} `; } @@ -440,6 +483,9 @@ const Autofunction = ({ ${property.deprecated.deprecatedText}
` : ""; + const properyPrefix = functionException[property.name] + ? functionException[property.name]["content"] + : ""; const description = property.description ? property.description : `

No description

`; @@ -452,6 +498,15 @@ const Autofunction = ({

`; row["body"] = ` ${deprecatedMarkup} + ${ + propertyPrefix + ? ReactDOMServer.renderToString( + + + , + ) + : "" + } ${description} `; propertiesRows.push(row); diff --git a/components/blocks/iconHeader.js b/components/blocks/iconHeader.js index 0a8d41759..561dc00fa 100644 --- a/components/blocks/iconHeader.js +++ b/components/blocks/iconHeader.js @@ -2,17 +2,21 @@ import classNames from "classnames"; import styles from "./iconHeader.module.css"; -const IconHeader = ({ icon, rotate, title, background, color }) => { +const IconHeader = ({ icon, rotate, title, background, color, compact }) => { return (
- - {icon} - + {compact ? ( + "" + ) : ( + + {icon} + + )}

{title}

diff --git a/components/blocks/note.js b/components/blocks/note.js index 5421ecb77..aa217a5e5 100644 --- a/components/blocks/note.js +++ b/components/blocks/note.js @@ -6,15 +6,22 @@ import NoteStyles from "./note.module.css"; import IconHeader from "./iconHeader"; -const Note = ({ children }) => { +const Note = ({ children, label, compact }) => { return ( -
+
{children}
diff --git a/components/blocks/note.module.css b/components/blocks/note.module.css index ace7445b6..fcaf3e384 100644 --- a/components/blocks/note.module.css +++ b/components/blocks/note.module.css @@ -5,3 +5,7 @@ :global(.dark) .Note { background-color: #062633; } + +.Compact { + @apply p-4; +} diff --git a/pages/[...slug].js b/pages/[...slug].js index c24f10a84..93a970ce2 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -76,6 +76,7 @@ export default function Article({ data, source, streamlit, + exceptions, slug, menu, currMenuItem, @@ -152,6 +153,7 @@ export default function Article({ {...props} streamlitFunction={props.function} streamlit={streamlit} + exceptions={exceptions} version={version} versions={versions} slug={slug} @@ -334,7 +336,12 @@ export async function getStaticProps(context) { join(pythonDirectory, "streamlit.json"), "utf8", ); + const jsonExceptions = fs.readFileSync( + join(pythonDirectory, "snowflake.json"), + "utf8", + ); const streamlitFuncs = jsonContents ? JSON.parse(jsonContents) : {}; + const streamlitExceptions = jsonExceptions ? JSON.parse(jsonExceptions) : {}; const all_versions = Object.keys(streamlitFuncs); const versions = sortBy(all_versions, [ (o) => { @@ -343,11 +350,11 @@ export async function getStaticProps(context) { }, ]); const current_version = versions[versions.length - 1]; - const funcs = jsonContents ? JSON.parse(jsonContents) : {}; const menu = getMenu(); props["streamlit"] = {}; + props["exceptions"] = {}; props["versions"] = all_versions; props["versionFromStaticLoad"] = null; @@ -366,14 +373,17 @@ export async function getStaticProps(context) { const should_version = //gi.test(fileContents); if (should_version) { - props["streamlit"] = funcs[current_version]; + props["streamlit"] = streamlitFuncs[current_version]; + props["exceptions"] = streamlitExceptions[current_version] ?? {}; } const isnum = /^[\d\.]+$/.test(context.params.slug[0]); const isSiS = /^SiS[\d\.]*$/.test(context.params.slug[0]); if (isnum || isSiS) { props["versionFromStaticLoad"] = context.params.slug[0]; - props["streamlit"] = funcs[props["versionFromStaticLoad"]]; + props["streamlit"] = streamlitFuncs[props["versionFromStaticLoad"]]; + props["exceptions"] = + streamlitExceptions[props["versionFromStaticLoad"]] ?? {}; location = `/${context.params.slug.slice(1).join("/")}`; } diff --git a/python/snowflake.json b/python/snowflake.json new file mode 100644 index 000000000..2c30a3123 --- /dev/null +++ b/python/snowflake.json @@ -0,0 +1,570 @@ +{ + "1.22.0": { + "streamlit.bokeh_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.cache_data": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_data` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.cache_resource": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_resource` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.camera_input": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.caption": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.download_button": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.experimental_get_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.experimental_set_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.file_uploader": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.map": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.map`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.markdown": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.pydeck_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.pydeck_chart`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.set_page_config": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "page_title": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + }, + "page_icon": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + } + }, + "streamlit.write": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.components.v1.declare_component": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.html": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.iframe": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + } + }, + "1.26.0": { + "streamlit.bokeh_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.cache_data": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_data` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.cache_resource": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_resource` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.camera_input": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.caption": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.experimental_get_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.experimental_set_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.file_uploader": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.map": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.map`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.markdown": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.pydeck_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.pydeck_chart`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.set_page_config": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "page_title": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + }, + "page_icon": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + } + }, + "streamlit.write": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.components.v1.declare_component": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.html": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.iframe": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + } + }, + "1.29.0": { + "streamlit.bokeh_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.cache_data": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_data` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.cache_resource": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_resource` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.camera_input": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.caption": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.experimental_get_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.experimental_set_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.file_uploader": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.map": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.map`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.markdown": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.pydeck_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.pydeck_chart`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.set_page_config": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "page_title": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + }, + "page_icon": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + } + }, + "streamlit.write": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.components.v1.declare_component": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.html": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.iframe": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.link_button": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "External links are blocked by default. For more information, see [External network access in Streamlit in Snowflake](https://docs.snowflake.com/en/developer-guide/streamlit/additional-features#external-network-access-in-sis)." + } + } + }, + "1.31.0": { + "streamlit.bokeh_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.cache_data": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_data` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.cache_resource": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_resource` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.camera_input": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.caption": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.experimental_get_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.experimental_set_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.file_uploader": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.map": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.map`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.markdown": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.pydeck_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.pydeck_chart`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.set_page_config": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "page_title": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + }, + "page_icon": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + } + }, + "streamlit.write": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.components.v1.declare_component": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.html": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.iframe": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.link_button": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "External links are blocked by default. For more information, see [External network access in Streamlit in Snowflake](https://docs.snowflake.com/en/developer-guide/streamlit/additional-features#external-network-access-in-sis)." + } + }, + "streamlit.query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "Query parameters are not visible in your app's URL in Streamlit in Snowflake. However, query parameters can still be read and set through `st.query_params`." + } + } + } +} diff --git a/python/streamlit.json b/python/streamlit.json index 492fe7b5e..460f935f0 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -1,3605 +1,4 @@ { - "SiS": { - "streamlit.altair_chart": { - "name": "altair_chart", - "signature": "st.altair_chart(altair_chart, use_container_width=False, theme=\"streamlit\")", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nc = alt.Chart(chart_data).mark_circle().encode(\n    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.altair_chart(c, use_container_width=True)\n
\n

Examples of Altair charts can be found at\nhttps://altair-viz.github.io/gallery/.

\n\n \n
\n", - "description": "

Display a chart using the Altair library.

\n", - "args": [ - { - "name": "altair_chart", - "type_name": "altair.vegalite.v2.api.Chart", - "is_optional": false, - "description": "

The Altair chart object to display.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over Altair's native width value.

\n", - "default": null - }, - { - "name": "theme", - "type_name": "\"streamlit\" or None", - "is_optional": false, - "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", - "default": "behavior" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L422" - }, - "streamlit.area_chart": { - "name": "area_chart", - "signature": "st.area_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nst.area_chart(chart_data)\n
\n\n \n
\n", - "description": "

Display an area chart.

\n

This is just syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.area_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", - "is_optional": false, - "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "x", - "type_name": "str or None", - "is_optional": false, - "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "y", - "type_name": "str, sequence of str, or None", - "is_optional": false, - "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int", - "is_optional": false, - "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int", - "is_optional": false, - "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L247" - }, - "streamlit.audio": { - "name": "audio", - "signature": "st.audio(data, format=\"audio/wav\", start_time=0, *, sample_rate=None)", - "example": "
\n
\nimport streamlit as st\nimport numpy as np\n\naudio_file = open('myaudio.ogg', 'rb')\naudio_bytes = audio_file.read()\n\nst.audio(audio_bytes, format='audio/ogg')\n\nsample_rate = 44100  # 44100 samples per second\nseconds = 2  # Note duration of 2 seconds\nfrequency_la = 440  # Our played note will be 440 Hz\n# Generate array with seconds*sample_rate steps, ranging between 0 and seconds\nt = np.linspace(0, seconds, seconds * sample_rate, False)\n# Generate a 440 Hz sine wave\nnote_la = np.sin(frequency_la * t * 2 * np.pi)\n\nst.audio(note_la, sample_rate=sample_rate)\n
\n\n \n
\n", - "description": "

Display an audio player.

\n", - "args": [ - { - "name": "data", - "type_name": "str, bytes, BytesIO, numpy.ndarray, or file opened with", - "is_optional": false, - "description": "

io.open().\nRaw audio data, filename, or a URL pointing to the file to load.\nRaw data formats must include all necessary file headers to match the file\nformat specified via format.\nIf data is a numpy array, it must either be a 1D array of the waveform\nor a 2D array of shape (num_channels, num_samples) with waveforms\nfor all channels. See the default channel order at\nhttp://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx

\n", - "default": "channel" - }, - { - "name": "format", - "type_name": "str", - "is_optional": false, - "description": "

The mime type for the audio file. Defaults to 'audio/wav'.\nSee https://tools.ietf.org/html/rfc4281 for more info.

\n", - "default": "s" - }, - { - "name": "start_time", - "type_name": "int", - "is_optional": false, - "description": "

The time from which this element should start playing.

\n", - "default": null - }, - { - "name": "sample_rate", - "type_name": "int or None", - "is_optional": false, - "description": "

The sample rate of the audio data in samples per second. Only required if\ndata is a numpy array.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/media.py#L43" - }, - "streamlit.balloons": { - "name": "balloons", - "signature": "st.balloons()", - "example": "
\n
\nimport streamlit as st\n\nst.balloons()\n
\n

...then watch your app and get ready for a celebration!

\n
\n", - "description": "

Draw celebratory balloons.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/balloons.py#L25" - }, - "streamlit.bar_chart": { - "name": "bar_chart", - "signature": "st.bar_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=["a", "b", "c"])\n\nst.bar_chart(chart_data)\n
\n\n \n
\n", - "description": "

Display a bar chart.

\n

This is just syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.bar_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", - "is_optional": false, - "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "x", - "type_name": "str or None", - "is_optional": false, - "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "y", - "type_name": "str, sequence of str, or None", - "is_optional": false, - "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int", - "is_optional": false, - "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int", - "is_optional": false, - "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L334" - }, - "streamlit.beta_columns": { - "name": "beta_columns", - "signature": "st.beta_columns(spec, *, gap=\"small\")", - "examples": "
\n

You can use with notation to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n
\n\n \n
\n", - "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

Columns can only be placed inside other columns up to one level of nesting.

\n
\n

Warning

\n

Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.

\n
\n", - "args": [ - { - "name": "spec", - "type_name": "int or list of numbers", - "is_optional": false, - "description": "
\n
If an int
\n
Specifies the number of columns to insert, and all columns\nhave equal width.
\n
If a list of numbers
\n

Creates a column for each number, and each\ncolumn's width is proportional to the number provided. Numbers can\nbe ints or floats, but they must be positive.

\n

For example, st.columns([3, 1, 2]) creates 3 columns where\nthe first column is 3 times the width of the second, and the last\ncolumn is 2 times that width.

\n
\n
\n", - "default": null - }, - { - "name": "gap", - "type_name": "string (\"small\", \"medium\", or \"large\")", - "is_optional": false, - "description": "

An optional string, which indicates the size of the gap between each column.\nThe default is a small gap between columns. This argument can only be supplied by\nkeyword.

\n", - "default": "a" - } - ], - "returns": [ - { - "type_name": "list of containers", - "is_generator": false, - "description": "

A list of container objects.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L77" - }, - "streamlit.beta_container": { - "name": "beta_container", - "signature": "st.beta_container()", - "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.container():\n   st.write("This is inside the container")\n\n   # You can call any Streamlit command, including custom components:\n   st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n\n \n

Inserting elements out of order:

\n
\nimport streamlit as st\n\ncontainer = st.container()\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n
\n\n \n
\n", - "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L29" - }, - "streamlit.beta_expander": { - "name": "beta_expander", - "signature": "st.beta_expander(label, expanded=False)", - "examples": "
\n

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write(\\"\\"\\"\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    \\"\\"\\")\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write(\\"\\"\\"\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n\\"\\"\\")\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n
\n", - "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

Currently, you may not put expanders inside another expander.

\n
\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "expanded", - "type_name": "bool", - "is_optional": false, - "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L320" - }, - "streamlit.button": { - "name": "button", - "signature": "st.button(label, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", - "example": "
\n
\nimport streamlit as st\n\nif st.button('Say hello'):\n    st.write('Why hello there')\nelse:\n    st.write('Goodbye')\n
\n\n \n
\n", - "description": "

Display a button widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed when the button is\nhovered over.

\n", - "default": null - }, - { - "name": "on_click", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this button is clicked.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "type", - "type_name": "\"secondary\" or \"primary\"", - "is_optional": false, - "description": "

An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. This\nargument can only be supplied by keyword. Defaults to "secondary".

\n", - "default": "s" - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the button if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which makes the button stretch its width to match the parent container.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "bool", - "is_generator": false, - "description": "

True if the button was clicked on the last run of the app,\nFalse otherwise.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/button.py#L61" - }, - "streamlit.cache": { - "name": "cache", - "signature": "st.cache(func=None, persist=False, allow_output_mutation=False, show_spinner=True, suppress_st_warning=False, hash_funcs=None, max_entries=None, ttl=None)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\n@st.cache(persist=True)\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

To disable hashing return values, set the allow_output_mutation parameter to True:

\n
\n@st.cache(allow_output_mutation=True)\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. MongoClient) to a hash function (id) like this:

\n
\n@st.cache(hash_funcs={MongoClient: id})\ndef connect_to_database(url):\n    return MongoClient(url)\n
\n

Alternatively, you can map the type's fully-qualified name\n(e.g. "pymongo.mongo_client.MongoClient") to the hash function instead:

\n
\n@st.cache(hash_funcs={"pymongo.mongo_client.MongoClient": id})\ndef connect_to_database(url):\n    return MongoClient(url)\n
\n
\n", - "description": "

Function decorator to memoize function executions.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function to cache. Streamlit hashes the function and dependent code.

\n", - "default": null - }, - { - "name": "persist", - "type_name": "boolean", - "is_optional": false, - "description": "

Whether to persist the cache on disk.

\n", - "default": null - }, - { - "name": "allow_output_mutation", - "type_name": "boolean", - "is_optional": false, - "description": "

Streamlit shows a warning when return values are mutated, as that\ncan have unintended consequences. This is done by hashing the return value internally.

\n

If you know what you're doing and would like to override this warning, set this to True.

\n", - "default": null - }, - { - "name": "show_spinner", - "type_name": "boolean", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na cache miss.

\n", - "default": "True" - }, - { - "name": "suppress_st_warning", - "type_name": "boolean", - "is_optional": false, - "description": "

Suppress warnings about calling Streamlit commands from within\nthe cached function.

\n", - "default": null - }, - { - "name": "hash_funcs", - "type_name": "dict or None", - "is_optional": false, - "description": "

Mapping of types or fully qualified names to hash functions. This is used to override\nthe behavior of the hasher inside Streamlit's caching mechanism: when the hasher\nencounters an object, it will first check to see if its type matches a key in this\ndict and, if so, will use the provided function to generate a hash for it. See below\nfor an example of how this can be used.

\n", - "default": null - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "ttl", - "type_name": "float or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", - "default": "None." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/legacy_caching/caching.py#L486" - }, - "streamlit.cache_data": { - "name": "cache_data", - "signature": "st.cache_data(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "
\n

Streamlit in Snowflake Note

\n

st.cache_data is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions.

\n
\n

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

To cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function to cache. Streamlit hashes the function's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.\nNote that ttl is incompatible with persist="disk" - ttl will be\nignored if persist is specified.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "persist", - "type_name": "str or boolean or None", - "is_optional": false, - "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", - "default": "None." - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L378" - }, - "streamlit.cache_resource": { - "name": "cache_resource", - "signature": "st.cache_resource(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

A cache_resource function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "
\n

Streamlit in Snowflake Note

\n

st.cache_resource is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions.

\n
\n

Decorator to cache functions that return global resources (e.g. database connections, ML models).

\n

Cached objects must be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using st.session_state\nto store resources per session instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

To cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "validate", - "type_name": "callable or None", - "is_optional": false, - "description": "

An optional validation function for cached data. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", - "default": null - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L258" - }, - "streamlit.caption": { - "name": "caption", - "signature": "st.caption(body, unsafe_allow_html=False, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.caption('This is a string that explains something above.')\nst.caption('A caption with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in small font.

\n

This should be used for captions, asides, footnotes, sidenotes, and\nother explanatory text.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "unsafe_allow_html", - "type_name": "bool", - "is_optional": false, - "description": "

By default, any HTML tags found in strings will be escaped and\ntherefore treated as pure text. This behavior may be turned off by\nsetting this argument to True.

\n

That said, we strongly advise against it. It is hard to write secure\nHTML, so by using this argument you may be compromising your users'\nsecurity. For more information, see:

\n

https://github.com/streamlit/streamlit/issues/152

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the caption.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L132" - }, - "streamlit.checkbox": { - "name": "checkbox", - "signature": "st.checkbox(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\nagree = st.checkbox('I agree')\n\nif agree:\n    st.write('Great!')\n
\n\n \n
\n", - "description": "

Display a checkbox widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this checkbox is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "value", - "type_name": "bool", - "is_optional": false, - "description": "

Preselect the checkbox when it first renders. This will be\ncast to bool internally.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the checkbox.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this checkbox's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the checkbox if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "bool", - "is_generator": false, - "description": "

Whether or not the checkbox is checked.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/checkbox.py#L52" - }, - "streamlit.code": { - "name": "code", - "signature": "st.code(body, language=\"python\", line_numbers=False)", - "example": "
\n
\nimport streamlit as st\n\ncode = '''def hello():\n    print("Hello, Streamlit!")'''\nst.code(code, language='python')\n
\n
\n", - "description": "

Display a code block with optional syntax highlighting.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The string to display as code.

\n", - "default": null - }, - { - "name": "language", - "type_name": "str or None", - "is_optional": false, - "description": "

The language that the code is written in, for syntax highlighting.\nIf None, the code will be unstyled. Defaults to "python".

\n

For a list of available language values, see:

\n

https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD

\n", - "default": "s" - }, - { - "name": "line_numbers", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean indicating whether to show line numbers to the\nleft of the code block. Defaults to False.

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/code.py#L27" - }, - "streamlit.color_picker": { - "name": "color_picker", - "signature": "st.color_picker(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ncolor = st.color_picker('Pick A Color', '#00f900')\nst.write('The current color is', color)\n
\n\n \n
\n", - "description": "

Display a color picker widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "str", - "is_optional": false, - "description": "

The hex value of this widget when it first renders. If None,\ndefaults to black.

\n", - "default": "black." - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the color picker.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this color_picker's value\nchanges.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the color picker if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn\u2019t show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "str", - "is_generator": false, - "description": "

The selected color as a hex string.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/color_picker.py#L52" - }, - "streamlit.columns": { - "name": "columns", - "signature": "st.columns(spec, *, gap=\"small\")", - "examples": "
\n

You can use with notation to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n
\n\n \n
\n", - "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

Columns can only be placed inside other columns up to one level of nesting.

\n
\n

Warning

\n

Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.

\n
\n", - "args": [ - { - "name": "spec", - "type_name": "int or list of numbers", - "is_optional": false, - "description": "
\n
If an int
\n
Specifies the number of columns to insert, and all columns\nhave equal width.
\n
If a list of numbers
\n

Creates a column for each number, and each\ncolumn's width is proportional to the number provided. Numbers can\nbe ints or floats, but they must be positive.

\n

For example, st.columns([3, 1, 2]) creates 3 columns where\nthe first column is 3 times the width of the second, and the last\ncolumn is 2 times that width.

\n
\n
\n", - "default": null - }, - { - "name": "gap", - "type_name": "string (\"small\", \"medium\", or \"large\")", - "is_optional": false, - "description": "

An optional string, which indicates the size of the gap between each column.\nThe default is a small gap between columns. This argument can only be supplied by\nkeyword.

\n", - "default": "a" - } - ], - "returns": [ - { - "type_name": "list of containers", - "is_generator": false, - "description": "

A list of container objects.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L77" - }, - "streamlit.container": { - "name": "container", - "signature": "st.container()", - "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.container():\n   st.write("This is inside the container")\n\n   # You can call any Streamlit command, including custom components:\n   st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n\n \n

Inserting elements out of order:

\n
\nimport streamlit as st\n\ncontainer = st.container()\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n
\n\n \n
\n", - "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L29" - }, - "streamlit.dataframe": { - "name": "dataframe", - "signature": "st.dataframe(data=None, width=None, height=None, *, use_container_width=False)", - "examples": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nst.dataframe(df)  # Same as st.write(df)\n
\n\n \n
\nst.dataframe(df, 200, 100)\n
\n

You can also pass a Pandas Styler object to change the style of\nthe rendered DataFrame:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(10, 20),\n   columns=('col %d' % i for i in range(20)))\n\nst.dataframe(df.style.highlight_max(axis=0))\n
\n\n \n
\n", - "description": "

Display a dataframe as an interactive table.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", - "is_optional": false, - "description": "

The data to display.

\n

If 'data' is a pandas.Styler, it will be used to style its\nunderlying DataFrame. Streamlit supports custom cell\nvalues and colors. (It does not support some of the more exotic\npandas styling features, like bar charts, hovering, and captions.)\nStyler support is experimental!\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "width", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired width of the dataframe expressed in pixels. If None, the width\nwill be automatically calculated based on the column content.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired height of the dataframe expressed in pixels. If None, a\ndefault height is used.

\n", - "default": "height" - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the dataframe width to the width of the parent container.\nThis takes precedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L40" - }, - "streamlit.date_input": { - "name": "date_input", - "signature": "st.date_input(label, value=None, min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport datetime\nimport streamlit as st\n\nd = st.date_input(\n    "When\\'s your birthday",\n    datetime.date(2019, 7, 6))\nst.write('Your birthday is:', d)\n
\n\n \n
\n", - "description": "

Display a date input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this date input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None", - "is_optional": false, - "description": "

The value of this widget when it first renders. If a list/tuple with\n0 to 2 date/datetime values is provided, the datepicker will allow\nusers to provide a range. Defaults to today as a single-date picker.

\n", - "default": "today" - }, - { - "name": "min_value", - "type_name": "datetime.date or datetime.datetime", - "is_optional": false, - "description": "

The minimum selectable date. If value is a date, defaults to value - 10 years.\nIf value is the interval [start, end], defaults to start - 10 years.

\n", - "default": "value" - }, - { - "name": "max_value", - "type_name": "datetime.date or datetime.datetime", - "is_optional": false, - "description": "

The maximum selectable date. If value is a date, defaults to value + 10 years.\nIf value is the interval [start, end], defaults to end + 10 years.

\n", - "default": "value" - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this date_input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the date input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "datetime.date or a tuple with 0-2 dates", - "is_generator": false, - "description": "

The current value of the date input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/time_widgets.py#L399" - }, - "streamlit.divider": { - "name": "divider", - "signature": "st.divider()", - "example": "
\n
\nimport streamlit as st\n\nst.divider()\n
\n
\n", - "description": "

Display a horizontal rule.

\n
\n

Note

\n

You can achieve the same effect with st.write("---") or\neven just "---" in your script (via magic).

\n
\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L244" - }, - "streamlit.echo": { - "name": "echo", - "signature": "st.echo(code_location=\"above\")", - "example": "
\n
\nimport streamlit as st\n\nwith st.echo():\n    st.write('This code will be printed')\n
\n
\n", - "description": "

Use in a with block to draw some code on the app, then execute it.

\n", - "args": [ - { - "name": "code_location", - "type_name": "\"above\" or \"below\"", - "is_optional": false, - "description": "

Whether to show the echoed code before or after the results of the\nexecuted code block.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/echo.py#L27" - }, - "streamlit.empty": { - "name": "empty", - "signature": "st.empty()", - "examples": "
\n

Overwriting elements in-place using "with" notation:

\n
\nimport streamlit as st\nimport time\n\nwith st.empty():\n    for seconds in range(60):\n        st.write(f"\u23f3 {seconds} seconds have passed")\n        time.sleep(1)\n    st.write("\u2714\ufe0f 1 minute over!")\n
\n

Replacing several elements, then clearing them:

\n
\nimport streamlit as st\n\nplaceholder = st.empty()\n\n# Replace the placeholder with some text:\nplaceholder.text("Hello")\n\n# Replace the text with a chart:\nplaceholder.line_chart({"data": [1, 5, 2, 6]})\n\n# Replace the chart with several elements:\nwith placeholder.container():\n    st.write("This is one element")\n    st.write("This is another")\n\n# Clear all those elements:\nplaceholder.empty()\n
\n
\n", - "description": "

Insert a single-element container.

\n

Inserts a container into your app that can be used to hold a single element.\nThis allows you to, for example, remove elements at any point, or replace\nseveral elements at once (using a child multi-element container).

\n

To insert/replace/clear an element on the returned container, you can\nuse "with" notation or just call methods directly on the returned object.\nSee examples below.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/empty.py#L24" - }, - "streamlit.error": { - "name": "error", - "signature": "st.error(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.error('This is an error', icon="\ud83d\udea8")\n
\n
\n", - "description": "

Display error message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The error text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L39" - }, - "streamlit.exception": { - "name": "exception", - "signature": "st.exception(exception)", - "example": "
\n
\nimport streamlit as st\n\ne = RuntimeError('This is an exception of type RuntimeError')\nst.exception(e)\n
\n
\n", - "description": "

Display an exception.

\n", - "args": [ - { - "name": "exception", - "type_name": "Exception", - "is_optional": false, - "description": "

The exception to display.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/exception.py#L50" - }, - "streamlit.expander": { - "name": "expander", - "signature": "st.expander(label, expanded=False)", - "examples": "
\n

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write(\\"\\"\\"\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    \\"\\"\\")\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write(\\"\\"\\"\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n\\"\\"\\")\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n
\n", - "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

Currently, you may not put expanders inside another expander.

\n
\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "expanded", - "type_name": "bool", - "is_optional": false, - "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L320" - }, - "streamlit.experimental_connection": { - "name": "experimental_connection", - "signature": "st.experimental_connection(name, type=None, max_entries=None, ttl=None, **kwargs)", - "examples": "
\n

The easiest way to create a first-party (SQL or Snowpark) connection is to use their\ndefault names and define corresponding sections in your secrets.toml file.

\n
\nimport streamlit as st\nconn = st.experimental_connection("sql") # Config section defined in [connections.sql] in secrets.toml.\n
\n

Creating a SQLConnection with a custom name requires you to explicitly specify the\ntype. If type is not passed as a kwarg, it must be set in the appropriate section of\nsecrets.toml.

\n
\nimport streamlit as st\nconn1 = st.experimental_connection("my_sql_connection", type="sql") # Config section defined in [connections.my_sql_connection].\nconn2 = st.experimental_connection("my_other_sql_connection") # type must be set in [connections.my_other_sql_connection].\n
\n

Passing the full module path to the connection class that you want to use can be\nuseful, especially when working with a custom connection:

\n
\nimport streamlit as st\nconn = st.experimental_connection("my_sql_connection", type="streamlit.connections.SQLConnection")\n
\n

Finally, you can pass the connection class to use directly to this function. Doing\nso allows static type checking tools such as mypy to infer the exact return\ntype of st.experimental_connection.

\n
\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\nconn = st.experimental_connection("my_sql_connection", type=SQLConnection)\n
\n
\n", - "description": "

Create a new connection to a data store or API, or return an existing one.

\n

Config options, credentials, secrets, etc. for connections are taken from various\nsources:

\n
    \n
  • Any connection-specific configuration files.
  • \n
  • An app's secrets.toml files.
  • \n
  • The kwargs passed to this function.
  • \n
\n", - "args": [ - { - "name": "name", - "type_name": "str", - "is_optional": false, - "description": "

The connection name used for secrets lookup in [connections.<name>].\nType will be inferred from passing "sql" or "snowpark".

\n", - "default": null - }, - { - "name": "type", - "type_name": "str or connection class or None", - "is_optional": false, - "description": "

The type of connection to create. It can be a keyword ("sql" or "snowpark"),\na path to an importable class, or an imported class reference. All classes\nmust extend st.connections.ExperimentalBaseConnection and implement the\n_connect() method. If the type kwarg is None, a type field must be set\nin the connection's section in secrets.toml.

\n", - "default": null - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of connections to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "**kwargs", - "type_name": "any", - "is_optional": false, - "description": "

Additional connection specific kwargs that are passed to the Connection's\n_connect() method. Learn more from the specific Connection's documentation.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "Connection object", - "is_generator": false, - "description": "

An initialized Connection object of the specified type.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/connection_factory.py#L170" - }, - "streamlit.experimental_data_editor": { - "name": "experimental_data_editor", - "signature": "st.experimental_data_editor(data, *, width=None, height=None, use_container_width=False, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None)", - "examples": "
\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n       {"command": "st.selectbox", "rating": 4, "is_widget": True},\n       {"command": "st.balloons", "rating": 5, "is_widget": False},\n       {"command": "st.time_input", "rating": 3, "is_widget": True},\n   ]\n)\nedited_df = st.experimental_data_editor(df)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n\n \n

You can also allow the user to add and delete rows by setting num_rows to "dynamic":

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n       {"command": "st.selectbox", "rating": 4, "is_widget": True},\n       {"command": "st.balloons", "rating": 5, "is_widget": False},\n       {"command": "st.time_input", "rating": 3, "is_widget": True},\n   ]\n)\nedited_df = st.experimental_data_editor(df, num_rows="dynamic")\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n\n \n
\n", - "description": "

Display a data editor widget.

\n

Display a data editor widget that allows you to edit DataFrames and\nmany other data structures in a table-like UI.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.DataFrame, list, set, tuple, dict, or None", - "is_optional": false, - "description": "

The data to edit in the data editor.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired width of the data editor expressed in pixels. If None, the width will\nbe automatically determined.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired height of the data editor expressed in pixels. If None, the height will\nbe automatically determined.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the data editor width to the width of the parent container.\nThis takes precedence over the width argument. Defaults to False.

\n", - "default": "False." - }, - { - "name": "num_rows", - "type_name": "\"fixed\" or \"dynamic\"", - "is_optional": false, - "description": "

Specifies if the user can add and delete rows in the data editor.\nIf "fixed", the user cannot add or delete rows. If "dynamic", the user can\nadd and delete rows in the data editor, but column sorting is disabled.\nDefaults to "fixed".

\n", - "default": "s" - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean which, if True, disables the data editor and prevents\nany edits. Defaults to False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

An optional string to use as the unique key for this widget. If this\nis omitted, a key will be generated for the widget based on its\ncontent. Multiple widgets of the same type may not share the same\nkey.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this data_editor's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "pd.DataFrame, pd.Styler, pyarrow.Table, np.ndarray, list, set, tuple, or dict.", - "is_generator": false, - "description": "

The edited data. The edited data is returned in its original data type if\nit corresponds to any of the supported return types. All other data types\nare returned as a pd.DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/data_editor.py#L448" - }, - "streamlit.experimental_memo": { - "name": "experimental_memo", - "signature": "st.experimental_memo(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

To cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function to cache. Streamlit hashes the function's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.\nNote that ttl is incompatible with persist="disk" - ttl will be\nignored if persist is specified.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "persist", - "type_name": "str or boolean or None", - "is_optional": false, - "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", - "default": "None." - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L378" - }, - "streamlit.experimental_rerun": { - "name": "experimental_rerun", - "signature": "st.experimental_rerun()", - "description": "

Rerun the script immediately.

\n

When st.experimental_rerun() is called, the script is halted - no\nmore statements will be run, and the script will be queued to re-run\nfrom the top.

\n

If this function is called outside of Streamlit, it will raise an\nException.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/execution_control.py#L46" - }, - "streamlit.experimental_show": { - "name": "experimental_show", - "signature": "st.experimental_show(*args)", - "notes": "
\n

This is an experimental feature with usage limitations:

\n
    \n
  • The method must be called with the name show.
  • \n
  • Must be called in one line of code, and only once per line.
  • \n
  • \n
    When passing multiple arguments the inclusion of , or ) in a string
    \n
    argument may cause an error.
    \n
    \n
  • \n
\n
\n", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\n\ndataframe = pd.DataFrame({\n    'first column': [1, 2, 3, 4],\n    'second column': [10, 20, 30, 40],\n})\nst.experimental_show(dataframe)\n
\n
\n", - "description": "

Write arguments and argument names to your app for debugging purposes.

\n

Show() has similar properties to write():

\n
\n
    \n
  1. You can pass in multiple arguments, all of which will be debugged.
  2. \n
  3. It returns None, so it's "slot" in the app cannot be reused.
  4. \n
\n
\n

Note: This is an experimental feature. See\nhttps://docs.streamlit.io/library/advanced-features/prerelease#experimental for more information.

\n", - "args": [ - { - "name": "*args", - "type_name": "any", - "is_optional": false, - "description": "

One or many objects to debug in the App.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/show.py#L23" - }, - "streamlit.experimental_singleton": { - "name": "experimental_singleton", - "signature": "st.experimental_singleton(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

A cache_resource function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "

Decorator to cache functions that return global resources (e.g. database connections, ML models).

\n

Cached objects are shared across all users, sessions, and reruns. They\nmust be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using st.session_state\nto store resources per session instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

To cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "validate", - "type_name": "callable or None", - "is_optional": false, - "description": "

An optional validation function for cached data. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", - "default": null - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L258" - }, - "streamlit.form": { - "name": "form", - "signature": "st.form(key, clear_on_submit=False)", - "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.form("my_form"):\n   st.write("Inside the form")\n   slider_val = st.slider("Form slider")\n   checkbox_val = st.checkbox("Form checkbox")\n\n   # Every form must have a submit button.\n   submitted = st.form_submit_button("Submit")\n   if submitted:\n       st.write("slider", slider_val, "checkbox", checkbox_val)\n\nst.write("Outside the form")\n
\n

Inserting elements out of order:

\n
\nimport streamlit as st\n\nform = st.form("my_form")\nform.slider("Inside the form")\nst.slider("Outside the form")\n\n# Now add a submit button to the form:\nform.form_submit_button("Submit")\n
\n
\n", - "description": "

Create a form that batches elements together with a "Submit" button.

\n

A form is a container that visually groups other elements and\nwidgets together, and contains a Submit button. When the form's\nSubmit button is pressed, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

To add elements to a form object, you can use "with" notation\n(preferred) or just call methods directly on the form. See\nexamples below.

\n

Forms have a few constraints:

\n
    \n
  • Every form must contain a st.form_submit_button.
  • \n
  • st.button and st.download_button cannot be added to a form.
  • \n
  • Forms can appear anywhere in your app (sidebar, columns, etc),\nbut they cannot be embedded inside other forms.
  • \n
\n

For more information about forms, check out our\nblog post.

\n", - "args": [ - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

A string that identifies the form. Each form must have its own\nkey. (This key is not displayed to the user in the interface.)

\n", - "default": null - }, - { - "name": "clear_on_submit", - "type_name": "bool", - "is_optional": false, - "description": "

If True, all widgets inside the form will be reset to their default\nvalues after the user presses the Submit button. Defaults to False.\n(Note that Custom Components are unaffected by this flag, and\nwill not be reset to their defaults on form submission.)

\n", - "default": "values" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/form.py#L118" - }, - "streamlit.form_submit_button": { - "name": "form_submit_button", - "signature": "st.form_submit_button(label=\"Submit\", help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", - "description": "

Display a form submit button.

\n

When this button is clicked, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

Every form must have a form_submit_button. A form_submit_button\ncannot exist outside a form.

\n

For more information about forms, check out our\nblog post.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this button is for.\nDefaults to "Submit".

\n", - "default": "s" - }, - { - "name": "help", - "type_name": "str or None", - "is_optional": false, - "description": "

A tooltip that gets displayed when the button is hovered over.\nDefaults to None.

\n", - "default": "None." - }, - { - "name": "on_click", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this button is clicked.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "type", - "type_name": "\"secondary\" or \"primary\"", - "is_optional": false, - "description": "

An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. This\nargument can only be supplied by keyword. Defaults to "secondary".

\n", - "default": "s" - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the button if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which makes the button stretch its width to match the parent container.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "bool", - "is_generator": false, - "description": "

True if the button was clicked.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/form.py#L211" - }, - "streamlit.get_option": { - "name": "get_option", - "signature": "st.get_option(key)", - "description": "

Return the current value of a given Streamlit config option.

\n

Run streamlit config show in the terminal to see all available options.

\n", - "args": [ - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show on a terminal.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/config.py#L131" - }, - "streamlit.graphviz_chart": { - "name": "graphviz_chart", - "signature": "st.graphviz_chart(figure_or_dot, use_container_width=False)", - "example": "
\n
\nimport streamlit as st\nimport graphviz\n\n# Create a graphlib graph object\ngraph = graphviz.Digraph()\ngraph.edge('run', 'intr')\ngraph.edge('intr', 'runbl')\ngraph.edge('runbl', 'run')\ngraph.edge('run', 'kernel')\ngraph.edge('kernel', 'zombie')\ngraph.edge('kernel', 'sleep')\ngraph.edge('kernel', 'runmem')\ngraph.edge('sleep', 'swap')\ngraph.edge('swap', 'runswap')\ngraph.edge('runswap', 'new')\ngraph.edge('runswap', 'runmem')\ngraph.edge('new', 'runmem')\ngraph.edge('sleep', 'runmem')\n\nst.graphviz_chart(graph)\n
\n

Or you can render the chart from the graph using GraphViz's Dot\nlanguage:

\n
\nst.graphviz_chart('''\n    digraph {\n        run -> intr\n        intr -> runbl\n        runbl -> run\n        run -> kernel\n        kernel -> zombie\n        kernel -> sleep\n        kernel -> runmem\n        sleep -> swap\n        swap -> runswap\n        runswap -> new\n        runswap -> runmem\n        new -> runmem\n        sleep -> runmem\n    }\n''')\n
\n\n \n
\n", - "description": "

Display a graph using the dagre-d3 library.

\n", - "args": [ - { - "name": "figure_or_dot", - "type_name": "graphviz.dot.Graph, graphviz.dot.Digraph, str", - "is_optional": false, - "description": "

The Graphlib graph object or dot string to display

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the figure's native width value.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/graphviz_chart.py#L39" - }, - "streamlit.header": { - "name": "header", - "signature": "st.header(body, anchor=None, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.header('This is a header')\nst.header('A header with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in header formatting.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "anchor", - "type_name": "str or False", - "is_optional": false, - "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the header.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L40" - }, - "streamlit.help": { - "name": "help", - "signature": "st.help(obj=streamlit)", - "example": "
\n

Don't remember how to initialize a dataframe? Try this:

\n
\nimport streamlit as st\nimport pandas\n\nst.help(pandas.DataFrame)\n
\n\n \n

Want to quickly check what data type is output by a certain function?\nTry:

\n
\nimport streamlit as st\n\nx = my_poorly_documented_function()\nst.help(x)\n
\n

Want to quickly inspect an object? No sweat:

\n
\nclass Dog:\n  '''A typical dog.'''\n\n  def __init__(self, breed, color):\n    self.breed = breed\n    self.color = color\n\n  def bark(self):\n    return 'Woof!'\n\n\nfido = Dog('poodle', 'white')\n\nst.help(fido)\n
\n\n \n

And if you're using Magic, you can get help for functions, classes,\nand modules without even typing st.help:

\n
\nimport streamlit as st\nimport pandas\n\n# Get help for Pandas read_csv:\npandas.read_csv\n\n# Get help for Streamlit itself:\nst\n
\n\n \n
\n", - "description": "

Display help and other information for a given object.

\n

Depending on the type of object that is passed in, this displays the\nobject's name, type, value, signature, docstring, and member variables,\nmethods \u2014 as well as the values/docstring of members and methods.

\n", - "args": [ - { - "name": "obj", - "type_name": "any", - "is_optional": false, - "description": "

The object whose information should be displayed. If left\nunspecified, this call will display help for Streamlit itself.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/doc_string.py#L49" - }, - "streamlit.image": { - "name": "image", - "signature": "st.image(image, caption=None, width=None, use_column_width=None, clamp=False, channels=\"RGB\", output_format=\"auto\")", - "example": "
\n
\nimport streamlit as st\nfrom PIL import Image\n\nimage = Image.open('sunrise.jpg')\n\nst.image(image, caption='Sunrise by the mountains')\n
\n\n \n
\n", - "description": "

Display an image or list of images.

\n", - "args": [ - { - "name": "image", - "type_name": "numpy.ndarray, [numpy.ndarray], BytesIO, str, or [str]", - "is_optional": false, - "description": "

Monochrome image of shape (w,h) or (w,h,1)\nOR a color image of shape (w,h,3)\nOR an RGBA image of shape (w,h,4)\nOR a URL to fetch the image from\nOR a path of a local image file\nOR an SVG XML string like <svg xmlns=...</svg>\nOR a list of one of the above, to display multiple images.

\n", - "default": null - }, - { - "name": "caption", - "type_name": "str or list of str", - "is_optional": false, - "description": "

Image caption. If displaying multiple images, caption should be a\nlist of captions (one for each image).

\n", - "default": null - }, - { - "name": "width", - "type_name": "int or None", - "is_optional": false, - "description": "

Image width. None means use the image width,\nbut do not exceed the width of the column.\nShould be set for SVG images, as they have no default image width.

\n", - "default": "image" - }, - { - "name": "use_column_width", - "type_name": "'auto' or 'always' or 'never' or bool", - "is_optional": false, - "description": "

If 'auto', set the image's width to its natural size,\nbut do not exceed the width of the column.\nIf 'always' or True, set the image's width to the column width.\nIf 'never' or False, set the image's width to its natural size.\nNote: if set, use_column_width takes precedence over the width parameter.

\n", - "default": null - }, - { - "name": "clamp", - "type_name": "bool", - "is_optional": false, - "description": "

Clamp image pixel values to a valid range ([0-255] per channel).\nThis is only meaningful for byte array images; the parameter is\nignored for image URLs. If this is not set, and an image has an\nout-of-range value, an error will be thrown.

\n", - "default": null - }, - { - "name": "channels", - "type_name": "'RGB' or 'BGR'", - "is_optional": false, - "description": "

If image is an nd.array, this parameter denotes the format used to\nrepresent color information. Defaults to 'RGB', meaning\nimage[:, :, 0] is the red channel, image[:, :, 1] is green, and\nimage[:, :, 2] is blue. For images coming from libraries like\nOpenCV you should set this to 'BGR', instead.

\n", - "default": "s" - }, - { - "name": "output_format", - "type_name": "'JPEG', 'PNG', or 'auto'", - "is_optional": false, - "description": "

This parameter specifies the format to use when transferring the\nimage data. Photos should use the JPEG format for lossy compression\nwhile diagrams should use the PNG format for lossless compression.\nDefaults to 'auto' which identifies the compression type based\non the type and format of the image argument.

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/image.py#L88" - }, - "streamlit.info": { - "name": "info", - "signature": "st.info(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.info('This is a purely informational message', icon="\u2139\ufe0f")\n
\n
\n", - "description": "

Display an informational message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The info text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L103" - }, - "streamlit.json": { - "name": "json", - "signature": "st.json(body, *, expanded=True)", - "example": "
\n
\nimport streamlit as st\n\nst.json({\n    'foo': 'bar',\n    'baz': 'boz',\n    'stuff': [\n        'stuff 1',\n        'stuff 2',\n        'stuff 3',\n        'stuff 5',\n    ],\n})\n
\n\n \n
\n", - "description": "

Display object or string as a pretty-printed JSON string.

\n", - "args": [ - { - "name": "body", - "type_name": "object or str", - "is_optional": false, - "description": "

The object to print as JSON. All referenced objects should be\nserializable to JSON as well. If object is a string, we assume it\ncontains serialized JSON.

\n", - "default": null - }, - { - "name": "expanded", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean that allows the user to set whether the initial\nstate of this json element should be expanded. Defaults to True.\nThis argument can only be supplied by keyword.

\n", - "default": "True." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/json.py#L35" - }, - "streamlit.latex": { - "name": "latex", - "signature": "st.latex(body, *, help=None)", - "example": "
\n
\nimport streamlit as st\n\nst.latex(r'''\n    a + ar + a r^2 + a r^3 + \\cdots + a r^{n-1} =\n    \\sum_{k=0}^{n-1} ar^k =\n    a \\left(\\frac{1-r^{n}}{1-r}\\right)\n    ''')\n
\n
\n", - "description": "

Display mathematical expressions formatted as LaTeX.

\n

Supported LaTeX functions are listed at\nhttps://katex.org/docs/supported.html.

\n", - "args": [ - { - "name": "body", - "type_name": "str or SymPy expression", - "is_optional": false, - "description": "

The string or SymPy expression to display as LaTeX. If str, it's\na good idea to use raw Python strings since LaTeX uses backslashes\na lot.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the LaTeX expression.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L196" - }, - "streamlit.line_chart": { - "name": "line_chart", - "signature": "st.line_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nst.line_chart(chart_data)\n
\n\n \n
\n", - "description": "

Display a line chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.line_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None", - "is_optional": false, - "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "x", - "type_name": "str or None", - "is_optional": false, - "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "y", - "type_name": "str, sequence of str, or None", - "is_optional": false, - "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int", - "is_optional": false, - "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int", - "is_optional": false, - "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L160" - }, - "streamlit.map": { - "name": "map", - "signature": "st.map(data=None, zoom=None, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n    np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n    columns=['lat', 'lon'])\n\nst.map(df)\n
\n\n \n
\n", - "description": "

Display a map with points on it.

\n

This is a wrapper around st.pydeck_chart to quickly create\nscatterplot charts on top of a map, with auto-centering and auto-zoom.

\n

When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox.

\n

Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the mapbox.token config option. The use of Mapbox is governed by Mapbox's Terms of Use.

\n

To get a token for yourself, create an account at https://mapbox.com.\nFor more info on how to set config options, see\nhttps://docs.streamlit.io/library/advanced-features/configuration

\n
\n

Streamlit in Snowflake Note

\n

When you use the st.map, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's External Offerings Terms.

\n
\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", - "is_optional": false, - "description": "

The data to be plotted. Must have two columns:

\n
    \n
  • latitude called 'lat', 'latitude', 'LAT', 'LATITUDE'
  • \n
  • longitude called 'lon', 'longitude', 'LON', 'LONGITUDE'.
  • \n
\n", - "default": null - }, - { - "name": "zoom", - "type_name": "int", - "is_optional": false, - "description": "

Zoom level as specified in\nhttps://wiki.openstreetmap.org/wiki/Zoom_levels

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/map.py#L76" - }, - "streamlit.markdown": { - "name": "markdown", - "signature": "st.markdown(body, unsafe_allow_html=False, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.markdown('Streamlit is **_really_ cool**.')\nst.markdown(\u201dThis text is :red[colored red], and this is **:blue[colored]** and bold.\u201d)\nst.markdown(":green[$\\sqrt{x^2+y^2}=1$] is a Pythagorean identity. :pencil:")\n
\n
\n", - "description": "

Display string formatted as Markdown.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The string to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "unsafe_allow_html", - "type_name": "bool", - "is_optional": false, - "description": "

Defaults to False.

\n
\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text.\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the Markdown.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L31" - }, - "streamlit.metric": { - "name": "metric", - "signature": "st.metric(label, value, delta=None, delta_color=\"normal\", help=None, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\nst.metric(label="Temperature", value="70 \u00b0F", delta="1.2 \u00b0F")\n
\n\n \n

st.metric looks especially nice in combination with st.columns:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\ncol1.metric("Temperature", "70 \u00b0F", "1.2 \u00b0F")\ncol2.metric("Wind", "9 mph", "-8%")\ncol3.metric("Humidity", "86%", "4%")\n
\n\n \n

The delta indicator color can also be inverted or turned off:

\n
\nimport streamlit as st\n\nst.metric(label="Gas price", value=4, delta=-0.5,\n    delta_color="inverse")\n\nst.metric(label="Active developers", value=123, delta=123,\n    delta_color="off")\n
\n\n \n
\n", - "description": "

Display a metric in big bold font, with an optional indicator of how the metric changed.

\n

Tip: If you want to display a large number, it may be a good idea to\nshorten it using packages like millify\nor numerize. E.g. 1234 can be\ndisplayed as 1.2k using st.metric("Short number", millify(1234)).

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

The header or title for the metric. The label can optionally contain\nMarkdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "value", - "type_name": "int, float, str, or None", - "is_optional": false, - "description": "

Value of the metric. None is rendered as a long dash.

\n", - "default": null - }, - { - "name": "delta", - "type_name": "int, float, str, or None", - "is_optional": false, - "description": "

Indicator of how the metric changed, rendered with an arrow below\nthe metric. If delta is negative (int/float) or starts with a minus\nsign (str), the arrow points down and the text is red; else the\narrow points up and the text is green. If None (default), no delta\nindicator is shown.

\n", - "default": null - }, - { - "name": "delta_color", - "type_name": "str", - "is_optional": false, - "description": "

If "normal" (default), the delta indicator is shown as described\nabove. If "inverse", it is red when positive and green when\nnegative. This is useful when a negative change is considered\ngood, e.g. if cost decreased. If "off", delta is shown in gray\nregardless of its value.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the metric label.

\n", - "default": null - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/metric.py#L46" - }, - "streamlit.multiselect": { - "name": "multiselect", - "signature": "st.multiselect(label, options, default=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", max_selections=None)", - "example": "
\n
\nimport streamlit as st\n\noptions = st.multiselect(\n    'What are your favorite colors',\n    ['Green', 'Yellow', 'Red', 'Blue'],\n    ['Yellow', 'Red'])\n\nst.write('You selected:', options)\n
\n\n \n
\n", - "description": "

Display a multiselect widget.

\n

The multiselect widget starts as empty.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence[V], numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the select options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", - "default": "." - }, - { - "name": "default", - "type_name": "[V], V, or None", - "is_optional": false, - "description": "

List of default values. Can also be a single value.

\n", - "default": "values." - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of selectbox options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe multiselect.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the multiselect.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this multiselect's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the multiselect widget if set\nto True. The default is False. This argument can only be supplied\nby keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - }, - { - "name": "max_selections", - "type_name": "int", - "is_optional": false, - "description": "

The max selections that can be selected at a time.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "list", - "is_generator": false, - "description": "

A list with the selected options

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/multiselect.py#L145" - }, - "streamlit.number_input": { - "name": "number_input", - "signature": "st.number_input(label, min_value=None, max_value=None, value=, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\nnumber = st.number_input('Insert a number')\nst.write('The current number is ', number)\n
\n\n \n
\n", - "description": "

Display a numeric input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "min_value", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The minimum permitted value.\nIf None, there will be no minimum.

\n", - "default": null - }, - { - "name": "max_value", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The maximum permitted value.\nIf None, there will be no maximum.

\n", - "default": null - }, - { - "name": "value", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The value of this widget when it first renders.\nDefaults to min_value, or 0.0 if min_value is None

\n", - "default": "min_value" - }, - { - "name": "step", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 otherwise.\nIf the value is not specified, the format parameter will be used.

\n", - "default": "1" - }, - { - "name": "format", - "type_name": "str or None", - "is_optional": false, - "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. Output must be purely numeric. This does not impact\nthe return value. Valid formatters: %d %e %f %g %i %u

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this number_input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the number input if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "int or float", - "is_generator": false, - "description": "

The current value of the numeric input widget. The return type\nwill match the data type of the value parameter.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/number_input.py#L66" - }, - "streamlit.plotly_chart": { - "name": "plotly_chart", - "signature": "st.plotly_chart(figure_or_data, use_container_width=False, sharing=\"streamlit\", theme=\"streamlit\", **kwargs)", - "example": "
\n

The example below comes straight from the examples at\nhttps://plot.ly/python:

\n
\nimport streamlit as st\nimport numpy as np\nimport plotly.figure_factory as ff\n\n# Add histogram data\nx1 = np.random.randn(200) - 2\nx2 = np.random.randn(200)\nx3 = np.random.randn(200) + 2\n\n# Group data together\nhist_data = [x1, x2, x3]\n\ngroup_labels = ['Group 1', 'Group 2', 'Group 3']\n\n# Create distplot with custom bin_size\nfig = ff.create_distplot(\n        hist_data, group_labels, bin_size=[.1, .25, .5])\n\n# Plot!\nst.plotly_chart(fig, use_container_width=True)\n
\n\n \n
\n", - "description": "

Display an interactive Plotly chart.

\n

Plotly is a charting library for Python. The arguments to this function\nclosely follow the ones for Plotly's plot() function. You can find\nmore about Plotly at https://plot.ly/python.

\n

To show Plotly charts in Streamlit, call st.plotly_chart wherever you\nwould call Plotly's py.plot or py.iplot.

\n", - "args": [ - { - "name": "figure_or_data", - "type_name": "plotly.graph_objs.Figure, plotly.graph_objs.Data,", - "is_optional": false, - "description": "

dict/list of plotly.graph_objs.Figure/Data

\n

See https://plot.ly/python/ for examples of graph descriptions.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the figure's native width value.

\n", - "default": null - }, - { - "name": "sharing", - "type_name": "{'streamlit', 'private', 'secret', 'public'}", - "is_optional": false, - "description": "

Use 'streamlit' to insert the plot and all its dependencies\ndirectly in the Streamlit app using plotly's offline mode (default).\nUse any other sharing mode to send the chart to Plotly chart studio, which\nrequires an account. See https://plot.ly/python/chart-studio/ for more information.

\n", - "default": null - }, - { - "name": "theme", - "type_name": "\"streamlit\" or None", - "is_optional": false, - "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", - "default": "behavior" - }, - { - "name": "**kwargs", - "type_name": null, - "is_optional": null, - "description": "

Any argument accepted by Plotly's plot() function.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/plotly_chart.py#L81" - }, - "streamlit.progress": { - "name": "progress", - "signature": "st.progress(value, text=None)", - "example": "
\n

Here is an example of a progress bar increasing over time:

\n
\nimport streamlit as st\nimport time\n\nprogress_text = "Operation in progress. Please wait."\nmy_bar = st.progress(0, text=progress_text)\n\nfor percent_complete in range(100):\n    time.sleep(0.1)\n    my_bar.progress(percent_complete + 1, text=progress_text)\n
\n
\n", - "description": "

Display a progress bar.

\n", - "args": [ - { - "name": "value", - "type_name": "int or float", - "is_optional": false, - "description": "

0 <= value <= 100 for int

\n

0.0 <= value <= 1.0 for float

\n", - "default": null - }, - { - "name": "text", - "type_name": "str or None", - "is_optional": false, - "description": "

A message to display above the progress bar. The text can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/progress.py#L66" - }, - "streamlit.pydeck_chart": { - "name": "pydeck_chart", - "signature": "st.pydeck_chart(pydeck_obj=None, use_container_width=False)", - "example": "
\n

Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the\nlight or dark map style, based on which Streamlit theme is currently active:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport pydeck as pdk\n\nchart_data = pd.DataFrame(\n   np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n   columns=['lat', 'lon'])\n\nst.pydeck_chart(pdk.Deck(\n    map_style=None,\n    initial_view_state=pdk.ViewState(\n        latitude=37.76,\n        longitude=-122.4,\n        zoom=11,\n        pitch=50,\n    ),\n    layers=[\n        pdk.Layer(\n           'HexagonLayer',\n           data=chart_data,\n           get_position='[lon, lat]',\n           radius=200,\n           elevation_scale=4,\n           elevation_range=[0, 1000],\n           pickable=True,\n           extruded=True,\n        ),\n        pdk.Layer(\n            'ScatterplotLayer',\n            data=chart_data,\n            get_position='[lon, lat]',\n            get_color='[200, 30, 0, 160]',\n            get_radius=200,\n        ),\n    ],\n))\n
\n\n \n
\n

Note

\n

To make the PyDeck chart's style consistent with Streamlit's theme,\nyou can set map_style=None in the pydeck.Deck object.

\n
\n
\n", - "description": "

Draw a chart using the PyDeck library.

\n

This supports 3D maps, point clouds, and more! More info about PyDeck\nat https://deckgl.readthedocs.io/en/latest/.

\n

These docs are also quite useful:

\n\n

When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox.

\n

Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the mapbox.token config option.The use of Mapbox is governed by Mapbox's Terms of Use.

\n

To get a token for yourself, create an account at https://mapbox.com.\nFor more info on how to set config options, see\nhttps://docs.streamlit.io/library/advanced-features/configuration

\n
\n

Streamlit in Snowflake Note

\n

When you use the st.pydeck_chart, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's External Offerings Terms.

\n
\n", - "args": [ - { - "name": "pydeck_obj", - "type_name": "pydeck.Deck or None", - "is_optional": false, - "description": "

Object specifying the PyDeck chart to draw.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/deck_gl_json_chart.py#L36" - }, - "streamlit.pyplot": { - "name": "pyplot", - "signature": "st.pyplot(fig=None, clear_figure=None, use_container_width=True, **kwargs)", - "notes": "
\n
\n

Note

\n

Deprecation warning. After December 1st, 2020, we will remove the ability\nto specify no arguments in st.pyplot(), as that requires the use of\nMatplotlib's global figure object, which is not thread-safe. So\nplease always pass a figure object as shown in the example section\nabove.

\n
\n

Matplotlib supports several types of "backends". If you're getting an\nerror using Matplotlib with Streamlit, try setting your backend to "TkAgg":

\n
\necho "backend: TkAgg" >> ~/.matplotlib/matplotlibrc\n
\n

For more information, see https://matplotlib.org/faq/usage_faq.html.

\n
\n", - "example": "
\n
\nimport streamlit as st\nimport matplotlib.pyplot as plt\nimport numpy as np\n\narr = np.random.normal(1, 1, size=100)\nfig, ax = plt.subplots()\nax.hist(arr, bins=20)\n\nst.pyplot(fig)\n
\n\n \n
\n", - "description": "

Display a matplotlib.pyplot figure.

\n", - "args": [ - { - "name": "fig", - "type_name": "Matplotlib Figure", - "is_optional": false, - "description": "

The figure to plot. When this argument isn't specified, this\nfunction will render the global figure (but this is deprecated,\nas described below)

\n", - "default": null - }, - { - "name": "clear_figure", - "type_name": "bool", - "is_optional": false, - "description": "

If True, the figure will be cleared after being rendered.\nIf False, the figure will not be cleared after being rendered.\nIf left unspecified, we pick a default based on the value of fig.

\n
    \n
  • If fig is set, defaults to False.
  • \n
  • If fig is not set, defaults to True. This simulates Jupyter's\napproach to matplotlib rendering.
  • \n
\n", - "default": "based" - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. Defaults to True.

\n", - "default": "s" - }, - { - "name": "**kwargs", - "type_name": "any", - "is_optional": false, - "description": "

Arguments to pass to Matplotlib's savefig function.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/pyplot.py#L38" - }, - "streamlit.radio": { - "name": "radio", - "signature": "st.radio(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, horizontal=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ngenre = st.radio(\n    "What\\'s your favorite movie genre",\n    ('Comedy', 'Drama', 'Documentary'))\n\nif genre == 'Comedy':\n    st.write('You selected comedy.')\nelse:\n    st.write("You didn\\'t select comedy.")\n
\n\n \n
\n", - "description": "

Display a radio button widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this radio group is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the radio options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", - "default": "." - }, - { - "name": "index", - "type_name": "int", - "is_optional": false, - "description": "

The index of the preselected option on first render.

\n", - "default": null - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of radio options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe radio.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the radio.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this radio's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the radio button if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", - "default": "False." - }, - { - "name": "horizontal", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which orients the radio group horizontally.\nThe default is false (vertical buttons). This argument can only\nbe supplied by keyword.

\n", - "default": "false" - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "any", - "is_generator": false, - "description": "

The selected option.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/radio.py#L75" - }, - "streamlit.select_slider": { - "name": "select_slider", - "signature": "st.select_slider(label, options=(), value=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "examples": "
\nimport streamlit as st\n\ncolor = st.select_slider(\n    'Select a color of the rainbow',\n    options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'])\nst.write('My favorite color is', color)\n
\n

And here's an example of a range select slider:

\n
\nimport streamlit as st\n\nstart_color, end_color = st.select_slider(\n    'Select a range of color wavelength',\n    options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'],\n    value=('red', 'blue'))\nst.write('You selected wavelengths between', start_color, 'and', end_color)\n
\n\n \n ", - "description": "

Display a slider widget to select items from a list.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.select_slider and st.slider is that\nselect_slider accepts any datatype and takes an iterable set of\noptions, while slider only accepts numerical or date/time data and\ntakes a range as input.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the slider options. All options will be cast to str\ninternally by default. For pandas.DataFrame, the first column is\nselected.

\n", - "default": "." - }, - { - "name": "value", - "type_name": "a supported type or a tuple/list of supported types or None", - "is_optional": false, - "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to first option.

\n", - "default": "first" - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of the labels from the options.\nargument. It receives the option as an argument and its output\nwill be cast to str.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the select slider.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this select_slider's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the select slider if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "any value or tuple of any value", - "is_generator": false, - "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/select_slider.py#L106" - }, - "streamlit.selectbox": { - "name": "selectbox", - "signature": "st.selectbox(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\noption = st.selectbox(\n    'How would you like to be contacted?',\n    ('Email', 'Home phone', 'Mobile phone'))\n\nst.write('You selected:', option)\n
\n\n \n
\n", - "description": "

Display a select widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the select options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", - "default": "." - }, - { - "name": "index", - "type_name": "int", - "is_optional": false, - "description": "

The index of the preselected option on first render.

\n", - "default": null - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of the labels. It receives the option\nas an argument and its output will be cast to str.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the selectbox.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this selectbox's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the selectbox if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "any", - "is_generator": false, - "description": "

The selected option

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/selectbox.py#L71" - }, - "streamlit.set_option": { - "name": "set_option", - "signature": "st.set_option(key, value)", - "description": "

Set config option.

\n
\n
Currently, only the following config options can be set within the script itself:
\n
    \n
  • client.caching
  • \n
  • client.displayEnabled
  • \n
  • deprecation.*
  • \n
\n
\n
\n

Calling with any other options will raise StreamlitAPIException.

\n

Run streamlit config show in the terminal to see all available options.

\n", - "args": [ - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show on a terminal.

\n", - "default": null - }, - { - "name": "value", - "type_name": null, - "is_optional": null, - "description": "

The new value to assign to this config option.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/config.py#L92" - }, - "streamlit.set_page_config": { - "name": "set_page_config", - "signature": "st.set_page_config(page_title=None, page_icon=None, layout=\"centered\", initial_sidebar_state=\"auto\", menu_items=None)", - "example": "
\nimport streamlit as st\n\nst.set_page_config(\n    page_title="Ex-stream-ly Cool App",\n    page_icon="\ud83e\uddca",\n    layout="wide",\n    initial_sidebar_state="expanded",\n    menu_items={\n        'Get Help': 'https://www.extremelycoolapp.com/help',\n        'Report a bug': "https://www.extremelycoolapp.com/bug",\n        'About': "# This is a header. This is an *extremely* cool app!"\n    }\n)\n
\n", - "description": "

Configures the default settings of the page.

\n
\n

Note

\n

This must be the first Streamlit command used in your app, and must only\nbe set once.

\n
\n", - "args": [ - { - "name": "page_title", - "type_name": "str or None", - "is_optional": false, - "description": "

The page title, shown in the browser tab.\n

\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake.

\n
\n", - "default": "the" - }, - { - "name": "page_icon", - "type_name": "Anything supported by st.image or str or None", - "is_optional": false, - "description": "

The page favicon.\n

\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake.

\n
\n", - "default": null - }, - { - "name": "layout", - "type_name": "\"centered\" or \"wide\"", - "is_optional": false, - "description": "

How the page content should be laid out. Defaults to "centered",\nwhich constrains the elements into a centered column of fixed width;\n"wide" uses the entire screen.

\n", - "default": "s" - }, - { - "name": "initial_sidebar_state", - "type_name": "\"auto\" or \"expanded\" or \"collapsed\"", - "is_optional": false, - "description": "

How the sidebar should start out. Defaults to "auto",\nwhich hides the sidebar on mobile-sized devices, and shows it otherwise.\n"expanded" shows the sidebar initially; "collapsed" hides it.

\n", - "default": "s" - }, - { - "name": "menu_items", - "type_name": "dict", - "is_optional": false, - "description": "

Configure the menu that appears on the top-right side of this app.\nThe keys in this dict denote the menu item you'd like to configure:

\n
    \n
  • \n
    "Get help": str or None
    \n
    The URL this menu item should point to.\nIf None, hides this menu item.
    \n
    \n
  • \n
  • \n
    "Report a Bug": str or None
    \n
    The URL this menu item should point to.\nIf None, hides this menu item.
    \n
    \n
  • \n
  • \n
    "About": str or None
    \n
    A markdown string to show in the About dialog.\nIf None, only shows Streamlit's default About text.
    \n
    \n
  • \n
\n

The URL may also refer to an email address e.g. mailto:john@example.com.

\n", - "default": "About" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/page_config.py#L114" - }, - "streamlit.slider": { - "name": "slider", - "signature": "st.slider(label, min_value=None, max_value=None, value=None, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "examples": "
\n
\nimport streamlit as st\n\nage = st.slider('How old are you?', 0, 130, 25)\nst.write("I'm ", age, 'years old')\n
\n

And here's an example of a range slider:

\n
\nimport streamlit as st\n\nvalues = st.slider(\n    'Select a range of values',\n    0.0, 100.0, (25.0, 75.0))\nst.write('Values:', values)\n
\n

This is a range time slider:

\n
\nimport streamlit as st\nfrom datetime import time\n\nappointment = st.slider(\n    "Schedule your appointment:",\n    value=(time(11, 30), time(12, 45)))\nst.write("You're scheduled for:", appointment)\n
\n

Finally, a datetime slider:

\n
\nimport streamlit as st\nfrom datetime import datetime\n\nstart_time = st.slider(\n    "When do you start?",\n    value=datetime(2020, 1, 1, 9, 30),\n    format="MM/DD/YY - hh:mm")\nst.write("Start time:", start_time)\n
\n\n \n
\n", - "description": "

Display a slider widget.

\n

This supports int, float, date, time, and datetime types.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.slider and st.select_slider is that\nslider only accepts numerical or date/time data and takes a range as\ninput, while select_slider accepts any datatype and takes an iterable\nset of options.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "min_value", - "type_name": "a supported type or None", - "is_optional": false, - "description": "

The minimum permitted value.\nDefaults to 0 if the value is an int, 0.0 if a float,\nvalue - timedelta(days=14) if a date/datetime, time.min if a time

\n", - "default": "0" - }, - { - "name": "max_value", - "type_name": "a supported type or None", - "is_optional": false, - "description": "

The maximum permitted value.\nDefaults to 100 if the value is an int, 1.0 if a float,\nvalue + timedelta(days=14) if a date/datetime, time.max if a time

\n", - "default": "100" - }, - { - "name": "value", - "type_name": "a supported type or a tuple/list of supported types or None", - "is_optional": false, - "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to min_value.

\n", - "default": "min_value." - }, - { - "name": "step", - "type_name": "int/float/timedelta or None", - "is_optional": false, - "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 if a float,\ntimedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time\n(or if max_value - min_value < 1 day)

\n", - "default": "1" - }, - { - "name": "format", - "type_name": "str or None", - "is_optional": false, - "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. This does not impact the return value.\nFormatter for int/float supports: %d %e %f %g %i\nFormatter for date/time/datetime uses Moment.js notation:\nhttps://momentjs.com/docs/#/displaying/format/

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the slider.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this slider's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the slider if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "int/float/date/time/datetime or tuple of int/float/date/time/datetime", - "is_generator": false, - "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/slider.py#L171" - }, - "streamlit.snow": { - "name": "snow", - "signature": "st.snow()", - "example": "
\n
\nimport streamlit as st\n\nst.snow()\n
\n

...then watch your app and get ready for a cool celebration!

\n
\n", - "description": "

Draw celebratory snowfall.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/snow.py#L25" - }, - "streamlit.spinner": { - "name": "spinner", - "signature": "st.spinner(text=\"In progress...\")", - "example": "
\n
\nimport time\nimport streamlit as st\n\nwith st.spinner('Wait for it...'):\n    time.sleep(5)\nst.success('Done!')\n
\n
\n", - "description": "

Temporarily displays a message while executing a block of code.

\n", - "args": [ - { - "name": "text", - "type_name": "str", - "is_optional": false, - "description": "

A message to display while executing that block

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/spinner.py#L23" - }, - "streamlit.stop": { - "name": "stop", - "signature": "st.stop()", - "example": "
\n
\nimport streamlit as st\n\nname = st.text_input('Name')\nif not name:\n  st.warning('Please input a name.')\n  st.stop()\nst.success('Thank you for inputting a name.')\n
\n
\n", - "description": "

Stops execution immediately.

\n

Streamlit will not run any statements after st.stop().\nWe recommend rendering a message to explain why the script has stopped.\nWhen run outside of Streamlit, this will raise an Exception.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/execution_control.py#L25" - }, - "streamlit.subheader": { - "name": "subheader", - "signature": "st.subheader(body, anchor=None, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.subheader('This is a subheader')\nst.subheader('A subheader with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in subheader formatting.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "anchor", - "type_name": "str or False", - "is_optional": false, - "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the subheader.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L93" - }, - "streamlit.success": { - "name": "success", - "signature": "st.success(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.success('This is a success message!', icon="\u2705")\n
\n
\n", - "description": "

Display a success message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The success text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L136" - }, - "streamlit.table": { - "name": "table", - "signature": "st.table(data=None)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(10, 5),\n   columns=('col %d' % i for i in range(5)))\n\nst.table(df)\n
\n\n \n
\n", - "description": "

Display a static table.

\n

This differs from st.dataframe in that the table in this case is\nstatic: its entire contents are laid out directly on the page.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", - "is_optional": false, - "description": "

The table data.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L122" - }, - "streamlit.tabs": { - "name": "tabs", - "signature": "st.tabs(tabs)", - "examples": "
\n

You can use with notation to insert any element into a tab:

\n
\nimport streamlit as st\n\ntab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])\n\nwith tab1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg", width=200)\n\nwith tab2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\n\nwith tab3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ntab1, tab2 = st.tabs(["\ud83d\udcc8 Chart", "\ud83d\uddc3 Data"])\ndata = np.random.randn(10, 1)\n\ntab1.subheader("A tab with a chart")\ntab1.line_chart(data)\n\ntab2.subheader("A tab with the data")\ntab2.write(data)\n
\n\n \n
\n", - "description": "

Insert containers separated into tabs.

\n

Inserts a number of multi-element containers as tabs.\nTabs are a navigational element that allows users to easily\nmove between groups of related content.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

All the content of every tab is always sent to and rendered on the frontend.\nConditional rendering is currently not supported.

\n
\n", - "args": [ - { - "name": "tabs", - "type_name": "list of strings", - "is_optional": false, - "description": "

Creates a tab for each string in the list. The first tab is selected by default.\nThe string is used as the name of the tab and can optionally contain Markdown,\nsupporting the following elements: Bold, Italics, Strikethroughs, Inline Code,\nEmojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": "." - } - ], - "returns": [ - { - "type_name": "list of containers", - "is_generator": false, - "description": "

A list of container objects.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L208" - }, - "streamlit.text": { - "name": "text", - "signature": "st.text(body, *, help=None)", - "example": "
\n
\nimport streamlit as st\n\nst.text('This is some text.')\n
\n
\n", - "description": "

Write fixed-width and preformatted text.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The string to display.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the text.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text.py#L27" - }, - "streamlit.text_area": { - "name": "text_area", - "signature": "st.text_area(label, value=\"\", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ntxt = st.text_area('Text to analyze', '''\n    It was the best of times, it was the worst of times, it was\n    the age of wisdom, it was the age of foolishness, it was\n    the epoch of belief, it was the epoch of incredulity, it\n    was the season of Light, it was the season of Darkness, it\n    was the spring of hope, it was the winter of despair, (...)\n    ''')\nst.write('Sentiment:', run_sentiment_analysis(txt))\n
\n
\n", - "description": "

Display a multi-line text input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "object", - "is_optional": false, - "description": "

The text value of this widget when it first renders. This will be\ncast to str internally.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired height of the UI element expressed in pixels. If None, a\ndefault height is used.

\n", - "default": "height" - }, - { - "name": "max_chars", - "type_name": "int or None", - "is_optional": false, - "description": "

Maximum number of characters allowed in text area.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the textarea.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this text_area's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "placeholder", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional string displayed when the text area is empty. If None,\nno text is displayed. This argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the text area if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "str", - "is_generator": false, - "description": "

The current value of the text input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text_widgets.py#L274" - }, - "streamlit.text_input": { - "name": "text_input", - "signature": "st.text_input(label, value=\"\", max_chars=None, key=None, type=\"default\", help=None, autocomplete=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ntitle = st.text_input('Movie title', 'Life of Brian')\nst.write('The current movie title is', title)\n
\n\n \n
\n", - "description": "

Display a single-line text input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "object", - "is_optional": false, - "description": "

The text value of this widget when it first renders. This will be\ncast to str internally.

\n", - "default": null - }, - { - "name": "max_chars", - "type_name": "int or None", - "is_optional": false, - "description": "

Max number of characters allowed in text input.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "type", - "type_name": "\"default\" or \"password\"", - "is_optional": false, - "description": "

The type of the text input. This can be either "default" (for\na regular text input), or "password" (for a text input that\nmasks the user's typed value). Defaults to "default".

\n", - "default": "s" - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "autocomplete", - "type_name": "str", - "is_optional": false, - "description": "

An optional value that will be passed to the <input> element's\nautocomplete property. If unspecified, this value will be set to\n"new-password" for "password" inputs, and the empty string for\n"default" inputs. For more details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this text input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "placeholder", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional string displayed when the text input is empty. If None,\nno text is displayed. This argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the text input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "str", - "is_generator": false, - "description": "

The current value of the text input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text_widgets.py#L71" - }, - "streamlit.time_input": { - "name": "time_input", - "signature": "st.time_input(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", step=0:15:00)", - "example": "
\n
\nimport datetime\nimport streamlit as st\n\nt = st.time_input('Set an alarm for', datetime.time(8, 45))\nst.write('Alarm is set for', t)\n
\n\n \n
\n", - "description": "

Display a time input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this time input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "datetime.time/datetime.datetime", - "is_optional": false, - "description": "

The value of this widget when it first renders. This will be\ncast to str internally. Defaults to the current time.

\n", - "default": "the" - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this time_input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the time input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - }, - { - "name": "step", - "type_name": "int or timedelta", - "is_optional": false, - "description": "

The stepping interval in seconds. Defaults to 900, i.e. 15 minutes.\nYou can also pass a datetime.timedelta object.

\n", - "default": "900" - } - ], - "returns": [ - { - "type_name": "datetime.time", - "is_generator": false, - "description": "

The current value of the time input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/time_widgets.py#L214" - }, - "streamlit.title": { - "name": "title", - "signature": "st.title(body, anchor=None, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.title('This is a title')\nst.title('A title with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in title formatting.

\n

Each document should have a single st.title(), although this is not\nenforced.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "anchor", - "type_name": "str or False", - "is_optional": false, - "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the title.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L146" - }, - "streamlit.vega_lite_chart": { - "name": "vega_lite_chart", - "signature": "st.vega_lite_chart(data=None, spec=None, use_container_width=False, theme=\"streamlit\", **kwargs)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(200, 3),\n    columns=['a', 'b', 'c'])\n\nst.vega_lite_chart(chart_data, {\n    'mark': {'type': 'circle', 'tooltip': True},\n    'encoding': {\n        'x': {'field': 'a', 'type': 'quantitative'},\n        'y': {'field': 'b', 'type': 'quantitative'},\n        'size': {'field': 'c', 'type': 'quantitative'},\n        'color': {'field': 'c', 'type': 'quantitative'},\n    },\n})\n
\n\n \n

Examples of Vega-Lite usage without Streamlit can be found at\nhttps://vega.github.io/vega-lite/examples/. Most of those can be easily\ntranslated to the syntax shown above.

\n
\n", - "description": "

Display a chart using the Vega-Lite library.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None", - "is_optional": false, - "description": "

Either the data to be plotted or a Vega-Lite spec containing the\ndata (which more closely follows the Vega-Lite API).\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "spec", - "type_name": "dict or None", - "is_optional": false, - "description": "

The Vega-Lite spec for the chart. If the spec was already passed in\nthe previous argument, this must be set to None. See\nhttps://vega.github.io/vega-lite/docs/ for more info.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over Vega-Lite's native width value.

\n", - "default": null - }, - { - "name": "theme", - "type_name": "\"streamlit\" or None", - "is_optional": false, - "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", - "default": "behavior" - }, - { - "name": "**kwargs", - "type_name": "any", - "is_optional": false, - "description": "

Same as spec, but as keywords.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L475" - }, - "streamlit.video": { - "name": "video", - "signature": "st.video(data, format=\"video/mp4\", start_time=0)", - "example": "
\n
\nimport streamlit as st\n\nvideo_file = open('myvideo.mp4', 'rb')\nvideo_bytes = video_file.read()\n\nst.video(video_bytes)\n
\n\n \n
\n

Note

\n

Some videos may not display if they are encoded using MP4V (which is an export option in OpenCV), as this codec is\nnot widely supported by browsers. Converting your video to H.264 will allow the video to be displayed in Streamlit.\nSee this StackOverflow post or this\nStreamlit forum post\nfor more information.

\n
\n
\n", - "description": "

Display a video player.

\n", - "args": [ - { - "name": "data", - "type_name": "str, bytes, BytesIO, numpy.ndarray, or file opened with", - "is_optional": false, - "description": "

io.open().\nRaw video data, filename, or URL pointing to a video to load.\nIncludes support for YouTube URLs.\nNumpy arrays and raw data formats must include all necessary file\nheaders to match specified file format.

\n", - "default": null - }, - { - "name": "format", - "type_name": "str", - "is_optional": false, - "description": "

The mime type for the video file. Defaults to 'video/mp4'.\nSee https://tools.ietf.org/html/rfc4281 for more info.

\n", - "default": "s" - }, - { - "name": "start_time", - "type_name": "int", - "is_optional": false, - "description": "

The time from which this element should start playing.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/media.py#L117" - }, - "streamlit.warning": { - "name": "warning", - "signature": "st.warning(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.warning('This is a warning', icon="\u26a0\ufe0f")\n
\n
\n", - "description": "

Display warning message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The warning text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L71" - }, - "streamlit.write": { - "name": "write", - "signature": "st.write(*args, unsafe_allow_html=False, **kwargs)", - "example": "
\n

Its basic use case is to draw Markdown-formatted text, whenever the\ninput is a string:

\n
\nimport streamlit as st\n\nst.write('Hello, *World!* :sunglasses:')\n
\n\n \n

As mentioned earlier, st.write() also accepts other data formats, such as\nnumbers, data frames, styled data frames, and assorted objects:

\n
\nimport streamlit as st\nimport pandas as pd\n\nst.write(1234)\nst.write(pd.DataFrame({\n    'first column': [1, 2, 3, 4],\n    'second column': [10, 20, 30, 40],\n}))\n
\n\n \n

Finally, you can pass in multiple arguments to do things like:

\n
\nimport streamlit as st\n\nst.write('1 + 1 = ', 2)\nst.write('Below is a DataFrame:', data_frame, 'Above is a dataframe.')\n
\n\n \n

Oh, one more thing: st.write accepts chart objects too! For example:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\ndf = pd.DataFrame(\n    np.random.randn(200, 3),\n    columns=['a', 'b', 'c'])\n\nc = alt.Chart(df).mark_circle().encode(\n    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.write(c)\n
\n\n \n
\n", - "description": "

Write arguments to the app.

\n

This is the Swiss Army knife of Streamlit commands: it does different\nthings depending on what you throw at it. Unlike other Streamlit commands,\nwrite() has some unique properties:

\n
    \n
  1. You can pass in multiple arguments, all of which will be written.
  2. \n
  3. Its behavior depends on the input types as follows.
  4. \n
  5. It returns None, so its "slot" in the App cannot be reused.
  6. \n
\n", - "args": [ - { - "name": "*args", - "type_name": "any", - "is_optional": false, - "description": "

One or many objects to print to the App.

\n

Arguments are handled as follows:

\n
    \n
  • \n
    write(string) : Prints the formatted Markdown string, with
    \n
    support for LaTeX expression, emoji shortcodes, and colored text.\nSee docs for st.markdown for more.
    \n
    \n
  • \n
  • write(data_frame) : Displays the DataFrame as a table.
  • \n
  • write(error) : Prints an exception specially.
  • \n
  • write(func) : Displays information about a function.
  • \n
  • write(module) : Displays information about the module.
  • \n
  • write(class) : Displays information about a class.
  • \n
  • write(dict) : Displays dict in an interactive widget.
  • \n
  • write(mpl_fig) : Displays a Matplotlib figure.
  • \n
  • write(altair) : Displays an Altair chart.
  • \n
  • write(keras) : Displays a Keras model.
  • \n
  • write(graphviz) : Displays a Graphviz graph.
  • \n
  • write(plotly_fig) : Displays a Plotly figure.
  • \n
  • write(bokeh_fig) : Displays a Bokeh figure.
  • \n
  • write(sympy_expr) : Prints SymPy expression using LaTeX.
  • \n
  • write(htmlable) : Prints _repr_html_() for the object if available.
  • \n
  • write(obj) : Prints str(obj) if otherwise unknown.
  • \n
\n", - "default": null - }, - { - "name": "unsafe_allow_html", - "type_name": "bool", - "is_optional": false, - "description": "

This is a keyword-only argument that defaults to False.

\n

By default, any HTML tags found in strings will be escaped and\ntherefore treated as pure text. This behavior may be turned off by\nsetting this argument to True.

\n

That said, we strongly advise against it. It is hard to write secure\nHTML, so by using this argument you may be compromising your users'\nsecurity. For more information, see:

\n

https://github.com/streamlit/streamlit/issues/152

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/write.py#L48" - }, - "streamlit.experimental_memo.clear": { - "name": "experimental_memo.clear", - "signature": "st.experimental_memo.clear()", - "description": "

Clear all in-memory and on-disk data caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L541" - }, - "streamlit.cache_data.clear": { - "name": "cache_data.clear", - "signature": "st.cache_data.clear()", - "description": "

Clear all in-memory and on-disk data caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L541" - }, - "streamlit.experimental_singleton.clear": { - "name": "experimental_singleton.clear", - "signature": "st.experimental_singleton.clear()", - "description": "

Clear all cache_resource caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L396" - }, - "streamlit.cache_resource.clear": { - "name": "cache_resource.clear", - "signature": "st.cache_resource.clear()", - "description": "

Clear all cache_resource caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L396" - }, - "streamlit.connections.ExperimentalBaseConnection": { - "name": "ExperimentalBaseConnection", - "signature": "st.connections.ExperimentalBaseConnection(connection_name, **kwargs)", - "is_class": true, - "methods": [ - { - "name": "reset", - "signature": "st.connections.reset.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - } - ], - "properties": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L25", - "description": "

The abstract base class that all Streamlit Connections must inherit from.

\n

This base class provides connection authors with a standardized way to hook into the\nst.experimental_connection() factory function: connection authors are required to\nprovide an implementation for the abstract method _connect in their subclasses.

\n

Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information

\n
\n

Note

\n

While providing an implementation of _connect is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a query() method for\nreads and a session property for more complex operations.

\n
\n", - "args": [], - "returns": [] - }, - "streamlit.connections.SQLConnection": { - "name": "SQLConnection", - "signature": "st.connections.SQLConnection(connection_name, **kwargs)", - "is_class": true, - "methods": [ - { - "name": "query", - "signature": "st.connections.query.query(sql, *, ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only query.

", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "index_col", - "type_name": "str, list of str, or None", - "is_optional": false, - "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", - "default": "None." - }, - { - "name": "chunksize", - "type_name": "int or None", - "is_optional": false, - "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", - "default": "None." - }, - { - "name": "params", - "type_name": "list, tuple, dict or None", - "is_optional": false, - "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", - "default": "None." - }, - { - "name": "**kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

Additional keyword arguments are passed to pd.read_sql.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L121" - }, - { - "name": "reset", - "signature": "st.connections.reset.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - } - ], - "properties": [ - { - "name": "session", - "signature": "st.connections.session.session", - "example": "
\n
\nimport streamlit as st\nconn = st.experimental_connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n
\n", - "description": "

Return a SQLAlchemy Session.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L226" - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L45", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", - "description": "

A connection to a SQL database using a SQLAlchemy Engine. Initialize using st.experimental_connection("<name>", type="sql").

\n

SQLConnection provides the query() convenience method, which can be used to\nrun simple read-only queries with both caching and simple error handling/retries.\nMore complex DB interactions can be performed by using the .session property\nto receive a regular SQLAlchemy Session.

\n

SQLConnections should always be created using st.experimental_connection(),\nnot initialized directly. Connection parameters for a SQLConnection can be\nspecified using either st.secrets or **kwargs. Some frequently used\nparameters include:

\n
    \n
  • url or arguments for sqlalchemy.engine.URL.create().\nMost commonly it includes a dialect, host, database, username and password.
  • \n
  • create_engine_kwargs can be passed via st.secrets, such as for\nsnowflake-sqlalchemy\nor Google BigQuery.\nThese can also be passed directly as **kwargs to experimental_connection().
  • \n
  • autocommit=True to run with isolation level AUTOCOMMIT. Default is False.
  • \n
\n", - "args": [], - "returns": [] - }, - "streamlit.connections.SnowparkConnection": { - "name": "SnowparkConnection", - "signature": "st.connections.SnowparkConnection(connection_name, **kwargs)", - "is_class": true, - "methods": [ - { - "name": "query", - "signature": "st.connections.query.query(sql, ttl=None)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only SQL query.

", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L123" - }, - { - "name": "reset", - "signature": "st.connections.reset.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - { - "name": "safe_session", - "signature": "st.connections.safe_session.safe_session()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\nwith conn.safe_session() as session:\n    df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n
\n
\n", - "description": "

Grab the underlying Snowpark session in a thread-safe manner.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L207" - } - ], - "properties": [ - { - "name": "session", - "signature": "st.connections.session.session", - "example": "
\n
\nimport streamlit as st\n\nsession = st.experimental_connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n
\n
\n", - "description": "

Access the underlying Snowpark session.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L184" - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L70", - "description": "

A connection to Snowpark using snowflake.snowpark.session.Session. Initialize using

\n

st.experimental_connection("<name>", type="snowpark").

\n

In addition to accessing the Snowpark Session, SnowparkConnection supports direct SQL querying using\nquery("...") and thread safe access using with conn.safe_session():. See methods\nbelow for more information. SnowparkConnections should always be created using\nst.experimental_connection(), not initialized directly.

\n
\n

Note

\n

We don't expect this iteration of SnowparkConnection to be able to scale\nwell in apps with many concurrent users due to the lock contention that will occur\nover the single underlying Session object under high load.

\n
\n", - "args": [], - "returns": [] - }, - "streamlit.connections.SQLConnection.query": { - "name": "query", - "signature": "SQLConnection.query(sql, *, ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only query.

\n

This method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n

Aside from the ttl kwarg, all kwargs passed to this function are passed down\nto pd.read_sql\nand have the behavior described in the pandas documentation.

\n", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "index_col", - "type_name": "str, list of str, or None", - "is_optional": false, - "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", - "default": "None." - }, - { - "name": "chunksize", - "type_name": "int or None", - "is_optional": false, - "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", - "default": "None." - }, - { - "name": "params", - "type_name": "list, tuple, dict or None", - "is_optional": false, - "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", - "default": "None." - }, - { - "name": "**kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

Additional keyword arguments are passed to pd.read_sql.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L121" - }, - "streamlit.connections.SQLConnection.reset": { - "name": "reset", - "signature": "SQLConnection.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - "streamlit.connections.SQLConnection.session": { - "name": "session", - "signature": "SQLConnection.session", - "example": "
\n
\nimport streamlit as st\nconn = st.experimental_connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n
\n", - "description": "

Return a SQLAlchemy Session.

\n

Users of this connection should use the contextmanager pattern for writes,\ntransactions, and anything more complex than simple read queries.

\n

See the usage example below, which assumes we have a table numbers with a\nsingle integer column val. The SQLAlchemy docs also contain\nmuch more information on the usage of sessions.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L226" - }, - "streamlit.connections.SnowparkConnection.query": { - "name": "query", - "signature": "SnowparkConnection.query(sql, ttl=None)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only SQL query.

\n

This method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L123" - }, - "streamlit.connections.SnowparkConnection.reset": { - "name": "reset", - "signature": "SnowparkConnection.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - "streamlit.connections.SnowparkConnection.safe_session": { - "name": "safe_session", - "signature": "SnowparkConnection.safe_session()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\nwith conn.safe_session() as session:\n    df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n
\n
\n", - "description": "

Grab the underlying Snowpark session in a thread-safe manner.

\n

As operations on a Snowpark session are not thread safe, we need to take care\nwhen using a session in the context of a Streamlit app where each script run\noccurs in its own thread. Using the contextmanager pattern to do this ensures\nthat access on this connection's underlying Session is done in a thread-safe\nmanner.

\n

Information on how to use Snowpark sessions can be found in the Snowpark documentation.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L207" - }, - "streamlit.connections.SnowparkConnection.session": { - "name": "session", - "signature": "SnowparkConnection.session", - "example": "
\n
\nimport streamlit as st\n\nsession = st.experimental_connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n
\n
\n", - "description": "

Access the underlying Snowpark session.

\n
\n

Note

\n

Snowpark sessions are not thread safe. Users of this method are\nresponsible for ensuring that access to the session returned by this method is\ndone in a thread-safe manner. For most users, we recommend using the thread-safe\nsafe_session() method and a with block.

\n
\n

Information on how to use Snowpark sessions can be found in the Snowpark documentation.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L184" - }, - "streamlit.connections.ExperimentalBaseConnection.reset": { - "name": "reset", - "signature": "ExperimentalBaseConnection.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - "DeltaGenerator.add_rows": { - "name": "add_rows", - "signature": "element.add_rows(data=None, **kwargs)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf1 = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nmy_table = st.table(df1)\n\ndf2 = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nmy_table.add_rows(df2)\n# Now the table shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n
\n

You can do the same thing with plots. For example, if you want to add\nmore data to a line chart:

\n
\n# Assuming df1 and df2 from the example above still exist...\nmy_chart = st.line_chart(df1)\nmy_chart.add_rows(df2)\n# Now the chart shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n
\n

And for plots whose datasets are named, you can pass the data with a\nkeyword argument where the key is the name:

\n
\nmy_chart = st.vega_lite_chart({\n    'mark': 'line',\n    'encoding': {'x': 'a', 'y': 'b'},\n    'datasets': {\n      'some_fancy_name': df1,  # <-- named dataset\n     },\n    'data': {'name': 'some_fancy_name'},\n}),\nmy_chart.add_rows(some_fancy_name=df2)  # <-- name used as keyword\n
\n
\n", - "description": "

Concatenate a dataframe to the bottom of the current one.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None", - "is_optional": false, - "description": "

Table to concat. Optional.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "**kwargs", - "type_name": "pandas.DataFrame, numpy.ndarray, Iterable, dict, or None", - "is_optional": false, - "description": "

The named dataset to concat. Optional. You can only pass in 1\ndataset (including the one in the data parameter).

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L550" - }, - "streamlit.experimental_user.to_dict": { - "name": "to_dict", - "signature": "st.experimental_user.to_dict()", - "description": "

Get user info as a dictionary.

\n

This method primarily exists for internal use and is not needed for\nmost cases. st.experimental_user returns an object that inherits from\ndict by default.

\n", - "args": [], - "returns": [ - { - "type_name": "Dict[str,str]", - "is_generator": false, - "description": "

A dictionary of the current user's information.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L54" - }, - "streamlit.experimental_user": { - "name": "streamlit.experimental_user", - "signature": "st.experimental_user()", - "is_class": true, - "methods": [ - { - "name": "to_dict", - "signature": "st.to_dict.to_dict()", - "description": "

Get user info as a dictionary.

", - "args": [], - "returns": [ - { - "type_name": "Dict[str,str]", - "is_generator": false, - "description": "

A dictionary of the current user's information.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L54" - } - ], - "properties": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L30", - "description": "

A read-only, dict-like object for accessing information about current user.

\n

Properties can by accessed via key or attribute notation. For example,\nst.experimental_user["email"] or st.experimental_user.email.

\n", - "args": [ - { - "name": "user_name", - "type_name": "str", - "is_optional": false, - "description": "

Snowflake user name

\n", - "default": null - }, - { - "name": "login_name", - "type_name": "str", - "is_optional": false, - "description": "

Snowflake user's login name

\n", - "default": null - }, - { - "name": "email", - "type_name": "str", - "is_optional": false, - "description": "

Snowflake user's email

\n", - "default": null - } - ], - "returns": [] - } - }, "1.13.0": { "streamlit.altair_chart": { "name": "altair_chart", From 4b67c63910e2d6b28b9bd4c39ed637b700ecfed0 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Mon, 15 Jul 2024 14:56:26 -0700 Subject: [PATCH 02/40] Add marker to SiS versions --- components/blocks/autofunction.js | 12 +++++++----- components/blocks/autofunction.module.css | 4 ++++ pages/[...slug].js | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/components/blocks/autofunction.js b/components/blocks/autofunction.js index 846da5c27..9488b5665 100644 --- a/components/blocks/autofunction.js +++ b/components/blocks/autofunction.js @@ -28,6 +28,7 @@ const cleanHref = (name) => { const Autofunction = ({ version, versions, + snowflakeVersions, streamlitFunction, streamlit, exceptions, @@ -103,6 +104,7 @@ const Autofunction = ({ const VersionSelector = ({ versionList, + snowflakeVersions, currentVersion, handleSelectVersion, }) => { @@ -124,11 +126,9 @@ const Autofunction = ({ > {versionList.map((version, index) => ( ))} @@ -224,6 +224,7 @@ const Autofunction = ({ @@ -292,6 +293,7 @@ const Autofunction = ({ {headerTitle} diff --git a/components/blocks/autofunction.module.css b/components/blocks/autofunction.module.css index f7b407c36..df616fa50 100644 --- a/components/blocks/autofunction.module.css +++ b/components/blocks/autofunction.module.css @@ -175,3 +175,7 @@ :global(.dark) .Keyword::after { @apply bg-gray-80 text-gray-30; } + +.Snowflake::after { + content: "SiS"; +} diff --git a/pages/[...slug].js b/pages/[...slug].js index 93a970ce2..30ccd8298 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -84,6 +84,7 @@ export default function Article({ nextMenuItem, versionFromStaticLoad, versions, + snowflakeVersions, filename, }) { let versionWarning; @@ -156,6 +157,7 @@ export default function Article({ exceptions={exceptions} version={version} versions={versions} + snowflakeVersions={snowflakeVersions} slug={slug} oldStreamlitFunction={props.oldName ?? ""} /> @@ -356,6 +358,7 @@ export async function getStaticProps(context) { props["streamlit"] = {}; props["exceptions"] = {}; props["versions"] = all_versions; + props["snowflakeVersions"] = []; props["versionFromStaticLoad"] = null; if ("slug" in context.params) { @@ -375,6 +378,7 @@ export async function getStaticProps(context) { if (should_version) { props["streamlit"] = streamlitFuncs[current_version]; props["exceptions"] = streamlitExceptions[current_version] ?? {}; + props["snowflakeVersions"] = Object.keys(streamlitExceptions); } const isnum = /^[\d\.]+$/.test(context.params.slug[0]); From b1fbf26ca60b49a9b9a37444dff6e6b80ed36641 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Mon, 15 Jul 2024 15:03:40 -0700 Subject: [PATCH 03/40] Add original SiS version back in (test) --- python/streamlit.json | 3601 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3601 insertions(+) diff --git a/python/streamlit.json b/python/streamlit.json index 460f935f0..492fe7b5e 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -1,4 +1,3605 @@ { + "SiS": { + "streamlit.altair_chart": { + "name": "altair_chart", + "signature": "st.altair_chart(altair_chart, use_container_width=False, theme=\"streamlit\")", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nc = alt.Chart(chart_data).mark_circle().encode(\n    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.altair_chart(c, use_container_width=True)\n
\n

Examples of Altair charts can be found at\nhttps://altair-viz.github.io/gallery/.

\n\n \n
\n", + "description": "

Display a chart using the Altair library.

\n", + "args": [ + { + "name": "altair_chart", + "type_name": "altair.vegalite.v2.api.Chart", + "is_optional": false, + "description": "

The Altair chart object to display.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over Altair's native width value.

\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L422" + }, + "streamlit.area_chart": { + "name": "area_chart", + "signature": "st.area_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nst.area_chart(chart_data)\n
\n\n \n
\n", + "description": "

Display an area chart.

\n

This is just syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.area_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", + "is_optional": false, + "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, sequence of str, or None", + "is_optional": false, + "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L247" + }, + "streamlit.audio": { + "name": "audio", + "signature": "st.audio(data, format=\"audio/wav\", start_time=0, *, sample_rate=None)", + "example": "
\n
\nimport streamlit as st\nimport numpy as np\n\naudio_file = open('myaudio.ogg', 'rb')\naudio_bytes = audio_file.read()\n\nst.audio(audio_bytes, format='audio/ogg')\n\nsample_rate = 44100  # 44100 samples per second\nseconds = 2  # Note duration of 2 seconds\nfrequency_la = 440  # Our played note will be 440 Hz\n# Generate array with seconds*sample_rate steps, ranging between 0 and seconds\nt = np.linspace(0, seconds, seconds * sample_rate, False)\n# Generate a 440 Hz sine wave\nnote_la = np.sin(frequency_la * t * 2 * np.pi)\n\nst.audio(note_la, sample_rate=sample_rate)\n
\n\n \n
\n", + "description": "

Display an audio player.

\n", + "args": [ + { + "name": "data", + "type_name": "str, bytes, BytesIO, numpy.ndarray, or file opened with", + "is_optional": false, + "description": "

io.open().\nRaw audio data, filename, or a URL pointing to the file to load.\nRaw data formats must include all necessary file headers to match the file\nformat specified via format.\nIf data is a numpy array, it must either be a 1D array of the waveform\nor a 2D array of shape (num_channels, num_samples) with waveforms\nfor all channels. See the default channel order at\nhttp://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx

\n", + "default": "channel" + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "description": "

The mime type for the audio file. Defaults to 'audio/wav'.\nSee https://tools.ietf.org/html/rfc4281 for more info.

\n", + "default": "s" + }, + { + "name": "start_time", + "type_name": "int", + "is_optional": false, + "description": "

The time from which this element should start playing.

\n", + "default": null + }, + { + "name": "sample_rate", + "type_name": "int or None", + "is_optional": false, + "description": "

The sample rate of the audio data in samples per second. Only required if\ndata is a numpy array.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/media.py#L43" + }, + "streamlit.balloons": { + "name": "balloons", + "signature": "st.balloons()", + "example": "
\n
\nimport streamlit as st\n\nst.balloons()\n
\n

...then watch your app and get ready for a celebration!

\n
\n", + "description": "

Draw celebratory balloons.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/balloons.py#L25" + }, + "streamlit.bar_chart": { + "name": "bar_chart", + "signature": "st.bar_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=["a", "b", "c"])\n\nst.bar_chart(chart_data)\n
\n\n \n
\n", + "description": "

Display a bar chart.

\n

This is just syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.bar_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", + "is_optional": false, + "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, sequence of str, or None", + "is_optional": false, + "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L334" + }, + "streamlit.beta_columns": { + "name": "beta_columns", + "signature": "st.beta_columns(spec, *, gap=\"small\")", + "examples": "
\n

You can use with notation to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n
\n\n \n
\n", + "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

Columns can only be placed inside other columns up to one level of nesting.

\n
\n

Warning

\n

Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.

\n
\n", + "args": [ + { + "name": "spec", + "type_name": "int or list of numbers", + "is_optional": false, + "description": "
\n
If an int
\n
Specifies the number of columns to insert, and all columns\nhave equal width.
\n
If a list of numbers
\n

Creates a column for each number, and each\ncolumn's width is proportional to the number provided. Numbers can\nbe ints or floats, but they must be positive.

\n

For example, st.columns([3, 1, 2]) creates 3 columns where\nthe first column is 3 times the width of the second, and the last\ncolumn is 2 times that width.

\n
\n
\n", + "default": null + }, + { + "name": "gap", + "type_name": "string (\"small\", \"medium\", or \"large\")", + "is_optional": false, + "description": "

An optional string, which indicates the size of the gap between each column.\nThe default is a small gap between columns. This argument can only be supplied by\nkeyword.

\n", + "default": "a" + } + ], + "returns": [ + { + "type_name": "list of containers", + "is_generator": false, + "description": "

A list of container objects.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L77" + }, + "streamlit.beta_container": { + "name": "beta_container", + "signature": "st.beta_container()", + "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.container():\n   st.write("This is inside the container")\n\n   # You can call any Streamlit command, including custom components:\n   st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n\n \n

Inserting elements out of order:

\n
\nimport streamlit as st\n\ncontainer = st.container()\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n
\n\n \n
\n", + "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L29" + }, + "streamlit.beta_expander": { + "name": "beta_expander", + "signature": "st.beta_expander(label, expanded=False)", + "examples": "
\n

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write(\\"\\"\\"\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    \\"\\"\\")\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write(\\"\\"\\"\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n\\"\\"\\")\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n
\n", + "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

Currently, you may not put expanders inside another expander.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L320" + }, + "streamlit.button": { + "name": "button", + "signature": "st.button(label, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", + "example": "
\n
\nimport streamlit as st\n\nif st.button('Say hello'):\n    st.write('Why hello there')\nelse:\n    st.write('Goodbye')\n
\n\n \n
\n", + "description": "

Display a button widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed when the button is\nhovered over.

\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this button is clicked.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"secondary\" or \"primary\"", + "is_optional": false, + "description": "

An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. This\nargument can only be supplied by keyword. Defaults to "secondary".

\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the button if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which makes the button stretch its width to match the parent container.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

True if the button was clicked on the last run of the app,\nFalse otherwise.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/button.py#L61" + }, + "streamlit.cache": { + "name": "cache", + "signature": "st.cache(func=None, persist=False, allow_output_mutation=False, show_spinner=True, suppress_st_warning=False, hash_funcs=None, max_entries=None, ttl=None)", + "example": "
\n
\nimport streamlit as st\n\n@st.cache\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\n@st.cache(persist=True)\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

To disable hashing return values, set the allow_output_mutation parameter to True:

\n
\n@st.cache(allow_output_mutation=True)\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. MongoClient) to a hash function (id) like this:

\n
\n@st.cache(hash_funcs={MongoClient: id})\ndef connect_to_database(url):\n    return MongoClient(url)\n
\n

Alternatively, you can map the type's fully-qualified name\n(e.g. "pymongo.mongo_client.MongoClient") to the hash function instead:

\n
\n@st.cache(hash_funcs={"pymongo.mongo_client.MongoClient": id})\ndef connect_to_database(url):\n    return MongoClient(url)\n
\n
\n", + "description": "

Function decorator to memoize function executions.

\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "description": "

The function to cache. Streamlit hashes the function and dependent code.

\n", + "default": null + }, + { + "name": "persist", + "type_name": "boolean", + "is_optional": false, + "description": "

Whether to persist the cache on disk.

\n", + "default": null + }, + { + "name": "allow_output_mutation", + "type_name": "boolean", + "is_optional": false, + "description": "

Streamlit shows a warning when return values are mutated, as that\ncan have unintended consequences. This is done by hashing the return value internally.

\n

If you know what you're doing and would like to override this warning, set this to True.

\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean", + "is_optional": false, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na cache miss.

\n", + "default": "True" + }, + { + "name": "suppress_st_warning", + "type_name": "boolean", + "is_optional": false, + "description": "

Suppress warnings about calling Streamlit commands from within\nthe cached function.

\n", + "default": null + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "description": "

Mapping of types or fully qualified names to hash functions. This is used to override\nthe behavior of the hasher inside Streamlit's caching mechanism: when the hasher\nencounters an object, it will first check to see if its type matches a key in this\ndict and, if so, will use the provided function to generate a hash for it. See below\nfor an example of how this can be used.

\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", + "default": "None." + }, + { + "name": "ttl", + "type_name": "float or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", + "default": "None." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/legacy_caching/caching.py#L486" + }, + "streamlit.cache_data": { + "name": "cache_data", + "signature": "st.cache_data(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets)", + "example": "
\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n
\n", + "description": "
\n

Streamlit in Snowflake Note

\n

st.cache_data is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions.

\n
\n

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

To cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/library/advanced-features/caching.

\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "description": "

The function to cache. Streamlit hashes the function's source code.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float or timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.\nNote that ttl is incompatible with persist="disk" - ttl will be\nignored if persist is specified.

\n", + "default": "None." + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", + "default": "None." + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", + "default": "True" + }, + { + "name": "persist", + "type_name": "str or boolean or None", + "is_optional": false, + "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", + "default": "None." + }, + { + "name": "experimental_allow_widgets", + "type_name": "boolean", + "is_optional": false, + "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", + "default": "False." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L378" + }, + "streamlit.cache_resource": { + "name": "cache_resource", + "signature": "st.cache_resource(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets)", + "example": "
\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

A cache_resource function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n
\n", + "description": "
\n

Streamlit in Snowflake Note

\n

st.cache_resource is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions.

\n
\n

Decorator to cache functions that return global resources (e.g. database connections, ML models).

\n

Cached objects must be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using st.session_state\nto store resources per session instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

To cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/library/advanced-features/caching.

\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float or timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", + "default": "None." + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", + "default": "None." + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", + "default": "True" + }, + { + "name": "validate", + "type_name": "callable or None", + "is_optional": false, + "description": "

An optional validation function for cached data. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", + "default": null + }, + { + "name": "experimental_allow_widgets", + "type_name": "boolean", + "is_optional": false, + "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", + "default": "False." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L258" + }, + "streamlit.caption": { + "name": "caption", + "signature": "st.caption(body, unsafe_allow_html=False, *, help=None)", + "examples": "
\n
\nimport streamlit as st\n\nst.caption('This is a string that explains something above.')\nst.caption('A caption with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", + "description": "

Display text in small font.

\n

This should be used for captions, asides, footnotes, sidenotes, and\nother explanatory text.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "description": "

By default, any HTML tags found in strings will be escaped and\ntherefore treated as pure text. This behavior may be turned off by\nsetting this argument to True.

\n

That said, we strongly advise against it. It is hard to write secure\nHTML, so by using this argument you may be compromising your users'\nsecurity. For more information, see:

\n

https://github.com/streamlit/streamlit/issues/152

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the caption.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L132" + }, + "streamlit.checkbox": { + "name": "checkbox", + "signature": "st.checkbox(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\nagree = st.checkbox('I agree')\n\nif agree:\n    st.write('Great!')\n
\n\n \n
\n", + "description": "

Display a checkbox widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this checkbox is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "description": "

Preselect the checkbox when it first renders. This will be\ncast to bool internally.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the checkbox.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this checkbox's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the checkbox if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

Whether or not the checkbox is checked.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/checkbox.py#L52" + }, + "streamlit.code": { + "name": "code", + "signature": "st.code(body, language=\"python\", line_numbers=False)", + "example": "
\n
\nimport streamlit as st\n\ncode = '''def hello():\n    print("Hello, Streamlit!")'''\nst.code(code, language='python')\n
\n
\n", + "description": "

Display a code block with optional syntax highlighting.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The string to display as code.

\n", + "default": null + }, + { + "name": "language", + "type_name": "str or None", + "is_optional": false, + "description": "

The language that the code is written in, for syntax highlighting.\nIf None, the code will be unstyled. Defaults to "python".

\n

For a list of available language values, see:

\n

https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD

\n", + "default": "s" + }, + { + "name": "line_numbers", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean indicating whether to show line numbers to the\nleft of the code block. Defaults to False.

\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/code.py#L27" + }, + "streamlit.color_picker": { + "name": "color_picker", + "signature": "st.color_picker(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\ncolor = st.color_picker('Pick A Color', '#00f900')\nst.write('The current color is', color)\n
\n\n \n
\n", + "description": "

Display a color picker widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "str", + "is_optional": false, + "description": "

The hex value of this widget when it first renders. If None,\ndefaults to black.

\n", + "default": "black." + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the color picker.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this color_picker's value\nchanges.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the color picker if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn\u2019t show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "

The selected color as a hex string.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/color_picker.py#L52" + }, + "streamlit.columns": { + "name": "columns", + "signature": "st.columns(spec, *, gap=\"small\")", + "examples": "
\n

You can use with notation to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n
\n\n \n
\n", + "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

Columns can only be placed inside other columns up to one level of nesting.

\n
\n

Warning

\n

Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.

\n
\n", + "args": [ + { + "name": "spec", + "type_name": "int or list of numbers", + "is_optional": false, + "description": "
\n
If an int
\n
Specifies the number of columns to insert, and all columns\nhave equal width.
\n
If a list of numbers
\n

Creates a column for each number, and each\ncolumn's width is proportional to the number provided. Numbers can\nbe ints or floats, but they must be positive.

\n

For example, st.columns([3, 1, 2]) creates 3 columns where\nthe first column is 3 times the width of the second, and the last\ncolumn is 2 times that width.

\n
\n
\n", + "default": null + }, + { + "name": "gap", + "type_name": "string (\"small\", \"medium\", or \"large\")", + "is_optional": false, + "description": "

An optional string, which indicates the size of the gap between each column.\nThe default is a small gap between columns. This argument can only be supplied by\nkeyword.

\n", + "default": "a" + } + ], + "returns": [ + { + "type_name": "list of containers", + "is_generator": false, + "description": "

A list of container objects.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L77" + }, + "streamlit.container": { + "name": "container", + "signature": "st.container()", + "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.container():\n   st.write("This is inside the container")\n\n   # You can call any Streamlit command, including custom components:\n   st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n\n \n

Inserting elements out of order:

\n
\nimport streamlit as st\n\ncontainer = st.container()\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n
\n\n \n
\n", + "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L29" + }, + "streamlit.dataframe": { + "name": "dataframe", + "signature": "st.dataframe(data=None, width=None, height=None, *, use_container_width=False)", + "examples": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nst.dataframe(df)  # Same as st.write(df)\n
\n\n \n
\nst.dataframe(df, 200, 100)\n
\n

You can also pass a Pandas Styler object to change the style of\nthe rendered DataFrame:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(10, 20),\n   columns=('col %d' % i for i in range(20)))\n\nst.dataframe(df.style.highlight_max(axis=0))\n
\n\n \n
\n", + "description": "

Display a dataframe as an interactive table.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", + "is_optional": false, + "description": "

The data to display.

\n

If 'data' is a pandas.Styler, it will be used to style its\nunderlying DataFrame. Streamlit supports custom cell\nvalues and colors. (It does not support some of the more exotic\npandas styling features, like bar charts, hovering, and captions.)\nStyler support is experimental!\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "description": "

Desired width of the dataframe expressed in pixels. If None, the width\nwill be automatically calculated based on the column content.

\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "description": "

Desired height of the dataframe expressed in pixels. If None, a\ndefault height is used.

\n", + "default": "height" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the dataframe width to the width of the parent container.\nThis takes precedence over the width argument.\nThis argument can only be supplied by keyword.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L40" + }, + "streamlit.date_input": { + "name": "date_input", + "signature": "st.date_input(label, value=None, min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport datetime\nimport streamlit as st\n\nd = st.date_input(\n    "When\\'s your birthday",\n    datetime.date(2019, 7, 6))\nst.write('Your birthday is:', d)\n
\n\n \n
\n", + "description": "

Display a date input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this date input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None", + "is_optional": false, + "description": "

The value of this widget when it first renders. If a list/tuple with\n0 to 2 date/datetime values is provided, the datepicker will allow\nusers to provide a range. Defaults to today as a single-date picker.

\n", + "default": "today" + }, + { + "name": "min_value", + "type_name": "datetime.date or datetime.datetime", + "is_optional": false, + "description": "

The minimum selectable date. If value is a date, defaults to value - 10 years.\nIf value is the interval [start, end], defaults to start - 10 years.

\n", + "default": "value" + }, + { + "name": "max_value", + "type_name": "datetime.date or datetime.datetime", + "is_optional": false, + "description": "

The maximum selectable date. If value is a date, defaults to value + 10 years.\nIf value is the interval [start, end], defaults to end + 10 years.

\n", + "default": "value" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the input.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this date_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the date input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "datetime.date or a tuple with 0-2 dates", + "is_generator": false, + "description": "

The current value of the date input widget.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/time_widgets.py#L399" + }, + "streamlit.divider": { + "name": "divider", + "signature": "st.divider()", + "example": "
\n
\nimport streamlit as st\n\nst.divider()\n
\n
\n", + "description": "

Display a horizontal rule.

\n
\n

Note

\n

You can achieve the same effect with st.write("---") or\neven just "---" in your script (via magic).

\n
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L244" + }, + "streamlit.echo": { + "name": "echo", + "signature": "st.echo(code_location=\"above\")", + "example": "
\n
\nimport streamlit as st\n\nwith st.echo():\n    st.write('This code will be printed')\n
\n
\n", + "description": "

Use in a with block to draw some code on the app, then execute it.

\n", + "args": [ + { + "name": "code_location", + "type_name": "\"above\" or \"below\"", + "is_optional": false, + "description": "

Whether to show the echoed code before or after the results of the\nexecuted code block.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/echo.py#L27" + }, + "streamlit.empty": { + "name": "empty", + "signature": "st.empty()", + "examples": "
\n

Overwriting elements in-place using "with" notation:

\n
\nimport streamlit as st\nimport time\n\nwith st.empty():\n    for seconds in range(60):\n        st.write(f"\u23f3 {seconds} seconds have passed")\n        time.sleep(1)\n    st.write("\u2714\ufe0f 1 minute over!")\n
\n

Replacing several elements, then clearing them:

\n
\nimport streamlit as st\n\nplaceholder = st.empty()\n\n# Replace the placeholder with some text:\nplaceholder.text("Hello")\n\n# Replace the text with a chart:\nplaceholder.line_chart({"data": [1, 5, 2, 6]})\n\n# Replace the chart with several elements:\nwith placeholder.container():\n    st.write("This is one element")\n    st.write("This is another")\n\n# Clear all those elements:\nplaceholder.empty()\n
\n
\n", + "description": "

Insert a single-element container.

\n

Inserts a container into your app that can be used to hold a single element.\nThis allows you to, for example, remove elements at any point, or replace\nseveral elements at once (using a child multi-element container).

\n

To insert/replace/clear an element on the returned container, you can\nuse "with" notation or just call methods directly on the returned object.\nSee examples below.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/empty.py#L24" + }, + "streamlit.error": { + "name": "error", + "signature": "st.error(body, *, icon=None)", + "example": "
\n
\nimport streamlit as st\n\nst.error('This is an error', icon="\ud83d\udea8")\n
\n
\n", + "description": "

Display error message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The error text to display.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", + "default": "None" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L39" + }, + "streamlit.exception": { + "name": "exception", + "signature": "st.exception(exception)", + "example": "
\n
\nimport streamlit as st\n\ne = RuntimeError('This is an exception of type RuntimeError')\nst.exception(e)\n
\n
\n", + "description": "

Display an exception.

\n", + "args": [ + { + "name": "exception", + "type_name": "Exception", + "is_optional": false, + "description": "

The exception to display.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/exception.py#L50" + }, + "streamlit.expander": { + "name": "expander", + "signature": "st.expander(label, expanded=False)", + "examples": "
\n

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write(\\"\\"\\"\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    \\"\\"\\")\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write(\\"\\"\\"\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n\\"\\"\\")\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n
\n", + "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

Currently, you may not put expanders inside another expander.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L320" + }, + "streamlit.experimental_connection": { + "name": "experimental_connection", + "signature": "st.experimental_connection(name, type=None, max_entries=None, ttl=None, **kwargs)", + "examples": "
\n

The easiest way to create a first-party (SQL or Snowpark) connection is to use their\ndefault names and define corresponding sections in your secrets.toml file.

\n
\nimport streamlit as st\nconn = st.experimental_connection("sql") # Config section defined in [connections.sql] in secrets.toml.\n
\n

Creating a SQLConnection with a custom name requires you to explicitly specify the\ntype. If type is not passed as a kwarg, it must be set in the appropriate section of\nsecrets.toml.

\n
\nimport streamlit as st\nconn1 = st.experimental_connection("my_sql_connection", type="sql") # Config section defined in [connections.my_sql_connection].\nconn2 = st.experimental_connection("my_other_sql_connection") # type must be set in [connections.my_other_sql_connection].\n
\n

Passing the full module path to the connection class that you want to use can be\nuseful, especially when working with a custom connection:

\n
\nimport streamlit as st\nconn = st.experimental_connection("my_sql_connection", type="streamlit.connections.SQLConnection")\n
\n

Finally, you can pass the connection class to use directly to this function. Doing\nso allows static type checking tools such as mypy to infer the exact return\ntype of st.experimental_connection.

\n
\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\nconn = st.experimental_connection("my_sql_connection", type=SQLConnection)\n
\n
\n", + "description": "

Create a new connection to a data store or API, or return an existing one.

\n

Config options, credentials, secrets, etc. for connections are taken from various\nsources:

\n
    \n
  • Any connection-specific configuration files.
  • \n
  • An app's secrets.toml files.
  • \n
  • The kwargs passed to this function.
  • \n
\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "description": "

The connection name used for secrets lookup in [connections.<name>].\nType will be inferred from passing "sql" or "snowpark".

\n", + "default": null + }, + { + "name": "type", + "type_name": "str or connection class or None", + "is_optional": false, + "description": "

The type of connection to create. It can be a keyword ("sql" or "snowpark"),\na path to an importable class, or an imported class reference. All classes\nmust extend st.connections.ExperimentalBaseConnection and implement the\n_connect() method. If the type kwarg is None, a type field must be set\nin the connection's section in secrets.toml.

\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "description": "

The maximum number of connections to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", + "default": "None." + }, + { + "name": "ttl", + "type_name": "float or timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None." + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "description": "

Additional connection specific kwargs that are passed to the Connection's\n_connect() method. Learn more from the specific Connection's documentation.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Connection object", + "is_generator": false, + "description": "

An initialized Connection object of the specified type.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/connection_factory.py#L170" + }, + "streamlit.experimental_data_editor": { + "name": "experimental_data_editor", + "signature": "st.experimental_data_editor(data, *, width=None, height=None, use_container_width=False, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None)", + "examples": "
\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n       {"command": "st.selectbox", "rating": 4, "is_widget": True},\n       {"command": "st.balloons", "rating": 5, "is_widget": False},\n       {"command": "st.time_input", "rating": 3, "is_widget": True},\n   ]\n)\nedited_df = st.experimental_data_editor(df)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n\n \n

You can also allow the user to add and delete rows by setting num_rows to "dynamic":

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n       {"command": "st.selectbox", "rating": 4, "is_widget": True},\n       {"command": "st.balloons", "rating": 5, "is_widget": False},\n       {"command": "st.time_input", "rating": 3, "is_widget": True},\n   ]\n)\nedited_df = st.experimental_data_editor(df, num_rows="dynamic")\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n\n \n
\n", + "description": "

Display a data editor widget.

\n

Display a data editor widget that allows you to edit DataFrames and\nmany other data structures in a table-like UI.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.DataFrame, list, set, tuple, dict, or None", + "is_optional": false, + "description": "

The data to edit in the data editor.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "description": "

Desired width of the data editor expressed in pixels. If None, the width will\nbe automatically determined.

\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "description": "

Desired height of the data editor expressed in pixels. If None, the height will\nbe automatically determined.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the data editor width to the width of the parent container.\nThis takes precedence over the width argument. Defaults to False.

\n", + "default": "False." + }, + { + "name": "num_rows", + "type_name": "\"fixed\" or \"dynamic\"", + "is_optional": false, + "description": "

Specifies if the user can add and delete rows in the data editor.\nIf "fixed", the user cannot add or delete rows. If "dynamic", the user can\nadd and delete rows in the data editor, but column sorting is disabled.\nDefaults to "fixed".

\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean which, if True, disables the data editor and prevents\nany edits. Defaults to False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "description": "

An optional string to use as the unique key for this widget. If this\nis omitted, a key will be generated for the widget based on its\ncontent. Multiple widgets of the same type may not share the same\nkey.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this data_editor's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pd.DataFrame, pd.Styler, pyarrow.Table, np.ndarray, list, set, tuple, or dict.", + "is_generator": false, + "description": "

The edited data. The edited data is returned in its original data type if\nit corresponds to any of the supported return types. All other data types\nare returned as a pd.DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/data_editor.py#L448" + }, + "streamlit.experimental_memo": { + "name": "experimental_memo", + "signature": "st.experimental_memo(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets)", + "example": "
\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n
\n", + "description": "

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

To cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/library/advanced-features/caching.

\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "description": "

The function to cache. Streamlit hashes the function's source code.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float or timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.\nNote that ttl is incompatible with persist="disk" - ttl will be\nignored if persist is specified.

\n", + "default": "None." + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", + "default": "None." + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", + "default": "True" + }, + { + "name": "persist", + "type_name": "str or boolean or None", + "is_optional": false, + "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", + "default": "None." + }, + { + "name": "experimental_allow_widgets", + "type_name": "boolean", + "is_optional": false, + "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", + "default": "False." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L378" + }, + "streamlit.experimental_rerun": { + "name": "experimental_rerun", + "signature": "st.experimental_rerun()", + "description": "

Rerun the script immediately.

\n

When st.experimental_rerun() is called, the script is halted - no\nmore statements will be run, and the script will be queued to re-run\nfrom the top.

\n

If this function is called outside of Streamlit, it will raise an\nException.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/execution_control.py#L46" + }, + "streamlit.experimental_show": { + "name": "experimental_show", + "signature": "st.experimental_show(*args)", + "notes": "
\n

This is an experimental feature with usage limitations:

\n
    \n
  • The method must be called with the name show.
  • \n
  • Must be called in one line of code, and only once per line.
  • \n
  • \n
    When passing multiple arguments the inclusion of , or ) in a string
    \n
    argument may cause an error.
    \n
    \n
  • \n
\n
\n", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\n\ndataframe = pd.DataFrame({\n    'first column': [1, 2, 3, 4],\n    'second column': [10, 20, 30, 40],\n})\nst.experimental_show(dataframe)\n
\n
\n", + "description": "

Write arguments and argument names to your app for debugging purposes.

\n

Show() has similar properties to write():

\n
\n
    \n
  1. You can pass in multiple arguments, all of which will be debugged.
  2. \n
  3. It returns None, so it's "slot" in the app cannot be reused.
  4. \n
\n
\n

Note: This is an experimental feature. See\nhttps://docs.streamlit.io/library/advanced-features/prerelease#experimental for more information.

\n", + "args": [ + { + "name": "*args", + "type_name": "any", + "is_optional": false, + "description": "

One or many objects to debug in the App.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/show.py#L23" + }, + "streamlit.experimental_singleton": { + "name": "experimental_singleton", + "signature": "st.experimental_singleton(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets)", + "example": "
\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

A cache_resource function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n
\n", + "description": "

Decorator to cache functions that return global resources (e.g. database connections, ML models).

\n

Cached objects are shared across all users, sessions, and reruns. They\nmust be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using st.session_state\nto store resources per session instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

To cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/library/advanced-features/caching.

\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float or timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", + "default": "None." + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", + "default": "None." + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", + "default": "True" + }, + { + "name": "validate", + "type_name": "callable or None", + "is_optional": false, + "description": "

An optional validation function for cached data. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", + "default": null + }, + { + "name": "experimental_allow_widgets", + "type_name": "boolean", + "is_optional": false, + "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", + "default": "False." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L258" + }, + "streamlit.form": { + "name": "form", + "signature": "st.form(key, clear_on_submit=False)", + "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.form("my_form"):\n   st.write("Inside the form")\n   slider_val = st.slider("Form slider")\n   checkbox_val = st.checkbox("Form checkbox")\n\n   # Every form must have a submit button.\n   submitted = st.form_submit_button("Submit")\n   if submitted:\n       st.write("slider", slider_val, "checkbox", checkbox_val)\n\nst.write("Outside the form")\n
\n

Inserting elements out of order:

\n
\nimport streamlit as st\n\nform = st.form("my_form")\nform.slider("Inside the form")\nst.slider("Outside the form")\n\n# Now add a submit button to the form:\nform.form_submit_button("Submit")\n
\n
\n", + "description": "

Create a form that batches elements together with a "Submit" button.

\n

A form is a container that visually groups other elements and\nwidgets together, and contains a Submit button. When the form's\nSubmit button is pressed, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

To add elements to a form object, you can use "with" notation\n(preferred) or just call methods directly on the form. See\nexamples below.

\n

Forms have a few constraints:

\n
    \n
  • Every form must contain a st.form_submit_button.
  • \n
  • st.button and st.download_button cannot be added to a form.
  • \n
  • Forms can appear anywhere in your app (sidebar, columns, etc),\nbut they cannot be embedded inside other forms.
  • \n
\n

For more information about forms, check out our\nblog post.

\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "description": "

A string that identifies the form. Each form must have its own\nkey. (This key is not displayed to the user in the interface.)

\n", + "default": null + }, + { + "name": "clear_on_submit", + "type_name": "bool", + "is_optional": false, + "description": "

If True, all widgets inside the form will be reset to their default\nvalues after the user presses the Submit button. Defaults to False.\n(Note that Custom Components are unaffected by this flag, and\nwill not be reset to their defaults on form submission.)

\n", + "default": "values" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/form.py#L118" + }, + "streamlit.form_submit_button": { + "name": "form_submit_button", + "signature": "st.form_submit_button(label=\"Submit\", help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", + "description": "

Display a form submit button.

\n

When this button is clicked, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

Every form must have a form_submit_button. A form_submit_button\ncannot exist outside a form.

\n

For more information about forms, check out our\nblog post.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this button is for.\nDefaults to "Submit".

\n", + "default": "s" + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "description": "

A tooltip that gets displayed when the button is hovered over.\nDefaults to None.

\n", + "default": "None." + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this button is clicked.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"secondary\" or \"primary\"", + "is_optional": false, + "description": "

An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. This\nargument can only be supplied by keyword. Defaults to "secondary".

\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the button if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which makes the button stretch its width to match the parent container.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

True if the button was clicked.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/form.py#L211" + }, + "streamlit.get_option": { + "name": "get_option", + "signature": "st.get_option(key)", + "description": "

Return the current value of a given Streamlit config option.

\n

Run streamlit config show in the terminal to see all available options.

\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show on a terminal.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/config.py#L131" + }, + "streamlit.graphviz_chart": { + "name": "graphviz_chart", + "signature": "st.graphviz_chart(figure_or_dot, use_container_width=False)", + "example": "
\n
\nimport streamlit as st\nimport graphviz\n\n# Create a graphlib graph object\ngraph = graphviz.Digraph()\ngraph.edge('run', 'intr')\ngraph.edge('intr', 'runbl')\ngraph.edge('runbl', 'run')\ngraph.edge('run', 'kernel')\ngraph.edge('kernel', 'zombie')\ngraph.edge('kernel', 'sleep')\ngraph.edge('kernel', 'runmem')\ngraph.edge('sleep', 'swap')\ngraph.edge('swap', 'runswap')\ngraph.edge('runswap', 'new')\ngraph.edge('runswap', 'runmem')\ngraph.edge('new', 'runmem')\ngraph.edge('sleep', 'runmem')\n\nst.graphviz_chart(graph)\n
\n

Or you can render the chart from the graph using GraphViz's Dot\nlanguage:

\n
\nst.graphviz_chart('''\n    digraph {\n        run -> intr\n        intr -> runbl\n        runbl -> run\n        run -> kernel\n        kernel -> zombie\n        kernel -> sleep\n        kernel -> runmem\n        sleep -> swap\n        swap -> runswap\n        runswap -> new\n        runswap -> runmem\n        new -> runmem\n        sleep -> runmem\n    }\n''')\n
\n\n \n
\n", + "description": "

Display a graph using the dagre-d3 library.

\n", + "args": [ + { + "name": "figure_or_dot", + "type_name": "graphviz.dot.Graph, graphviz.dot.Digraph, str", + "is_optional": false, + "description": "

The Graphlib graph object or dot string to display

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over the figure's native width value.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/graphviz_chart.py#L39" + }, + "streamlit.header": { + "name": "header", + "signature": "st.header(body, anchor=None, *, help=None)", + "examples": "
\n
\nimport streamlit as st\n\nst.header('This is a header')\nst.header('A header with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", + "description": "

Display text in header formatting.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the header.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L40" + }, + "streamlit.help": { + "name": "help", + "signature": "st.help(obj=streamlit)", + "example": "
\n

Don't remember how to initialize a dataframe? Try this:

\n
\nimport streamlit as st\nimport pandas\n\nst.help(pandas.DataFrame)\n
\n\n \n

Want to quickly check what data type is output by a certain function?\nTry:

\n
\nimport streamlit as st\n\nx = my_poorly_documented_function()\nst.help(x)\n
\n

Want to quickly inspect an object? No sweat:

\n
\nclass Dog:\n  '''A typical dog.'''\n\n  def __init__(self, breed, color):\n    self.breed = breed\n    self.color = color\n\n  def bark(self):\n    return 'Woof!'\n\n\nfido = Dog('poodle', 'white')\n\nst.help(fido)\n
\n\n \n

And if you're using Magic, you can get help for functions, classes,\nand modules without even typing st.help:

\n
\nimport streamlit as st\nimport pandas\n\n# Get help for Pandas read_csv:\npandas.read_csv\n\n# Get help for Streamlit itself:\nst\n
\n\n \n
\n", + "description": "

Display help and other information for a given object.

\n

Depending on the type of object that is passed in, this displays the\nobject's name, type, value, signature, docstring, and member variables,\nmethods \u2014 as well as the values/docstring of members and methods.

\n", + "args": [ + { + "name": "obj", + "type_name": "any", + "is_optional": false, + "description": "

The object whose information should be displayed. If left\nunspecified, this call will display help for Streamlit itself.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/doc_string.py#L49" + }, + "streamlit.image": { + "name": "image", + "signature": "st.image(image, caption=None, width=None, use_column_width=None, clamp=False, channels=\"RGB\", output_format=\"auto\")", + "example": "
\n
\nimport streamlit as st\nfrom PIL import Image\n\nimage = Image.open('sunrise.jpg')\n\nst.image(image, caption='Sunrise by the mountains')\n
\n\n \n
\n", + "description": "

Display an image or list of images.

\n", + "args": [ + { + "name": "image", + "type_name": "numpy.ndarray, [numpy.ndarray], BytesIO, str, or [str]", + "is_optional": false, + "description": "

Monochrome image of shape (w,h) or (w,h,1)\nOR a color image of shape (w,h,3)\nOR an RGBA image of shape (w,h,4)\nOR a URL to fetch the image from\nOR a path of a local image file\nOR an SVG XML string like <svg xmlns=...</svg>\nOR a list of one of the above, to display multiple images.

\n", + "default": null + }, + { + "name": "caption", + "type_name": "str or list of str", + "is_optional": false, + "description": "

Image caption. If displaying multiple images, caption should be a\nlist of captions (one for each image).

\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "description": "

Image width. None means use the image width,\nbut do not exceed the width of the column.\nShould be set for SVG images, as they have no default image width.

\n", + "default": "image" + }, + { + "name": "use_column_width", + "type_name": "'auto' or 'always' or 'never' or bool", + "is_optional": false, + "description": "

If 'auto', set the image's width to its natural size,\nbut do not exceed the width of the column.\nIf 'always' or True, set the image's width to the column width.\nIf 'never' or False, set the image's width to its natural size.\nNote: if set, use_column_width takes precedence over the width parameter.

\n", + "default": null + }, + { + "name": "clamp", + "type_name": "bool", + "is_optional": false, + "description": "

Clamp image pixel values to a valid range ([0-255] per channel).\nThis is only meaningful for byte array images; the parameter is\nignored for image URLs. If this is not set, and an image has an\nout-of-range value, an error will be thrown.

\n", + "default": null + }, + { + "name": "channels", + "type_name": "'RGB' or 'BGR'", + "is_optional": false, + "description": "

If image is an nd.array, this parameter denotes the format used to\nrepresent color information. Defaults to 'RGB', meaning\nimage[:, :, 0] is the red channel, image[:, :, 1] is green, and\nimage[:, :, 2] is blue. For images coming from libraries like\nOpenCV you should set this to 'BGR', instead.

\n", + "default": "s" + }, + { + "name": "output_format", + "type_name": "'JPEG', 'PNG', or 'auto'", + "is_optional": false, + "description": "

This parameter specifies the format to use when transferring the\nimage data. Photos should use the JPEG format for lossy compression\nwhile diagrams should use the PNG format for lossless compression.\nDefaults to 'auto' which identifies the compression type based\non the type and format of the image argument.

\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/image.py#L88" + }, + "streamlit.info": { + "name": "info", + "signature": "st.info(body, *, icon=None)", + "example": "
\n
\nimport streamlit as st\n\nst.info('This is a purely informational message', icon="\u2139\ufe0f")\n
\n
\n", + "description": "

Display an informational message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The info text to display.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", + "default": "None" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L103" + }, + "streamlit.json": { + "name": "json", + "signature": "st.json(body, *, expanded=True)", + "example": "
\n
\nimport streamlit as st\n\nst.json({\n    'foo': 'bar',\n    'baz': 'boz',\n    'stuff': [\n        'stuff 1',\n        'stuff 2',\n        'stuff 3',\n        'stuff 5',\n    ],\n})\n
\n\n \n
\n", + "description": "

Display object or string as a pretty-printed JSON string.

\n", + "args": [ + { + "name": "body", + "type_name": "object or str", + "is_optional": false, + "description": "

The object to print as JSON. All referenced objects should be\nserializable to JSON as well. If object is a string, we assume it\ncontains serialized JSON.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean that allows the user to set whether the initial\nstate of this json element should be expanded. Defaults to True.\nThis argument can only be supplied by keyword.

\n", + "default": "True." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/json.py#L35" + }, + "streamlit.latex": { + "name": "latex", + "signature": "st.latex(body, *, help=None)", + "example": "
\n
\nimport streamlit as st\n\nst.latex(r'''\n    a + ar + a r^2 + a r^3 + \\cdots + a r^{n-1} =\n    \\sum_{k=0}^{n-1} ar^k =\n    a \\left(\\frac{1-r^{n}}{1-r}\\right)\n    ''')\n
\n
\n", + "description": "

Display mathematical expressions formatted as LaTeX.

\n

Supported LaTeX functions are listed at\nhttps://katex.org/docs/supported.html.

\n", + "args": [ + { + "name": "body", + "type_name": "str or SymPy expression", + "is_optional": false, + "description": "

The string or SymPy expression to display as LaTeX. If str, it's\na good idea to use raw Python strings since LaTeX uses backslashes\na lot.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the LaTeX expression.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L196" + }, + "streamlit.line_chart": { + "name": "line_chart", + "signature": "st.line_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nst.line_chart(chart_data)\n
\n\n \n
\n", + "description": "

Display a line chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.line_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None", + "is_optional": false, + "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, sequence of str, or None", + "is_optional": false, + "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L160" + }, + "streamlit.map": { + "name": "map", + "signature": "st.map(data=None, zoom=None, use_container_width=True)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n    np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n    columns=['lat', 'lon'])\n\nst.map(df)\n
\n\n \n
\n", + "description": "

Display a map with points on it.

\n

This is a wrapper around st.pydeck_chart to quickly create\nscatterplot charts on top of a map, with auto-centering and auto-zoom.

\n

When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox.

\n

Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the mapbox.token config option. The use of Mapbox is governed by Mapbox's Terms of Use.

\n

To get a token for yourself, create an account at https://mapbox.com.\nFor more info on how to set config options, see\nhttps://docs.streamlit.io/library/advanced-features/configuration

\n
\n

Streamlit in Snowflake Note

\n

When you use the st.map, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's External Offerings Terms.

\n
\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", + "is_optional": false, + "description": "

The data to be plotted. Must have two columns:

\n
    \n
  • latitude called 'lat', 'latitude', 'LAT', 'LATITUDE'
  • \n
  • longitude called 'lon', 'longitude', 'LON', 'LONGITUDE'.
  • \n
\n", + "default": null + }, + { + "name": "zoom", + "type_name": "int", + "is_optional": false, + "description": "

Zoom level as specified in\nhttps://wiki.openstreetmap.org/wiki/Zoom_levels

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/map.py#L76" + }, + "streamlit.markdown": { + "name": "markdown", + "signature": "st.markdown(body, unsafe_allow_html=False, *, help=None)", + "examples": "
\n
\nimport streamlit as st\n\nst.markdown('Streamlit is **_really_ cool**.')\nst.markdown(\u201dThis text is :red[colored red], and this is **:blue[colored]** and bold.\u201d)\nst.markdown(":green[$\\sqrt{x^2+y^2}=1$] is a Pythagorean identity. :pencil:")\n
\n
\n", + "description": "

Display string formatted as Markdown.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The string to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "description": "

Defaults to False.

\n
\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text.\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the Markdown.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L31" + }, + "streamlit.metric": { + "name": "metric", + "signature": "st.metric(label, value, delta=None, delta_color=\"normal\", help=None, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\nst.metric(label="Temperature", value="70 \u00b0F", delta="1.2 \u00b0F")\n
\n\n \n

st.metric looks especially nice in combination with st.columns:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\ncol1.metric("Temperature", "70 \u00b0F", "1.2 \u00b0F")\ncol2.metric("Wind", "9 mph", "-8%")\ncol3.metric("Humidity", "86%", "4%")\n
\n\n \n

The delta indicator color can also be inverted or turned off:

\n
\nimport streamlit as st\n\nst.metric(label="Gas price", value=4, delta=-0.5,\n    delta_color="inverse")\n\nst.metric(label="Active developers", value=123, delta=123,\n    delta_color="off")\n
\n\n \n
\n", + "description": "

Display a metric in big bold font, with an optional indicator of how the metric changed.

\n

Tip: If you want to display a large number, it may be a good idea to\nshorten it using packages like millify\nor numerize. E.g. 1234 can be\ndisplayed as 1.2k using st.metric("Short number", millify(1234)).

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

The header or title for the metric. The label can optionally contain\nMarkdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, str, or None", + "is_optional": false, + "description": "

Value of the metric. None is rendered as a long dash.

\n", + "default": null + }, + { + "name": "delta", + "type_name": "int, float, str, or None", + "is_optional": false, + "description": "

Indicator of how the metric changed, rendered with an arrow below\nthe metric. If delta is negative (int/float) or starts with a minus\nsign (str), the arrow points down and the text is red; else the\narrow points up and the text is green. If None (default), no delta\nindicator is shown.

\n", + "default": null + }, + { + "name": "delta_color", + "type_name": "str", + "is_optional": false, + "description": "

If "normal" (default), the delta indicator is shown as described\nabove. If "inverse", it is red when positive and green when\nnegative. This is useful when a negative change is considered\ngood, e.g. if cost decreased. If "off", delta is shown in gray\nregardless of its value.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the metric label.

\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/metric.py#L46" + }, + "streamlit.multiselect": { + "name": "multiselect", + "signature": "st.multiselect(label, options, default=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", max_selections=None)", + "example": "
\n
\nimport streamlit as st\n\noptions = st.multiselect(\n    'What are your favorite colors',\n    ['Green', 'Yellow', 'Red', 'Blue'],\n    ['Yellow', 'Red'])\n\nst.write('You selected:', options)\n
\n\n \n
\n", + "description": "

Display a multiselect widget.

\n

The multiselect widget starts as empty.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Sequence[V], numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", + "is_optional": false, + "description": "

Labels for the select options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", + "default": "." + }, + { + "name": "default", + "type_name": "[V], V, or None", + "is_optional": false, + "description": "

List of default values. Can also be a single value.

\n", + "default": "values." + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "description": "

Function to modify the display of selectbox options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe multiselect.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the multiselect.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this multiselect's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the multiselect widget if set\nto True. The default is False. This argument can only be supplied\nby keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + }, + { + "name": "max_selections", + "type_name": "int", + "is_optional": false, + "description": "

The max selections that can be selected at a time.\nThis argument can only be supplied by keyword.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "list", + "is_generator": false, + "description": "

A list with the selected options

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/multiselect.py#L145" + }, + "streamlit.number_input": { + "name": "number_input", + "signature": "st.number_input(label, min_value=None, max_value=None, value=, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\nnumber = st.number_input('Insert a number')\nst.write('The current number is ', number)\n
\n\n \n
\n", + "description": "

Display a numeric input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int or float or None", + "is_optional": false, + "description": "

The minimum permitted value.\nIf None, there will be no minimum.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int or float or None", + "is_optional": false, + "description": "

The maximum permitted value.\nIf None, there will be no maximum.

\n", + "default": null + }, + { + "name": "value", + "type_name": "int or float or None", + "is_optional": false, + "description": "

The value of this widget when it first renders.\nDefaults to min_value, or 0.0 if min_value is None

\n", + "default": "min_value" + }, + { + "name": "step", + "type_name": "int or float or None", + "is_optional": false, + "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 otherwise.\nIf the value is not specified, the format parameter will be used.

\n", + "default": "1" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. Output must be purely numeric. This does not impact\nthe return value. Valid formatters: %d %e %f %g %i %u

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the input.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this number_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the number input if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "int or float", + "is_generator": false, + "description": "

The current value of the numeric input widget. The return type\nwill match the data type of the value parameter.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/number_input.py#L66" + }, + "streamlit.plotly_chart": { + "name": "plotly_chart", + "signature": "st.plotly_chart(figure_or_data, use_container_width=False, sharing=\"streamlit\", theme=\"streamlit\", **kwargs)", + "example": "
\n

The example below comes straight from the examples at\nhttps://plot.ly/python:

\n
\nimport streamlit as st\nimport numpy as np\nimport plotly.figure_factory as ff\n\n# Add histogram data\nx1 = np.random.randn(200) - 2\nx2 = np.random.randn(200)\nx3 = np.random.randn(200) + 2\n\n# Group data together\nhist_data = [x1, x2, x3]\n\ngroup_labels = ['Group 1', 'Group 2', 'Group 3']\n\n# Create distplot with custom bin_size\nfig = ff.create_distplot(\n        hist_data, group_labels, bin_size=[.1, .25, .5])\n\n# Plot!\nst.plotly_chart(fig, use_container_width=True)\n
\n\n \n
\n", + "description": "

Display an interactive Plotly chart.

\n

Plotly is a charting library for Python. The arguments to this function\nclosely follow the ones for Plotly's plot() function. You can find\nmore about Plotly at https://plot.ly/python.

\n

To show Plotly charts in Streamlit, call st.plotly_chart wherever you\nwould call Plotly's py.plot or py.iplot.

\n", + "args": [ + { + "name": "figure_or_data", + "type_name": "plotly.graph_objs.Figure, plotly.graph_objs.Data,", + "is_optional": false, + "description": "

dict/list of plotly.graph_objs.Figure/Data

\n

See https://plot.ly/python/ for examples of graph descriptions.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over the figure's native width value.

\n", + "default": null + }, + { + "name": "sharing", + "type_name": "{'streamlit', 'private', 'secret', 'public'}", + "is_optional": false, + "description": "

Use 'streamlit' to insert the plot and all its dependencies\ndirectly in the Streamlit app using plotly's offline mode (default).\nUse any other sharing mode to send the chart to Plotly chart studio, which\nrequires an account. See https://plot.ly/python/chart-studio/ for more information.

\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", + "default": "behavior" + }, + { + "name": "**kwargs", + "type_name": null, + "is_optional": null, + "description": "

Any argument accepted by Plotly's plot() function.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/plotly_chart.py#L81" + }, + "streamlit.progress": { + "name": "progress", + "signature": "st.progress(value, text=None)", + "example": "
\n

Here is an example of a progress bar increasing over time:

\n
\nimport streamlit as st\nimport time\n\nprogress_text = "Operation in progress. Please wait."\nmy_bar = st.progress(0, text=progress_text)\n\nfor percent_complete in range(100):\n    time.sleep(0.1)\n    my_bar.progress(percent_complete + 1, text=progress_text)\n
\n
\n", + "description": "

Display a progress bar.

\n", + "args": [ + { + "name": "value", + "type_name": "int or float", + "is_optional": false, + "description": "

0 <= value <= 100 for int

\n

0.0 <= value <= 1.0 for float

\n", + "default": null + }, + { + "name": "text", + "type_name": "str or None", + "is_optional": false, + "description": "

A message to display above the progress bar. The text can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/progress.py#L66" + }, + "streamlit.pydeck_chart": { + "name": "pydeck_chart", + "signature": "st.pydeck_chart(pydeck_obj=None, use_container_width=False)", + "example": "
\n

Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the\nlight or dark map style, based on which Streamlit theme is currently active:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport pydeck as pdk\n\nchart_data = pd.DataFrame(\n   np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n   columns=['lat', 'lon'])\n\nst.pydeck_chart(pdk.Deck(\n    map_style=None,\n    initial_view_state=pdk.ViewState(\n        latitude=37.76,\n        longitude=-122.4,\n        zoom=11,\n        pitch=50,\n    ),\n    layers=[\n        pdk.Layer(\n           'HexagonLayer',\n           data=chart_data,\n           get_position='[lon, lat]',\n           radius=200,\n           elevation_scale=4,\n           elevation_range=[0, 1000],\n           pickable=True,\n           extruded=True,\n        ),\n        pdk.Layer(\n            'ScatterplotLayer',\n            data=chart_data,\n            get_position='[lon, lat]',\n            get_color='[200, 30, 0, 160]',\n            get_radius=200,\n        ),\n    ],\n))\n
\n\n \n
\n

Note

\n

To make the PyDeck chart's style consistent with Streamlit's theme,\nyou can set map_style=None in the pydeck.Deck object.

\n
\n
\n", + "description": "

Draw a chart using the PyDeck library.

\n

This supports 3D maps, point clouds, and more! More info about PyDeck\nat https://deckgl.readthedocs.io/en/latest/.

\n

These docs are also quite useful:

\n\n

When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox.

\n

Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the mapbox.token config option.The use of Mapbox is governed by Mapbox's Terms of Use.

\n

To get a token for yourself, create an account at https://mapbox.com.\nFor more info on how to set config options, see\nhttps://docs.streamlit.io/library/advanced-features/configuration

\n
\n

Streamlit in Snowflake Note

\n

When you use the st.pydeck_chart, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's External Offerings Terms.

\n
\n", + "args": [ + { + "name": "pydeck_obj", + "type_name": "pydeck.Deck or None", + "is_optional": false, + "description": "

Object specifying the PyDeck chart to draw.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/deck_gl_json_chart.py#L36" + }, + "streamlit.pyplot": { + "name": "pyplot", + "signature": "st.pyplot(fig=None, clear_figure=None, use_container_width=True, **kwargs)", + "notes": "
\n
\n

Note

\n

Deprecation warning. After December 1st, 2020, we will remove the ability\nto specify no arguments in st.pyplot(), as that requires the use of\nMatplotlib's global figure object, which is not thread-safe. So\nplease always pass a figure object as shown in the example section\nabove.

\n
\n

Matplotlib supports several types of "backends". If you're getting an\nerror using Matplotlib with Streamlit, try setting your backend to "TkAgg":

\n
\necho "backend: TkAgg" >> ~/.matplotlib/matplotlibrc\n
\n

For more information, see https://matplotlib.org/faq/usage_faq.html.

\n
\n", + "example": "
\n
\nimport streamlit as st\nimport matplotlib.pyplot as plt\nimport numpy as np\n\narr = np.random.normal(1, 1, size=100)\nfig, ax = plt.subplots()\nax.hist(arr, bins=20)\n\nst.pyplot(fig)\n
\n\n \n
\n", + "description": "

Display a matplotlib.pyplot figure.

\n", + "args": [ + { + "name": "fig", + "type_name": "Matplotlib Figure", + "is_optional": false, + "description": "

The figure to plot. When this argument isn't specified, this\nfunction will render the global figure (but this is deprecated,\nas described below)

\n", + "default": null + }, + { + "name": "clear_figure", + "type_name": "bool", + "is_optional": false, + "description": "

If True, the figure will be cleared after being rendered.\nIf False, the figure will not be cleared after being rendered.\nIf left unspecified, we pick a default based on the value of fig.

\n
    \n
  • If fig is set, defaults to False.
  • \n
  • If fig is not set, defaults to True. This simulates Jupyter's\napproach to matplotlib rendering.
  • \n
\n", + "default": "based" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. Defaults to True.

\n", + "default": "s" + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "description": "

Arguments to pass to Matplotlib's savefig function.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/pyplot.py#L38" + }, + "streamlit.radio": { + "name": "radio", + "signature": "st.radio(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, horizontal=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\ngenre = st.radio(\n    "What\\'s your favorite movie genre",\n    ('Comedy', 'Drama', 'Documentary'))\n\nif genre == 'Comedy':\n    st.write('You selected comedy.')\nelse:\n    st.write("You didn\\'t select comedy.")\n
\n\n \n
\n", + "description": "

Display a radio button widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this radio group is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", + "is_optional": false, + "description": "

Labels for the radio options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", + "default": "." + }, + { + "name": "index", + "type_name": "int", + "is_optional": false, + "description": "

The index of the preselected option on first render.

\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "description": "

Function to modify the display of radio options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe radio.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the radio.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this radio's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the radio button if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", + "default": "False." + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which orients the radio group horizontally.\nThe default is false (vertical buttons). This argument can only\nbe supplied by keyword.

\n", + "default": "false" + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "

The selected option.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/radio.py#L75" + }, + "streamlit.select_slider": { + "name": "select_slider", + "signature": "st.select_slider(label, options=(), value=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "examples": "
\nimport streamlit as st\n\ncolor = st.select_slider(\n    'Select a color of the rainbow',\n    options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'])\nst.write('My favorite color is', color)\n
\n

And here's an example of a range select slider:

\n
\nimport streamlit as st\n\nstart_color, end_color = st.select_slider(\n    'Select a range of color wavelength',\n    options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'],\n    value=('red', 'blue'))\nst.write('You selected wavelengths between', start_color, 'and', end_color)\n
\n\n \n ", + "description": "

Display a slider widget to select items from a list.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.select_slider and st.slider is that\nselect_slider accepts any datatype and takes an iterable set of\noptions, while slider only accepts numerical or date/time data and\ntakes a range as input.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", + "is_optional": false, + "description": "

Labels for the slider options. All options will be cast to str\ninternally by default. For pandas.DataFrame, the first column is\nselected.

\n", + "default": "." + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to first option.

\n", + "default": "first" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "description": "

Function to modify the display of the labels from the options.\nargument. It receives the option as an argument and its output\nwill be cast to str.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the select slider.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this select_slider's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the select slider if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any value or tuple of any value", + "is_generator": false, + "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/select_slider.py#L106" + }, + "streamlit.selectbox": { + "name": "selectbox", + "signature": "st.selectbox(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\noption = st.selectbox(\n    'How would you like to be contacted?',\n    ('Email', 'Home phone', 'Mobile phone'))\n\nst.write('You selected:', option)\n
\n\n \n
\n", + "description": "

Display a select widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", + "is_optional": false, + "description": "

Labels for the select options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", + "default": "." + }, + { + "name": "index", + "type_name": "int", + "is_optional": false, + "description": "

The index of the preselected option on first render.

\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "description": "

Function to modify the display of the labels. It receives the option\nas an argument and its output will be cast to str.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the selectbox.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this selectbox's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the selectbox if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "

The selected option

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/selectbox.py#L71" + }, + "streamlit.set_option": { + "name": "set_option", + "signature": "st.set_option(key, value)", + "description": "

Set config option.

\n
\n
Currently, only the following config options can be set within the script itself:
\n
    \n
  • client.caching
  • \n
  • client.displayEnabled
  • \n
  • deprecation.*
  • \n
\n
\n
\n

Calling with any other options will raise StreamlitAPIException.

\n

Run streamlit config show in the terminal to see all available options.

\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show on a terminal.

\n", + "default": null + }, + { + "name": "value", + "type_name": null, + "is_optional": null, + "description": "

The new value to assign to this config option.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/config.py#L92" + }, + "streamlit.set_page_config": { + "name": "set_page_config", + "signature": "st.set_page_config(page_title=None, page_icon=None, layout=\"centered\", initial_sidebar_state=\"auto\", menu_items=None)", + "example": "
\nimport streamlit as st\n\nst.set_page_config(\n    page_title="Ex-stream-ly Cool App",\n    page_icon="\ud83e\uddca",\n    layout="wide",\n    initial_sidebar_state="expanded",\n    menu_items={\n        'Get Help': 'https://www.extremelycoolapp.com/help',\n        'Report a bug': "https://www.extremelycoolapp.com/bug",\n        'About': "# This is a header. This is an *extremely* cool app!"\n    }\n)\n
\n", + "description": "

Configures the default settings of the page.

\n
\n

Note

\n

This must be the first Streamlit command used in your app, and must only\nbe set once.

\n
\n", + "args": [ + { + "name": "page_title", + "type_name": "str or None", + "is_optional": false, + "description": "

The page title, shown in the browser tab.\n

\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake.

\n
\n", + "default": "the" + }, + { + "name": "page_icon", + "type_name": "Anything supported by st.image or str or None", + "is_optional": false, + "description": "

The page favicon.\n

\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake.

\n
\n", + "default": null + }, + { + "name": "layout", + "type_name": "\"centered\" or \"wide\"", + "is_optional": false, + "description": "

How the page content should be laid out. Defaults to "centered",\nwhich constrains the elements into a centered column of fixed width;\n"wide" uses the entire screen.

\n", + "default": "s" + }, + { + "name": "initial_sidebar_state", + "type_name": "\"auto\" or \"expanded\" or \"collapsed\"", + "is_optional": false, + "description": "

How the sidebar should start out. Defaults to "auto",\nwhich hides the sidebar on mobile-sized devices, and shows it otherwise.\n"expanded" shows the sidebar initially; "collapsed" hides it.

\n", + "default": "s" + }, + { + "name": "menu_items", + "type_name": "dict", + "is_optional": false, + "description": "

Configure the menu that appears on the top-right side of this app.\nThe keys in this dict denote the menu item you'd like to configure:

\n
    \n
  • \n
    "Get help": str or None
    \n
    The URL this menu item should point to.\nIf None, hides this menu item.
    \n
    \n
  • \n
  • \n
    "Report a Bug": str or None
    \n
    The URL this menu item should point to.\nIf None, hides this menu item.
    \n
    \n
  • \n
  • \n
    "About": str or None
    \n
    A markdown string to show in the About dialog.\nIf None, only shows Streamlit's default About text.
    \n
    \n
  • \n
\n

The URL may also refer to an email address e.g. mailto:john@example.com.

\n", + "default": "About" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/page_config.py#L114" + }, + "streamlit.slider": { + "name": "slider", + "signature": "st.slider(label, min_value=None, max_value=None, value=None, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "examples": "
\n
\nimport streamlit as st\n\nage = st.slider('How old are you?', 0, 130, 25)\nst.write("I'm ", age, 'years old')\n
\n

And here's an example of a range slider:

\n
\nimport streamlit as st\n\nvalues = st.slider(\n    'Select a range of values',\n    0.0, 100.0, (25.0, 75.0))\nst.write('Values:', values)\n
\n

This is a range time slider:

\n
\nimport streamlit as st\nfrom datetime import time\n\nappointment = st.slider(\n    "Schedule your appointment:",\n    value=(time(11, 30), time(12, 45)))\nst.write("You're scheduled for:", appointment)\n
\n

Finally, a datetime slider:

\n
\nimport streamlit as st\nfrom datetime import datetime\n\nstart_time = st.slider(\n    "When do you start?",\n    value=datetime(2020, 1, 1, 9, 30),\n    format="MM/DD/YY - hh:mm")\nst.write("Start time:", start_time)\n
\n\n \n
\n", + "description": "

Display a slider widget.

\n

This supports int, float, date, time, and datetime types.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.slider and st.select_slider is that\nslider only accepts numerical or date/time data and takes a range as\ninput, while select_slider accepts any datatype and takes an iterable\nset of options.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "min_value", + "type_name": "a supported type or None", + "is_optional": false, + "description": "

The minimum permitted value.\nDefaults to 0 if the value is an int, 0.0 if a float,\nvalue - timedelta(days=14) if a date/datetime, time.min if a time

\n", + "default": "0" + }, + { + "name": "max_value", + "type_name": "a supported type or None", + "is_optional": false, + "description": "

The maximum permitted value.\nDefaults to 100 if the value is an int, 1.0 if a float,\nvalue + timedelta(days=14) if a date/datetime, time.max if a time

\n", + "default": "100" + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to min_value.

\n", + "default": "min_value." + }, + { + "name": "step", + "type_name": "int/float/timedelta or None", + "is_optional": false, + "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 if a float,\ntimedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time\n(or if max_value - min_value < 1 day)

\n", + "default": "1" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. This does not impact the return value.\nFormatter for int/float supports: %d %e %f %g %i\nFormatter for date/time/datetime uses Moment.js notation:\nhttps://momentjs.com/docs/#/displaying/format/

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the slider.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this slider's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the slider if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "int/float/date/time/datetime or tuple of int/float/date/time/datetime", + "is_generator": false, + "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/slider.py#L171" + }, + "streamlit.snow": { + "name": "snow", + "signature": "st.snow()", + "example": "
\n
\nimport streamlit as st\n\nst.snow()\n
\n

...then watch your app and get ready for a cool celebration!

\n
\n", + "description": "

Draw celebratory snowfall.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/snow.py#L25" + }, + "streamlit.spinner": { + "name": "spinner", + "signature": "st.spinner(text=\"In progress...\")", + "example": "
\n
\nimport time\nimport streamlit as st\n\nwith st.spinner('Wait for it...'):\n    time.sleep(5)\nst.success('Done!')\n
\n
\n", + "description": "

Temporarily displays a message while executing a block of code.

\n", + "args": [ + { + "name": "text", + "type_name": "str", + "is_optional": false, + "description": "

A message to display while executing that block

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/spinner.py#L23" + }, + "streamlit.stop": { + "name": "stop", + "signature": "st.stop()", + "example": "
\n
\nimport streamlit as st\n\nname = st.text_input('Name')\nif not name:\n  st.warning('Please input a name.')\n  st.stop()\nst.success('Thank you for inputting a name.')\n
\n
\n", + "description": "

Stops execution immediately.

\n

Streamlit will not run any statements after st.stop().\nWe recommend rendering a message to explain why the script has stopped.\nWhen run outside of Streamlit, this will raise an Exception.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/execution_control.py#L25" + }, + "streamlit.subheader": { + "name": "subheader", + "signature": "st.subheader(body, anchor=None, *, help=None)", + "examples": "
\n
\nimport streamlit as st\n\nst.subheader('This is a subheader')\nst.subheader('A subheader with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", + "description": "

Display text in subheader formatting.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the subheader.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L93" + }, + "streamlit.success": { + "name": "success", + "signature": "st.success(body, *, icon=None)", + "example": "
\n
\nimport streamlit as st\n\nst.success('This is a success message!', icon="\u2705")\n
\n
\n", + "description": "

Display a success message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The success text to display.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", + "default": "None" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L136" + }, + "streamlit.table": { + "name": "table", + "signature": "st.table(data=None)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(10, 5),\n   columns=('col %d' % i for i in range(5)))\n\nst.table(df)\n
\n\n \n
\n", + "description": "

Display a static table.

\n

This differs from st.dataframe in that the table in this case is\nstatic: its entire contents are laid out directly on the page.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", + "is_optional": false, + "description": "

The table data.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L122" + }, + "streamlit.tabs": { + "name": "tabs", + "signature": "st.tabs(tabs)", + "examples": "
\n

You can use with notation to insert any element into a tab:

\n
\nimport streamlit as st\n\ntab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])\n\nwith tab1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg", width=200)\n\nwith tab2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\n\nwith tab3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ntab1, tab2 = st.tabs(["\ud83d\udcc8 Chart", "\ud83d\uddc3 Data"])\ndata = np.random.randn(10, 1)\n\ntab1.subheader("A tab with a chart")\ntab1.line_chart(data)\n\ntab2.subheader("A tab with the data")\ntab2.write(data)\n
\n\n \n
\n", + "description": "

Insert containers separated into tabs.

\n

Inserts a number of multi-element containers as tabs.\nTabs are a navigational element that allows users to easily\nmove between groups of related content.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

All the content of every tab is always sent to and rendered on the frontend.\nConditional rendering is currently not supported.

\n
\n", + "args": [ + { + "name": "tabs", + "type_name": "list of strings", + "is_optional": false, + "description": "

Creates a tab for each string in the list. The first tab is selected by default.\nThe string is used as the name of the tab and can optionally contain Markdown,\nsupporting the following elements: Bold, Italics, Strikethroughs, Inline Code,\nEmojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", + "default": "." + } + ], + "returns": [ + { + "type_name": "list of containers", + "is_generator": false, + "description": "

A list of container objects.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L208" + }, + "streamlit.text": { + "name": "text", + "signature": "st.text(body, *, help=None)", + "example": "
\n
\nimport streamlit as st\n\nst.text('This is some text.')\n
\n
\n", + "description": "

Write fixed-width and preformatted text.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The string to display.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the text.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text.py#L27" + }, + "streamlit.text_area": { + "name": "text_area", + "signature": "st.text_area(label, value=\"\", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\ntxt = st.text_area('Text to analyze', '''\n    It was the best of times, it was the worst of times, it was\n    the age of wisdom, it was the age of foolishness, it was\n    the epoch of belief, it was the epoch of incredulity, it\n    was the season of Light, it was the season of Darkness, it\n    was the spring of hope, it was the winter of despair, (...)\n    ''')\nst.write('Sentiment:', run_sentiment_analysis(txt))\n
\n
\n", + "description": "

Display a multi-line text input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "object", + "is_optional": false, + "description": "

The text value of this widget when it first renders. This will be\ncast to str internally.

\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "description": "

Desired height of the UI element expressed in pixels. If None, a\ndefault height is used.

\n", + "default": "height" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "description": "

Maximum number of characters allowed in text area.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the textarea.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this text_area's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional string displayed when the text area is empty. If None,\nno text is displayed. This argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the text area if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "

The current value of the text input widget.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text_widgets.py#L274" + }, + "streamlit.text_input": { + "name": "text_input", + "signature": "st.text_input(label, value=\"\", max_chars=None, key=None, type=\"default\", help=None, autocomplete=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", + "example": "
\n
\nimport streamlit as st\n\ntitle = st.text_input('Movie title', 'Life of Brian')\nst.write('The current movie title is', title)\n
\n\n \n
\n", + "description": "

Display a single-line text input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "object", + "is_optional": false, + "description": "

The text value of this widget when it first renders. This will be\ncast to str internally.

\n", + "default": null + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "description": "

Max number of characters allowed in text input.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"default\" or \"password\"", + "is_optional": false, + "description": "

The type of the text input. This can be either "default" (for\na regular text input), or "password" (for a text input that\nmasks the user's typed value). Defaults to "default".

\n", + "default": "s" + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the input.

\n", + "default": null + }, + { + "name": "autocomplete", + "type_name": "str", + "is_optional": false, + "description": "

An optional value that will be passed to the <input> element's\nautocomplete property. If unspecified, this value will be set to\n"new-password" for "password" inputs, and the empty string for\n"default" inputs. For more details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this text input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional string displayed when the text input is empty. If None,\nno text is displayed. This argument can only be supplied by keyword.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the text input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "

The current value of the text input widget.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text_widgets.py#L71" + }, + "streamlit.time_input": { + "name": "time_input", + "signature": "st.time_input(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", step=0:15:00)", + "example": "
\n
\nimport datetime\nimport streamlit as st\n\nt = st.time_input('Set an alarm for', datetime.time(8, 45))\nst.write('Alarm is set for', t)\n
\n\n \n
\n", + "description": "

Display a time input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "description": "

A short label explaining to the user what this time input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "datetime.time/datetime.datetime", + "is_optional": false, + "description": "

The value of this widget when it first renders. This will be\ncast to str internally. Defaults to the current time.

\n", + "default": "the" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the input.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "description": "

An optional callback invoked when this time_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "description": "

An optional boolean, which disables the time input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", + "default": "False." + }, + { + "name": "label_visibility", + "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", + "is_optional": false, + "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", + "default": "is" + }, + { + "name": "step", + "type_name": "int or timedelta", + "is_optional": false, + "description": "

The stepping interval in seconds. Defaults to 900, i.e. 15 minutes.\nYou can also pass a datetime.timedelta object.

\n", + "default": "900" + } + ], + "returns": [ + { + "type_name": "datetime.time", + "is_generator": false, + "description": "

The current value of the time input widget.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/time_widgets.py#L214" + }, + "streamlit.title": { + "name": "title", + "signature": "st.title(body, anchor=None, *, help=None)", + "examples": "
\n
\nimport streamlit as st\n\nst.title('This is a title')\nst.title('A title with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", + "description": "

Display text in title formatting.

\n

Each document should have a single st.title(), although this is not\nenforced.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "description": "

An optional tooltip that gets displayed next to the title.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L146" + }, + "streamlit.vega_lite_chart": { + "name": "vega_lite_chart", + "signature": "st.vega_lite_chart(data=None, spec=None, use_container_width=False, theme=\"streamlit\", **kwargs)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(200, 3),\n    columns=['a', 'b', 'c'])\n\nst.vega_lite_chart(chart_data, {\n    'mark': {'type': 'circle', 'tooltip': True},\n    'encoding': {\n        'x': {'field': 'a', 'type': 'quantitative'},\n        'y': {'field': 'b', 'type': 'quantitative'},\n        'size': {'field': 'c', 'type': 'quantitative'},\n        'color': {'field': 'c', 'type': 'quantitative'},\n    },\n})\n
\n\n \n

Examples of Vega-Lite usage without Streamlit can be found at\nhttps://vega.github.io/vega-lite/examples/. Most of those can be easily\ntranslated to the syntax shown above.

\n
\n", + "description": "

Display a chart using the Vega-Lite library.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None", + "is_optional": false, + "description": "

Either the data to be plotted or a Vega-Lite spec containing the\ndata (which more closely follows the Vega-Lite API).\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + }, + { + "name": "spec", + "type_name": "dict or None", + "is_optional": false, + "description": "

The Vega-Lite spec for the chart. If the spec was already passed in\nthe previous argument, this must be set to None. See\nhttps://vega.github.io/vega-lite/docs/ for more info.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "description": "

If True, set the chart width to the column width. This takes\nprecedence over Vega-Lite's native width value.

\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", + "default": "behavior" + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "description": "

Same as spec, but as keywords.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L475" + }, + "streamlit.video": { + "name": "video", + "signature": "st.video(data, format=\"video/mp4\", start_time=0)", + "example": "
\n
\nimport streamlit as st\n\nvideo_file = open('myvideo.mp4', 'rb')\nvideo_bytes = video_file.read()\n\nst.video(video_bytes)\n
\n\n \n
\n

Note

\n

Some videos may not display if they are encoded using MP4V (which is an export option in OpenCV), as this codec is\nnot widely supported by browsers. Converting your video to H.264 will allow the video to be displayed in Streamlit.\nSee this StackOverflow post or this\nStreamlit forum post\nfor more information.

\n
\n
\n", + "description": "

Display a video player.

\n", + "args": [ + { + "name": "data", + "type_name": "str, bytes, BytesIO, numpy.ndarray, or file opened with", + "is_optional": false, + "description": "

io.open().\nRaw video data, filename, or URL pointing to a video to load.\nIncludes support for YouTube URLs.\nNumpy arrays and raw data formats must include all necessary file\nheaders to match specified file format.

\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "description": "

The mime type for the video file. Defaults to 'video/mp4'.\nSee https://tools.ietf.org/html/rfc4281 for more info.

\n", + "default": "s" + }, + { + "name": "start_time", + "type_name": "int", + "is_optional": false, + "description": "

The time from which this element should start playing.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/media.py#L117" + }, + "streamlit.warning": { + "name": "warning", + "signature": "st.warning(body, *, icon=None)", + "example": "
\n
\nimport streamlit as st\n\nst.warning('This is a warning', icon="\u26a0\ufe0f")\n
\n
\n", + "description": "

Display warning message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "description": "

The warning text to display.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", + "default": "None" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L71" + }, + "streamlit.write": { + "name": "write", + "signature": "st.write(*args, unsafe_allow_html=False, **kwargs)", + "example": "
\n

Its basic use case is to draw Markdown-formatted text, whenever the\ninput is a string:

\n
\nimport streamlit as st\n\nst.write('Hello, *World!* :sunglasses:')\n
\n\n \n

As mentioned earlier, st.write() also accepts other data formats, such as\nnumbers, data frames, styled data frames, and assorted objects:

\n
\nimport streamlit as st\nimport pandas as pd\n\nst.write(1234)\nst.write(pd.DataFrame({\n    'first column': [1, 2, 3, 4],\n    'second column': [10, 20, 30, 40],\n}))\n
\n\n \n

Finally, you can pass in multiple arguments to do things like:

\n
\nimport streamlit as st\n\nst.write('1 + 1 = ', 2)\nst.write('Below is a DataFrame:', data_frame, 'Above is a dataframe.')\n
\n\n \n

Oh, one more thing: st.write accepts chart objects too! For example:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\ndf = pd.DataFrame(\n    np.random.randn(200, 3),\n    columns=['a', 'b', 'c'])\n\nc = alt.Chart(df).mark_circle().encode(\n    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.write(c)\n
\n\n \n
\n", + "description": "

Write arguments to the app.

\n

This is the Swiss Army knife of Streamlit commands: it does different\nthings depending on what you throw at it. Unlike other Streamlit commands,\nwrite() has some unique properties:

\n
    \n
  1. You can pass in multiple arguments, all of which will be written.
  2. \n
  3. Its behavior depends on the input types as follows.
  4. \n
  5. It returns None, so its "slot" in the App cannot be reused.
  6. \n
\n", + "args": [ + { + "name": "*args", + "type_name": "any", + "is_optional": false, + "description": "

One or many objects to print to the App.

\n

Arguments are handled as follows:

\n
    \n
  • \n
    write(string) : Prints the formatted Markdown string, with
    \n
    support for LaTeX expression, emoji shortcodes, and colored text.\nSee docs for st.markdown for more.
    \n
    \n
  • \n
  • write(data_frame) : Displays the DataFrame as a table.
  • \n
  • write(error) : Prints an exception specially.
  • \n
  • write(func) : Displays information about a function.
  • \n
  • write(module) : Displays information about the module.
  • \n
  • write(class) : Displays information about a class.
  • \n
  • write(dict) : Displays dict in an interactive widget.
  • \n
  • write(mpl_fig) : Displays a Matplotlib figure.
  • \n
  • write(altair) : Displays an Altair chart.
  • \n
  • write(keras) : Displays a Keras model.
  • \n
  • write(graphviz) : Displays a Graphviz graph.
  • \n
  • write(plotly_fig) : Displays a Plotly figure.
  • \n
  • write(bokeh_fig) : Displays a Bokeh figure.
  • \n
  • write(sympy_expr) : Prints SymPy expression using LaTeX.
  • \n
  • write(htmlable) : Prints _repr_html_() for the object if available.
  • \n
  • write(obj) : Prints str(obj) if otherwise unknown.
  • \n
\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "description": "

This is a keyword-only argument that defaults to False.

\n

By default, any HTML tags found in strings will be escaped and\ntherefore treated as pure text. This behavior may be turned off by\nsetting this argument to True.

\n

That said, we strongly advise against it. It is hard to write secure\nHTML, so by using this argument you may be compromising your users'\nsecurity. For more information, see:

\n

https://github.com/streamlit/streamlit/issues/152

\n", + "default": "False." + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/write.py#L48" + }, + "streamlit.experimental_memo.clear": { + "name": "experimental_memo.clear", + "signature": "st.experimental_memo.clear()", + "description": "

Clear all in-memory and on-disk data caches.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L541" + }, + "streamlit.cache_data.clear": { + "name": "cache_data.clear", + "signature": "st.cache_data.clear()", + "description": "

Clear all in-memory and on-disk data caches.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L541" + }, + "streamlit.experimental_singleton.clear": { + "name": "experimental_singleton.clear", + "signature": "st.experimental_singleton.clear()", + "description": "

Clear all cache_resource caches.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L396" + }, + "streamlit.cache_resource.clear": { + "name": "cache_resource.clear", + "signature": "st.cache_resource.clear()", + "description": "

Clear all cache_resource caches.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L396" + }, + "streamlit.connections.ExperimentalBaseConnection": { + "name": "ExperimentalBaseConnection", + "signature": "st.connections.ExperimentalBaseConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L25", + "description": "

The abstract base class that all Streamlit Connections must inherit from.

\n

This base class provides connection authors with a standardized way to hook into the\nst.experimental_connection() factory function: connection authors are required to\nprovide an implementation for the abstract method _connect in their subclasses.

\n

Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information

\n
\n

Note

\n

While providing an implementation of _connect is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a query() method for\nreads and a session property for more complex operations.

\n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SQLConnection": { + "name": "SQLConnection", + "signature": "st.connections.SQLConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "query", + "signature": "st.connections.query.query(sql, *, ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n
\n
\n", + "description": "

Run a read-only query.

", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None." + }, + { + "name": "index_col", + "type_name": "str, list of str, or None", + "is_optional": false, + "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", + "default": "None." + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", + "default": "None." + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", + "default": "None." + }, + { + "name": "**kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

Additional keyword arguments are passed to pd.read_sql.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pd.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L121" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" + } + ], + "properties": [ + { + "name": "session", + "signature": "st.connections.session.session", + "example": "
\n
\nimport streamlit as st\nconn = st.experimental_connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n
\n", + "description": "

Return a SQLAlchemy Session.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L226" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L45", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", + "description": "

A connection to a SQL database using a SQLAlchemy Engine. Initialize using st.experimental_connection("<name>", type="sql").

\n

SQLConnection provides the query() convenience method, which can be used to\nrun simple read-only queries with both caching and simple error handling/retries.\nMore complex DB interactions can be performed by using the .session property\nto receive a regular SQLAlchemy Session.

\n

SQLConnections should always be created using st.experimental_connection(),\nnot initialized directly. Connection parameters for a SQLConnection can be\nspecified using either st.secrets or **kwargs. Some frequently used\nparameters include:

\n
    \n
  • url or arguments for sqlalchemy.engine.URL.create().\nMost commonly it includes a dialect, host, database, username and password.
  • \n
  • create_engine_kwargs can be passed via st.secrets, such as for\nsnowflake-sqlalchemy\nor Google BigQuery.\nThese can also be passed directly as **kwargs to experimental_connection().
  • \n
  • autocommit=True to run with isolation level AUTOCOMMIT. Default is False.
  • \n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SnowparkConnection": { + "name": "SnowparkConnection", + "signature": "st.connections.SnowparkConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "query", + "signature": "st.connections.query.query(sql, ttl=None)", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", + "description": "

Run a read-only SQL query.

", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None." + } + ], + "returns": [ + { + "type_name": "pd.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L123" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" + }, + { + "name": "safe_session", + "signature": "st.connections.safe_session.safe_session()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\nwith conn.safe_session() as session:\n    df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n
\n
\n", + "description": "

Grab the underlying Snowpark session in a thread-safe manner.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L207" + } + ], + "properties": [ + { + "name": "session", + "signature": "st.connections.session.session", + "example": "
\n
\nimport streamlit as st\n\nsession = st.experimental_connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n
\n
\n", + "description": "

Access the underlying Snowpark session.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L184" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L70", + "description": "

A connection to Snowpark using snowflake.snowpark.session.Session. Initialize using

\n

st.experimental_connection("<name>", type="snowpark").

\n

In addition to accessing the Snowpark Session, SnowparkConnection supports direct SQL querying using\nquery("...") and thread safe access using with conn.safe_session():. See methods\nbelow for more information. SnowparkConnections should always be created using\nst.experimental_connection(), not initialized directly.

\n
\n

Note

\n

We don't expect this iteration of SnowparkConnection to be able to scale\nwell in apps with many concurrent users due to the lock contention that will occur\nover the single underlying Session object under high load.

\n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SQLConnection.query": { + "name": "query", + "signature": "SQLConnection.query(sql, *, ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n
\n
\n", + "description": "

Run a read-only query.

\n

This method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n

Aside from the ttl kwarg, all kwargs passed to this function are passed down\nto pd.read_sql\nand have the behavior described in the pandas documentation.

\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None." + }, + { + "name": "index_col", + "type_name": "str, list of str, or None", + "is_optional": false, + "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", + "default": "None." + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", + "default": "None." + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", + "default": "None." + }, + { + "name": "**kwargs", + "type_name": "dict", + "is_optional": false, + "description": "

Additional keyword arguments are passed to pd.read_sql.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pd.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L121" + }, + "streamlit.connections.SQLConnection.reset": { + "name": "reset", + "signature": "SQLConnection.reset()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" + }, + "streamlit.connections.SQLConnection.session": { + "name": "session", + "signature": "SQLConnection.session", + "example": "
\n
\nimport streamlit as st\nconn = st.experimental_connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n
\n", + "description": "

Return a SQLAlchemy Session.

\n

Users of this connection should use the contextmanager pattern for writes,\ntransactions, and anything more complex than simple read queries.

\n

See the usage example below, which assumes we have a table numbers with a\nsingle integer column val. The SQLAlchemy docs also contain\nmuch more information on the usage of sessions.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L226" + }, + "streamlit.connections.SnowparkConnection.query": { + "name": "query", + "signature": "SnowparkConnection.query(sql, ttl=None)", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", + "description": "

Run a read-only SQL query.

\n

This method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None." + } + ], + "returns": [ + { + "type_name": "pd.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L123" + }, + "streamlit.connections.SnowparkConnection.reset": { + "name": "reset", + "signature": "SnowparkConnection.reset()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" + }, + "streamlit.connections.SnowparkConnection.safe_session": { + "name": "safe_session", + "signature": "SnowparkConnection.safe_session()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\nwith conn.safe_session() as session:\n    df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n
\n
\n", + "description": "

Grab the underlying Snowpark session in a thread-safe manner.

\n

As operations on a Snowpark session are not thread safe, we need to take care\nwhen using a session in the context of a Streamlit app where each script run\noccurs in its own thread. Using the contextmanager pattern to do this ensures\nthat access on this connection's underlying Session is done in a thread-safe\nmanner.

\n

Information on how to use Snowpark sessions can be found in the Snowpark documentation.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L207" + }, + "streamlit.connections.SnowparkConnection.session": { + "name": "session", + "signature": "SnowparkConnection.session", + "example": "
\n
\nimport streamlit as st\n\nsession = st.experimental_connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n
\n
\n", + "description": "

Access the underlying Snowpark session.

\n
\n

Note

\n

Snowpark sessions are not thread safe. Users of this method are\nresponsible for ensuring that access to the session returned by this method is\ndone in a thread-safe manner. For most users, we recommend using the thread-safe\nsafe_session() method and a with block.

\n
\n

Information on how to use Snowpark sessions can be found in the Snowpark documentation.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L184" + }, + "streamlit.connections.ExperimentalBaseConnection.reset": { + "name": "reset", + "signature": "ExperimentalBaseConnection.reset()", + "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" + }, + "DeltaGenerator.add_rows": { + "name": "add_rows", + "signature": "element.add_rows(data=None, **kwargs)", + "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf1 = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nmy_table = st.table(df1)\n\ndf2 = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nmy_table.add_rows(df2)\n# Now the table shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n
\n

You can do the same thing with plots. For example, if you want to add\nmore data to a line chart:

\n
\n# Assuming df1 and df2 from the example above still exist...\nmy_chart = st.line_chart(df1)\nmy_chart.add_rows(df2)\n# Now the chart shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n
\n

And for plots whose datasets are named, you can pass the data with a\nkeyword argument where the key is the name:

\n
\nmy_chart = st.vega_lite_chart({\n    'mark': 'line',\n    'encoding': {'x': 'a', 'y': 'b'},\n    'datasets': {\n      'some_fancy_name': df1,  # <-- named dataset\n     },\n    'data': {'name': 'some_fancy_name'},\n}),\nmy_chart.add_rows(some_fancy_name=df2)  # <-- name used as keyword\n
\n
\n", + "description": "

Concatenate a dataframe to the bottom of the current one.

\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None", + "is_optional": false, + "description": "

Table to concat. Optional.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "pandas.DataFrame, numpy.ndarray, Iterable, dict, or None", + "is_optional": false, + "description": "

The named dataset to concat. Optional. You can only pass in 1\ndataset (including the one in the data parameter).

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L550" + }, + "streamlit.experimental_user.to_dict": { + "name": "to_dict", + "signature": "st.experimental_user.to_dict()", + "description": "

Get user info as a dictionary.

\n

This method primarily exists for internal use and is not needed for\nmost cases. st.experimental_user returns an object that inherits from\ndict by default.

\n", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "

A dictionary of the current user's information.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L54" + }, + "streamlit.experimental_user": { + "name": "streamlit.experimental_user", + "signature": "st.experimental_user()", + "is_class": true, + "methods": [ + { + "name": "to_dict", + "signature": "st.to_dict.to_dict()", + "description": "

Get user info as a dictionary.

", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "

A dictionary of the current user's information.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L54" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L30", + "description": "

A read-only, dict-like object for accessing information about current user.

\n

Properties can by accessed via key or attribute notation. For example,\nst.experimental_user["email"] or st.experimental_user.email.

\n", + "args": [ + { + "name": "user_name", + "type_name": "str", + "is_optional": false, + "description": "

Snowflake user name

\n", + "default": null + }, + { + "name": "login_name", + "type_name": "str", + "is_optional": false, + "description": "

Snowflake user's login name

\n", + "default": null + }, + { + "name": "email", + "type_name": "str", + "is_optional": false, + "description": "

Snowflake user's email

\n", + "default": null + } + ], + "returns": [] + } + }, "1.13.0": { "streamlit.altair_chart": { "name": "altair_chart", From 9c18468c4f2ee96eac8830b16902fc8055d2819d Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Mon, 15 Jul 2024 15:10:13 -0700 Subject: [PATCH 04/40] Revert "Add original SiS version back in (test)" This reverts commit b1fbf26ca60b49a9b9a37444dff6e6b80ed36641. --- python/streamlit.json | 3601 ----------------------------------------- 1 file changed, 3601 deletions(-) diff --git a/python/streamlit.json b/python/streamlit.json index 492fe7b5e..460f935f0 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -1,3605 +1,4 @@ { - "SiS": { - "streamlit.altair_chart": { - "name": "altair_chart", - "signature": "st.altair_chart(altair_chart, use_container_width=False, theme=\"streamlit\")", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nc = alt.Chart(chart_data).mark_circle().encode(\n    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.altair_chart(c, use_container_width=True)\n
\n

Examples of Altair charts can be found at\nhttps://altair-viz.github.io/gallery/.

\n\n \n
\n", - "description": "

Display a chart using the Altair library.

\n", - "args": [ - { - "name": "altair_chart", - "type_name": "altair.vegalite.v2.api.Chart", - "is_optional": false, - "description": "

The Altair chart object to display.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over Altair's native width value.

\n", - "default": null - }, - { - "name": "theme", - "type_name": "\"streamlit\" or None", - "is_optional": false, - "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", - "default": "behavior" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L422" - }, - "streamlit.area_chart": { - "name": "area_chart", - "signature": "st.area_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nst.area_chart(chart_data)\n
\n\n \n
\n", - "description": "

Display an area chart.

\n

This is just syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.area_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", - "is_optional": false, - "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "x", - "type_name": "str or None", - "is_optional": false, - "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "y", - "type_name": "str, sequence of str, or None", - "is_optional": false, - "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int", - "is_optional": false, - "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int", - "is_optional": false, - "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L247" - }, - "streamlit.audio": { - "name": "audio", - "signature": "st.audio(data, format=\"audio/wav\", start_time=0, *, sample_rate=None)", - "example": "
\n
\nimport streamlit as st\nimport numpy as np\n\naudio_file = open('myaudio.ogg', 'rb')\naudio_bytes = audio_file.read()\n\nst.audio(audio_bytes, format='audio/ogg')\n\nsample_rate = 44100  # 44100 samples per second\nseconds = 2  # Note duration of 2 seconds\nfrequency_la = 440  # Our played note will be 440 Hz\n# Generate array with seconds*sample_rate steps, ranging between 0 and seconds\nt = np.linspace(0, seconds, seconds * sample_rate, False)\n# Generate a 440 Hz sine wave\nnote_la = np.sin(frequency_la * t * 2 * np.pi)\n\nst.audio(note_la, sample_rate=sample_rate)\n
\n\n \n
\n", - "description": "

Display an audio player.

\n", - "args": [ - { - "name": "data", - "type_name": "str, bytes, BytesIO, numpy.ndarray, or file opened with", - "is_optional": false, - "description": "

io.open().\nRaw audio data, filename, or a URL pointing to the file to load.\nRaw data formats must include all necessary file headers to match the file\nformat specified via format.\nIf data is a numpy array, it must either be a 1D array of the waveform\nor a 2D array of shape (num_channels, num_samples) with waveforms\nfor all channels. See the default channel order at\nhttp://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx

\n", - "default": "channel" - }, - { - "name": "format", - "type_name": "str", - "is_optional": false, - "description": "

The mime type for the audio file. Defaults to 'audio/wav'.\nSee https://tools.ietf.org/html/rfc4281 for more info.

\n", - "default": "s" - }, - { - "name": "start_time", - "type_name": "int", - "is_optional": false, - "description": "

The time from which this element should start playing.

\n", - "default": null - }, - { - "name": "sample_rate", - "type_name": "int or None", - "is_optional": false, - "description": "

The sample rate of the audio data in samples per second. Only required if\ndata is a numpy array.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/media.py#L43" - }, - "streamlit.balloons": { - "name": "balloons", - "signature": "st.balloons()", - "example": "
\n
\nimport streamlit as st\n\nst.balloons()\n
\n

...then watch your app and get ready for a celebration!

\n
\n", - "description": "

Draw celebratory balloons.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/balloons.py#L25" - }, - "streamlit.bar_chart": { - "name": "bar_chart", - "signature": "st.bar_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=["a", "b", "c"])\n\nst.bar_chart(chart_data)\n
\n\n \n
\n", - "description": "

Display a bar chart.

\n

This is just syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.bar_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", - "is_optional": false, - "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "x", - "type_name": "str or None", - "is_optional": false, - "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "y", - "type_name": "str, sequence of str, or None", - "is_optional": false, - "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int", - "is_optional": false, - "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int", - "is_optional": false, - "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L334" - }, - "streamlit.beta_columns": { - "name": "beta_columns", - "signature": "st.beta_columns(spec, *, gap=\"small\")", - "examples": "
\n

You can use with notation to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n
\n\n \n
\n", - "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

Columns can only be placed inside other columns up to one level of nesting.

\n
\n

Warning

\n

Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.

\n
\n", - "args": [ - { - "name": "spec", - "type_name": "int or list of numbers", - "is_optional": false, - "description": "
\n
If an int
\n
Specifies the number of columns to insert, and all columns\nhave equal width.
\n
If a list of numbers
\n

Creates a column for each number, and each\ncolumn's width is proportional to the number provided. Numbers can\nbe ints or floats, but they must be positive.

\n

For example, st.columns([3, 1, 2]) creates 3 columns where\nthe first column is 3 times the width of the second, and the last\ncolumn is 2 times that width.

\n
\n
\n", - "default": null - }, - { - "name": "gap", - "type_name": "string (\"small\", \"medium\", or \"large\")", - "is_optional": false, - "description": "

An optional string, which indicates the size of the gap between each column.\nThe default is a small gap between columns. This argument can only be supplied by\nkeyword.

\n", - "default": "a" - } - ], - "returns": [ - { - "type_name": "list of containers", - "is_generator": false, - "description": "

A list of container objects.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L77" - }, - "streamlit.beta_container": { - "name": "beta_container", - "signature": "st.beta_container()", - "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.container():\n   st.write("This is inside the container")\n\n   # You can call any Streamlit command, including custom components:\n   st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n\n \n

Inserting elements out of order:

\n
\nimport streamlit as st\n\ncontainer = st.container()\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n
\n\n \n
\n", - "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L29" - }, - "streamlit.beta_expander": { - "name": "beta_expander", - "signature": "st.beta_expander(label, expanded=False)", - "examples": "
\n

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write(\\"\\"\\"\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    \\"\\"\\")\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write(\\"\\"\\"\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n\\"\\"\\")\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n
\n", - "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

Currently, you may not put expanders inside another expander.

\n
\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "expanded", - "type_name": "bool", - "is_optional": false, - "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L320" - }, - "streamlit.button": { - "name": "button", - "signature": "st.button(label, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", - "example": "
\n
\nimport streamlit as st\n\nif st.button('Say hello'):\n    st.write('Why hello there')\nelse:\n    st.write('Goodbye')\n
\n\n \n
\n", - "description": "

Display a button widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed when the button is\nhovered over.

\n", - "default": null - }, - { - "name": "on_click", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this button is clicked.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "type", - "type_name": "\"secondary\" or \"primary\"", - "is_optional": false, - "description": "

An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. This\nargument can only be supplied by keyword. Defaults to "secondary".

\n", - "default": "s" - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the button if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which makes the button stretch its width to match the parent container.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "bool", - "is_generator": false, - "description": "

True if the button was clicked on the last run of the app,\nFalse otherwise.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/button.py#L61" - }, - "streamlit.cache": { - "name": "cache", - "signature": "st.cache(func=None, persist=False, allow_output_mutation=False, show_spinner=True, suppress_st_warning=False, hash_funcs=None, max_entries=None, ttl=None)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\n@st.cache(persist=True)\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

To disable hashing return values, set the allow_output_mutation parameter to True:

\n
\n@st.cache(allow_output_mutation=True)\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. MongoClient) to a hash function (id) like this:

\n
\n@st.cache(hash_funcs={MongoClient: id})\ndef connect_to_database(url):\n    return MongoClient(url)\n
\n

Alternatively, you can map the type's fully-qualified name\n(e.g. "pymongo.mongo_client.MongoClient") to the hash function instead:

\n
\n@st.cache(hash_funcs={"pymongo.mongo_client.MongoClient": id})\ndef connect_to_database(url):\n    return MongoClient(url)\n
\n
\n", - "description": "

Function decorator to memoize function executions.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function to cache. Streamlit hashes the function and dependent code.

\n", - "default": null - }, - { - "name": "persist", - "type_name": "boolean", - "is_optional": false, - "description": "

Whether to persist the cache on disk.

\n", - "default": null - }, - { - "name": "allow_output_mutation", - "type_name": "boolean", - "is_optional": false, - "description": "

Streamlit shows a warning when return values are mutated, as that\ncan have unintended consequences. This is done by hashing the return value internally.

\n

If you know what you're doing and would like to override this warning, set this to True.

\n", - "default": null - }, - { - "name": "show_spinner", - "type_name": "boolean", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na cache miss.

\n", - "default": "True" - }, - { - "name": "suppress_st_warning", - "type_name": "boolean", - "is_optional": false, - "description": "

Suppress warnings about calling Streamlit commands from within\nthe cached function.

\n", - "default": null - }, - { - "name": "hash_funcs", - "type_name": "dict or None", - "is_optional": false, - "description": "

Mapping of types or fully qualified names to hash functions. This is used to override\nthe behavior of the hasher inside Streamlit's caching mechanism: when the hasher\nencounters an object, it will first check to see if its type matches a key in this\ndict and, if so, will use the provided function to generate a hash for it. See below\nfor an example of how this can be used.

\n", - "default": null - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "ttl", - "type_name": "float or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", - "default": "None." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/legacy_caching/caching.py#L486" - }, - "streamlit.cache_data": { - "name": "cache_data", - "signature": "st.cache_data(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "
\n

Streamlit in Snowflake Note

\n

st.cache_data is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions.

\n
\n

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

To cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function to cache. Streamlit hashes the function's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.\nNote that ttl is incompatible with persist="disk" - ttl will be\nignored if persist is specified.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "persist", - "type_name": "str or boolean or None", - "is_optional": false, - "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", - "default": "None." - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L378" - }, - "streamlit.cache_resource": { - "name": "cache_resource", - "signature": "st.cache_resource(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

A cache_resource function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "
\n

Streamlit in Snowflake Note

\n

st.cache_resource is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions.

\n
\n

Decorator to cache functions that return global resources (e.g. database connections, ML models).

\n

Cached objects must be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using st.session_state\nto store resources per session instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

To cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "validate", - "type_name": "callable or None", - "is_optional": false, - "description": "

An optional validation function for cached data. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", - "default": null - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L258" - }, - "streamlit.caption": { - "name": "caption", - "signature": "st.caption(body, unsafe_allow_html=False, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.caption('This is a string that explains something above.')\nst.caption('A caption with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in small font.

\n

This should be used for captions, asides, footnotes, sidenotes, and\nother explanatory text.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "unsafe_allow_html", - "type_name": "bool", - "is_optional": false, - "description": "

By default, any HTML tags found in strings will be escaped and\ntherefore treated as pure text. This behavior may be turned off by\nsetting this argument to True.

\n

That said, we strongly advise against it. It is hard to write secure\nHTML, so by using this argument you may be compromising your users'\nsecurity. For more information, see:

\n

https://github.com/streamlit/streamlit/issues/152

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the caption.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L132" - }, - "streamlit.checkbox": { - "name": "checkbox", - "signature": "st.checkbox(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\nagree = st.checkbox('I agree')\n\nif agree:\n    st.write('Great!')\n
\n\n \n
\n", - "description": "

Display a checkbox widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this checkbox is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "value", - "type_name": "bool", - "is_optional": false, - "description": "

Preselect the checkbox when it first renders. This will be\ncast to bool internally.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the checkbox.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this checkbox's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the checkbox if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "bool", - "is_generator": false, - "description": "

Whether or not the checkbox is checked.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/checkbox.py#L52" - }, - "streamlit.code": { - "name": "code", - "signature": "st.code(body, language=\"python\", line_numbers=False)", - "example": "
\n
\nimport streamlit as st\n\ncode = '''def hello():\n    print("Hello, Streamlit!")'''\nst.code(code, language='python')\n
\n
\n", - "description": "

Display a code block with optional syntax highlighting.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The string to display as code.

\n", - "default": null - }, - { - "name": "language", - "type_name": "str or None", - "is_optional": false, - "description": "

The language that the code is written in, for syntax highlighting.\nIf None, the code will be unstyled. Defaults to "python".

\n

For a list of available language values, see:

\n

https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD

\n", - "default": "s" - }, - { - "name": "line_numbers", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean indicating whether to show line numbers to the\nleft of the code block. Defaults to False.

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/code.py#L27" - }, - "streamlit.color_picker": { - "name": "color_picker", - "signature": "st.color_picker(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ncolor = st.color_picker('Pick A Color', '#00f900')\nst.write('The current color is', color)\n
\n\n \n
\n", - "description": "

Display a color picker widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "str", - "is_optional": false, - "description": "

The hex value of this widget when it first renders. If None,\ndefaults to black.

\n", - "default": "black." - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the color picker.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this color_picker's value\nchanges.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the color picker if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn\u2019t show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "str", - "is_generator": false, - "description": "

The selected color as a hex string.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/color_picker.py#L52" - }, - "streamlit.columns": { - "name": "columns", - "signature": "st.columns(spec, *, gap=\"small\")", - "examples": "
\n

You can use with notation to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n
\n\n \n
\n", - "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

Columns can only be placed inside other columns up to one level of nesting.

\n
\n

Warning

\n

Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.

\n
\n", - "args": [ - { - "name": "spec", - "type_name": "int or list of numbers", - "is_optional": false, - "description": "
\n
If an int
\n
Specifies the number of columns to insert, and all columns\nhave equal width.
\n
If a list of numbers
\n

Creates a column for each number, and each\ncolumn's width is proportional to the number provided. Numbers can\nbe ints or floats, but they must be positive.

\n

For example, st.columns([3, 1, 2]) creates 3 columns where\nthe first column is 3 times the width of the second, and the last\ncolumn is 2 times that width.

\n
\n
\n", - "default": null - }, - { - "name": "gap", - "type_name": "string (\"small\", \"medium\", or \"large\")", - "is_optional": false, - "description": "

An optional string, which indicates the size of the gap between each column.\nThe default is a small gap between columns. This argument can only be supplied by\nkeyword.

\n", - "default": "a" - } - ], - "returns": [ - { - "type_name": "list of containers", - "is_generator": false, - "description": "

A list of container objects.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L77" - }, - "streamlit.container": { - "name": "container", - "signature": "st.container()", - "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.container():\n   st.write("This is inside the container")\n\n   # You can call any Streamlit command, including custom components:\n   st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n\n \n

Inserting elements out of order:

\n
\nimport streamlit as st\n\ncontainer = st.container()\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n
\n\n \n
\n", - "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L29" - }, - "streamlit.dataframe": { - "name": "dataframe", - "signature": "st.dataframe(data=None, width=None, height=None, *, use_container_width=False)", - "examples": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nst.dataframe(df)  # Same as st.write(df)\n
\n\n \n
\nst.dataframe(df, 200, 100)\n
\n

You can also pass a Pandas Styler object to change the style of\nthe rendered DataFrame:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(10, 20),\n   columns=('col %d' % i for i in range(20)))\n\nst.dataframe(df.style.highlight_max(axis=0))\n
\n\n \n
\n", - "description": "

Display a dataframe as an interactive table.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", - "is_optional": false, - "description": "

The data to display.

\n

If 'data' is a pandas.Styler, it will be used to style its\nunderlying DataFrame. Streamlit supports custom cell\nvalues and colors. (It does not support some of the more exotic\npandas styling features, like bar charts, hovering, and captions.)\nStyler support is experimental!\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "width", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired width of the dataframe expressed in pixels. If None, the width\nwill be automatically calculated based on the column content.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired height of the dataframe expressed in pixels. If None, a\ndefault height is used.

\n", - "default": "height" - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the dataframe width to the width of the parent container.\nThis takes precedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L40" - }, - "streamlit.date_input": { - "name": "date_input", - "signature": "st.date_input(label, value=None, min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport datetime\nimport streamlit as st\n\nd = st.date_input(\n    "When\\'s your birthday",\n    datetime.date(2019, 7, 6))\nst.write('Your birthday is:', d)\n
\n\n \n
\n", - "description": "

Display a date input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this date input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime or None", - "is_optional": false, - "description": "

The value of this widget when it first renders. If a list/tuple with\n0 to 2 date/datetime values is provided, the datepicker will allow\nusers to provide a range. Defaults to today as a single-date picker.

\n", - "default": "today" - }, - { - "name": "min_value", - "type_name": "datetime.date or datetime.datetime", - "is_optional": false, - "description": "

The minimum selectable date. If value is a date, defaults to value - 10 years.\nIf value is the interval [start, end], defaults to start - 10 years.

\n", - "default": "value" - }, - { - "name": "max_value", - "type_name": "datetime.date or datetime.datetime", - "is_optional": false, - "description": "

The maximum selectable date. If value is a date, defaults to value + 10 years.\nIf value is the interval [start, end], defaults to end + 10 years.

\n", - "default": "value" - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this date_input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the date input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "datetime.date or a tuple with 0-2 dates", - "is_generator": false, - "description": "

The current value of the date input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/time_widgets.py#L399" - }, - "streamlit.divider": { - "name": "divider", - "signature": "st.divider()", - "example": "
\n
\nimport streamlit as st\n\nst.divider()\n
\n
\n", - "description": "

Display a horizontal rule.

\n
\n

Note

\n

You can achieve the same effect with st.write("---") or\neven just "---" in your script (via magic).

\n
\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L244" - }, - "streamlit.echo": { - "name": "echo", - "signature": "st.echo(code_location=\"above\")", - "example": "
\n
\nimport streamlit as st\n\nwith st.echo():\n    st.write('This code will be printed')\n
\n
\n", - "description": "

Use in a with block to draw some code on the app, then execute it.

\n", - "args": [ - { - "name": "code_location", - "type_name": "\"above\" or \"below\"", - "is_optional": false, - "description": "

Whether to show the echoed code before or after the results of the\nexecuted code block.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/echo.py#L27" - }, - "streamlit.empty": { - "name": "empty", - "signature": "st.empty()", - "examples": "
\n

Overwriting elements in-place using "with" notation:

\n
\nimport streamlit as st\nimport time\n\nwith st.empty():\n    for seconds in range(60):\n        st.write(f"\u23f3 {seconds} seconds have passed")\n        time.sleep(1)\n    st.write("\u2714\ufe0f 1 minute over!")\n
\n

Replacing several elements, then clearing them:

\n
\nimport streamlit as st\n\nplaceholder = st.empty()\n\n# Replace the placeholder with some text:\nplaceholder.text("Hello")\n\n# Replace the text with a chart:\nplaceholder.line_chart({"data": [1, 5, 2, 6]})\n\n# Replace the chart with several elements:\nwith placeholder.container():\n    st.write("This is one element")\n    st.write("This is another")\n\n# Clear all those elements:\nplaceholder.empty()\n
\n
\n", - "description": "

Insert a single-element container.

\n

Inserts a container into your app that can be used to hold a single element.\nThis allows you to, for example, remove elements at any point, or replace\nseveral elements at once (using a child multi-element container).

\n

To insert/replace/clear an element on the returned container, you can\nuse "with" notation or just call methods directly on the returned object.\nSee examples below.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/empty.py#L24" - }, - "streamlit.error": { - "name": "error", - "signature": "st.error(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.error('This is an error', icon="\ud83d\udea8")\n
\n
\n", - "description": "

Display error message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The error text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L39" - }, - "streamlit.exception": { - "name": "exception", - "signature": "st.exception(exception)", - "example": "
\n
\nimport streamlit as st\n\ne = RuntimeError('This is an exception of type RuntimeError')\nst.exception(e)\n
\n
\n", - "description": "

Display an exception.

\n", - "args": [ - { - "name": "exception", - "type_name": "Exception", - "is_optional": false, - "description": "

The exception to display.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/exception.py#L50" - }, - "streamlit.expander": { - "name": "expander", - "signature": "st.expander(label, expanded=False)", - "examples": "
\n

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write(\\"\\"\\"\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    \\"\\"\\")\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write(\\"\\"\\"\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n\\"\\"\\")\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n\n \n
\n", - "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

Currently, you may not put expanders inside another expander.

\n
\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "expanded", - "type_name": "bool", - "is_optional": false, - "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L320" - }, - "streamlit.experimental_connection": { - "name": "experimental_connection", - "signature": "st.experimental_connection(name, type=None, max_entries=None, ttl=None, **kwargs)", - "examples": "
\n

The easiest way to create a first-party (SQL or Snowpark) connection is to use their\ndefault names and define corresponding sections in your secrets.toml file.

\n
\nimport streamlit as st\nconn = st.experimental_connection("sql") # Config section defined in [connections.sql] in secrets.toml.\n
\n

Creating a SQLConnection with a custom name requires you to explicitly specify the\ntype. If type is not passed as a kwarg, it must be set in the appropriate section of\nsecrets.toml.

\n
\nimport streamlit as st\nconn1 = st.experimental_connection("my_sql_connection", type="sql") # Config section defined in [connections.my_sql_connection].\nconn2 = st.experimental_connection("my_other_sql_connection") # type must be set in [connections.my_other_sql_connection].\n
\n

Passing the full module path to the connection class that you want to use can be\nuseful, especially when working with a custom connection:

\n
\nimport streamlit as st\nconn = st.experimental_connection("my_sql_connection", type="streamlit.connections.SQLConnection")\n
\n

Finally, you can pass the connection class to use directly to this function. Doing\nso allows static type checking tools such as mypy to infer the exact return\ntype of st.experimental_connection.

\n
\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\nconn = st.experimental_connection("my_sql_connection", type=SQLConnection)\n
\n
\n", - "description": "

Create a new connection to a data store or API, or return an existing one.

\n

Config options, credentials, secrets, etc. for connections are taken from various\nsources:

\n
    \n
  • Any connection-specific configuration files.
  • \n
  • An app's secrets.toml files.
  • \n
  • The kwargs passed to this function.
  • \n
\n", - "args": [ - { - "name": "name", - "type_name": "str", - "is_optional": false, - "description": "

The connection name used for secrets lookup in [connections.<name>].\nType will be inferred from passing "sql" or "snowpark".

\n", - "default": null - }, - { - "name": "type", - "type_name": "str or connection class or None", - "is_optional": false, - "description": "

The type of connection to create. It can be a keyword ("sql" or "snowpark"),\na path to an importable class, or an imported class reference. All classes\nmust extend st.connections.ExperimentalBaseConnection and implement the\n_connect() method. If the type kwarg is None, a type field must be set\nin the connection's section in secrets.toml.

\n", - "default": null - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of connections to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "**kwargs", - "type_name": "any", - "is_optional": false, - "description": "

Additional connection specific kwargs that are passed to the Connection's\n_connect() method. Learn more from the specific Connection's documentation.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "Connection object", - "is_generator": false, - "description": "

An initialized Connection object of the specified type.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/connection_factory.py#L170" - }, - "streamlit.experimental_data_editor": { - "name": "experimental_data_editor", - "signature": "st.experimental_data_editor(data, *, width=None, height=None, use_container_width=False, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None)", - "examples": "
\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n       {"command": "st.selectbox", "rating": 4, "is_widget": True},\n       {"command": "st.balloons", "rating": 5, "is_widget": False},\n       {"command": "st.time_input", "rating": 3, "is_widget": True},\n   ]\n)\nedited_df = st.experimental_data_editor(df)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n\n \n

You can also allow the user to add and delete rows by setting num_rows to "dynamic":

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n       {"command": "st.selectbox", "rating": 4, "is_widget": True},\n       {"command": "st.balloons", "rating": 5, "is_widget": False},\n       {"command": "st.time_input", "rating": 3, "is_widget": True},\n   ]\n)\nedited_df = st.experimental_data_editor(df, num_rows="dynamic")\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n\n \n
\n", - "description": "

Display a data editor widget.

\n

Display a data editor widget that allows you to edit DataFrames and\nmany other data structures in a table-like UI.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.DataFrame, list, set, tuple, dict, or None", - "is_optional": false, - "description": "

The data to edit in the data editor.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired width of the data editor expressed in pixels. If None, the width will\nbe automatically determined.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired height of the data editor expressed in pixels. If None, the height will\nbe automatically determined.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the data editor width to the width of the parent container.\nThis takes precedence over the width argument. Defaults to False.

\n", - "default": "False." - }, - { - "name": "num_rows", - "type_name": "\"fixed\" or \"dynamic\"", - "is_optional": false, - "description": "

Specifies if the user can add and delete rows in the data editor.\nIf "fixed", the user cannot add or delete rows. If "dynamic", the user can\nadd and delete rows in the data editor, but column sorting is disabled.\nDefaults to "fixed".

\n", - "default": "s" - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean which, if True, disables the data editor and prevents\nany edits. Defaults to False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

An optional string to use as the unique key for this widget. If this\nis omitted, a key will be generated for the widget based on its\ncontent. Multiple widgets of the same type may not share the same\nkey.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this data_editor's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "pd.DataFrame, pd.Styler, pyarrow.Table, np.ndarray, list, set, tuple, or dict.", - "is_generator": false, - "description": "

The edited data. The edited data is returned in its original data type if\nit corresponds to any of the supported return types. All other data types\nare returned as a pd.DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/data_editor.py#L448" - }, - "streamlit.experimental_memo": { - "name": "experimental_memo", - "signature": "st.experimental_memo(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

To cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function to cache. Streamlit hashes the function's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.\nNote that ttl is incompatible with persist="disk" - ttl will be\nignored if persist is specified.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "persist", - "type_name": "str or boolean or None", - "is_optional": false, - "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", - "default": "None." - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L378" - }, - "streamlit.experimental_rerun": { - "name": "experimental_rerun", - "signature": "st.experimental_rerun()", - "description": "

Rerun the script immediately.

\n

When st.experimental_rerun() is called, the script is halted - no\nmore statements will be run, and the script will be queued to re-run\nfrom the top.

\n

If this function is called outside of Streamlit, it will raise an\nException.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/execution_control.py#L46" - }, - "streamlit.experimental_show": { - "name": "experimental_show", - "signature": "st.experimental_show(*args)", - "notes": "
\n

This is an experimental feature with usage limitations:

\n
    \n
  • The method must be called with the name show.
  • \n
  • Must be called in one line of code, and only once per line.
  • \n
  • \n
    When passing multiple arguments the inclusion of , or ) in a string
    \n
    argument may cause an error.
    \n
    \n
  • \n
\n
\n", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\n\ndataframe = pd.DataFrame({\n    'first column': [1, 2, 3, 4],\n    'second column': [10, 20, 30, 40],\n})\nst.experimental_show(dataframe)\n
\n
\n", - "description": "

Write arguments and argument names to your app for debugging purposes.

\n

Show() has similar properties to write():

\n
\n
    \n
  1. You can pass in multiple arguments, all of which will be debugged.
  2. \n
  3. It returns None, so it's "slot" in the app cannot be reused.
  4. \n
\n
\n

Note: This is an experimental feature. See\nhttps://docs.streamlit.io/library/advanced-features/prerelease#experimental for more information.

\n", - "args": [ - { - "name": "*args", - "type_name": "any", - "is_optional": false, - "description": "

One or many objects to debug in the App.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/show.py#L23" - }, - "streamlit.experimental_singleton": { - "name": "experimental_singleton", - "signature": "st.experimental_singleton(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets)", - "example": "
\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

A cache_resource function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n
\n", - "description": "

Decorator to cache functions that return global resources (e.g. database connections, ML models).

\n

Cached objects are shared across all users, sessions, and reruns. They\nmust be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using st.session_state\nto store resources per session instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

To cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/library/advanced-features/caching.

\n", - "args": [ - { - "name": "func", - "type_name": "callable", - "is_optional": false, - "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float or timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "max_entries", - "type_name": "int or None", - "is_optional": false, - "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.

\n", - "default": "None." - }, - { - "name": "show_spinner", - "type_name": "boolean or string", - "is_optional": false, - "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", - "default": "True" - }, - { - "name": "validate", - "type_name": "callable or None", - "is_optional": false, - "description": "

An optional validation function for cached data. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", - "default": null - }, - { - "name": "experimental_allow_widgets", - "type_name": "boolean", - "is_optional": false, - "description": "

Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.\nWe may remove support for this option at any time without notice.

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L258" - }, - "streamlit.form": { - "name": "form", - "signature": "st.form(key, clear_on_submit=False)", - "examples": "
\n

Inserting elements using "with" notation:

\n
\nimport streamlit as st\n\nwith st.form("my_form"):\n   st.write("Inside the form")\n   slider_val = st.slider("Form slider")\n   checkbox_val = st.checkbox("Form checkbox")\n\n   # Every form must have a submit button.\n   submitted = st.form_submit_button("Submit")\n   if submitted:\n       st.write("slider", slider_val, "checkbox", checkbox_val)\n\nst.write("Outside the form")\n
\n

Inserting elements out of order:

\n
\nimport streamlit as st\n\nform = st.form("my_form")\nform.slider("Inside the form")\nst.slider("Outside the form")\n\n# Now add a submit button to the form:\nform.form_submit_button("Submit")\n
\n
\n", - "description": "

Create a form that batches elements together with a "Submit" button.

\n

A form is a container that visually groups other elements and\nwidgets together, and contains a Submit button. When the form's\nSubmit button is pressed, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

To add elements to a form object, you can use "with" notation\n(preferred) or just call methods directly on the form. See\nexamples below.

\n

Forms have a few constraints:

\n
    \n
  • Every form must contain a st.form_submit_button.
  • \n
  • st.button and st.download_button cannot be added to a form.
  • \n
  • Forms can appear anywhere in your app (sidebar, columns, etc),\nbut they cannot be embedded inside other forms.
  • \n
\n

For more information about forms, check out our\nblog post.

\n", - "args": [ - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

A string that identifies the form. Each form must have its own\nkey. (This key is not displayed to the user in the interface.)

\n", - "default": null - }, - { - "name": "clear_on_submit", - "type_name": "bool", - "is_optional": false, - "description": "

If True, all widgets inside the form will be reset to their default\nvalues after the user presses the Submit button. Defaults to False.\n(Note that Custom Components are unaffected by this flag, and\nwill not be reset to their defaults on form submission.)

\n", - "default": "values" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/form.py#L118" - }, - "streamlit.form_submit_button": { - "name": "form_submit_button", - "signature": "st.form_submit_button(label=\"Submit\", help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", - "description": "

Display a form submit button.

\n

When this button is clicked, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

Every form must have a form_submit_button. A form_submit_button\ncannot exist outside a form.

\n

For more information about forms, check out our\nblog post.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this button is for.\nDefaults to "Submit".

\n", - "default": "s" - }, - { - "name": "help", - "type_name": "str or None", - "is_optional": false, - "description": "

A tooltip that gets displayed when the button is hovered over.\nDefaults to None.

\n", - "default": "None." - }, - { - "name": "on_click", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this button is clicked.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "type", - "type_name": "\"secondary\" or \"primary\"", - "is_optional": false, - "description": "

An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. This\nargument can only be supplied by keyword. Defaults to "secondary".

\n", - "default": "s" - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the button if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which makes the button stretch its width to match the parent container.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "bool", - "is_generator": false, - "description": "

True if the button was clicked.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/form.py#L211" - }, - "streamlit.get_option": { - "name": "get_option", - "signature": "st.get_option(key)", - "description": "

Return the current value of a given Streamlit config option.

\n

Run streamlit config show in the terminal to see all available options.

\n", - "args": [ - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show on a terminal.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/config.py#L131" - }, - "streamlit.graphviz_chart": { - "name": "graphviz_chart", - "signature": "st.graphviz_chart(figure_or_dot, use_container_width=False)", - "example": "
\n
\nimport streamlit as st\nimport graphviz\n\n# Create a graphlib graph object\ngraph = graphviz.Digraph()\ngraph.edge('run', 'intr')\ngraph.edge('intr', 'runbl')\ngraph.edge('runbl', 'run')\ngraph.edge('run', 'kernel')\ngraph.edge('kernel', 'zombie')\ngraph.edge('kernel', 'sleep')\ngraph.edge('kernel', 'runmem')\ngraph.edge('sleep', 'swap')\ngraph.edge('swap', 'runswap')\ngraph.edge('runswap', 'new')\ngraph.edge('runswap', 'runmem')\ngraph.edge('new', 'runmem')\ngraph.edge('sleep', 'runmem')\n\nst.graphviz_chart(graph)\n
\n

Or you can render the chart from the graph using GraphViz's Dot\nlanguage:

\n
\nst.graphviz_chart('''\n    digraph {\n        run -> intr\n        intr -> runbl\n        runbl -> run\n        run -> kernel\n        kernel -> zombie\n        kernel -> sleep\n        kernel -> runmem\n        sleep -> swap\n        swap -> runswap\n        runswap -> new\n        runswap -> runmem\n        new -> runmem\n        sleep -> runmem\n    }\n''')\n
\n\n \n
\n", - "description": "

Display a graph using the dagre-d3 library.

\n", - "args": [ - { - "name": "figure_or_dot", - "type_name": "graphviz.dot.Graph, graphviz.dot.Digraph, str", - "is_optional": false, - "description": "

The Graphlib graph object or dot string to display

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the figure's native width value.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/graphviz_chart.py#L39" - }, - "streamlit.header": { - "name": "header", - "signature": "st.header(body, anchor=None, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.header('This is a header')\nst.header('A header with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in header formatting.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "anchor", - "type_name": "str or False", - "is_optional": false, - "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the header.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L40" - }, - "streamlit.help": { - "name": "help", - "signature": "st.help(obj=streamlit)", - "example": "
\n

Don't remember how to initialize a dataframe? Try this:

\n
\nimport streamlit as st\nimport pandas\n\nst.help(pandas.DataFrame)\n
\n\n \n

Want to quickly check what data type is output by a certain function?\nTry:

\n
\nimport streamlit as st\n\nx = my_poorly_documented_function()\nst.help(x)\n
\n

Want to quickly inspect an object? No sweat:

\n
\nclass Dog:\n  '''A typical dog.'''\n\n  def __init__(self, breed, color):\n    self.breed = breed\n    self.color = color\n\n  def bark(self):\n    return 'Woof!'\n\n\nfido = Dog('poodle', 'white')\n\nst.help(fido)\n
\n\n \n

And if you're using Magic, you can get help for functions, classes,\nand modules without even typing st.help:

\n
\nimport streamlit as st\nimport pandas\n\n# Get help for Pandas read_csv:\npandas.read_csv\n\n# Get help for Streamlit itself:\nst\n
\n\n \n
\n", - "description": "

Display help and other information for a given object.

\n

Depending on the type of object that is passed in, this displays the\nobject's name, type, value, signature, docstring, and member variables,\nmethods \u2014 as well as the values/docstring of members and methods.

\n", - "args": [ - { - "name": "obj", - "type_name": "any", - "is_optional": false, - "description": "

The object whose information should be displayed. If left\nunspecified, this call will display help for Streamlit itself.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/doc_string.py#L49" - }, - "streamlit.image": { - "name": "image", - "signature": "st.image(image, caption=None, width=None, use_column_width=None, clamp=False, channels=\"RGB\", output_format=\"auto\")", - "example": "
\n
\nimport streamlit as st\nfrom PIL import Image\n\nimage = Image.open('sunrise.jpg')\n\nst.image(image, caption='Sunrise by the mountains')\n
\n\n \n
\n", - "description": "

Display an image or list of images.

\n", - "args": [ - { - "name": "image", - "type_name": "numpy.ndarray, [numpy.ndarray], BytesIO, str, or [str]", - "is_optional": false, - "description": "

Monochrome image of shape (w,h) or (w,h,1)\nOR a color image of shape (w,h,3)\nOR an RGBA image of shape (w,h,4)\nOR a URL to fetch the image from\nOR a path of a local image file\nOR an SVG XML string like <svg xmlns=...</svg>\nOR a list of one of the above, to display multiple images.

\n", - "default": null - }, - { - "name": "caption", - "type_name": "str or list of str", - "is_optional": false, - "description": "

Image caption. If displaying multiple images, caption should be a\nlist of captions (one for each image).

\n", - "default": null - }, - { - "name": "width", - "type_name": "int or None", - "is_optional": false, - "description": "

Image width. None means use the image width,\nbut do not exceed the width of the column.\nShould be set for SVG images, as they have no default image width.

\n", - "default": "image" - }, - { - "name": "use_column_width", - "type_name": "'auto' or 'always' or 'never' or bool", - "is_optional": false, - "description": "

If 'auto', set the image's width to its natural size,\nbut do not exceed the width of the column.\nIf 'always' or True, set the image's width to the column width.\nIf 'never' or False, set the image's width to its natural size.\nNote: if set, use_column_width takes precedence over the width parameter.

\n", - "default": null - }, - { - "name": "clamp", - "type_name": "bool", - "is_optional": false, - "description": "

Clamp image pixel values to a valid range ([0-255] per channel).\nThis is only meaningful for byte array images; the parameter is\nignored for image URLs. If this is not set, and an image has an\nout-of-range value, an error will be thrown.

\n", - "default": null - }, - { - "name": "channels", - "type_name": "'RGB' or 'BGR'", - "is_optional": false, - "description": "

If image is an nd.array, this parameter denotes the format used to\nrepresent color information. Defaults to 'RGB', meaning\nimage[:, :, 0] is the red channel, image[:, :, 1] is green, and\nimage[:, :, 2] is blue. For images coming from libraries like\nOpenCV you should set this to 'BGR', instead.

\n", - "default": "s" - }, - { - "name": "output_format", - "type_name": "'JPEG', 'PNG', or 'auto'", - "is_optional": false, - "description": "

This parameter specifies the format to use when transferring the\nimage data. Photos should use the JPEG format for lossy compression\nwhile diagrams should use the PNG format for lossless compression.\nDefaults to 'auto' which identifies the compression type based\non the type and format of the image argument.

\n", - "default": "s" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/image.py#L88" - }, - "streamlit.info": { - "name": "info", - "signature": "st.info(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.info('This is a purely informational message', icon="\u2139\ufe0f")\n
\n
\n", - "description": "

Display an informational message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The info text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L103" - }, - "streamlit.json": { - "name": "json", - "signature": "st.json(body, *, expanded=True)", - "example": "
\n
\nimport streamlit as st\n\nst.json({\n    'foo': 'bar',\n    'baz': 'boz',\n    'stuff': [\n        'stuff 1',\n        'stuff 2',\n        'stuff 3',\n        'stuff 5',\n    ],\n})\n
\n\n \n
\n", - "description": "

Display object or string as a pretty-printed JSON string.

\n", - "args": [ - { - "name": "body", - "type_name": "object or str", - "is_optional": false, - "description": "

The object to print as JSON. All referenced objects should be\nserializable to JSON as well. If object is a string, we assume it\ncontains serialized JSON.

\n", - "default": null - }, - { - "name": "expanded", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean that allows the user to set whether the initial\nstate of this json element should be expanded. Defaults to True.\nThis argument can only be supplied by keyword.

\n", - "default": "True." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/json.py#L35" - }, - "streamlit.latex": { - "name": "latex", - "signature": "st.latex(body, *, help=None)", - "example": "
\n
\nimport streamlit as st\n\nst.latex(r'''\n    a + ar + a r^2 + a r^3 + \\cdots + a r^{n-1} =\n    \\sum_{k=0}^{n-1} ar^k =\n    a \\left(\\frac{1-r^{n}}{1-r}\\right)\n    ''')\n
\n
\n", - "description": "

Display mathematical expressions formatted as LaTeX.

\n

Supported LaTeX functions are listed at\nhttps://katex.org/docs/supported.html.

\n", - "args": [ - { - "name": "body", - "type_name": "str or SymPy expression", - "is_optional": false, - "description": "

The string or SymPy expression to display as LaTeX. If str, it's\na good idea to use raw Python strings since LaTeX uses backslashes\na lot.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the LaTeX expression.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L196" - }, - "streamlit.line_chart": { - "name": "line_chart", - "signature": "st.line_chart(data=None, *, x=None, y=None, width=0, height=0, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(20, 3),\n    columns=['a', 'b', 'c'])\n\nst.line_chart(chart_data)\n
\n\n \n
\n", - "description": "

Display a line chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's spec. As a result this is easier to use for many "just plot\nthis" scenarios, while being less customizable.

\n

If st.line_chart does not guess the data specification\ncorrectly, try specifying your desired chart using st.altair_chart.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None", - "is_optional": false, - "description": "

Data to be plotted.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "x", - "type_name": "str or None", - "is_optional": false, - "description": "

Column name to use for the x-axis. If None, uses the data index for the x-axis.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "y", - "type_name": "str, sequence of str, or None", - "is_optional": false, - "description": "

Column name(s) to use for the y-axis. If a sequence of strings, draws several series\non the same chart by melting your wide-format table into a long-format table behind\nthe scenes. If None, draws the data of all remaining columns as data series.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "width", - "type_name": "int", - "is_optional": false, - "description": "

The chart width in pixels. If 0, selects the width automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int", - "is_optional": false, - "description": "

The chart height in pixels. If 0, selects the height automatically.\nThis argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the width argument.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L160" - }, - "streamlit.map": { - "name": "map", - "signature": "st.map(data=None, zoom=None, use_container_width=True)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n    np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n    columns=['lat', 'lon'])\n\nst.map(df)\n
\n\n \n
\n", - "description": "

Display a map with points on it.

\n

This is a wrapper around st.pydeck_chart to quickly create\nscatterplot charts on top of a map, with auto-centering and auto-zoom.

\n

When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox.

\n

Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the mapbox.token config option. The use of Mapbox is governed by Mapbox's Terms of Use.

\n

To get a token for yourself, create an account at https://mapbox.com.\nFor more info on how to set config options, see\nhttps://docs.streamlit.io/library/advanced-features/configuration

\n
\n

Streamlit in Snowflake Note

\n

When you use the st.map, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's External Offerings Terms.

\n
\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", - "is_optional": false, - "description": "

The data to be plotted. Must have two columns:

\n
    \n
  • latitude called 'lat', 'latitude', 'LAT', 'LATITUDE'
  • \n
  • longitude called 'lon', 'longitude', 'LON', 'LONGITUDE'.
  • \n
\n", - "default": null - }, - { - "name": "zoom", - "type_name": "int", - "is_optional": false, - "description": "

Zoom level as specified in\nhttps://wiki.openstreetmap.org/wiki/Zoom_levels

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/map.py#L76" - }, - "streamlit.markdown": { - "name": "markdown", - "signature": "st.markdown(body, unsafe_allow_html=False, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.markdown('Streamlit is **_really_ cool**.')\nst.markdown(\u201dThis text is :red[colored red], and this is **:blue[colored]** and bold.\u201d)\nst.markdown(":green[$\\sqrt{x^2+y^2}=1$] is a Pythagorean identity. :pencil:")\n
\n
\n", - "description": "

Display string formatted as Markdown.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The string to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "unsafe_allow_html", - "type_name": "bool", - "is_optional": false, - "description": "

Defaults to False.

\n
\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text.\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the Markdown.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/markdown.py#L31" - }, - "streamlit.metric": { - "name": "metric", - "signature": "st.metric(label, value, delta=None, delta_color=\"normal\", help=None, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\nst.metric(label="Temperature", value="70 \u00b0F", delta="1.2 \u00b0F")\n
\n\n \n

st.metric looks especially nice in combination with st.columns:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\ncol1.metric("Temperature", "70 \u00b0F", "1.2 \u00b0F")\ncol2.metric("Wind", "9 mph", "-8%")\ncol3.metric("Humidity", "86%", "4%")\n
\n\n \n

The delta indicator color can also be inverted or turned off:

\n
\nimport streamlit as st\n\nst.metric(label="Gas price", value=4, delta=-0.5,\n    delta_color="inverse")\n\nst.metric(label="Active developers", value=123, delta=123,\n    delta_color="off")\n
\n\n \n
\n", - "description": "

Display a metric in big bold font, with an optional indicator of how the metric changed.

\n

Tip: If you want to display a large number, it may be a good idea to\nshorten it using packages like millify\nor numerize. E.g. 1234 can be\ndisplayed as 1.2k using st.metric("Short number", millify(1234)).

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

The header or title for the metric. The label can optionally contain\nMarkdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - }, - { - "name": "value", - "type_name": "int, float, str, or None", - "is_optional": false, - "description": "

Value of the metric. None is rendered as a long dash.

\n", - "default": null - }, - { - "name": "delta", - "type_name": "int, float, str, or None", - "is_optional": false, - "description": "

Indicator of how the metric changed, rendered with an arrow below\nthe metric. If delta is negative (int/float) or starts with a minus\nsign (str), the arrow points down and the text is red; else the\narrow points up and the text is green. If None (default), no delta\nindicator is shown.

\n", - "default": null - }, - { - "name": "delta_color", - "type_name": "str", - "is_optional": false, - "description": "

If "normal" (default), the delta indicator is shown as described\nabove. If "inverse", it is red when positive and green when\nnegative. This is useful when a negative change is considered\ngood, e.g. if cost decreased. If "off", delta is shown in gray\nregardless of its value.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the metric label.

\n", - "default": null - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/metric.py#L46" - }, - "streamlit.multiselect": { - "name": "multiselect", - "signature": "st.multiselect(label, options, default=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", max_selections=None)", - "example": "
\n
\nimport streamlit as st\n\noptions = st.multiselect(\n    'What are your favorite colors',\n    ['Green', 'Yellow', 'Red', 'Blue'],\n    ['Yellow', 'Red'])\n\nst.write('You selected:', options)\n
\n\n \n
\n", - "description": "

Display a multiselect widget.

\n

The multiselect widget starts as empty.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence[V], numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the select options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", - "default": "." - }, - { - "name": "default", - "type_name": "[V], V, or None", - "is_optional": false, - "description": "

List of default values. Can also be a single value.

\n", - "default": "values." - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of selectbox options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe multiselect.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the multiselect.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this multiselect's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the multiselect widget if set\nto True. The default is False. This argument can only be supplied\nby keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - }, - { - "name": "max_selections", - "type_name": "int", - "is_optional": false, - "description": "

The max selections that can be selected at a time.\nThis argument can only be supplied by keyword.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "list", - "is_generator": false, - "description": "

A list with the selected options

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/multiselect.py#L145" - }, - "streamlit.number_input": { - "name": "number_input", - "signature": "st.number_input(label, min_value=None, max_value=None, value=, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\nnumber = st.number_input('Insert a number')\nst.write('The current number is ', number)\n
\n\n \n
\n", - "description": "

Display a numeric input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "min_value", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The minimum permitted value.\nIf None, there will be no minimum.

\n", - "default": null - }, - { - "name": "max_value", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The maximum permitted value.\nIf None, there will be no maximum.

\n", - "default": null - }, - { - "name": "value", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The value of this widget when it first renders.\nDefaults to min_value, or 0.0 if min_value is None

\n", - "default": "min_value" - }, - { - "name": "step", - "type_name": "int or float or None", - "is_optional": false, - "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 otherwise.\nIf the value is not specified, the format parameter will be used.

\n", - "default": "1" - }, - { - "name": "format", - "type_name": "str or None", - "is_optional": false, - "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. Output must be purely numeric. This does not impact\nthe return value. Valid formatters: %d %e %f %g %i %u

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this number_input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the number input if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "int or float", - "is_generator": false, - "description": "

The current value of the numeric input widget. The return type\nwill match the data type of the value parameter.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/number_input.py#L66" - }, - "streamlit.plotly_chart": { - "name": "plotly_chart", - "signature": "st.plotly_chart(figure_or_data, use_container_width=False, sharing=\"streamlit\", theme=\"streamlit\", **kwargs)", - "example": "
\n

The example below comes straight from the examples at\nhttps://plot.ly/python:

\n
\nimport streamlit as st\nimport numpy as np\nimport plotly.figure_factory as ff\n\n# Add histogram data\nx1 = np.random.randn(200) - 2\nx2 = np.random.randn(200)\nx3 = np.random.randn(200) + 2\n\n# Group data together\nhist_data = [x1, x2, x3]\n\ngroup_labels = ['Group 1', 'Group 2', 'Group 3']\n\n# Create distplot with custom bin_size\nfig = ff.create_distplot(\n        hist_data, group_labels, bin_size=[.1, .25, .5])\n\n# Plot!\nst.plotly_chart(fig, use_container_width=True)\n
\n\n \n
\n", - "description": "

Display an interactive Plotly chart.

\n

Plotly is a charting library for Python. The arguments to this function\nclosely follow the ones for Plotly's plot() function. You can find\nmore about Plotly at https://plot.ly/python.

\n

To show Plotly charts in Streamlit, call st.plotly_chart wherever you\nwould call Plotly's py.plot or py.iplot.

\n", - "args": [ - { - "name": "figure_or_data", - "type_name": "plotly.graph_objs.Figure, plotly.graph_objs.Data,", - "is_optional": false, - "description": "

dict/list of plotly.graph_objs.Figure/Data

\n

See https://plot.ly/python/ for examples of graph descriptions.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over the figure's native width value.

\n", - "default": null - }, - { - "name": "sharing", - "type_name": "{'streamlit', 'private', 'secret', 'public'}", - "is_optional": false, - "description": "

Use 'streamlit' to insert the plot and all its dependencies\ndirectly in the Streamlit app using plotly's offline mode (default).\nUse any other sharing mode to send the chart to Plotly chart studio, which\nrequires an account. See https://plot.ly/python/chart-studio/ for more information.

\n", - "default": null - }, - { - "name": "theme", - "type_name": "\"streamlit\" or None", - "is_optional": false, - "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", - "default": "behavior" - }, - { - "name": "**kwargs", - "type_name": null, - "is_optional": null, - "description": "

Any argument accepted by Plotly's plot() function.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/plotly_chart.py#L81" - }, - "streamlit.progress": { - "name": "progress", - "signature": "st.progress(value, text=None)", - "example": "
\n

Here is an example of a progress bar increasing over time:

\n
\nimport streamlit as st\nimport time\n\nprogress_text = "Operation in progress. Please wait."\nmy_bar = st.progress(0, text=progress_text)\n\nfor percent_complete in range(100):\n    time.sleep(0.1)\n    my_bar.progress(percent_complete + 1, text=progress_text)\n
\n
\n", - "description": "

Display a progress bar.

\n", - "args": [ - { - "name": "value", - "type_name": "int or float", - "is_optional": false, - "description": "

0 <= value <= 100 for int

\n

0.0 <= value <= 1.0 for float

\n", - "default": null - }, - { - "name": "text", - "type_name": "str or None", - "is_optional": false, - "description": "

A message to display above the progress bar. The text can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/progress.py#L66" - }, - "streamlit.pydeck_chart": { - "name": "pydeck_chart", - "signature": "st.pydeck_chart(pydeck_obj=None, use_container_width=False)", - "example": "
\n

Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the\nlight or dark map style, based on which Streamlit theme is currently active:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport pydeck as pdk\n\nchart_data = pd.DataFrame(\n   np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n   columns=['lat', 'lon'])\n\nst.pydeck_chart(pdk.Deck(\n    map_style=None,\n    initial_view_state=pdk.ViewState(\n        latitude=37.76,\n        longitude=-122.4,\n        zoom=11,\n        pitch=50,\n    ),\n    layers=[\n        pdk.Layer(\n           'HexagonLayer',\n           data=chart_data,\n           get_position='[lon, lat]',\n           radius=200,\n           elevation_scale=4,\n           elevation_range=[0, 1000],\n           pickable=True,\n           extruded=True,\n        ),\n        pdk.Layer(\n            'ScatterplotLayer',\n            data=chart_data,\n            get_position='[lon, lat]',\n            get_color='[200, 30, 0, 160]',\n            get_radius=200,\n        ),\n    ],\n))\n
\n\n \n
\n

Note

\n

To make the PyDeck chart's style consistent with Streamlit's theme,\nyou can set map_style=None in the pydeck.Deck object.

\n
\n
\n", - "description": "

Draw a chart using the PyDeck library.

\n

This supports 3D maps, point clouds, and more! More info about PyDeck\nat https://deckgl.readthedocs.io/en/latest/.

\n

These docs are also quite useful:

\n\n

When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox.

\n

Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the mapbox.token config option.The use of Mapbox is governed by Mapbox's Terms of Use.

\n

To get a token for yourself, create an account at https://mapbox.com.\nFor more info on how to set config options, see\nhttps://docs.streamlit.io/library/advanced-features/configuration

\n
\n

Streamlit in Snowflake Note

\n

When you use the st.pydeck_chart, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's External Offerings Terms.

\n
\n", - "args": [ - { - "name": "pydeck_obj", - "type_name": "pydeck.Deck or None", - "is_optional": false, - "description": "

Object specifying the PyDeck chart to draw.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/deck_gl_json_chart.py#L36" - }, - "streamlit.pyplot": { - "name": "pyplot", - "signature": "st.pyplot(fig=None, clear_figure=None, use_container_width=True, **kwargs)", - "notes": "
\n
\n

Note

\n

Deprecation warning. After December 1st, 2020, we will remove the ability\nto specify no arguments in st.pyplot(), as that requires the use of\nMatplotlib's global figure object, which is not thread-safe. So\nplease always pass a figure object as shown in the example section\nabove.

\n
\n

Matplotlib supports several types of "backends". If you're getting an\nerror using Matplotlib with Streamlit, try setting your backend to "TkAgg":

\n
\necho "backend: TkAgg" >> ~/.matplotlib/matplotlibrc\n
\n

For more information, see https://matplotlib.org/faq/usage_faq.html.

\n
\n", - "example": "
\n
\nimport streamlit as st\nimport matplotlib.pyplot as plt\nimport numpy as np\n\narr = np.random.normal(1, 1, size=100)\nfig, ax = plt.subplots()\nax.hist(arr, bins=20)\n\nst.pyplot(fig)\n
\n\n \n
\n", - "description": "

Display a matplotlib.pyplot figure.

\n", - "args": [ - { - "name": "fig", - "type_name": "Matplotlib Figure", - "is_optional": false, - "description": "

The figure to plot. When this argument isn't specified, this\nfunction will render the global figure (but this is deprecated,\nas described below)

\n", - "default": null - }, - { - "name": "clear_figure", - "type_name": "bool", - "is_optional": false, - "description": "

If True, the figure will be cleared after being rendered.\nIf False, the figure will not be cleared after being rendered.\nIf left unspecified, we pick a default based on the value of fig.

\n
    \n
  • If fig is set, defaults to False.
  • \n
  • If fig is not set, defaults to True. This simulates Jupyter's\napproach to matplotlib rendering.
  • \n
\n", - "default": "based" - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. Defaults to True.

\n", - "default": "s" - }, - { - "name": "**kwargs", - "type_name": "any", - "is_optional": false, - "description": "

Arguments to pass to Matplotlib's savefig function.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/pyplot.py#L38" - }, - "streamlit.radio": { - "name": "radio", - "signature": "st.radio(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, horizontal=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ngenre = st.radio(\n    "What\\'s your favorite movie genre",\n    ('Comedy', 'Drama', 'Documentary'))\n\nif genre == 'Comedy':\n    st.write('You selected comedy.')\nelse:\n    st.write("You didn\\'t select comedy.")\n
\n\n \n
\n", - "description": "

Display a radio button widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this radio group is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the radio options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", - "default": "." - }, - { - "name": "index", - "type_name": "int", - "is_optional": false, - "description": "

The index of the preselected option on first render.

\n", - "default": null - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of radio options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe radio.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the radio.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this radio's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the radio button if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.

\n", - "default": "False." - }, - { - "name": "horizontal", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which orients the radio group horizontally.\nThe default is false (vertical buttons). This argument can only\nbe supplied by keyword.

\n", - "default": "false" - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "any", - "is_generator": false, - "description": "

The selected option.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/radio.py#L75" - }, - "streamlit.select_slider": { - "name": "select_slider", - "signature": "st.select_slider(label, options=(), value=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "examples": "
\nimport streamlit as st\n\ncolor = st.select_slider(\n    'Select a color of the rainbow',\n    options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'])\nst.write('My favorite color is', color)\n
\n

And here's an example of a range select slider:

\n
\nimport streamlit as st\n\nstart_color, end_color = st.select_slider(\n    'Select a range of color wavelength',\n    options=['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'],\n    value=('red', 'blue'))\nst.write('You selected wavelengths between', start_color, 'and', end_color)\n
\n\n \n ", - "description": "

Display a slider widget to select items from a list.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.select_slider and st.slider is that\nselect_slider accepts any datatype and takes an iterable set of\noptions, while slider only accepts numerical or date/time data and\ntakes a range as input.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the slider options. All options will be cast to str\ninternally by default. For pandas.DataFrame, the first column is\nselected.

\n", - "default": "." - }, - { - "name": "value", - "type_name": "a supported type or a tuple/list of supported types or None", - "is_optional": false, - "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to first option.

\n", - "default": "first" - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of the labels from the options.\nargument. It receives the option as an argument and its output\nwill be cast to str.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the select slider.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this select_slider's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the select slider if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "any value or tuple of any value", - "is_generator": false, - "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/select_slider.py#L106" - }, - "streamlit.selectbox": { - "name": "selectbox", - "signature": "st.selectbox(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\noption = st.selectbox(\n    'How would you like to be contacted?',\n    ('Email', 'Home phone', 'Mobile phone'))\n\nst.write('You selected:', option)\n
\n\n \n
\n", - "description": "

Display a select widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "options", - "type_name": "Sequence, numpy.ndarray, pandas.Series, pandas.DataFrame, or pandas.Index", - "is_optional": false, - "description": "

Labels for the select options. This will be cast to str internally\nby default. For pandas.DataFrame, the first column is selected.

\n", - "default": "." - }, - { - "name": "index", - "type_name": "int", - "is_optional": false, - "description": "

The index of the preselected option on first render.

\n", - "default": null - }, - { - "name": "format_func", - "type_name": "function", - "is_optional": false, - "description": "

Function to modify the display of the labels. It receives the option\nas an argument and its output will be cast to str.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the selectbox.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this selectbox's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the selectbox if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "any", - "is_generator": false, - "description": "

The selected option

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/selectbox.py#L71" - }, - "streamlit.set_option": { - "name": "set_option", - "signature": "st.set_option(key, value)", - "description": "

Set config option.

\n
\n
Currently, only the following config options can be set within the script itself:
\n
    \n
  • client.caching
  • \n
  • client.displayEnabled
  • \n
  • deprecation.*
  • \n
\n
\n
\n

Calling with any other options will raise StreamlitAPIException.

\n

Run streamlit config show in the terminal to see all available options.

\n", - "args": [ - { - "name": "key", - "type_name": "str", - "is_optional": false, - "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show on a terminal.

\n", - "default": null - }, - { - "name": "value", - "type_name": null, - "is_optional": null, - "description": "

The new value to assign to this config option.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/config.py#L92" - }, - "streamlit.set_page_config": { - "name": "set_page_config", - "signature": "st.set_page_config(page_title=None, page_icon=None, layout=\"centered\", initial_sidebar_state=\"auto\", menu_items=None)", - "example": "
\nimport streamlit as st\n\nst.set_page_config(\n    page_title="Ex-stream-ly Cool App",\n    page_icon="\ud83e\uddca",\n    layout="wide",\n    initial_sidebar_state="expanded",\n    menu_items={\n        'Get Help': 'https://www.extremelycoolapp.com/help',\n        'Report a bug': "https://www.extremelycoolapp.com/bug",\n        'About': "# This is a header. This is an *extremely* cool app!"\n    }\n)\n
\n", - "description": "

Configures the default settings of the page.

\n
\n

Note

\n

This must be the first Streamlit command used in your app, and must only\nbe set once.

\n
\n", - "args": [ - { - "name": "page_title", - "type_name": "str or None", - "is_optional": false, - "description": "

The page title, shown in the browser tab.\n

\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake.

\n
\n", - "default": "the" - }, - { - "name": "page_icon", - "type_name": "Anything supported by st.image or str or None", - "is_optional": false, - "description": "

The page favicon.\n

\n

Streamlit in Snowflake Note

\n

This parameter is ignored in Streamlit in Snowflake.

\n
\n", - "default": null - }, - { - "name": "layout", - "type_name": "\"centered\" or \"wide\"", - "is_optional": false, - "description": "

How the page content should be laid out. Defaults to "centered",\nwhich constrains the elements into a centered column of fixed width;\n"wide" uses the entire screen.

\n", - "default": "s" - }, - { - "name": "initial_sidebar_state", - "type_name": "\"auto\" or \"expanded\" or \"collapsed\"", - "is_optional": false, - "description": "

How the sidebar should start out. Defaults to "auto",\nwhich hides the sidebar on mobile-sized devices, and shows it otherwise.\n"expanded" shows the sidebar initially; "collapsed" hides it.

\n", - "default": "s" - }, - { - "name": "menu_items", - "type_name": "dict", - "is_optional": false, - "description": "

Configure the menu that appears on the top-right side of this app.\nThe keys in this dict denote the menu item you'd like to configure:

\n
    \n
  • \n
    "Get help": str or None
    \n
    The URL this menu item should point to.\nIf None, hides this menu item.
    \n
    \n
  • \n
  • \n
    "Report a Bug": str or None
    \n
    The URL this menu item should point to.\nIf None, hides this menu item.
    \n
    \n
  • \n
  • \n
    "About": str or None
    \n
    A markdown string to show in the About dialog.\nIf None, only shows Streamlit's default About text.
    \n
    \n
  • \n
\n

The URL may also refer to an email address e.g. mailto:john@example.com.

\n", - "default": "About" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/page_config.py#L114" - }, - "streamlit.slider": { - "name": "slider", - "signature": "st.slider(label, min_value=None, max_value=None, value=None, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", - "examples": "
\n
\nimport streamlit as st\n\nage = st.slider('How old are you?', 0, 130, 25)\nst.write("I'm ", age, 'years old')\n
\n

And here's an example of a range slider:

\n
\nimport streamlit as st\n\nvalues = st.slider(\n    'Select a range of values',\n    0.0, 100.0, (25.0, 75.0))\nst.write('Values:', values)\n
\n

This is a range time slider:

\n
\nimport streamlit as st\nfrom datetime import time\n\nappointment = st.slider(\n    "Schedule your appointment:",\n    value=(time(11, 30), time(12, 45)))\nst.write("You're scheduled for:", appointment)\n
\n

Finally, a datetime slider:

\n
\nimport streamlit as st\nfrom datetime import datetime\n\nstart_time = st.slider(\n    "When do you start?",\n    value=datetime(2020, 1, 1, 9, 30),\n    format="MM/DD/YY - hh:mm")\nst.write("Start time:", start_time)\n
\n\n \n
\n", - "description": "

Display a slider widget.

\n

This supports int, float, date, time, and datetime types.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.slider and st.select_slider is that\nslider only accepts numerical or date/time data and takes a range as\ninput, while select_slider accepts any datatype and takes an iterable\nset of options.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "min_value", - "type_name": "a supported type or None", - "is_optional": false, - "description": "

The minimum permitted value.\nDefaults to 0 if the value is an int, 0.0 if a float,\nvalue - timedelta(days=14) if a date/datetime, time.min if a time

\n", - "default": "0" - }, - { - "name": "max_value", - "type_name": "a supported type or None", - "is_optional": false, - "description": "

The maximum permitted value.\nDefaults to 100 if the value is an int, 1.0 if a float,\nvalue + timedelta(days=14) if a date/datetime, time.max if a time

\n", - "default": "100" - }, - { - "name": "value", - "type_name": "a supported type or a tuple/list of supported types or None", - "is_optional": false, - "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to min_value.

\n", - "default": "min_value." - }, - { - "name": "step", - "type_name": "int/float/timedelta or None", - "is_optional": false, - "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 if a float,\ntimedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time\n(or if max_value - min_value < 1 day)

\n", - "default": "1" - }, - { - "name": "format", - "type_name": "str or None", - "is_optional": false, - "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. This does not impact the return value.\nFormatter for int/float supports: %d %e %f %g %i\nFormatter for date/time/datetime uses Moment.js notation:\nhttps://momentjs.com/docs/#/displaying/format/

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the slider.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this slider's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the slider if set to True. The\ndefault is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "int/float/date/time/datetime or tuple of int/float/date/time/datetime", - "is_generator": false, - "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/slider.py#L171" - }, - "streamlit.snow": { - "name": "snow", - "signature": "st.snow()", - "example": "
\n
\nimport streamlit as st\n\nst.snow()\n
\n

...then watch your app and get ready for a cool celebration!

\n
\n", - "description": "

Draw celebratory snowfall.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/snow.py#L25" - }, - "streamlit.spinner": { - "name": "spinner", - "signature": "st.spinner(text=\"In progress...\")", - "example": "
\n
\nimport time\nimport streamlit as st\n\nwith st.spinner('Wait for it...'):\n    time.sleep(5)\nst.success('Done!')\n
\n
\n", - "description": "

Temporarily displays a message while executing a block of code.

\n", - "args": [ - { - "name": "text", - "type_name": "str", - "is_optional": false, - "description": "

A message to display while executing that block

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/spinner.py#L23" - }, - "streamlit.stop": { - "name": "stop", - "signature": "st.stop()", - "example": "
\n
\nimport streamlit as st\n\nname = st.text_input('Name')\nif not name:\n  st.warning('Please input a name.')\n  st.stop()\nst.success('Thank you for inputting a name.')\n
\n
\n", - "description": "

Stops execution immediately.

\n

Streamlit will not run any statements after st.stop().\nWe recommend rendering a message to explain why the script has stopped.\nWhen run outside of Streamlit, this will raise an Exception.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/commands/execution_control.py#L25" - }, - "streamlit.subheader": { - "name": "subheader", - "signature": "st.subheader(body, anchor=None, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.subheader('This is a subheader')\nst.subheader('A subheader with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in subheader formatting.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "anchor", - "type_name": "str or False", - "is_optional": false, - "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the subheader.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L93" - }, - "streamlit.success": { - "name": "success", - "signature": "st.success(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.success('This is a success message!', icon="\u2705")\n
\n
\n", - "description": "

Display a success message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The success text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L136" - }, - "streamlit.table": { - "name": "table", - "signature": "st.table(data=None)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n   np.random.randn(10, 5),\n   columns=('col %d' % i for i in range(5)))\n\nst.table(df)\n
\n\n \n
\n", - "description": "

Display a static table.

\n

This differs from st.dataframe in that the table in this case is\nstatic: its entire contents are laid out directly on the page.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", - "is_optional": false, - "description": "

The table data.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L122" - }, - "streamlit.tabs": { - "name": "tabs", - "signature": "st.tabs(tabs)", - "examples": "
\n

You can use with notation to insert any element into a tab:

\n
\nimport streamlit as st\n\ntab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])\n\nwith tab1:\n   st.header("A cat")\n   st.image("https://static.streamlit.io/examples/cat.jpg", width=200)\n\nwith tab2:\n   st.header("A dog")\n   st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\n\nwith tab3:\n   st.header("An owl")\n   st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n
\n\n \n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\ntab1, tab2 = st.tabs(["\ud83d\udcc8 Chart", "\ud83d\uddc3 Data"])\ndata = np.random.randn(10, 1)\n\ntab1.subheader("A tab with a chart")\ntab1.line_chart(data)\n\ntab2.subheader("A tab with the data")\ntab2.write(data)\n
\n\n \n
\n", - "description": "

Insert containers separated into tabs.

\n

Inserts a number of multi-element containers as tabs.\nTabs are a navigational element that allows users to easily\nmove between groups of related content.

\n

To add elements to the returned containers, you can use "with" notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Warning

\n

All the content of every tab is always sent to and rendered on the frontend.\nConditional rendering is currently not supported.

\n
\n", - "args": [ - { - "name": "tabs", - "type_name": "list of strings", - "is_optional": false, - "description": "

Creates a tab for each string in the list. The first tab is selected by default.\nThe string is used as the name of the tab and can optionally contain Markdown,\nsupporting the following elements: Bold, Italics, Strikethroughs, Inline Code,\nEmojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n", - "default": "." - } - ], - "returns": [ - { - "type_name": "list of containers", - "is_generator": false, - "description": "

A list of container objects.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/layouts.py#L208" - }, - "streamlit.text": { - "name": "text", - "signature": "st.text(body, *, help=None)", - "example": "
\n
\nimport streamlit as st\n\nst.text('This is some text.')\n
\n
\n", - "description": "

Write fixed-width and preformatted text.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The string to display.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the text.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text.py#L27" - }, - "streamlit.text_area": { - "name": "text_area", - "signature": "st.text_area(label, value=\"\", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ntxt = st.text_area('Text to analyze', '''\n    It was the best of times, it was the worst of times, it was\n    the age of wisdom, it was the age of foolishness, it was\n    the epoch of belief, it was the epoch of incredulity, it\n    was the season of Light, it was the season of Darkness, it\n    was the spring of hope, it was the winter of despair, (...)\n    ''')\nst.write('Sentiment:', run_sentiment_analysis(txt))\n
\n
\n", - "description": "

Display a multi-line text input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "object", - "is_optional": false, - "description": "

The text value of this widget when it first renders. This will be\ncast to str internally.

\n", - "default": null - }, - { - "name": "height", - "type_name": "int or None", - "is_optional": false, - "description": "

Desired height of the UI element expressed in pixels. If None, a\ndefault height is used.

\n", - "default": "height" - }, - { - "name": "max_chars", - "type_name": "int or None", - "is_optional": false, - "description": "

Maximum number of characters allowed in text area.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the textarea.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this text_area's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "placeholder", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional string displayed when the text area is empty. If None,\nno text is displayed. This argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the text area if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "str", - "is_generator": false, - "description": "

The current value of the text input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text_widgets.py#L274" - }, - "streamlit.text_input": { - "name": "text_input", - "signature": "st.text_input(label, value=\"\", max_chars=None, key=None, type=\"default\", help=None, autocomplete=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", - "example": "
\n
\nimport streamlit as st\n\ntitle = st.text_input('Movie title', 'Life of Brian')\nst.write('The current movie title is', title)\n
\n\n \n
\n", - "description": "

Display a single-line text input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "object", - "is_optional": false, - "description": "

The text value of this widget when it first renders. This will be\ncast to str internally.

\n", - "default": null - }, - { - "name": "max_chars", - "type_name": "int or None", - "is_optional": false, - "description": "

Max number of characters allowed in text input.

\n", - "default": null - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "type", - "type_name": "\"default\" or \"password\"", - "is_optional": false, - "description": "

The type of the text input. This can be either "default" (for\na regular text input), or "password" (for a text input that\nmasks the user's typed value). Defaults to "default".

\n", - "default": "s" - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "autocomplete", - "type_name": "str", - "is_optional": false, - "description": "

An optional value that will be passed to the <input> element's\nautocomplete property. If unspecified, this value will be set to\n"new-password" for "password" inputs, and the empty string for\n"default" inputs. For more details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this text input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "placeholder", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional string displayed when the text input is empty. If None,\nno text is displayed. This argument can only be supplied by keyword.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the text input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - } - ], - "returns": [ - { - "type_name": "str", - "is_generator": false, - "description": "

The current value of the text input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/text_widgets.py#L71" - }, - "streamlit.time_input": { - "name": "time_input", - "signature": "st.time_input(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", step=0:15:00)", - "example": "
\n
\nimport datetime\nimport streamlit as st\n\nt = st.time_input('Set an alarm for', datetime.time(8, 45))\nst.write('Alarm is set for', t)\n
\n\n \n
\n", - "description": "

Display a time input widget.

\n", - "args": [ - { - "name": "label", - "type_name": "str", - "is_optional": false, - "description": "

A short label explaining to the user what this time input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n

Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. 1\\. Not an ordered list.

\n

For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.

\n", - "default": null - }, - { - "name": "value", - "type_name": "datetime.time/datetime.datetime", - "is_optional": false, - "description": "

The value of this widget when it first renders. This will be\ncast to str internally. Defaults to the current time.

\n", - "default": "the" - }, - { - "name": "key", - "type_name": "str or int", - "is_optional": false, - "description": "

An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the input.

\n", - "default": null - }, - { - "name": "on_change", - "type_name": "callable", - "is_optional": false, - "description": "

An optional callback invoked when this time_input's value changes.

\n", - "default": null - }, - { - "name": "args", - "type_name": "tuple", - "is_optional": false, - "description": "

An optional tuple of args to pass to the callback.

\n", - "default": null - }, - { - "name": "kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

An optional dict of kwargs to pass to the callback.

\n", - "default": null - }, - { - "name": "disabled", - "type_name": "bool", - "is_optional": false, - "description": "

An optional boolean, which disables the time input if set to True.\nThe default is False. This argument can only be supplied by keyword.

\n", - "default": "False." - }, - { - "name": "label_visibility", - "type_name": "\"visible\" or \"hidden\" or \"collapsed\"", - "is_optional": false, - "description": "

The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible". This argument can only be supplied by keyword.

\n", - "default": "is" - }, - { - "name": "step", - "type_name": "int or timedelta", - "is_optional": false, - "description": "

The stepping interval in seconds. Defaults to 900, i.e. 15 minutes.\nYou can also pass a datetime.timedelta object.

\n", - "default": "900" - } - ], - "returns": [ - { - "type_name": "datetime.time", - "is_generator": false, - "description": "

The current value of the time input widget.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/time_widgets.py#L214" - }, - "streamlit.title": { - "name": "title", - "signature": "st.title(body, anchor=None, *, help=None)", - "examples": "
\n
\nimport streamlit as st\n\nst.title('This is a title')\nst.title('A title with _italics_ :blue[colors] and emojis :sunglasses:')\n
\n
\n", - "description": "

Display text in title formatting.

\n

Each document should have a single st.title(), although this is not\nenforced.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.
  • \n
  • Colored text, using the syntax :color[text to be colored],\nwhere color needs to be replaced with any of the following\nsupported colors: blue, green, orange, red, violet.
  • \n
\n", - "default": null - }, - { - "name": "anchor", - "type_name": "str or False", - "is_optional": false, - "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", - "default": null - }, - { - "name": "help", - "type_name": "str", - "is_optional": false, - "description": "

An optional tooltip that gets displayed next to the title.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/heading.py#L146" - }, - "streamlit.vega_lite_chart": { - "name": "vega_lite_chart", - "signature": "st.vega_lite_chart(data=None, spec=None, use_container_width=False, theme=\"streamlit\", **kwargs)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n    np.random.randn(200, 3),\n    columns=['a', 'b', 'c'])\n\nst.vega_lite_chart(chart_data, {\n    'mark': {'type': 'circle', 'tooltip': True},\n    'encoding': {\n        'x': {'field': 'a', 'type': 'quantitative'},\n        'y': {'field': 'b', 'type': 'quantitative'},\n        'size': {'field': 'c', 'type': 'quantitative'},\n        'color': {'field': 'c', 'type': 'quantitative'},\n    },\n})\n
\n\n \n

Examples of Vega-Lite usage without Streamlit can be found at\nhttps://vega.github.io/vega-lite/examples/. Most of those can be easily\ntranslated to the syntax shown above.

\n
\n", - "description": "

Display a chart using the Vega-Lite library.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None", - "is_optional": false, - "description": "

Either the data to be plotted or a Vega-Lite spec containing the\ndata (which more closely follows the Vega-Lite API).\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "spec", - "type_name": "dict or None", - "is_optional": false, - "description": "

The Vega-Lite spec for the chart. If the spec was already passed in\nthe previous argument, this must be set to None. See\nhttps://vega.github.io/vega-lite/docs/ for more info.

\n", - "default": null - }, - { - "name": "use_container_width", - "type_name": "bool", - "is_optional": false, - "description": "

If True, set the chart width to the column width. This takes\nprecedence over Vega-Lite's native width value.

\n", - "default": null - }, - { - "name": "theme", - "type_name": "\"streamlit\" or None", - "is_optional": false, - "description": "

The theme of the chart. Currently, we only support "streamlit" for the Streamlit\ndefined design or None to fallback to the default behavior of the library.

\n", - "default": "behavior" - }, - { - "name": "**kwargs", - "type_name": "any", - "is_optional": false, - "description": "

Same as spec, but as keywords.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L475" - }, - "streamlit.video": { - "name": "video", - "signature": "st.video(data, format=\"video/mp4\", start_time=0)", - "example": "
\n
\nimport streamlit as st\n\nvideo_file = open('myvideo.mp4', 'rb')\nvideo_bytes = video_file.read()\n\nst.video(video_bytes)\n
\n\n \n
\n

Note

\n

Some videos may not display if they are encoded using MP4V (which is an export option in OpenCV), as this codec is\nnot widely supported by browsers. Converting your video to H.264 will allow the video to be displayed in Streamlit.\nSee this StackOverflow post or this\nStreamlit forum post\nfor more information.

\n
\n
\n", - "description": "

Display a video player.

\n", - "args": [ - { - "name": "data", - "type_name": "str, bytes, BytesIO, numpy.ndarray, or file opened with", - "is_optional": false, - "description": "

io.open().\nRaw video data, filename, or URL pointing to a video to load.\nIncludes support for YouTube URLs.\nNumpy arrays and raw data formats must include all necessary file\nheaders to match specified file format.

\n", - "default": null - }, - { - "name": "format", - "type_name": "str", - "is_optional": false, - "description": "

The mime type for the video file. Defaults to 'video/mp4'.\nSee https://tools.ietf.org/html/rfc4281 for more info.

\n", - "default": "s" - }, - { - "name": "start_time", - "type_name": "int", - "is_optional": false, - "description": "

The time from which this element should start playing.

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/media.py#L117" - }, - "streamlit.warning": { - "name": "warning", - "signature": "st.warning(body, *, icon=None)", - "example": "
\n
\nimport streamlit as st\n\nst.warning('This is a warning', icon="\u26a0\ufe0f")\n
\n
\n", - "description": "

Display warning message.

\n", - "args": [ - { - "name": "body", - "type_name": "str", - "is_optional": false, - "description": "

The warning text to display.

\n", - "default": null - }, - { - "name": "icon", - "type_name": "str or None", - "is_optional": false, - "description": "

An optional, keyword-only argument that specifies an emoji to use as\nthe icon for the alert. Shortcodes are not allowed, please use a\nsingle character instead. E.g. "\ud83d\udea8", "\ud83d\udd25", "\ud83e\udd16", etc.\nDefaults to None, which means no icon is displayed.

\n", - "default": "None" - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/alert.py#L71" - }, - "streamlit.write": { - "name": "write", - "signature": "st.write(*args, unsafe_allow_html=False, **kwargs)", - "example": "
\n

Its basic use case is to draw Markdown-formatted text, whenever the\ninput is a string:

\n
\nimport streamlit as st\n\nst.write('Hello, *World!* :sunglasses:')\n
\n\n \n

As mentioned earlier, st.write() also accepts other data formats, such as\nnumbers, data frames, styled data frames, and assorted objects:

\n
\nimport streamlit as st\nimport pandas as pd\n\nst.write(1234)\nst.write(pd.DataFrame({\n    'first column': [1, 2, 3, 4],\n    'second column': [10, 20, 30, 40],\n}))\n
\n\n \n

Finally, you can pass in multiple arguments to do things like:

\n
\nimport streamlit as st\n\nst.write('1 + 1 = ', 2)\nst.write('Below is a DataFrame:', data_frame, 'Above is a dataframe.')\n
\n\n \n

Oh, one more thing: st.write accepts chart objects too! For example:

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\ndf = pd.DataFrame(\n    np.random.randn(200, 3),\n    columns=['a', 'b', 'c'])\n\nc = alt.Chart(df).mark_circle().encode(\n    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.write(c)\n
\n\n \n
\n", - "description": "

Write arguments to the app.

\n

This is the Swiss Army knife of Streamlit commands: it does different\nthings depending on what you throw at it. Unlike other Streamlit commands,\nwrite() has some unique properties:

\n
    \n
  1. You can pass in multiple arguments, all of which will be written.
  2. \n
  3. Its behavior depends on the input types as follows.
  4. \n
  5. It returns None, so its "slot" in the App cannot be reused.
  6. \n
\n", - "args": [ - { - "name": "*args", - "type_name": "any", - "is_optional": false, - "description": "

One or many objects to print to the App.

\n

Arguments are handled as follows:

\n
    \n
  • \n
    write(string) : Prints the formatted Markdown string, with
    \n
    support for LaTeX expression, emoji shortcodes, and colored text.\nSee docs for st.markdown for more.
    \n
    \n
  • \n
  • write(data_frame) : Displays the DataFrame as a table.
  • \n
  • write(error) : Prints an exception specially.
  • \n
  • write(func) : Displays information about a function.
  • \n
  • write(module) : Displays information about the module.
  • \n
  • write(class) : Displays information about a class.
  • \n
  • write(dict) : Displays dict in an interactive widget.
  • \n
  • write(mpl_fig) : Displays a Matplotlib figure.
  • \n
  • write(altair) : Displays an Altair chart.
  • \n
  • write(keras) : Displays a Keras model.
  • \n
  • write(graphviz) : Displays a Graphviz graph.
  • \n
  • write(plotly_fig) : Displays a Plotly figure.
  • \n
  • write(bokeh_fig) : Displays a Bokeh figure.
  • \n
  • write(sympy_expr) : Prints SymPy expression using LaTeX.
  • \n
  • write(htmlable) : Prints _repr_html_() for the object if available.
  • \n
  • write(obj) : Prints str(obj) if otherwise unknown.
  • \n
\n", - "default": null - }, - { - "name": "unsafe_allow_html", - "type_name": "bool", - "is_optional": false, - "description": "

This is a keyword-only argument that defaults to False.

\n

By default, any HTML tags found in strings will be escaped and\ntherefore treated as pure text. This behavior may be turned off by\nsetting this argument to True.

\n

That said, we strongly advise against it. It is hard to write secure\nHTML, so by using this argument you may be compromising your users'\nsecurity. For more information, see:

\n

https://github.com/streamlit/streamlit/issues/152

\n", - "default": "False." - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/write.py#L48" - }, - "streamlit.experimental_memo.clear": { - "name": "experimental_memo.clear", - "signature": "st.experimental_memo.clear()", - "description": "

Clear all in-memory and on-disk data caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L541" - }, - "streamlit.cache_data.clear": { - "name": "cache_data.clear", - "signature": "st.cache_data.clear()", - "description": "

Clear all in-memory and on-disk data caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_data_api.py#L541" - }, - "streamlit.experimental_singleton.clear": { - "name": "experimental_singleton.clear", - "signature": "st.experimental_singleton.clear()", - "description": "

Clear all cache_resource caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L396" - }, - "streamlit.cache_resource.clear": { - "name": "cache_resource.clear", - "signature": "st.cache_resource.clear()", - "description": "

Clear all cache_resource caches.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/runtime/caching/cache_resource_api.py#L396" - }, - "streamlit.connections.ExperimentalBaseConnection": { - "name": "ExperimentalBaseConnection", - "signature": "st.connections.ExperimentalBaseConnection(connection_name, **kwargs)", - "is_class": true, - "methods": [ - { - "name": "reset", - "signature": "st.connections.reset.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - } - ], - "properties": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L25", - "description": "

The abstract base class that all Streamlit Connections must inherit from.

\n

This base class provides connection authors with a standardized way to hook into the\nst.experimental_connection() factory function: connection authors are required to\nprovide an implementation for the abstract method _connect in their subclasses.

\n

Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information

\n
\n

Note

\n

While providing an implementation of _connect is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a query() method for\nreads and a session property for more complex operations.

\n
\n", - "args": [], - "returns": [] - }, - "streamlit.connections.SQLConnection": { - "name": "SQLConnection", - "signature": "st.connections.SQLConnection(connection_name, **kwargs)", - "is_class": true, - "methods": [ - { - "name": "query", - "signature": "st.connections.query.query(sql, *, ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only query.

", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "index_col", - "type_name": "str, list of str, or None", - "is_optional": false, - "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", - "default": "None." - }, - { - "name": "chunksize", - "type_name": "int or None", - "is_optional": false, - "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", - "default": "None." - }, - { - "name": "params", - "type_name": "list, tuple, dict or None", - "is_optional": false, - "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", - "default": "None." - }, - { - "name": "**kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

Additional keyword arguments are passed to pd.read_sql.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L121" - }, - { - "name": "reset", - "signature": "st.connections.reset.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - } - ], - "properties": [ - { - "name": "session", - "signature": "st.connections.session.session", - "example": "
\n
\nimport streamlit as st\nconn = st.experimental_connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n
\n", - "description": "

Return a SQLAlchemy Session.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L226" - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L45", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", - "description": "

A connection to a SQL database using a SQLAlchemy Engine. Initialize using st.experimental_connection("<name>", type="sql").

\n

SQLConnection provides the query() convenience method, which can be used to\nrun simple read-only queries with both caching and simple error handling/retries.\nMore complex DB interactions can be performed by using the .session property\nto receive a regular SQLAlchemy Session.

\n

SQLConnections should always be created using st.experimental_connection(),\nnot initialized directly. Connection parameters for a SQLConnection can be\nspecified using either st.secrets or **kwargs. Some frequently used\nparameters include:

\n
    \n
  • url or arguments for sqlalchemy.engine.URL.create().\nMost commonly it includes a dialect, host, database, username and password.
  • \n
  • create_engine_kwargs can be passed via st.secrets, such as for\nsnowflake-sqlalchemy\nor Google BigQuery.\nThese can also be passed directly as **kwargs to experimental_connection().
  • \n
  • autocommit=True to run with isolation level AUTOCOMMIT. Default is False.
  • \n
\n", - "args": [], - "returns": [] - }, - "streamlit.connections.SnowparkConnection": { - "name": "SnowparkConnection", - "signature": "st.connections.SnowparkConnection(connection_name, **kwargs)", - "is_class": true, - "methods": [ - { - "name": "query", - "signature": "st.connections.query.query(sql, ttl=None)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only SQL query.

", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L123" - }, - { - "name": "reset", - "signature": "st.connections.reset.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - { - "name": "safe_session", - "signature": "st.connections.safe_session.safe_session()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\nwith conn.safe_session() as session:\n    df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n
\n
\n", - "description": "

Grab the underlying Snowpark session in a thread-safe manner.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L207" - } - ], - "properties": [ - { - "name": "session", - "signature": "st.connections.session.session", - "example": "
\n
\nimport streamlit as st\n\nsession = st.experimental_connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n
\n
\n", - "description": "

Access the underlying Snowpark session.

", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L184" - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L70", - "description": "

A connection to Snowpark using snowflake.snowpark.session.Session. Initialize using

\n

st.experimental_connection("<name>", type="snowpark").

\n

In addition to accessing the Snowpark Session, SnowparkConnection supports direct SQL querying using\nquery("...") and thread safe access using with conn.safe_session():. See methods\nbelow for more information. SnowparkConnections should always be created using\nst.experimental_connection(), not initialized directly.

\n
\n

Note

\n

We don't expect this iteration of SnowparkConnection to be able to scale\nwell in apps with many concurrent users due to the lock contention that will occur\nover the single underlying Session object under high load.

\n
\n", - "args": [], - "returns": [] - }, - "streamlit.connections.SQLConnection.query": { - "name": "query", - "signature": "SQLConnection.query(sql, *, ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only query.

\n

This method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n

Aside from the ttl kwarg, all kwargs passed to this function are passed down\nto pd.read_sql\nand have the behavior described in the pandas documentation.

\n", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - }, - { - "name": "index_col", - "type_name": "str, list of str, or None", - "is_optional": false, - "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", - "default": "None." - }, - { - "name": "chunksize", - "type_name": "int or None", - "is_optional": false, - "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", - "default": "None." - }, - { - "name": "params", - "type_name": "list, tuple, dict or None", - "is_optional": false, - "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", - "default": "None." - }, - { - "name": "**kwargs", - "type_name": "dict", - "is_optional": false, - "description": "

Additional keyword arguments are passed to pd.read_sql.

\n", - "default": null - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L121" - }, - "streamlit.connections.SQLConnection.reset": { - "name": "reset", - "signature": "SQLConnection.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - "streamlit.connections.SQLConnection.session": { - "name": "session", - "signature": "SQLConnection.session", - "example": "
\n
\nimport streamlit as st\nconn = st.experimental_connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n
\n", - "description": "

Return a SQLAlchemy Session.

\n

Users of this connection should use the contextmanager pattern for writes,\ntransactions, and anything more complex than simple read queries.

\n

See the usage example below, which assumes we have a table numbers with a\nsingle integer column val. The SQLAlchemy docs also contain\nmuch more information on the usage of sessions.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/sql_connection.py#L226" - }, - "streamlit.connections.SnowparkConnection.query": { - "name": "query", - "signature": "SnowparkConnection.query(sql, ttl=None)", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n
\n
\n", - "description": "

Run a read-only SQL query.

\n

This method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n", - "args": [ - { - "name": "sql", - "type_name": "str", - "is_optional": false, - "description": "

The read-only SQL query to execute.

\n", - "default": null - }, - { - "name": "ttl", - "type_name": "float, int, timedelta or None", - "is_optional": false, - "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", - "default": "None." - } - ], - "returns": [ - { - "type_name": "pd.DataFrame", - "is_generator": false, - "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L123" - }, - "streamlit.connections.SnowparkConnection.reset": { - "name": "reset", - "signature": "SnowparkConnection.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - "streamlit.connections.SnowparkConnection.safe_session": { - "name": "safe_session", - "signature": "SnowparkConnection.safe_session()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("snowpark")\nwith conn.safe_session() as session:\n    df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n
\n
\n", - "description": "

Grab the underlying Snowpark session in a thread-safe manner.

\n

As operations on a Snowpark session are not thread safe, we need to take care\nwhen using a session in the context of a Streamlit app where each script run\noccurs in its own thread. Using the contextmanager pattern to do this ensures\nthat access on this connection's underlying Session is done in a thread-safe\nmanner.

\n

Information on how to use Snowpark sessions can be found in the Snowpark documentation.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L207" - }, - "streamlit.connections.SnowparkConnection.session": { - "name": "session", - "signature": "SnowparkConnection.session", - "example": "
\n
\nimport streamlit as st\n\nsession = st.experimental_connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n
\n
\n", - "description": "

Access the underlying Snowpark session.

\n
\n

Note

\n

Snowpark sessions are not thread safe. Users of this method are\nresponsible for ensuring that access to the session returned by this method is\ndone in a thread-safe manner. For most users, we recommend using the thread-safe\nsafe_session() method and a with block.

\n
\n

Information on how to use Snowpark sessions can be found in the Snowpark documentation.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/snowpark_connection.py#L184" - }, - "streamlit.connections.ExperimentalBaseConnection.reset": { - "name": "reset", - "signature": "ExperimentalBaseConnection.reset()", - "example": "
\n
\nimport streamlit as st\n\nconn = st.experimental_connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n
\n", - "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", - "args": [], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/connections/base_connection.py#L137" - }, - "DeltaGenerator.add_rows": { - "name": "add_rows", - "signature": "element.add_rows(data=None, **kwargs)", - "example": "
\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf1 = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nmy_table = st.table(df1)\n\ndf2 = pd.DataFrame(\n   np.random.randn(50, 20),\n   columns=('col %d' % i for i in range(20)))\n\nmy_table.add_rows(df2)\n# Now the table shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n
\n

You can do the same thing with plots. For example, if you want to add\nmore data to a line chart:

\n
\n# Assuming df1 and df2 from the example above still exist...\nmy_chart = st.line_chart(df1)\nmy_chart.add_rows(df2)\n# Now the chart shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n
\n

And for plots whose datasets are named, you can pass the data with a\nkeyword argument where the key is the name:

\n
\nmy_chart = st.vega_lite_chart({\n    'mark': 'line',\n    'encoding': {'x': 'a', 'y': 'b'},\n    'datasets': {\n      'some_fancy_name': df1,  # <-- named dataset\n     },\n    'data': {'name': 'some_fancy_name'},\n}),\nmy_chart.add_rows(some_fancy_name=df2)  # <-- name used as keyword\n
\n
\n", - "description": "

Concatenate a dataframe to the bottom of the current one.

\n", - "args": [ - { - "name": "data", - "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None", - "is_optional": false, - "description": "

Table to concat. Optional.\nPyarrow tables are not supported by Streamlit's legacy DataFrame serialization\n(i.e. with config.dataFrameSerialization = "legacy").\nTo use pyarrow tables, please enable pyarrow by changing the config setting,\nconfig.dataFrameSerialization = "arrow".

\n", - "default": null - }, - { - "name": "**kwargs", - "type_name": "pandas.DataFrame, numpy.ndarray, Iterable, dict, or None", - "is_optional": false, - "description": "

The named dataset to concat. Optional. You can only pass in 1\ndataset (including the one in the data parameter).

\n", - "default": null - } - ], - "returns": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/elements/dataframe_selector.py#L550" - }, - "streamlit.experimental_user.to_dict": { - "name": "to_dict", - "signature": "st.experimental_user.to_dict()", - "description": "

Get user info as a dictionary.

\n

This method primarily exists for internal use and is not needed for\nmost cases. st.experimental_user returns an object that inherits from\ndict by default.

\n", - "args": [], - "returns": [ - { - "type_name": "Dict[str,str]", - "is_generator": false, - "description": "

A dictionary of the current user's information.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L54" - }, - "streamlit.experimental_user": { - "name": "streamlit.experimental_user", - "signature": "st.experimental_user()", - "is_class": true, - "methods": [ - { - "name": "to_dict", - "signature": "st.to_dict.to_dict()", - "description": "

Get user info as a dictionary.

", - "args": [], - "returns": [ - { - "type_name": "Dict[str,str]", - "is_generator": false, - "description": "

A dictionary of the current user's information.

\n", - "return_name": null - } - ], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L54" - } - ], - "properties": [], - "source": "https://github.com/streamlit/streamlit/blob/1.22.0/lib/streamlit/user_info.py#L30", - "description": "

A read-only, dict-like object for accessing information about current user.

\n

Properties can by accessed via key or attribute notation. For example,\nst.experimental_user["email"] or st.experimental_user.email.

\n", - "args": [ - { - "name": "user_name", - "type_name": "str", - "is_optional": false, - "description": "

Snowflake user name

\n", - "default": null - }, - { - "name": "login_name", - "type_name": "str", - "is_optional": false, - "description": "

Snowflake user's login name

\n", - "default": null - }, - { - "name": "email", - "type_name": "str", - "is_optional": false, - "description": "

Snowflake user's email

\n", - "default": null - } - ], - "returns": [] - } - }, "1.13.0": { "streamlit.altair_chart": { "name": "altair_chart", From 2472ed537b3d69f7cebfad2510f103d49957e2e3 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Mon, 15 Jul 2024 15:10:31 -0700 Subject: [PATCH 05/40] Typo in variable name --- components/blocks/autofunction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/blocks/autofunction.js b/components/blocks/autofunction.js index 9488b5665..78886386e 100644 --- a/components/blocks/autofunction.js +++ b/components/blocks/autofunction.js @@ -485,7 +485,7 @@ const Autofunction = ({ ${property.deprecated.deprecatedText}
` : ""; - const properyPrefix = functionException[property.name] + const propertyPrefix = functionException[property.name] ? functionException[property.name]["content"] : ""; const description = property.description From 139b9d6e85debd3e45a1c61f1c19d7c01c150705 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Mon, 15 Jul 2024 15:16:45 -0700 Subject: [PATCH 06/40] Use Snowflake text character --- components/blocks/autofunction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/blocks/autofunction.js b/components/blocks/autofunction.js index 78886386e..a465c5054 100644 --- a/components/blocks/autofunction.js +++ b/components/blocks/autofunction.js @@ -127,7 +127,7 @@ const Autofunction = ({ {versionList.map((version, index) => ( ))} From 15cba3017a11c4c59acdf7a2446e2ad381b116df Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Fri, 18 Oct 2024 01:16:19 -0700 Subject: [PATCH 07/40] Add Radix UI --- package-lock.json | 813 +++++++++++++++++++++++++++++++++++++++++++++- package.json | 4 + 2 files changed, 816 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index c7146d58f..813732646 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,10 @@ "version": "0.1.0", "dependencies": { "@mapbox/rehype-prism": "^0.9.0", + "@radix-ui/react-icons": "1.3.0", + "@radix-ui/react-popover": "1.1.2", + "@radix-ui/react-radio-group": "1.2.1", + "@radix-ui/react-scroll-area": "1.2.0", "@svgr/webpack": "^8.1.0", "@tryghost/content-api": "1.11.20", "algoliasearch": "^3.35.1", @@ -2097,6 +2101,44 @@ "node": ">=14" } }, + "node_modules/@floating-ui/core": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.8.tgz", + "integrity": "sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.8" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.11.tgz", + "integrity": "sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.6.0", + "@floating-ui/utils": "^0.2.8" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz", + "integrity": "sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz", + "integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==", + "license": "MIT" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", @@ -3404,6 +3446,626 @@ "node": ">=18" } }, + "node_modules/@radix-ui/number": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.0.tgz", + "integrity": "sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ==", + "license": "MIT" + }, + "node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-arrow": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz", + "integrity": "sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz", + "integrity": "sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-direction": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz", + "integrity": "sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.1.tgz", + "integrity": "sha512-QSxg29lfr/xcev6kSz7MAlmDnzbP1eI/Dwn3Tp1ip0KT5CUELsxkekFEMVBEoykI3oV39hKT4TKZzBNMbcTZYQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-escape-keydown": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-guards": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.1.tgz", + "integrity": "sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.0.tgz", + "integrity": "sha512-200UD8zylvEyL8Bx+z76RJnASR2gRMuxlgFCPAe/Q/679a/r0eK3MBVYMb7vZODZcffZBdob1EGnky78xmVvcA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-icons": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-icons/-/react-icons-1.3.0.tgz", + "integrity": "sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==", + "license": "MIT", + "peerDependencies": { + "react": "^16.x || ^17.x || ^18.x" + } + }, + "node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.2.tgz", + "integrity": "sha512-u2HRUyWW+lOiA2g0Le0tMmT55FGOEWHwPFt1EPfbLly7uXQExFo5duNKqG2DzmFXIdqOeNd+TpE8baHWJCyP9w==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-focus-guards": "1.1.1", + "@radix-ui/react-focus-scope": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-popper": "1.2.0", + "@radix-ui/react-portal": "1.1.2", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "aria-hidden": "^1.1.1", + "react-remove-scroll": "2.6.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.0.tgz", + "integrity": "sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.2.tgz", + "integrity": "sha512-WeDYLGPxJb/5EGBoedyJbT0MpoULmwnIPMJMSldkuiMsBAv7N1cRdsTWZWht9vpPOiN3qyiGAtbK2is47/uMFg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-presence": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.1.tgz", + "integrity": "sha512-IeFXVi4YS1K0wVZzXNrbaaUvIJ3qdY+/Ih4eHFhWA9SwGR9UDX7Ck8abvL57C4cv3wwMvUE0OG69Qc3NCcTe/A==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.2.1.tgz", + "integrity": "sha512-kdbv54g4vfRjja9DNWPMxKvXblzqbpEC8kspEkZ6dVP7kQksGCn+iZHkcCz2nb00+lPdRvxrqy4WrvvV1cNqrQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-roving-focus": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-previous": "1.1.0", + "@radix-ui/react-use-size": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.0.tgz", + "integrity": "sha512-EA6AMGeq9AEeQDeSH0aZgG198qkfHSbvWTf1HvoDmOB5bBG/qTxjYMWUKMnYiV6J/iP/J8MEFSuB2zRU2n7ODA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-collection": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-scroll-area": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-scroll-area/-/react-scroll-area-1.2.0.tgz", + "integrity": "sha512-q2jMBdsJ9zB7QG6ngQNzNwlvxLQqONyL58QbEGwuyRZZb/ARQwk3uQVbCF7GvQVOtV6EU/pDxAw3zRzJZI3rpQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/number": "1.1.0", + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-callback-ref": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.0.tgz", + "integrity": "sha512-CasTfvsy+frcFkbXtSJ2Zu9JHpN8TYKxkgJGWbjiZhFivxaeW7rMeZt7QELGVLaYVfFMsKHjb7Ak0nMEe+2Vfw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-escape-keydown": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz", + "integrity": "sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.0.tgz", + "integrity": "sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-previous": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz", + "integrity": "sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-rect": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.0.tgz", + "integrity": "sha512-0Fmkebhr6PiseyZlYAOtLS+nb7jLmpqTrJyv61Pe68MKYW6OWdRE2kI70TaYY27u7H0lajqM3hSMMLFq18Z7nQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-size": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.0.tgz", + "integrity": "sha512-XW3/vWuIXHa+2Uwcc2ABSfcCledmXhhQPlGbfcRXbiUQI5Icjcg19BGCZVKKInYbvUCut/ufbbLLPFC5cbb1hw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/rect": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.0.tgz", + "integrity": "sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==", + "license": "MIT" + }, "node_modules/@rushstack/eslint-patch": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.7.2.tgz", @@ -3811,7 +4473,7 @@ "version": "18.2.22", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.22.tgz", "integrity": "sha512-fHkBXPeNtfvri6gdsMYyW+dW7RXFo6Ad09nLFK0VQWR7yGLai/Cyvyj696gbwYvBnhGtevUG9cET0pmUbMtoPQ==", - "dev": true, + "devOptional": true, "dependencies": { "@types/react": "*" } @@ -4339,6 +5001,18 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "node_modules/aria-hidden": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz", + "integrity": "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/aria-query": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", @@ -6040,6 +6714,12 @@ "node": ">=0.10" } }, + "node_modules/detect-node-es": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", + "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==", + "license": "MIT" + }, "node_modules/devlop": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", @@ -7828,6 +8508,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-nonce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz", + "integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/get-port-please": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.1.2.tgz", @@ -9579,6 +10268,15 @@ "node": ">= 0.4" } }, + "node_modules/invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, "node_modules/ioredis": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.2.tgz", @@ -14825,6 +15523,53 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/react-remove-scroll": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz", + "integrity": "sha512-I2U4JVEsQenxDAKaVa3VZ/JeJZe0/2DxPWL8Tj8yLKctQJQiZM52pn/GWFpSp8dftjM3pSAHVJZscAnC/y+ySQ==", + "license": "MIT", + "dependencies": { + "react-remove-scroll-bar": "^2.3.6", + "react-style-singleton": "^2.2.1", + "tslib": "^2.1.0", + "use-callback-ref": "^1.3.0", + "use-sidecar": "^1.1.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-remove-scroll-bar": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.6.tgz", + "integrity": "sha512-DtSYaao4mBmX+HDo5YWYdBWQwYIQQshUV/dVxFxK+KM26Wjwp1gZ6rv6OC3oujI6Bfu6Xyg3TwK533AQutsn/g==", + "license": "MIT", + "dependencies": { + "react-style-singleton": "^2.2.1", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/react-responsive": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/react-responsive/-/react-responsive-9.0.2.tgz", @@ -14858,6 +15603,29 @@ "react-dom": "^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-style-singleton": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.1.tgz", + "integrity": "sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==", + "license": "MIT", + "dependencies": { + "get-nonce": "^1.0.0", + "invariant": "^2.2.4", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/react-transition-group": { "version": "4.4.5", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", @@ -18386,6 +19154,49 @@ "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==", "dev": true }, + "node_modules/use-callback-ref": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.2.tgz", + "integrity": "sha512-elOQwe6Q8gqZgDA8mrh44qRTQqpIHDcZ3hXTLjBe1i4ph8XpNJnO+aQf3NaG+lriLopI4HMx9VjQLfPQ6vhnoA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sidecar": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz", + "integrity": "sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==", + "license": "MIT", + "dependencies": { + "detect-node-es": "^1.1.0", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 4446c6261..95fd62a8a 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,10 @@ }, "dependencies": { "@mapbox/rehype-prism": "^0.9.0", + "@radix-ui/react-icons": "1.3.0", + "@radix-ui/react-popover": "1.1.2", + "@radix-ui/react-radio-group": "1.2.1", + "@radix-ui/react-scroll-area": "1.2.0", "@svgr/webpack": "^8.1.0", "@tryghost/content-api": "1.11.20", "algoliasearch": "^3.35.1", From 28e6cfa43dddb8909d126a97d95ac2c477d062c5 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Fri, 18 Oct 2024 01:16:51 -0700 Subject: [PATCH 08/40] Add 1.35.0 exceptions --- python/snowflake.json | 149 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/python/snowflake.json b/python/snowflake.json index 2c30a3123..c6d29fc6a 100644 --- a/python/snowflake.json +++ b/python/snowflake.json @@ -566,5 +566,154 @@ "content": "Query parameters are not visible in your app's URL in Streamlit in Snowflake. However, query parameters can still be read and set through `st.query_params`." } } + }, + "1.35.0": { + "streamlit.bokeh_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.cache_data": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_data` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.cache_resource": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "`st.cache_resource` is not fully supported in Streamlit in Snowflake. Caching only works within a single session. Cached values can't be carried over to other sessions." + } + }, + "streamlit.camera_input": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.caption": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.experimental_get_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.experimental_set_query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.file_uploader": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.map": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.map`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.markdown": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.pydeck_chart": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "supported", + "content": "When you use the `st.pydeck_chart`, Mapbox provides the map tiles when rendering map content. Mapbox is a third-party application and is subject to Snowflake's [External Offerings Terms](https://www.snowflake.com/legal/external-offering-terms/)." + } + }, + "streamlit.set_page_config": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "page_title": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + }, + "page_icon": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake." + } + }, + "streamlit.write": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial" + }, + "unsafe_allow_html": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This parameter is ignored in Streamlit in Snowflake. All HTML tags will be escaped and therefore treated as pure text." + } + }, + "streamlit.components.v1.declare_component": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.html": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.components.v1.iframe": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "unsupported", + "content": "This command does not exist in Streamlit in Snowflake." + } + }, + "streamlit.link_button": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "External links are blocked by default. For more information, see [External network access in Streamlit in Snowflake](https://docs.snowflake.com/en/developer-guide/streamlit/additional-features#external-network-access-in-sis)." + } + }, + "streamlit.query_params": { + "_": { + "platform": "Streamlit in Snowflake", + "type": "partial", + "content": "Query parameters are not visible in your app's URL in Streamlit in Snowflake. However, query parameters can still be read and set through `st.query_params`." + } + } } } From cb7bd2717fc3c4f8726ac79c4588c1f703d0b818 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Fri, 18 Oct 2024 01:27:21 -0700 Subject: [PATCH 09/40] Radix version selector --- components/blocks/autofunction.js | 48 +----- components/blocks/autofunction.module.css | 2 +- components/utilities/versionSelector.js | 138 ++++++++++++++++++ .../utilities/versionSelector.module.css | 131 +++++++++++++++++ pages/[...slug].js | 22 +-- public/fonts/styles.css | 3 +- 6 files changed, 286 insertions(+), 58 deletions(-) create mode 100644 components/utilities/versionSelector.js create mode 100644 components/utilities/versionSelector.module.css diff --git a/components/blocks/autofunction.js b/components/blocks/autofunction.js index a465c5054..2f4cfe92d 100644 --- a/components/blocks/autofunction.js +++ b/components/blocks/autofunction.js @@ -17,6 +17,7 @@ import "prismjs/plugins/line-highlight/prism-line-highlight.css"; import "prismjs/plugins/toolbar/prism-toolbar"; import "prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard"; import "prismjs/plugins/normalize-whitespace/prism-normalize-whitespace"; +import VersionSelector from "../utilities/versionSelector"; import styles from "./autofunction.module.css"; import { name } from "file-loader"; @@ -102,57 +103,22 @@ const Autofunction = ({ setIsHighlighted(true); }; - const VersionSelector = ({ - versionList, - snowflakeVersions, - currentVersion, - handleSelectVersion, - }) => { - const isSiS = currentVersion.startsWith("SiS") ? true : false; - const selectClass = isSiS - ? "version-select sis-version" - : currentVersion !== versionList[0] - ? "version-select old-version" - : "version-select"; - - return ( -
- -
- ); - }; - const handleSelectVersion = (event) => { const functionObject = streamlit[streamlitFunction] ?? streamlit[oldStreamlitFunction]; const slicedSlug = slug.slice(); - if (event.target.value !== currentVersion) { - setCurrentVersion(event.target.value); - if (event.target.value !== maxVersion) { + if (event !== currentVersion) { + setCurrentVersion(event); + if (event !== maxVersion) { let isnum = /^[\d\.]+$/.test(slicedSlug[0]); let isSiS = /^SiS[\d\.]*$/.test(slicedSlug[0]); if (isnum || isSiS) { - slicedSlug[0] = event.target.value; + slicedSlug[0] = event; } else { - slicedSlug.unshift(event.target.value); + slicedSlug.unshift(event); } - slug.unshift(event.target.value); + slug.unshift(event); } } diff --git a/components/blocks/autofunction.module.css b/components/blocks/autofunction.module.css index df616fa50..ed0130736 100644 --- a/components/blocks/autofunction.module.css +++ b/components/blocks/autofunction.module.css @@ -11,7 +11,7 @@ } .Title { - @apply mt-6 mb-2; + @apply grow mt-6 mb-2; } .Form { diff --git a/components/utilities/versionSelector.js b/components/utilities/versionSelector.js new file mode 100644 index 000000000..8153c3628 --- /dev/null +++ b/components/utilities/versionSelector.js @@ -0,0 +1,138 @@ +import React, { useState, useEffect } from "react"; +import * as Popover from "@radix-ui/react-popover"; +import * as RadioGroup from "@radix-ui/react-radio-group"; +import * as ScrollArea from "@radix-ui/react-scroll-area"; +import classNames from "classnames"; +import styles from "./versionSelector.module.css"; + +const platforms = [ + { id: "oss", name: "None" }, + { id: "sis", name: "Streamlit in Snowflake" }, + { id: "sf-na", name: "Snowflake Native Apps" }, +]; + +const VersionSelector = ({ + versionList, + snowflakeVersions, + currentVersion, + handleSelectVersion, +}) => { + const [platform, setPlatform] = useState("oss"); + + return ( + + + + + + +
+ Show exceptions for: + + {platforms.map((platform) => ( +
+ + + + +
+ ))} +
+
+ + +
+ + + {platform == "sis" + ? snowflakeVersions.map((sf_version) => ( +
+ + + + +
+ )) + : versionList.map((oss_version) => ( +
+ + + + +
+ ))} +
+
+
+ + + +
+ + + close + + +
+
+
+ ); +}; + +export default VersionSelector; diff --git a/components/utilities/versionSelector.module.css b/components/utilities/versionSelector.module.css new file mode 100644 index 000000000..10e28b3f8 --- /dev/null +++ b/components/utilities/versionSelector.module.css @@ -0,0 +1,131 @@ +.PopoverContent { + @apply bg-gray-20 rounded-md p-5 shadow-2xl text-gray-70; +} +:global(.dark) .PopoverContent { + @apply bg-gray-90 text-gray-40; +} +.PopoverContent legend { + @apply text-sm tracking-tight; +} +.PopoverArrow { + @apply fill-gray-20; +} +:global(.dark) .PopoverArrow { + @apply fill-gray-90; +} +.PopoverClose { + @apply h-6 w-6 absolute top-1.5 right-1.5; +} +.PopoverClose:hover { + @apply opacity-70; +} + +.VersionButton { + @apply font-mono font-bold flex flex-row md:flex-row-reverse text-lg; +} +:global(.dark) .VersionButton { + @apply text-gray-40; +} +.VersionButton:hover { + @apply opacity-60; +} +.VersionButton i { + @apply mt-1; +} +.PlatformOption { + @apply flex-none; +} + +/* Platform selection */ +/* ------------------ */ +.RadioGroupRoot { + @apply flex flex-col gap-1 pl-1; +} +.RadioGroupItem { + @apply bg-white w-4 h-4 rounded-2xl border border-gray-70; +} +:global(.dark) .RadioGroupItem { + @apply border-gray-70 bg-gray-40; +} +.RadioGroupItem:hover { + @apply opacity-70 cursor-pointer; +} +.RadioGroupIndicator { + @apply flex items-center justify-center w-full h-full relative; +} +.RadioGroupIndicator::after { + content: ""; + @apply bg-indigo-70 block w-2 h-2 rounded-md; +} +.RadioLabel { + @apply tracking-tight text-base pl-2; +} +.RadioLabel:hover { + @apply opacity-70 cursor-pointer; +} + +/* Lower section (scroll area) */ +/* --------------------------- */ +.ScrollAreaRoot { + @apply mt-4 bg-white w-[200px] rounded-md overflow-hidden; +} +:global(.dark) .ScrollAreaRoot { + @apply bg-gray-40; +} +.ScrollAreaViewport { + @apply w-full h-full max-h-96; +} +.ScrollAreaScrollbar { + @apply flex touch-none p-0.5; +} +.ScrollAreaScrollbar[data-orientation="vertical"] { + @apply w-2.5; +} +.ScrollAreaThumb { + @apply bg-gray-40 rounded-md relative flex-1; +} +/* increase target size for touch devices https://www.w3.org/WAI/WCAG21/Understanding/target-size.html */ +.ScrollAreaThumb::before { + content: ""; + @apply absolute top-1/2 left-1/2 w-full h-full min-w-11 min-h-11 -translate-x-1/2 -translate-y-1/2; +} +.FadeTop { + @apply bg-gradient-to-b from-white to-transparent h-8 -mb-8 mr-3 relative z-auto; +} +:global(.dark) .FadeTop { + @apply bg-gradient-to-b from-gray-40 to-transparent; +} +.FadeBottom { + @apply bg-gradient-to-t from-white to-transparent h-8 -mt-8 mr-3 relative z-auto; +} +:global(.dark) .FadeBottom { + @apply bg-gradient-to-t from-gray-40 to-transparent; +} + +/* List of versions within the scroll area*/ +/* -------------------------------------- */ +.VersionListRoot { + @apply flex flex-col gap-1 w-full pl-1 pt-6 pb-6; +} +.VersionListItem { + @apply w-4 h-4 border-transparent; +} +.VersionListItem:hover { + @apply opacity-70 cursor-pointer; +} +.VersionListIndicator { + @apply flex items-center justify-center w-full h-full relative top-1.5; +} +.VersionListIndicator::after { + content: "check"; + @apply text-indigo-70 text-2xl; +} +.VersionLabel { + @apply tracking-tight text-base pl-2 font-mono select-none; +} +:global(.dark) .VersionLabel { + @apply text-gray-80; +} +.VersionLabel:hover { + @apply opacity-70 cursor-pointer; +} diff --git a/pages/[...slug].js b/pages/[...slug].js index 30ccd8298..884ad7555 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -71,6 +71,7 @@ import YouTube from "../components/blocks/youTube"; import Cloud from "../components/blocks/cloud"; import styles from "../components/layouts/container.module.css"; +import { reverse } from "lodash"; export default function Article({ data, @@ -179,20 +180,11 @@ export default function Article({ currentLink = `/${slug.join("/")}`; versionWarning = ( - {version && version.startsWith("SiS") ? ( -

- You are reading the documentation for Streamlit in Snowflake. For - open-source Streamlit, version{" "} - {maxVersion} is the latest version - available. -

- ) : ( -

- You are reading the documentation for Streamlit version {version}, - but {maxVersion} is the latest - version available. -

- )} +

+ You are reading the documentation for Streamlit version {version}, but{" "} + {maxVersion} is the latest version + available. +

); } @@ -378,7 +370,7 @@ export async function getStaticProps(context) { if (should_version) { props["streamlit"] = streamlitFuncs[current_version]; props["exceptions"] = streamlitExceptions[current_version] ?? {}; - props["snowflakeVersions"] = Object.keys(streamlitExceptions); + props["snowflakeVersions"] = reverse(Object.keys(streamlitExceptions)); } const isnum = /^[\d\.]+$/.test(context.params.slug[0]); diff --git a/public/fonts/styles.css b/public/fonts/styles.css index d99150e73..465b608b4 100644 --- a/public/fonts/styles.css +++ b/public/fonts/styles.css @@ -143,7 +143,8 @@ format("woff2"); } +span.material-icons-sharp, .material-icons, i { font-family: "Material Icons"; -} +} \ No newline at end of file From 72cf6aa84a3feed5b6cc29c503bc972df18dd229 Mon Sep 17 00:00:00 2001 From: Debbie Matthews Date: Wed, 6 Nov 2024 18:06:38 -0800 Subject: [PATCH 10/40] Move version check to sideBar --- components/navigation/navChild.js | 6 ++---- components/navigation/navItem.js | 3 ++- components/navigation/sideBar.js | 9 ++++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/navigation/navChild.js b/components/navigation/navChild.js index cfd114061..572cc3260 100644 --- a/components/navigation/navChild.js +++ b/components/navigation/navChild.js @@ -2,13 +2,10 @@ import React, { useState } from "react"; import Link from "next/link"; import classNames from "classnames"; -import useVersion from "../../lib/useVersion.js"; - import styles from "./navChild.module.css"; -const NavChild = ({ slug, page, color, className }) => { +const NavChild = ({ slug, page, color, className, version }) => { const [manualState, setManualState] = useState(null); - const version = useVersion(); const isNum = /^[\d\.]+$/.test(slug[0]); const isSiS = /^SiS[\d\.]*$/.test(slug[0]); @@ -41,6 +38,7 @@ const NavChild = ({ slug, page, color, className }) => { page={child} color={color} depth={child.depth + 1} + version={version} /> ))} diff --git a/components/navigation/navItem.js b/components/navigation/navItem.js index 91526e1b4..8ca986e8d 100644 --- a/components/navigation/navItem.js +++ b/components/navigation/navItem.js @@ -7,7 +7,7 @@ import NavChild from "./navChild"; import styles from "./navItem.module.css"; -const NavItem = ({ page, slug, condensed, className }) => { +const NavItem = ({ page, slug, condensed, className, version }) => { let subNav; let navItem; let navBox; @@ -64,6 +64,7 @@ const NavItem = ({ page, slug, condensed, className }) => { key={child.menu_key} depth={child.depth + 1} className={className} + version={version} /> ))} diff --git a/components/navigation/sideBar.js b/components/navigation/sideBar.js index e1829b6ec..a6006105e 100644 --- a/components/navigation/sideBar.js +++ b/components/navigation/sideBar.js @@ -4,6 +4,7 @@ import classNames from "classnames"; import bus from "../../lib/bus"; import NavItem from "../navigation/navItem"; +import useVersion from "../../lib/useVersion.js"; import styles from "./sideBar.module.css"; @@ -14,6 +15,7 @@ const SideBar = ({ menu, slug }) => { const [isOpen, setIsOpen] = useState(false); const [theme, setTheme] = useState("light-mode"); const [hasSlug, setHasSlug] = useState(""); + const version = useVersion(); const handleTheme = () => { setTheme(document.body.dataset.theme); @@ -84,6 +86,7 @@ const SideBar = ({ menu, slug }) => { page={page} depth={page.depth + 1} condensed={isCondensed} + version={version} // className={isOver && styles.OverNavItem} /> )); @@ -94,7 +97,7 @@ const SideBar = ({ menu, slug }) => { styles.Container, isOpen ? styles.OpenNav : styles.ClosedNav, isOver ? styles.OverNav : styles.CollapsedNav, - isSticky === "window" && styles.WindowStickyNav + isSticky === "window" && styles.WindowStickyNav, )} onScroll={(e) => handleScroll(e)} > @@ -104,8 +107,8 @@ const SideBar = ({ menu, slug }) => { isSticky === "window" ? styles.WindowStickyGradient : isSticky === "scrollbar" - ? styles.ScrollBarStickyGradient - : styles.StandardGradient + ? styles.ScrollBarStickyGradient + : styles.StandardGradient, )} />