diff --git a/.gitignore b/.gitignore
index 2d7f31fab..9e4ed1ad0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,3 +114,6 @@ out/
public/pdf/pages/
.idea/
secrets.toml
+
+# No need to store this in Git. This gets autogenerated on export.
+public/llms-full.txt
diff --git a/README.md b/README.md
index 23e7727a3..1a02adb75 100644
--- a/README.md
+++ b/README.md
@@ -265,9 +265,9 @@ To preview your changes, refresh your browser tab and visit the edited page!
### Add a new docstring to the API Reference
-Any time a new version of Streamlit is released, the docstrings stored in `python/streamlit.json` have to be updated by running `make docstrings` . This will build the necessary Docker image, and update the file with the documentation for the latest release on PyPi.
+Any time a new version of Streamlit is released, the docstrings stored in `python/streamlit_api.json` have to be updated by running `make docstrings` . This will build the necessary Docker image, and update the file with the documentation for the latest release on PyPi.
-If you need to regenerate all function signatures, across all versions, delete the content in `python/streamlit.json`, leaving the file in place, and run `make docstrings`. This will systematically install each version of streamlit, and generate the necessary function signatures in `streamlit.json`.
+If you need to regenerate all function signatures, across all versions, delete the content in `python/streamlit_api.json`, leaving the file in place, and run `make docstrings`. This will systematically install each version of streamlit, and generate the necessary function signatures in `streamlit_api.json`.
Suppose a new Streamlit release includes a `st.my_chart` function that you want to include in the "Chart elements" section of the API Reference:
diff --git a/makefile b/makefile
index 60b7854ab..b030db127 100644
--- a/makefile
+++ b/makefile
@@ -11,11 +11,11 @@ start:
npm run start
.PHONY: export
-export: llms
+export: llms-full
npm run export
-.PHONY: llms
-llms:
+.PHONY: llms-full
+llms-full:
uv run python/generate_llms_full_txt.py
.PHONY: lint
diff --git a/next.config.js b/next.config.js
index 659c804b8..2102f3d38 100644
--- a/next.config.js
+++ b/next.config.js
@@ -7,11 +7,11 @@ const IS_DEV = process.env.NODE_ENV === "development";
const PYTHON_DIRECTORY = path.join(process.cwd(), "python/");
const jsonDocstrings = fs.readFileSync(
- path.join(PYTHON_DIRECTORY, "streamlit.json"),
+ path.join(PYTHON_DIRECTORY, "streamlit_api.json"),
"utf8",
);
const jsonPlatformNotes = fs.readFileSync(
- path.join(PYTHON_DIRECTORY, "snowflake.json"),
+ path.join(PYTHON_DIRECTORY, "snowflake_api.json"),
"utf8",
);
@@ -78,7 +78,7 @@ const CSP_HEADER = [
"default-src 'none';",
"font-src 'self';",
"form-action 'self';",
- "img-src",
+ "img-src",
"'self'",
"data:",
"https:",
diff --git a/public/llms-full.txt b/public/llms-full.txt
deleted file mode 100644
index cfa8d0030..000000000
--- a/public/llms-full.txt
+++ /dev/null
@@ -1,25007 +0,0 @@
-# Get started with Streamlit
-
-Source: https://docs.streamlit.io/get-started
-
-
-This Get Started guide explains how Streamlit works, how to install Streamlit on your preferred
-operating system, and how to create your first Streamlit app!
-
-Option 1: I'm comfortable with the command line
-
-Install Streamlit on your own machine using tools like `venv` and `pip`.
-
-Option 2: I prefer a graphical interface
-
-Install Streamlit using the Anaconda Distribution graphical user interface. This is also the best
-approach if you're on Windows or don't have Python set up.
-
-Option 3: I'd rather use a cloud-based environment
-
-Use Streamlit Community Cloud with GitHub Codespaces so you don't have to go through the trouble
-of installing Python and setting up an environment.
-
-Option 4: I need something secure, controlled, and in the cloud
-
-Use Streamlit in Snowflake to code your apps in the cloud, right alongside your
-data with role-based access controls.
-
-
streamlit_app.py
main_page.py
page_2.py
page_3.py
hello.py
(๐ Toggle to expand)Hello.py
pages/1_๐_Plotting_Demo.py
pages/2_๐_Mapping_Demo.py
pages/3_๐_DataFrame_Demo.py
st.Page
and st.navigation
pages/
directorypytest
. Learn how to initialize and run simulated apps, including how to retrieve, manipulate, and inspect app elements.Foo bar.
") -``` - -Right now, Magic only works in the main Python app file, not in imported files. See GitHub issue #288 for a discussion of the issues.
-Foo bar.
") -``` - -Foo bar.
" -) -``` - -secrets.toml
data.\n\n", + "description": "\nimport streamlit as st\n\ndef page2():\n st.title("Second page")\n\npg = st.navigation([\n st.Page("page1.py", title="First page", icon="\ud83d\udd25"),\n st.Page(page2, title="Second page", icon=":material/favorite:"),\n])\npg.run()\n\n
Configure a page for st.navigation in a multipage app.
\nCall st.Page to initialize a StreamlitPage object, and pass it to\nst.navigation to declare a page in your app.
\nWhen a user navigates to a page, st.navigation returns the selected\nStreamlitPage object. Call .run() on the returned StreamlitPage\nobject to execute the page. You can only run the page returned by\nst.navigation, and you can only run it once per app rerun.
\nA page can be defined by a Python file or Callable.
\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "The page source as a Callable or path to a Python file. If the page\nsource is defined by a Python file, the path can be a string or\npathlib.Path object. Paths can be absolute or relative to the\nentrypoint file. If the page source is defined by a Callable, the\nCallable can't accept arguments.
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The title of the page. If this is None (default), the page title\n(in the browser tab) and label (in the navigation menu) will be\ninferred from the filename or callable name in page. For more\ninformation, see Overview of multipage apps.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the page title and label.\nIf icon is None (default), no icon is displayed next to the\npage label in the navigation menu, and a Streamlit icon is displayed\nnext to the title (in the browser tab). If icon is a string, the\nfollowing options are valid:
\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nThe page's URL pathname, which is the path relative to the app's root\nURL. If this is None (default), the URL pathname will be inferred\nfrom the filename or callable name in page. For more information,\nsee Overview of multipage apps.
\nThe default page will have a pathname of "", indicating the root\nURL of the app. If you set default=True, url_path is ignored.\nurl_path can't include forward slashes; paths can't include\nsubdirectories.
\n", + "default": "page" + }, + { + "name": "default", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether this page is the default page to be shown when the app is\nloaded. If default is False (default), the page will have a\nnonempty URL pathname. However, if no default page is passed to\nst.navigation and this is the first page, this page will become the\ndefault page. If default is True, then the page will have\nan empty pathname and url_path will be ignored.
\n", + "default": "page" + } + ], + "returns": [ + { + "type_name": "StreamlitPage", + "is_generator": false, + "description": "The page object associated to the given script.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L29" + }, + "streamlit.altair_chart": { + "name": "altair_chart", + "signature": "st.altair_chart(altair_chart, *, use_container_width=None, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=None)", + "example": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nc = (\n alt.Chart(chart_data)\n .mark_circle()\n .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"])\n)\n\nst.altair_chart(c)\n\n
Display a chart using the Vega-Altair library.
\nVega-Altair is a declarative\nstatistical visualization library for Python, based on Vega and\nVega-Lite.
\n", + "args": [ + { + "name": "altair_chart", + "type_name": "altair.Chart", + "is_optional": false, + "is_kwarg_only": false, + "description": "The Altair chart object to display. See\nhttps://altair-viz.github.io/gallery/ for examples of graph\ndescriptions.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:
\nThe theme of the chart. If theme is "streamlit" (default),\nStreamlit uses its own design default. If theme is None,\nStreamlit falls back to the default behavior of the library.
\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string to use for giving this element a stable\nidentity. If key is None (default), this element's identity\nwill be determined based on the values of the other parameters.
\nAdditionally, if selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.
\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\non_select can be one of the following:
\nTo use selection events, the object passed to altair_chart must\ninclude selection paramters. To learn about defining interactions\nin Altair and how to declare selection-type parameters, see\nInteractive Charts\nin Altair's documentation.
\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "str or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "The selection parameters Streamlit should use. If\nselection_mode is None (default), Streamlit will use all\nselection parameters defined in the chart's Altair spec.
\nWhen Streamlit uses a selection parameter, selections from that\nparameter will trigger a rerun and be included in the selection\nstate. When Streamlit does not use a selection parameter,\nselections from that parameter will not trigger a rerun and not be\nincluded in the selection state.
\nSelection parameters are identified by their name property.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element that can be used with\nthe .add_rows() method. Otherwise, this command returns a\ndictionary-like object that supports both key and attribute\nnotation. The attributes are described by the VegaLiteState\ndictionary schema.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L1499" + }, + "streamlit.area_chart": { + "name": "area_chart", + "signature": "st.area_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, stack=None, width=None, height=None, use_container_width=True)", + "examples": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.area_chart(chart_data)\n\nYou can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": np.random.randn(20),\n "col2": np.random.randn(20),\n "col3": np.random.choice(["A", "B", "C"], 20),\n }\n)\n\nst.area_chart(chart_data, x="col1", y="col2", color="col3")\n\nIf your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple series with different\ncolors:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n np.random.randn(20, 3), columns=["col1", "col2", "col3"]\n)\n\nst.area_chart(\n chart_data,\n x="col1",\n y=["col2", "col3"],\n color=["#FF0000", "#0000FF"], # Optional\n)\n\nYou can adjust the stacking behavior by setting stack. Create a\nsteamgraph:
\n\nimport streamlit as st\nfrom vega_datasets import data\n\nsource = data.unemployment_across_industries()\n\nst.area_chart(source, x="date", y="count", color="series", stack="center")\n\n
Display an area chart.
\nThis 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 Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.
\nIf 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": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "Data to be plotted.
\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.
\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.
\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.
\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.
\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The color to use for different series in this chart.
\nFor an area chart with just 1 series, this can be:
\nFor an area chart with multiple series, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:
\nNone, to use the default colors.
\nThe name of a column in the dataset. Data points will be grouped\ninto series of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.
\nFor example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three series whose colors will be\nautomatically selected from the default palette.
\nBut, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into 3 series, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.
\nFor an area chart with multiple series, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:
\nWhether to stack the areas. If this is None (default),\nStreamlit uses Vega's default. Other values can be as follows:
\nDesired width of the chart expressed in pixels. If width is\nNone (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If width is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.
\nTo use width, you must set use_container_width=False.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the chart expressed in pixels. If height is\nNone (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If use_container_width is True (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If use_container_width is False,\nStreamlit sets the chart's width according to width.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L756" + }, + "streamlit.audio": { + "name": "audio", + "signature": "st.audio(data, format=\"audio/wav\", start_time=0, *, sample_rate=None, end_time=None, loop=False, autoplay=False)", + "examples": "\n\n", + "description": "To display an audio player for a local file, specify the file's string\npath and format.
\n\nimport streamlit as st\n\nst.audio("cat-purr.mp3", format="audio/mpeg", loop=True)\n\nYou can also pass bytes or numpy.ndarray objects to st.audio.
\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
Display an audio player.
\n", + "args": [ + { + "name": "data", + "type_name": "str, Path, bytes, BytesIO, numpy.ndarray, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "The audio to play. This can be one of the following:
\nIf data is a NumPy array, it must either be a 1D array of the\nwaveform or a 2D array of shape (C, S) where C is the number of\nchannels and S is the number of samples. See the default channel\norder 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, + "is_kwarg_only": false, + "description": "The MIME type for the audio file. This defaults to "audio/wav".\nFor more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.
\n", + "default": "s" + }, + { + "name": "start_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The time from which the element should start playing. This can be\none of the following:
\nThe sample rate of the audio data in samples per second. This is\nonly required if data is a NumPy array.
\n", + "default": null + }, + { + "name": "end_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The time at which the element should stop playing. This can be\none of the following:
\nWhether the audio should loop playback.
\n", + "default": null + }, + { + "name": "autoplay", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the audio file should start playing automatically. This is\nFalse by default. Browsers will not autoplay audio files if the\nuser has not interacted with the page by clicking somewhere.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/media.py#L72" + }, + "streamlit.audio_input": { + "name": "audio_input", + "signature": "st.audio_input(label, *, key=None, help=None, on_change=None, args=None, kwargs=None, disabled=False, label_visibility=\"visible\")", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\naudio_value = st.audio_input("Record a voice message")\n\nif audio_value:\n st.audio(audio_value)\n\n
Display a widget that returns an audio recording from the user's microphone.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this widget is used for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": true, + "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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional callback invoked when this audio input's value\nchanges.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the audio input if set to\nTrue. Default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "None or UploadedFile", + "is_generator": false, + "description": "The UploadedFile class is a subclass of BytesIO, and\ntherefore is "file-like". This means you can pass an instance of it\nanywhere a file is expected. The MIME type for the audio data is\naudio/wav.
\nNote
\nThe resulting UploadedFile is subject to the size\nlimitation configured in server.maxUploadSize. If you\nexpect large sound files, update the configuration option\nappropriately.
\n\n\n", + "description": "Create standalone badges with st.badge (with or without icons). If\nyou want to have multiple, side-by-side badges, you can use the\nMarkdown directive in st.markdown.
\n\nimport streamlit as st\n\nst.badge("New")\nst.badge("Success", icon=":material/check:", color="green")\n\nst.markdown(\n ":violet-badge[:material/star: Favorite] :orange-badge[\u26a0\ufe0f Needs review] :gray-badge[Deprecated]"\n)\n\n
Display a colored badge with an icon and label.
\nThis is a thin wrapper around the color-badge Markdown directive.\nThe following are equivalent:
\nNote
\nYou can insert badges everywhere Streamlit supports Markdown by\nusing the color-badge Markdown directive. See st.markdown for\nmore information.
\nThe label to display in the badge. The label can optionally contain\nGitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives. Because this command escapes square\nbrackets ([ ]) in this parameter, any directive requiring\nsquare brackets is not supported.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the badge label. If\nicon is None (default), no icon is displayed. If icon\nis a string, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nThe color to use for the badge. This defaults to "blue".
\nThis can be one of the following supported colors: blue, green,\norange, red, violet, gray/grey, or primary. If you use\n"primary", Streamlit will use the default primary accent color\nunless you set the theme.primaryColor configuration option.
\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/markdown.py#L281" + }, + "streamlit.balloons": { + "name": "balloons", + "signature": "st.balloons()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.balloons()\n\n...then watch your app and get ready for a celebration!
\n
Draw celebratory balloons.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/balloons.py#L27" + }, + "streamlit.bar_chart": { + "name": "bar_chart", + "signature": "st.bar_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, horizontal=False, stack=None, width=None, height=None, use_container_width=True)", + "examples": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.bar_chart(chart_data)\n\nYou can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": list(range(20)) * 3,\n "col2": np.random.randn(60),\n "col3": ["A"] * 20 + ["B"] * 20 + ["C"] * 20,\n }\n)\n\nst.bar_chart(chart_data, x="col1", y="col2", color="col3")\n\nIf your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple series with different\ncolors:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": list(range(20)),\n "col2": np.random.randn(20),\n "col3": np.random.randn(20),\n }\n)\n\nst.bar_chart(\n chart_data,\n x="col1",\n y=["col2", "col3"],\n color=["#FF0000", "#0000FF"], # Optional\n)\n\nYou can rotate your bar charts to display horizontally.
\n\nimport streamlit as st\nfrom vega_datasets import data\n\nsource = data.barley()\n\nst.bar_chart(source, x="variety", y="yield", color="site", horizontal=True)\n\nYou can unstack your bar charts.
\n\nimport streamlit as st\nfrom vega_datasets import data\n\nsource = data.barley()\n\nst.bar_chart(source, x="year", y="yield", color="site", stack=False)\n\n
Display a bar chart.
\nThis 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 Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.
\nIf 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": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "Data to be plotted.
\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.
\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.
\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.
\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.
\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The color to use for different series in this chart.
\nFor a bar chart with just one series, this can be:
\nFor a bar chart with multiple series, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:
\nNone, to use the default colors.
\nThe name of a column in the dataset. Data points will be grouped\ninto series of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.
\nFor example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three series whose colors will be\nautomatically selected from the default palette.
\nBut, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into 3 series, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.
\nFor a bar chart with multiple series, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:
\nWhether to make the bars horizontal. If this is False\n(default), the bars display vertically. If this is True,\nStreamlit swaps the x-axis and y-axis and the bars display\nhorizontally.
\n", + "default": null + }, + { + "name": "stack", + "type_name": "bool, \"normalize\", \"center\", \"layered\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to stack the bars. If this is None (default),\nStreamlit uses Vega's default. Other values can be as follows:
\nDesired width of the chart expressed in pixels. If width is\nNone (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If width is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.
\nTo use width, you must set use_container_width=False.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the chart expressed in pixels. If height is\nNone (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If use_container_width is True (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If use_container_width is False,\nStreamlit sets the chart's width according to width.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L997" + }, + "streamlit.bokeh_chart": { + "name": "bokeh_chart", + "signature": "st.bokeh_chart(figure, use_container_width=True)", + "example": "\n\n", + "description": "\nimport streamlit as st\nfrom bokeh.plotting import figure\n\nx = [1, 2, 3, 4, 5]\ny = [6, 7, 2, 4, 5]\n\np = figure(title="simple line example", x_axis_label="x", y_axis_label="y")\np.line(x, y, legend_label="Trend", line_width=2)\n\nst.bokeh_chart(p)\n\n
Display an interactive Bokeh chart.
\nBokeh is a charting library for Python. The arguments to this function\nclosely follow the ones for Bokeh's show function. You can find\nmore about Bokeh at https://bokeh.pydata.org.
\nTo show Bokeh charts in Streamlit, call st.bokeh_chart\nwherever you would call Bokeh's show.
\nImportant
\nYou must install bokeh==2.4.3 and numpy<2 to use this\ncommand.
\nIf you need a newer version of Bokeh, use our streamlit-bokeh\ncustom component instead.
\nA Bokeh figure to plot.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to override the figure's native width with the width of\nthe parent container. If use_container_width is True (default),\nStreamlit sets the width of the figure to match the width of the parent\ncontainer. If use_container_width is False, Streamlit sets the\nwidth of the chart to fit its contents according to the plotting library,\nup to the width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/bokeh_chart.py#L36" + }, + "streamlit.button": { + "name": "button", + "signature": "st.button(label, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", icon=None, disabled=False, use_container_width=False)", + "examples": "\n\n", + "description": "Example 1: Customize your button type
\n\nimport streamlit as st\n\nst.button("Reset", type="primary")\nif st.button("Say hello"):\n st.write("Why hello there")\nelse:\n st.write("Goodbye")\n\nif st.button("Aloha", type="tertiary"):\n st.write("Ciao")\n\nExample 2: Add icons to your button
\nAlthough you can add icons to your buttons through Markdown, the\nicon parameter is a convenient and consistent alternative.
\n\nimport streamlit as st\n\nleft, middle, right = st.columns(3)\nif left.button("Plain button", use_container_width=True):\n left.markdown("You clicked the plain button.")\nif middle.button("Emoji button", icon="\ud83d\ude03", use_container_width=True):\n middle.markdown("You clicked the emoji button.")\nif right.button("Material button", icon=":material/mood:", use_container_width=True):\n right.markdown("You clicked the Material button.")\n\n
Display a button widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this button is clicked.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string that specifies the button type. This can be one\nof the following:
\nAn optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nAn optional boolean that disables the button if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.
\nIn both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.
\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.45.1/lib/streamlit/elements/widgets/button.py#L88" + }, + "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\n", + "description": "\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\nTo 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\nTo disable hashing return values, set the allow_output_mutation parameter to\nTrue:
\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\nTo 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)\nlike this:
\n\n@st.cache(hash_funcs={MongoClient: id})\ndef connect_to_database(url):\n return MongoClient(url)\n\nAlternatively, 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
Legacy caching decorator (deprecated).
\nLegacy caching with st.cache has been removed from Streamlit. This is\nnow an alias for st.cache_data and st.cache_resource.
\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "The function to cache. Streamlit hashes the function's source code.
\n", + "default": null + }, + { + "name": "persist", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to persist the cache on disk.
\n", + "default": null + }, + { + "name": "allow_output_mutation", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to use st.cache_data or st.cache_resource. If this is\nFalse (default), the arguments are passed to st.cache_data. If\nthis is True, the arguments are passed to st.cache_resource.
\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": 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.
\n", + "default": "is" + }, + { + "name": "suppress_st_warning", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "This is not used.
\n", + "default": null + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Mapping of types or fully qualified names to hash functions. This is used to\noverride the behavior of the hasher inside Streamlit's caching mechanism: when\nthe hasher encounters an object, it will first check to see if its type matches\na key in this dict and, if so, will use the provided function to generate a hash\nfor it. See below for an example of how this can be used.
\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": 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": "is" + }, + { + "name": "ttl", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": 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.45.1/lib/streamlit/runtime/caching/legacy_cache_api.py#L33" + }, + "streamlit.cache_data": { + "name": "cache_data", + "signature": "st.cache_data(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets, hash_funcs=None)", + "example": "\n\n", + "description": "\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\nTo 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\nBy 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\nA 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(_db_connection, 50)\n# Clear the cached entry for the arguments provided.\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n\nTo override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. datetime.datetime) to a hash\nfunction (lambda dt: dt.isoformat()) like this:
\n\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={datetime.datetime: lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n return dt.astimezone(datetime.timezone.utc)\n\nAlternatively, you can map the type's fully-qualified name\n(e.g. "datetime.datetime") to the hash function instead:
\n\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={"datetime.datetime": lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n return dt.astimezone(datetime.timezone.utc)\n\n
Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).
\nCached 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.
\nYou can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().
\nA function's arguments must be hashable to cache it. If you have an\nunhashable argument (like a database connection) or an argument you\nwant to exclude from caching, use an underscore prefix in the argument\nname. In this case, Streamlit will return a cached value when all other\narguments match a previous function call. Alternatively, you can\ndeclare custom hashing functions with hash_funcs.
\nTo cache global resources, use st.cache_resource instead. Learn more\nabout caching at https://docs.streamlit.io/develop/concepts/architecture/caching.
\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "The function to cache. Streamlit hashes the function's source code.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum time to keep an entry in the cache. Can be one of:
\nNote that ttl will be ignored if persist="disk" or persist=True.
\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "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. Defaults to None.
\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "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": "\"disk\", bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "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": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Allow widgets to be used in the cached function. Defaults to False.
\n", + "default": "False", + "deprecated": { + "deprecated": true, + "deprecatedText": "The cached widget replay functionality was removed in 1.38. Please\nremove the experimental_allow_widgets parameter from your\ncaching decorators. This parameter will be removed in a future\nversion.
\n" + } + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/caching/cache_data_api.py#L379" + }, + "streamlit.cache_resource": { + "name": "cache_resource", + "signature": "st.cache_resource(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets, hash_funcs=None)", + "example": "\n\n", + "description": "\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\nBy 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\nA 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\nfetch_and_clean_data.clear(_sessionmaker, "https://streamlit.io/")\n# Clear the cached entry for the arguments provided.\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n\nTo override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. Person) to a hash\nfunction (str) like this:
\n\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n name: str\n\n@st.cache_resource(hash_funcs={Person: str})\ndef get_person_name(person: Person):\n return person.name\n\nAlternatively, you can map the type's fully-qualified name\n(e.g. "__main__.Person") to the hash function instead:
\n\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n name: str\n\n@st.cache_resource(hash_funcs={"__main__.Person": str})\ndef get_person_name(person: Person):\n return person.name\n\n
Decorator to cache functions that return global resources (e.g. database connections, ML models).
\nCached 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.
\nYou can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().
\nA function's arguments must be hashable to cache it. If you have an\nunhashable argument (like a database connection) or an argument you\nwant to exclude from caching, use an underscore prefix in the argument\nname. In this case, Streamlit will return a cached value when all other\narguments match a previous function call. Alternatively, you can\ndeclare custom hashing functions with hash_funcs.
\nTo cache data, use st.cache_data instead. Learn more about caching at\nhttps://docs.streamlit.io/develop/concepts/architecture/caching.
\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "The function that creates the cached resource. Streamlit hashes the\nfunction's source code.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum time to keep an entry in the cache. Can be one of:
\nThe 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. Defaults to None.
\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "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": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Allow widgets to be used in the cached function. Defaults to False.
\n", + "default": "False", + "deprecated": { + "deprecated": true, + "deprecatedText": "The cached widget replay functionality was removed in 1.38. Please\nremove the experimental_allow_widgets parameter from your\ncaching decorators. This parameter will be removed in a future\nversion.
\n" + } + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/caching/cache_resource_api.py#L248" + }, + "streamlit.camera_input": { + "name": "camera_input", + "signature": "st.camera_input(label, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\nenable = st.checkbox("Enable camera")\npicture = st.camera_input("Take a picture", disabled=not enable)\n\nif picture:\n st.image(picture)\n\n
Display a widget that returns pictures from the user's webcam.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this widget is used for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this camera_input's value\nchanges.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the camera input if set to\nTrue. Default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "None or UploadedFile", + "is_generator": false, + "description": "The UploadedFile class is a subclass of BytesIO, and therefore is\n"file-like". This means you can pass an instance of it anywhere a\nfile is expected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/camera_input.py#L89" + }, + "streamlit.caption": { + "name": "caption", + "signature": "st.caption(body, unsafe_allow_html=False, *, help=None)", + "examples": "\n\n", + "description": "\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
Display text in small font.
\nThis should be used for captions, asides, footnotes, sidenotes, and\nother explanatory text.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to render HTML within body. If this is False\n(default), any HTML tags found in body will be escaped and\ntherefore treated as raw text. If this is True, any HTML\nexpressions within body will be rendered.
\nAdding custom HTML to your app impacts safety, styling, and\nmaintainability.
\nNote
\nIf you only want to insert HTML or CSS without Markdown text,\nwe recommend using st.html instead.
\nA tooltip that gets displayed next to the caption. If this is\nNone (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/markdown.py#L146" + }, + "streamlit.chat_input": { + "name": "chat_input", + "signature": "st.chat_input(placeholder=\"Your message\", *, key=None, max_chars=None, accept_file=False, file_type=None, disabled=False, on_submit=None, args=None, kwargs=None)", + "examples": "\n\n", + "description": "Example 1: Pin the chat input widget to the bottom of your app
\nWhen st.chat_input is used in the main body of an app, it will be\npinned to the bottom of the page.
\n\nimport streamlit as st\n\nprompt = st.chat_input("Say something")\nif prompt:\n st.write(f"User has sent the following prompt: {prompt}")\n\nExample 2: Use the chat input widget inline
\nThe chat input can also be used inline by nesting it inside any layout\ncontainer (container, columns, tabs, sidebar, etc) or fragment. Create\nchat interfaces embedded next to other content, or have multiple\nchatbots!
\n\nimport streamlit as st\n\nwith st.sidebar:\n messages = st.container(height=300)\n if prompt := st.chat_input("Say something"):\n messages.chat_message("user").write(prompt)\n messages.chat_message("assistant").write(f"Echo: {prompt}")\n\nExample 3: Let users upload files
\nWhen you configure your chat input widget to allow file attachments, it\nwill return a dict-like object when the user sends a submission. You\ncan access the user's message through the text attribute of this\ndictionary. You can access a list of the user's submitted file(s)\nthrough the files attribute. Similar to st.session_state, you\ncan use key or attribute notation.
\n\nimport streamlit as st\n\nprompt = st.chat_input(\n "Say something and/or attach an image",\n accept_file=True,\n file_type=["jpg", "jpeg", "png"],\n)\nif prompt and prompt.text:\n st.markdown(prompt.text)\nif prompt and prompt["files"]:\n st.image(prompt["files"][0])\n\n
Display a chat input widget.
\n", + "args": [ + { + "name": "placeholder", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A placeholder text shown when the chat input is empty. This\ndefaults to "Your message". For accessibility reasons, you\nshould not use an empty string.
\n", + "default": "s" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": true, + "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 based on\nits content. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of characters that can be entered. If this is\nNone (default), there will be no maximum.
\n", + "default": null + }, + { + "name": "accept_file", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the chat input should accept files. This can be one of the\nfollowing values:
\nWhen the widget is configured to accept files, the accepted file\ntypes can be configured with the file_type parameter.
\nBy default, uploaded files are limited to 200 MB each. You can\nconfigure this using the server.maxUploadSize config option.\nFor more information on how to set config options, see\nconfig.toml.
\n", + "default": null + }, + { + "name": "file_type", + "type_name": "str, Sequence[str], or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The allowed file extension(s) for uploaded files. This can be one\nof the following types:
\nWhether the chat input should be disabled. This defaults to\nFalse.
\n", + "default": "s" + }, + { + "name": "on_submit", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional callback invoked when the chat input's value is submitted.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "None, str, or dict-like", + "is_generator": false, + "description": "The user's submission. This is one of the following types:
\nWhen the widget is configured to accept files and the user submits\nsomething in the last rerun, you can access the user's submission\nwith key or attribute notation from the dict-like object. This is\nshown in Example 3 below.
\nThe text attribute holds a string, which is the user's message.\nThis is an empty string if the user only submitted one or more\nfiles.
\nThe files attribute holds a list of UploadedFile objects.\nThe list is empty if the user only submitted a message. Unlike\nst.file_uploader, this attribute always returns a list, even\nwhen the widget is configured to accept only one file at a time.
\nThe UploadedFile class is a subclass of BytesIO, and therefore is\n"file-like". This means you can pass an instance of it anywhere a\nfile is expected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/chat.py#L367" + }, + "streamlit.chat_message": { + "name": "chat_message", + "signature": "st.chat_message(name, *, avatar=None)", + "examples": "\n\n", + "description": "You can use with notation to insert any element into an expander
\n\nimport streamlit as st\nimport numpy as np\n\nwith st.chat_message("user"):\n st.write("Hello \ud83d\udc4b")\n st.line_chart(np.random.randn(30, 3))\n\nOr you can just call methods directly in the returned objects:
\n\nimport streamlit as st\nimport numpy as np\n\nmessage = st.chat_message("assistant")\nmessage.write("Hello human")\nmessage.bar_chart(np.random.randn(30, 3))\n\n
Insert a chat message container.
\nTo add elements to the returned container, you can use with notation\n(preferred) or just call methods directly on the returned object. See the\nexamples below.
\n", + "args": [ + { + "name": "name", + "type_name": "\"user\", \"assistant\", \"ai\", \"human\", or str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The name of the message author. Can be "human"/"user" or\n"ai"/"assistant" to enable preset styling and avatars.
\nCurrently, the name is not shown in the UI but is only set as an\naccessibility label. For accessibility reasons, you should not use\nan empty string.
\n", + "default": null + }, + { + "name": "avatar", + "type_name": "Anything supported by st.image (except list), str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The avatar shown next to the message.
\nIf avatar is None (default), the icon will be determined\nfrom name as follows:
\nIn addition to the types supported by st.image (except list),\nthe following strings are valid:
\nA single-character emoji. For example, you can set avatar="\ud83e\uddd1\u200d\ud83d\udcbb"\nor avatar="\ud83e\udd96". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nA single container that can hold multiple elements.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/chat.py#L223" + }, + "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\n", + "description": "\nimport streamlit as st\n\nagree = st.checkbox("I agree")\n\nif agree:\n st.write("Great!")\n\n
Display a checkbox widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this checkbox is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this checkbox's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the checkbox if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\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.45.1/lib/streamlit/elements/widgets/checkbox.py#L59" + }, + "streamlit.code": { + "name": "code", + "signature": "st.code(body, language=\"python\", *, line_numbers=False, wrap_lines=False, height=None)", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\ncode = '''def hello():\n print("Hello, Streamlit!")'''\nst.code(code, language="python")\n\n\nimport streamlit as st\ncode = '''Is it a crown or boat?\n ii\n iiiiii\nWWw .iiiiiiii. ...:\n WWWWWWw .iiiiiiiiiiii. ........\n WWWWWWWWWWw iiiiiiiiiiiiiiii ...........\n WWWWWWWWWWWWWWwiiiiiiiiiiiiiiiii............\n WWWWWWWWWWWWWWWWWWwiiiiiiiiiiiiii.........\n WWWWWWWWWWWWWWWWWWWWWWwiiiiiiiiii.......\n WWWWWWWWWWWWWWWWWWWWWWWWWWwiiiiiii....\n WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwiiii.\n -MMMWWWWWWWWWWWWWWWWWWWWWWMMM-\n'''\nst.code(code, language=None)\n\n
Display a code block with optional syntax highlighting.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The string to display as code or monospace text.
\n", + "default": null + }, + { + "name": "language", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The language that the code is written in, for syntax highlighting.\nThis defaults to "python". If this is None, the code will\nbe plain, monospace text.
\nFor a list of available language values, see\nreact-syntax-highlighter\non GitHub.
\n", + "default": "s" + }, + { + "name": "line_numbers", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean indicating whether to show line numbers to the\nleft of the code block. This defaults to False.
\n", + "default": "s" + }, + { + "name": "wrap_lines", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean indicating whether to wrap lines. This defaults\nto False.
\n", + "default": "s" + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the code block expressed in pixels. If height\nis None (default), Streamlit sets the element's height to fit\nits content. Vertical scrolling within the element is enabled when\nthe height does not accomodate all lines.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/code.py#L29" + }, + "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\n", + "description": "\nimport streamlit as st\n\ncolor = st.color_picker("Pick A Color", "#00f900")\nst.write("The current color is", color)\n\n
Display a color picker widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this color_picker's value\nchanges.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the color picker if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\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.45.1/lib/streamlit/elements/widgets/color_picker.py#L61" + }, + "streamlit.columns": { + "name": "columns", + "signature": "st.columns(spec, *, gap=\"small\", vertical_alignment=\"top\", border=False)", + "examples": "\n\n", + "description": "Example 1: Use context management
\nYou can use the with statement 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\nExample 2: Use commands as container methods
\nYou can just call methods directly on 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\nExample 3: Align widgets
\nUse vertical_alignment="bottom" to align widgets.
\n\nimport streamlit as st\n\nleft, middle, right = st.columns(3, vertical_alignment="bottom")\n\nleft.text_input("Write something")\nmiddle.button("Click me", use_container_width=True)\nright.checkbox("Check me")\n\nExample 4: Use vertical alignment to create grids
\nAdjust vertical alignment to customize your grid layouts.
\n\nimport streamlit as st\nimport numpy as np\n\nvertical_alignment = st.selectbox(\n "Vertical alignment", ["top", "center", "bottom"], index=2\n)\n\nleft, middle, right = st.columns(3, vertical_alignment=vertical_alignment)\nleft.image("https://static.streamlit.io/examples/cat.jpg")\nmiddle.image("https://static.streamlit.io/examples/dog.jpg")\nright.image("https://static.streamlit.io/examples/owl.jpg")\n\nExample 5: Add borders
\nAdd borders to your columns instead of nested containers for consistent\nheights.
\n\nimport streamlit as st\n\nleft, middle, right = st.columns(3, border=True)\n\nleft.markdown("Lorem ipsum " * 10)\nmiddle.markdown("Lorem ipsum " * 5)\nright.markdown("Lorem ipsum ")\n\n
Insert containers laid out as side-by-side columns.
\nInserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.
\nTo add elements to the returned containers, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.
\nColumns can only be placed inside other columns up to one level of nesting.
\nWarning
\nColumns cannot be placed inside other columns in the sidebar. This\nis only possible in the main area of the app.
\nControls the number and width of columns to insert. Can be one of:
\nThe size of the gap between the columns. The default is "small".
\n", + "default": "is" + }, + { + "name": "vertical_alignment", + "type_name": "\"top\", \"center\", or \"bottom\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The vertical alignment of the content inside the columns. The\ndefault is "top".
\n", + "default": "is" + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to show a border around the column containers. If this is\nFalse (default), no border is shown. If this is True, a\nborder is shown around each column.
\n", + "default": null + } + ], + "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.45.1/lib/streamlit/elements/layouts.py#L176" + }, + "streamlit.connection": { + "name": "connection", + "signature": "st.connection(name, type=None, max_entries=None, ttl=None, **kwargs)", + "examples": "\n\n", + "description": "Example 1: Inferred connection type
\nThe easiest way to create a first-party (SQL, Snowflake, or Snowpark) connection is\nto use their default names and define corresponding sections in your secrets.toml\nfile. The following example creates a "sql"-type connection.
\n.streamlit/secrets.toml:
\n\n[connections.sql]\ndialect = "xxx"\nhost = "xxx"\nusername = "xxx"\npassword = "xxx"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection("sql")\n\nExample 2: Named connections
\nCreating a connection with a custom name requires you to explicitly\nspecify the type. If type is not passed as a keyword argument, it must\nbe set in the appropriate section of secrets.toml. The following\nexample creates two "sql"-type connections, each with their own\ncustom name. The first defines type in the st.connection command;\nthe second defines type in secrets.toml.
\n.streamlit/secrets.toml:
\n\n[connections.first_connection]\ndialect = "xxx"\nhost = "xxx"\nusername = "xxx"\npassword = "xxx"\n\n[connections.second_connection]\ntype = "sql"\ndialect = "yyy"\nhost = "yyy"\nusername = "yyy"\npassword = "yyy"\n\nYour app code:
\n\nimport streamlit as st\nconn1 = st.connection("first_connection", type="sql")\nconn2 = st.connection("second_connection")\n\nExample 3: Using a path to the connection class
\nPassing the full module path to the connection class can be useful,\nespecially when working with a custom connection. Although this is not the\ntypical way to create first party connections, the following example\ncreates the same type of connection as one with type="sql". Note that\ntype is a string path.
\n.streamlit/secrets.toml:
\n\n[connections.my_sql_connection]\nurl = "xxx+xxx://xxx:xxx@xxx:xxx/xxx"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection(\n "my_sql_connection", type="streamlit.connections.SQLConnection"\n)\n\nExample 4: Importing the connection class
\nYou can pass the connection class directly to the st.connection\ncommand. Doing so allows static type checking tools such as mypy to\ninfer the exact return type of st.connection. The following example\ncreates the same connection as in Example 3.
\n.streamlit/secrets.toml:
\n\n[connections.my_sql_connection]\nurl = "xxx+xxx://xxx:xxx@xxx:xxx/xxx"\n\nYour app code:
\n\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\nconn = st.connection("my_sql_connection", type=SQLConnection)\n\n
Create a new connection to a data store or API, or return an existing one.
\nConfiguration options, credentials, and secrets for connections are\ncombined from the following sources:
\nThe connection returned from st.connection is internally cached with\nst.cache_resource and is therefore shared between sessions.
\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The connection name used for secrets lookup in secrets.toml.\nStreamlit uses secrets under [connections.<name>] for the\nconnection. type will be inferred if name is one of the\nfollowing: "snowflake", "snowpark", or "sql".
\n", + "default": null + }, + { + "name": "type", + "type_name": "str, connection class, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The type of connection to create. This can be one of the following:
\nThe maximum number of connections to keep in the cache.\nIf this is None (default), the cache is unbounded. Otherwise, when\na new entry is added to a full cache, the oldest cached entry is\nremoved.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The maximum number of seconds to keep results in the cache.\nIf this is None (default), cached results do not expire with time.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "Connection-specific keyword arguments that are passed to the\nconnection's ._connect() method. **kwargs are typically\ncombined with (and take precendence over) key-value pairs in\nsecrets.toml. To learn more, see the specific connection's\ndocumentation.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Subclass of BaseConnection", + "is_generator": false, + "description": "An initialized connection object of the specified type.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/connection_factory.py#L205" + }, + "streamlit.container": { + "name": "container", + "signature": "st.container(*, height=None, border=None, key=None)", + "examples": "\n\n", + "description": "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\nInserting elements out of order:
\n\nimport streamlit as st\n\ncontainer = st.container(border=True)\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\nUsing height to make a grid:
\n\nimport streamlit as st\n\nrow1 = st.columns(3)\nrow2 = st.columns(3)\n\nfor col in row1 + row2:\n tile = col.container(height=120)\n tile.title(":balloon:")\n\nUsing height to create a scrolling container for long content:
\n\nimport streamlit as st\n\nlong_text = "Lorem ipsum. " * 1000\n\nwith st.container(height=300):\n st.markdown(long_text)\n\n
Insert a multi-element container.
\nInserts 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.
\nTo add elements to the returned container, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.
\n", + "args": [ + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the container expressed in pixels. If None (default)\nthe container grows to fit its content. If a fixed height, scrolling is\nenabled for large content and a grey border is shown around the container\nto visually separate its scroll surface from the rest of the app.
\nNote
\nUse containers with scroll sparingly. If you do, try to keep\nthe height small (below 500 pixels). Otherwise, the scroll\nsurface of the container might cover the majority of the screen\non mobile devices, which makes it hard to scroll the rest of the app.
\nWhether to show a border around the container. If None (default), a\nborder is shown if the container is set to a fixed height and not\nshown otherwise.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string to give this container a stable identity.
\nAdditionally, if key is provided, it will be used as CSS\nclass name prefixed with st-key-.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/layouts.py#L43" + }, + "streamlit.data_editor": { + "name": "data_editor", + "signature": "st.data_editor(data, *, width=None, height=None, use_container_width=None, hide_index=None, column_order=None, column_config=None, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None, row_height=None)", + "examples": "\n\n", + "description": "\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.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\nYou 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.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\nOr you can customize the data editor via column_config, hide_index,\ncolumn_order, or disabled:
\n\nimport pandas as pd\nimport streamlit as st\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.data_editor(\n df,\n column_config={\n "command": "Streamlit Command",\n "rating": st.column_config.NumberColumn(\n "Your rating",\n help="How much do you like this command (1-5)?",\n min_value=1,\n max_value=5,\n step=1,\n format="%d \u2b50",\n ),\n "is_widget": "Widget ?",\n },\n disabled=["command", "is_widget"],\n hide_index=True,\n)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n\n
Display a data editor widget.
\nThe data editor widget allows you to edit dataframes and many other data structures in a table-like UI.
\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "The data to edit in the data editor.
\nNote
\nDesired width of the data editor expressed in pixels. If width\nis None (default), Streamlit sets the data editor width to fit\nits contents up to the width of the parent container. If width\nis greater than the width of the parent container, Streamlit sets\nthe data editor width to match the width of the parent container.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the data editor expressed in pixels. If height\nis None (default), Streamlit sets the height to show at most\nten rows. Vertical scrolling within the data editor element is\nenabled when the height does not accomodate all rows.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If this is True (default), Streamlit sets the width\nof the data editor to match the width of the parent container. If\nthis is False, Streamlit sets the data editor's width according\nto width.
\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to hide the index column(s). If hide_index is None\n(default), the visibility of index columns is automatically\ndetermined based on the data.
\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the display order of columns. This also affects which columns are\nvisible. For example, column_order=("col2", "col1") will display 'col2'\nfirst, followed by 'col1', and will hide all other non-index columns. If\nNone (default), the order is inherited from the original data structure.
\n", + "default": null + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Configures how columns are displayed, e.g. their title, visibility, type, or\nformat, as well as editing properties such as min/max value or step.\nThis needs to be a dictionary where each key is a column name and the value\nis one of:
\nTo configure the index column(s), use _index as the column name.
\n", + "default": null + }, + { + "name": "num_rows", + "type_name": "\"fixed\" or \"dynamic\"", + "is_optional": false, + "is_kwarg_only": true, + "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 or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "Controls the editing of columns. If True, editing is disabled for all columns.\nIf an Iterable of column names is provided (e.g., disabled=("col1", "col2")),\nonly the specified columns will be disabled for editing. If False (default),\nall columns that support editing are editable.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional callback invoked when this data_editor's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "row_height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The height of each row in the data editor in pixels. If row_height\nis None (default), Streamlit will use a default row height,\nwhich fits one line of text.
\n", + "default": "row" + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame, pandas.Series, pyarrow.Table, numpy.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 pandas.DataFrame.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/data_editor.py#L580" + }, + "streamlit.dataframe": { + "name": "dataframe", + "signature": "st.dataframe(data=None, width=None, height=None, *, use_container_width=None, hide_index=None, column_order=None, column_config=None, key=None, on_select=\"ignore\", selection_mode=\"multi-row\", row_height=None)", + "examples": "\n\n", + "description": "Example 1: Display a dataframe
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))\n\nst.dataframe(df) # Same as st.write(df)\n\nExample 2: Use Pandas Styler
\nYou 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(np.random.randn(10, 20), columns=("col %d" % i for i in range(20)))\n\nst.dataframe(df.style.highlight_max(axis=0))\n\nExample 3: Use column configuration
\nYou can customize a dataframe via column_config, hide_index, or column_order.
\n\nimport random\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n {\n "name": ["Roadmap", "Extras", "Issues"],\n "url": ["https://roadmap.streamlit.app", "https://extras.streamlit.app", "https://issues.streamlit.app"],\n "stars": [random.randint(0, 1000) for _ in range(3)],\n "views_history": [[random.randint(0, 5000) for _ in range(30)] for _ in range(3)],\n }\n)\nst.dataframe(\n df,\n column_config={\n "name": "App name",\n "stars": st.column_config.NumberColumn(\n "Github Stars",\n help="Number of stars on GitHub",\n format="%d \u2b50",\n ),\n "url": st.column_config.LinkColumn("App URL"),\n "views_history": st.column_config.LineChartColumn(\n "Views (past 30 days)", y_min=0, y_max=5000\n ),\n },\n hide_index=True,\n)\n\nExample 4: Customize your index
\nYou can use column configuration to format your index.
\n\nimport streamlit as st\nimport pandas as pd\nfrom datetime import date\n\ndf = pd.DataFrame(\n {\n "Date": [date(2024, 1, 1), date(2024, 2, 1), date(2024, 3, 1)],\n "Total": [13429, 23564, 23452],\n }\n)\ndf.set_index("Date", inplace=True)\n\nconfig = {\n "_index": st.column_config.DateColumn("Month", format="MMM YYYY"),\n "Total": st.column_config.NumberColumn("Total ($)"),\n}\n\nst.dataframe(df, column_config=config)\n\n
Display a dataframe as an interactive table.
\nThis command works with a wide variety of collection-like and\ndataframe-like object types.
\n", + "args": [ + { + "name": "data", + "type_name": "dataframe-like, collection-like, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The data to display.
\nDataframe-like objects include dataframe and series objects from\npopular libraries like Dask, Modin, Numpy, pandas, Polars, PyArrow,\nSnowpark, Xarray, and more. You can use database cursors and\nclients that comply with the\nPython Database API Specification v2.0 (PEP 249). Additionally, you can use\nanything that supports the Python dataframe interchange protocol.
\nFor example, you can use the following:
\nIf a data type is not recognized, Streamlit will convert the object\nto a pandas.DataFrame or pyarrow.Table using a\n.to_pandas() or .to_arrow() method, respectively, if\navailable.
\nIf data is a pandas.Styler, it will be used to style its\nunderlying pandas.DataFrame. Streamlit supports custom cell\nvalues and colors. It does not support some of the more exotic\nstyling options, like bar charts, hovering, and captions. For\nthese styling options, use column configuration instead. Text and\nnumber formatting from column_config always takes precedence\nover text and number formatting from pandas.Styler.
\nCollection-like objects include all Python-native Collection\ntypes, such as dict, list, and set.
\nIf data is None, Streamlit renders an empty table.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Desired width of the dataframe expressed in pixels. If width is\nNone (default), Streamlit sets the dataframe width to fit its\ncontents up to the width of the parent container. If width is\ngreater than the width of the parent container, Streamlit sets the\ndataframe width to match the width of the parent container.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Desired height of the dataframe expressed in pixels. If height\nis None (default), Streamlit sets the height to show at most\nten rows. Vertical scrolling within the dataframe element is\nenabled when the height does not accomodate all rows.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If this is True (default), Streamlit sets the width\nof the dataframe to match the width of the parent container. If\nthis is False, Streamlit sets the dataframe's width according\nto width.
\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to hide the index column(s). If hide_index is None\n(default), the visibility of index columns is automatically\ndetermined based on the data.
\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The ordered list of columns to display. If column_order is\nNone (default), Streamlit displays all columns in the order\ninherited from the underlying data structure. If column_order\nis a list, the indicated columns will display in the order they\nappear within the list. Columns may be omitted or repeated within\nthe list.
\nFor example, column_order=("col2", "col1") will display\n"col2" first, followed by "col1", and will hide all other\nnon-index columns.
\n", + "default": null + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Configuration to customize how columns display. If column_config\nis None (default), columns are styled based on the underlying\ndata type of each column.
\nColumn configuration can modify column names, visibility, type,\nwidth, or format, among other things. column_config must be a\ndictionary where each key is a column name and the associated value\nis one of the following:
\nTo configure the index column(s), use _index as the column name.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string to use for giving this element a stable\nidentity. If key is None (default), this element's identity\nwill be determined based on the values of the other parameters.
\nAdditionally, if selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.
\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "How the dataframe should respond to user selection events. This\ncontrols whether or not the dataframe behaves like an input widget.\non_select can be one of the following:
\nThe types of selections Streamlit should allow when selections are\nenabled with on_select. This can be one of the following:
\nWhen column selections are enabled, column sorting is disabled.
\n", + "default": null + }, + { + "name": "row_height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The height of each row in the dataframe in pixels. If row_height\nis None (default), Streamlit will use a default row height,\nwhich fits one line of text.
\n", + "default": "row" + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "If on_select is "ignore" (default), this command returns an\ninternal placeholder for the dataframe element that can be used\nwith the .add_rows() method. Otherwise, this command returns a\ndictionary-like object that supports both key and attribute\nnotation. The attributes are described by the DataframeState\ndictionary schema.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/arrow.py#L258" + }, + "streamlit.date_input": { + "name": "date_input", + "signature": "st.date_input(label, value=\"today\", min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, format=\"YYYY/MM/DD\", disabled=False, label_visibility=\"visible\")", + "examples": "\n\n", + "description": "\nimport datetime\nimport streamlit as st\n\nd = st.date_input("When's your birthday", datetime.date(2019, 7, 6))\nst.write("Your birthday is:", d)\n\n\nimport datetime\nimport streamlit as st\n\ntoday = datetime.datetime.now()\nnext_year = today.year + 1\njan_1 = datetime.date(next_year, 1, 1)\ndec_31 = datetime.date(next_year, 12, 31)\n\nd = st.date_input(\n "Select your vacation for next year",\n (jan_1, datetime.date(next_year, 1, 7)),\n jan_1,\n dec_31,\n format="MM.DD.YYYY",\n)\nd\n\nTo initialize an empty date input, use None as the value:
\n\nimport datetime\nimport streamlit as st\n\nd = st.date_input("When's your birthday", value=None)\nst.write("Your birthday is:", d)\n\n
Display a date input widget.
\nThe date input widget can be configured to accept a single date or a\ndate range. The first day of the week is determined from the user's\nlocale in their browser.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this date input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "\"today\", datetime.date, datetime.datetime, str, list/tuple of these, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The value of this widget when it first renders. This can be one of\nthe following:
\nThe minimum selectable date. This can be any of the date types\naccepted by value, except list or tuple.
\nIf this is None (default), the minimum selectable date is ten\nyears before the initial value. If the initial value is an\ninterval, the minimum selectable date is ten years before the start\ndate of the interval. If no initial value is set, the minimum\nselectable date is ten years before today.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "\"today\", datetime.date, datetime.datetime, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The maximum selectable date. This can be any of the date types\naccepted by value, except list or tuple.
\nIf this is None (default), the maximum selectable date is ten\nyears after the initial value. If the initial value is an interval,\nthe maximum selectable date is ten years after the end date of the\ninterval. If no initial value is set, the maximum selectable date\nis ten years after today.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this date_input's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "A format string controlling how the interface should display dates.\nSupports "YYYY/MM/DD" (default), "DD/MM/YYYY", or "MM/DD/YYYY".\nYou may also use a period (.) or hyphen (-) as separators.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the date input if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "datetime.date or a tuple with 0-2 dates or None", + "is_generator": false, + "description": "The current value of the date input widget or None if no date has been\nselected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/time_widgets.py#L632" + }, + "streamlit.dialog": { + "name": "dialog", + "signature": "st.dialog(title, *, width=\"small\")", + "examples": "\n\n", + "description": "The following example demonstrates the basic usage of @st.dialog.\nIn this app, clicking "A" or "B" will open a modal dialog and prompt you\nto enter a reason for your vote. In the modal dialog, click "Submit" to record\nyour vote into Session State and rerun the app. This will close the modal dialog\nsince the dialog function is not called during the full-script rerun.
\n\nimport streamlit as st\n\n@st.dialog("Cast your vote")\ndef vote(item):\n st.write(f"Why is {item} your favorite?")\n reason = st.text_input("Because...")\n if st.button("Submit"):\n st.session_state.vote = {"item": item, "reason": reason}\n st.rerun()\n\nif "vote" not in st.session_state:\n st.write("Vote for your favorite")\n if st.button("A"):\n vote("A")\n if st.button("B"):\n vote("B")\nelse:\n f"You voted for {st.session_state.vote['item']} because {st.session_state.vote['reason']}"\n\n
Function decorator to create a modal dialog.
\nA function decorated with @st.dialog becomes a dialog\nfunction. When you call a dialog function, Streamlit inserts a modal dialog\ninto your app. Streamlit element commands called within the dialog function\nrender inside the modal dialog.
\nThe dialog function can accept arguments that can be passed when it is\ncalled. Any values from the dialog that need to be accessed from the wider\napp should generally be stored in Session State.
\nA user can dismiss a modal dialog by clicking outside of it, clicking the\n"X" in its upper-right corner, or pressing ESC on their keyboard.\nDismissing a modal dialog does not trigger an app rerun. To close the modal\ndialog programmatically, call st.rerun() explicitly inside of the\ndialog function.
\nst.dialog inherits behavior from st.fragment.\nWhen a user interacts with an input widget created inside a dialog function,\nStreamlit only reruns the dialog function instead of the full script.
\nCalling st.sidebar in a dialog function is not supported.
\nDialog code can interact with Session State, imported modules, and other\nStreamlit elements created outside the dialog. Note that these interactions\nare additive across multiple dialog reruns. You are responsible for\nhandling any side effects of that behavior.
\nWarning
\nOnly one dialog function may be called in a script run, which means\nthat only one dialog can be open at any given time.
\nThe title to display at the top of the modal dialog. It cannot be empty.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"large\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The width of the modal dialog. If width is "small (default), the\nmodal dialog will be 500 pixels wide. If width is "large", the\nmodal dialog will be about 750 pixels wide.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/dialog_decorator.py#L134" + }, + "streamlit.divider": { + "name": "divider", + "signature": "st.divider()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.divider()\n\n
Display a horizontal rule.
\nNote
\nYou can achieve the same effect with st.write("---") or\neven just "---" in your script (via magic).
\n\n\n", + "description": "Example 1: Download a dataframe as a CSV file
\nWhen working with a large dataframe, it's recommended to fetch your\ndata with a cached function. When working with a download button, it's\nsimilarly recommended to convert your data into a downloadable format\nwith a cached function. Caching ensures that the app reruns\neffeciently.
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\n@st.cache_data\ndef get_data():\n df = pd.DataFrame(\n np.random.randn(50, 20), columns=("col %d" % i for i in range(20))\n )\n return df\n\n@st.cache_data\ndef convert_for_download(df):\n return df.to_csv().encode("utf-8")\n\ndf = get_data()\ncsv = convert_for_download(df)\n\nst.download_button(\n label="Download CSV",\n data=csv,\n file_name="data.csv",\n mime="text/csv",\n icon=":material/download:",\n)\n\nExample 2: Download a string as a text file
\nIf you pass a string to the data argument, Streamlit will\nautomatically use the "text/plain" MIME type.
\nWhen you have a widget (like a text area) affecting the value of your\ndownload, it's recommended to use another button to prepare the\ndownload. In this case, use on_click="ignore" in your download\nbutton to prevent the download button from rerunning your app. This\nturns the download button into a frontend-only element that can be\nnested in another button.
\nWithout a preparation button, a user can type something into the text\narea and immediately click the download button. Because a download is\ninitiated concurrently with the app rerun, this can create a race-like\ncondition where the user doesn't see the updated data in their\ndownload.
\n\n\nImportant
\nEven when you prevent your download button from triggering a rerun,\nanother widget with a pending change can still trigger a rerun. For\nexample, if a text area has a pending change when a user clicks a\ndownload button, the text area will trigger a rerun.
\n\nimport streamlit as st\n\nmessage = st.text_area("Message", value="Lorem ipsum.\\nStreamlit is cool.")\n\nif st.button("Prepare download"):\n st.download_button(\n label="Download text",\n data=message,\n file_name="message.txt",\n on_click="ignore",\n type="primary",\n icon=":material/download:",\n )\n\nExample 3: Download a file
\nUse a context manager to open and read a local file on your Streamlit\nserver. Pass the io.BufferedReader object directly to data.\nRemember to specify the MIME type if you don't want the default\ntype of "application/octet-stream" for generic binary data. In the\nexample below, the MIME type is set to "image/png" for a PNG file.
\n\nimport streamlit as st\n\nwith open("flower.png", "rb") as file:\n st.download_button(\n label="Download image",\n data=file,\n file_name="flower.png",\n mime="image/png",\n )\n\n
Display a download button widget.
\nThis is useful when you would like to provide a way for your users\nto download a file directly from your app.
\nNote that the data to be downloaded is stored in-memory while the\nuser is connected, so it's a good idea to keep file sizes under a\ncouple hundred megabytes to conserve memory.
\nIf you want to prevent your app from rerunning when a user clicks the\ndownload button, wrap the download button in a fragment.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "data", + "type_name": "str, bytes, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "The contents of the file to be downloaded.
\nTo prevent unncecessary recomputation, use caching when converting\nyour data for download. For more information, see the Example 1\nbelow.
\n", + "default": null + }, + { + "name": "file_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional string to use as the name of the file to be downloaded,\nsuch as "my_file.csv". If not specified, the name will be\nautomatically generated.
\n", + "default": null + }, + { + "name": "mime", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The MIME type of the data. If this is None (default), Streamlit\nsets the MIME type depending on the value of data as follows:
\nFor more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable, \"rerun\", \"ignore\", or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "How the button should respond to user interaction. This controls\nwhether or not the button triggers a rerun and if a callback\nfunction is called. This can be one of the following values:
\nAn optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string that specifies the button type. This can be one\nof the following:
\nAn optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nAn optional boolean that disables the download button if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.
\nIn both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.
\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.45.1/lib/streamlit/elements/widgets/button.py#L258" + }, + "streamlit.echo": { + "name": "echo", + "signature": "st.echo(code_location=\"above\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nwith st.echo():\n st.write('This code will be printed')\n\n
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, + "is_kwarg_only": 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.45.1/lib/streamlit/commands/echo.py#L33" + }, + "streamlit.empty": { + "name": "empty", + "signature": "st.empty()", + "examples": "\n\n", + "description": "Inside a with st.empty(): block, each displayed element will\nreplace the previous one.
\n\nimport streamlit as st\nimport time\n\nwith st.empty():\n for seconds in range(10):\n st.write(f"\u23f3 {seconds} seconds have passed")\n time.sleep(1)\n st.write(":material/check: 10 seconds over!")\nst.button("Rerun")\n\nYou can use an st.empty to replace multiple elements in\nsuccession. Use st.container inside st.empty to display (and\nlater replace) a group of elements.
\n\nimport streamlit as st\nimport time\n\nst.button("Start over")\n\nplaceholder = st.empty()\nplaceholder.markdown("Hello")\ntime.sleep(1)\n\nplaceholder.progress(0, "Wait for it...")\ntime.sleep(1)\nplaceholder.progress(50, "Wait for it...")\ntime.sleep(1)\nplaceholder.progress(100, "Wait for it...")\ntime.sleep(1)\n\nwith placeholder.container():\n st.line_chart({"data": [1, 5, 2, 6]})\n time.sleep(1)\n st.markdown("3...")\n time.sleep(1)\n st.markdown("2...")\n time.sleep(1)\n st.markdown("1...")\n time.sleep(1)\n\nplaceholder.markdown("Poof!")\ntime.sleep(1)\n\nplaceholder.empty()\n\n
Insert a single-element container.
\nInserts 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).
\nTo 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.45.1/lib/streamlit/elements/empty.py#L28" + }, + "streamlit.error": { + "name": "error", + "signature": "st.error(body, *, icon=None, width=\"stretch\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.error('This is an error', icon="\ud83d\udea8")\n\n
Display error message.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the alert. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nThe desired width of the alert expressed in pixels. If this is\n"stretch" (default), Streamlit sets the width of the alert to\nmatch the width of the parent container. Otherwise, this must be an\ninteger. If the specified width is greater than the width of the\nparent container, Streamlit sets the width of the alert to match\nthe width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/alert.py#L32" + }, + "streamlit.exception": { + "name": "exception", + "signature": "st.exception(exception, width=\"stretch\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\ne = RuntimeError("This is an exception of type RuntimeError")\nst.exception(e)\n\n
Display an exception.
\nWhen accessing the app through localhost, in the lower-right corner\nof the exception, Streamlit displays links to Google and ChatGPT that\nare prefilled with the contents of the exception message.
\n", + "args": [ + { + "name": "exception", + "type_name": "Exception", + "is_optional": false, + "is_kwarg_only": false, + "description": "The exception to display.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int or \"stretch\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "The desired width of the exception expressed in pixels. If this is\n"stretch" (default), Streamlit sets the width of the exception\nto match the width of the parent container. Otherwise, this must be\nan integer. If the specified width is greater than the width of the\nparent container, Streamlit sets the width of the exception to\nmatch the width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/exception.py#L45" + }, + "streamlit.expander": { + "name": "expander", + "signature": "st.expander(label, expanded=False, *, icon=None)", + "examples": "\n\n", + "description": "You can use the 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\nOr you can just call methods directly on 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
Insert a multi-element container that can be expanded/collapsed.
\nInserts 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.
\nTo add elements to the returned container, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.
\nWarning
\nCurrently, you may not put expanders inside another expander.
\nA string to use as the header for the expander. The label can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).
\n", + "default": "s" + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the expander label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nDeprecated alias for @st.dialog.
\nSee the docstring for the decorator's new name.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/dialog_decorator.py#L243" + }, + "streamlit.experimental_fragment": { + "name": "experimental_fragment", + "signature": "st.experimental_fragment(func=None, *, run_every=None)", + "description": "Deprecated alias for @st.fragment. See the docstring for the decorator's new name.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/fragment.py#L471" + }, + "streamlit.experimental_get_query_params": { + "name": "experimental_get_query_params", + "signature": "st.experimental_get_query_params()", + "example": "\n\n", + "description": "Let's say the user's web browser is at\nhttp://localhost:8501/?show_map=True&selected=asia&selected=america.\nThen, you can get the query parameters using the following:
\n\nimport streamlit as st\n\nst.experimental_get_query_params()\n{"show_map": ["True"], "selected": ["asia", "america"]}\n\nNote that the values in the returned dict are always lists. This is\nbecause we internally use Python's urllib.parse.parse_qs(), which behaves\nthis way. And this behavior makes sense when you consider that every item\nin a query string is potentially a 1-element array.
\n
Return the query parameters that is currently showing in the browser's URL bar.
\n", + "args": [], + "returns": [ + { + "type_name": "dict", + "is_generator": false, + "description": "The current query parameters as a dict. "Query parameters" are the part of the URL that comes\nafter the first "?".
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/experimental_query_params.py#L31" + }, + "streamlit.experimental_set_query_params": { + "name": "experimental_set_query_params", + "signature": "st.experimental_set_query_params(**query_params)", + "example": "\n\n", + "description": "To point the user's web browser to something like\n"http://localhost:8501/?show_map=True&selected=asia&selected=america",\nyou would do the following:
\n\nimport streamlit as st\n\nst.experimental_set_query_params(\n show_map=True,\n selected=["asia", "america"],\n)\n\n
Set the query parameters that are shown in the browser's URL bar.
\nWarning
\nQuery param embed cannot be set using this method.
\nThe query parameters to set, as key-value pairs.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/experimental_query_params.py#L69" + }, + "streamlit.feedback": { + "name": "feedback", + "signature": "st.feedback(options=\"thumbs\", *, key=None, disabled=False, on_change=None, args=None, kwargs=None)", + "examples": "\n\n", + "description": "Display a feedback widget with stars, and show the selected sentiment:
\n\nimport streamlit as st\n\nsentiment_mapping = ["one", "two", "three", "four", "five"]\nselected = st.feedback("stars")\nif selected is not None:\n st.markdown(f"You selected {sentiment_mapping[selected]} star(s).")\n\nDisplay a feedback widget with thumbs, and show the selected sentiment:
\n\nimport streamlit as st\n\nsentiment_mapping = [":material/thumb_down:", ":material/thumb_up:"]\nselected = st.feedback("thumbs")\nif selected is not None:\n st.markdown(f"You selected: {sentiment_mapping[selected]}")\n\n
Display a feedback widget.
\nA feedback widget is an icon-based button group available in three\nstyles, as described in options. It is commonly used in chat and AI\napps to allow users to rate responses.
\n", + "args": [ + { + "name": "options", + "type_name": "\"thumbs\", \"faces\", or \"stars\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "The feedback options displayed to the user. options can be one\nof the following:
\nAn 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the feedback widget if set\nto True. The default is False.
\n", + "default": "is" + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional callback invoked when this feedback widget's value\nchanges.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "int or None", + "is_generator": false, + "description": "An integer indicating the user's selection, where 0 is the\nlowest feedback. Higher values indicate more positive feedback.\nIf no option was selected, the widget returns None.
\n\n\n", + "description": "Insert a file uploader that accepts a single file at a time:
\n\nimport streamlit as st\nimport pandas as pd\nfrom io import StringIO\n\nuploaded_file = st.file_uploader("Choose a file")\nif uploaded_file is not None:\n # To read file as bytes:\n bytes_data = uploaded_file.getvalue()\n st.write(bytes_data)\n\n # To convert to a string based IO:\n stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))\n st.write(stringio)\n\n # To read file as string:\n string_data = stringio.read()\n st.write(string_data)\n\n # Can be used wherever a "file-like" object is accepted:\n dataframe = pd.read_csv(uploaded_file)\n st.write(dataframe)\n\nInsert a file uploader that accepts multiple files at a time:
\n\nimport streamlit as st\n\nuploaded_files = st.file_uploader(\n "Choose a CSV file", accept_multiple_files=True\n)\nfor uploaded_file in uploaded_files:\n bytes_data = uploaded_file.read()\n st.write("filename:", uploaded_file.name)\n st.write(bytes_data)\n\n
Display a file uploader widget.
\nBy default, uploaded files are limited to 200 MB each. You can\nconfigure this using the server.maxUploadSize config option. For\nmore information on how to set config options, see config.toml.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this file uploader is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "type", + "type_name": "str or list of str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The allowed file extension(s) for uploaded files. This can be one\nof the following types:
\nWhether to accept more than one file in a submission. If this is\nFalse (default), the user can only submit one file at a time.\nIf this is True, the user can upload multiple files at the same\ntime, in which case the return value will be a list of files.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this file_uploader's value\nchanges.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the file uploader if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "None, UploadedFile, or list of UploadedFile", + "is_generator": false, + "description": "The UploadedFile class is a subclass of BytesIO, and therefore is\n"file-like". This means you can pass an instance of it anywhere a\nfile is expected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/file_uploader.py#L233" + }, + "streamlit.form": { + "name": "form", + "signature": "st.form(key, clear_on_submit=False, *, enter_to_submit=True, border=True)", + "examples": "\n\n", + "description": "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)\nst.write("Outside the form")\n\nInserting 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
Create a form that batches elements together with a "Submit" button.
\nA 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.
\nTo add elements to a form object, you can use with notation\n(preferred) or just call methods directly on the form. See\nexamples below.
\nForms have a few constraints:
\nA 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, + "is_kwarg_only": 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" + }, + { + "name": "enter_to_submit", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to submit the form when a user presses Enter while\ninteracting with a widget inside the form.
\nIf this is True (default), pressing Enter while interacting\nwith a form widget is equivalent to clicking the first\nst.form_submit_button in the form.
\nIf this is False, the user must click an\nst.form_submit_button to submit the form.
\nIf the first st.form_submit_button in the form is disabled,\nthe form will override submission behavior with\nenter_to_submit=False.
\n", + "default": null + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to show a border around the form. Defaults to True.
\nNote
\nNot showing a border can be confusing to viewers since interacting with a\nwidget in the form will do nothing. You should only remove the border if\nthere's another border (e.g. because of an expander) or the form is small\n(e.g. just a text input and a submit button).
\nDisplay a form submit button.
\nWhen this button is clicked, all widget values inside the form will be\nsent from the user's browser to your Streamlit server in a batch.
\nEvery form must have at least one st.form_submit_button. An\nst.form_submit_button cannot exist outside of a form.
\nFor more information about forms, check out our docs.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this button is for. This\ndefaults to "Submit". The label can optionally contain\nGitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": "s" + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this button is clicked.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string that specifies the button type. This can be one\nof the following:
\nAn optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nWhether to disable the button. If this is False (default), the\nuser can interact with the button. If this is True, the button\nis grayed-out and can't be clicked.
\nIf the first st.form_submit_button in the form is disabled,\nthe form will override submission behavior with\nenter_to_submit=False.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.
\nIn both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.
\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.45.1/lib/streamlit/elements/form.py#L191" + }, + "streamlit.fragment": { + "name": "fragment", + "signature": "st.fragment(func=None, *, run_every=None)", + "examples": "\n\n", + "description": "The following example demonstrates basic usage of\n@st.fragment. As an analogy, "inflating balloons" is a slow process that happens\noutside of the fragment. "Releasing balloons" is a quick process that happens inside\nof the fragment.
\n\nimport streamlit as st\nimport time\n\n@st.fragment\ndef release_the_balloons():\n st.button("Release the balloons", help="Fragment rerun")\n st.balloons()\n\nwith st.spinner("Inflating balloons..."):\n time.sleep(5)\nrelease_the_balloons()\nst.button("Inflate more balloons", help="Full rerun")\n\nThis next example demonstrates how elements both inside and outside of a\nfragement update with each app or fragment rerun. In this app, clicking\n"Rerun full app" will increment both counters and update all values\ndisplayed in the app. In contrast, clicking "Rerun fragment" will only\nincrement the counter within the fragment. In this case, the st.write\ncommand inside the fragment will update the app's frontend, but the two\nst.write commands outside the fragment will not update the frontend.
\n\nimport streamlit as st\n\nif "app_runs" not in st.session_state:\n st.session_state.app_runs = 0\n st.session_state.fragment_runs = 0\n\n@st.fragment\ndef my_fragment():\n st.session_state.fragment_runs += 1\n st.button("Rerun fragment")\n st.write(f"Fragment says it ran {st.session_state.fragment_runs} times.")\n\nst.session_state.app_runs += 1\nmy_fragment()\nst.button("Rerun full app")\nst.write(f"Full app says it ran {st.session_state.app_runs} times.")\nst.write(f"Full app sees that fragment ran {st.session_state.fragment_runs} times.")\n\nYou can also trigger an app rerun from inside a fragment by calling\nst.rerun.
\n\nimport streamlit as st\n\nif "clicks" not in st.session_state:\n st.session_state.clicks = 0\n\n@st.fragment\ndef count_to_five():\n if st.button("Plus one!"):\n st.session_state.clicks += 1\n if st.session_state.clicks % 5 == 0:\n st.rerun()\n return\n\ncount_to_five()\nst.header(f"Multiples of five clicks: {st.session_state.clicks // 5}")\n\nif st.button("Check click count"):\n st.toast(f"## Total clicks: {st.session_state.clicks}")\n\n
Decorator to turn a function into a fragment which can rerun independently of the full app.
\nWhen a user interacts with an input widget created inside a fragment,\nStreamlit only reruns the fragment instead of the full app. If\nrun_every is set, Streamlit will also rerun the fragment at the\nspecified interval while the session is active, even if the user is not\ninteracting with your app.
\nTo trigger an app rerun from inside a fragment, call st.rerun()\ndirectly. To trigger a fragment rerun from within itself, call\nst.rerun(scope="fragment"). Any values from the fragment that need to\nbe accessed from the wider app should generally be stored in Session State.
\nWhen Streamlit element commands are called directly in a fragment, the\nelements are cleared and redrawn on each fragment rerun, just like all\nelements are redrawn on each app rerun. The rest of the app is persisted\nduring a fragment rerun. When a fragment renders elements into externally\ncreated containers, the elements will not be cleared with each fragment\nrerun. Instead, elements will accumulate in those containers with each\nfragment rerun, until the next app rerun.
\nCalling st.sidebar in a fragment is not supported. To write elements to\nthe sidebar with a fragment, call your fragment function inside a\nwith st.sidebar context manager.
\nFragment code can interact with Session State, imported modules, and\nother Streamlit elements created outside the fragment. Note that these\ninteractions are additive across multiple fragment reruns. You are\nresponsible for handling any side effects of that behavior.
\nWarning
\nThe function to turn into a fragment.
\n", + "default": null + }, + { + "name": "run_every", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The time interval between automatic fragment reruns. This can be one of\nthe following:
\n\n\n\n
\n- None (default).
\n- An int or float specifying the interval in seconds.
\n- A string specifying the time in a format supported by Pandas'\nTimedelta constructor,\ne.g. "1d", "1.5 days", or "1h23s".
\n- A timedelta object from Python's built-in datetime library,\ne.g. timedelta(days=1).
\n
If run_every is None, the fragment will only rerun from\nuser-triggered events.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/fragment.py#L306" + }, + "streamlit.get_option": { + "name": "get_option", + "signature": "st.get_option(key)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\ncolor = st.get_option("theme.primaryColor")\n\n
Return the current value of a given Streamlit configuration option.
\nRun streamlit config show in a terminal to see all available options.
\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show in a terminal.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/config.py#L174" + }, + "streamlit.graphviz_chart": { + "name": "graphviz_chart", + "signature": "st.graphviz_chart(figure_or_dot, use_container_width=False)", + "example": "\n\n", + "description": "\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\nOr 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
Display a graph using the dagre-d3 library.
\n", + "args": [ + { + "name": "figure_or_dot", + "type_name": "graphviz.dot.Graph, graphviz.dot.Digraph, graphviz.sources.Source, str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The Graphlib graph object or dot string to display
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to override the figure's native width with the width of\nthe parent container. If use_container_width is False\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If use_container_width is True, Streamlit sets\nthe width of the figure to match the width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/graphviz_chart.py#L40" + }, + "streamlit.header": { + "name": "header", + "signature": "st.header(body, anchor=None, *, help=None, divider=False)", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\nst.header("_Streamlit_ is :blue[cool] :sunglasses:")\nst.header("This is a header with a divider", divider="gray")\nst.header("These headers have rotating dividers", divider=True)\nst.header("One", divider=True)\nst.header("Two", divider=True)\nst.header("Three", divider=True)\nst.header("Four", divider=True)\n\n
Display text in header formatting.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": 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 or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the header. If this is\nNone (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "divider", + "type_name": "bool or \u201cblue\u201d, \u201cgreen\u201d, \u201corange\u201d, \u201cred\u201d, \u201cviolet\u201d, \u201cgray\u201d/\"grey\", or \u201crainbow\u201d", + "is_optional": false, + "is_kwarg_only": true, + "description": "Shows a colored divider below the header. If True, successive\nheaders will cycle through divider colors. That is, the first\nheader will have a blue line, the second header will have a\ngreen line, and so on. If a string, the color can be set to one of\nthe following: blue, green, orange, red, violet, gray/grey, or\nrainbow.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/heading.py#L43" + }, + "streamlit.help": { + "name": "help", + "signature": "st.help(obj=\n\n", + "description": "Don't remember how to initialize a dataframe? Try this:
\n\nimport streamlit as st\nimport pandas\n\nst.help(pandas.DataFrame)\n\nWant 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\nWant 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\nAnd 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
Display help and other information for a given object.
\nDepending 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, + "is_kwarg_only": 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.45.1/lib/streamlit/elements/doc_string.py#L44" + }, + "streamlit.html": { + "name": "html", + "signature": "st.html(body)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.html(\n "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"\n)\n\n
Insert HTML into your app.
\nAdding custom HTML to your app impacts safety, styling, and\nmaintainability. We sanitize HTML with DOMPurify, but inserting HTML remains a\ndeveloper risk. Passing untrusted code to st.html or dynamically\nloading external code can increase the risk of vulnerabilities in your\napp.
\nst.html content is not iframed. Executing JavaScript is not\nsupported at this time.
\n", + "args": [ + { + "name": "body", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "The HTML code to insert. This can be one of the following:
\nIf the resulting HTML content is empty, Streamlit will raise an\nerror.
\nIf body is a path to a CSS file, Streamlit will wrap the CSS\ncontent in <style> tags automatically. When the resulting HTML\ncontent only contains style tags, Streamlit will send the content\nto the event container instead of the main container to avoid\ntaking up space in the app.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/html.py#L34" + }, + "streamlit.image": { + "name": "image", + "signature": "st.image(image, caption=None, width=None, use_column_width=None, clamp=False, channels=\"RGB\", output_format=\"auto\", *, use_container_width=False)", + "example": "\n\n", + "description": "\nimport streamlit as st\nst.image("sunrise.jpg", caption="Sunrise by the mountains")\n\n
Display an image or list of images.
\n", + "args": [ + { + "name": "image", + "type_name": "numpy.ndarray, BytesIO, str, Path, or list of these", + "is_optional": false, + "is_kwarg_only": false, + "description": "The image to display. This can be one of the following:
\nImage caption(s). If this is None (default), no caption is\ndisplayed. If image is a list of multiple images, caption\nmust be a list of captions (one caption for each image) or\nNone.
\nCaptions can optionally contain GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Image width. If this is None (default), Streamlit will use the\nimage's native width, up to the width of the parent container.\nWhen using an SVG image without a default width, you should declare\nwidth or use use_container_width=True.
\n", + "default": "width" + }, + { + "name": "use_column_width", + "type_name": "\"auto\", \"always\", \"never\", or bool", + "is_optional": false, + "is_kwarg_only": 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, + "deprecated": { + "deprecated": true, + "deprecatedText": "use_column_width is deprecated and will be removed in a future\nrelease. Please use the use_container_width parameter instead.
\n" + } + }, + { + "name": "clamp", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to clamp image pixel values to a valid range (0-255 per\nchannel). This is only used for byte array images; the parameter is\nignored for image URLs and files. If this is False (default)\nand an image has an out-of-range value, a RuntimeError will be\nraised.
\n", + "default": null + }, + { + "name": "channels", + "type_name": "\"RGB\" or \"BGR\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "The color format when image is an nd.array. This is ignored\nfor other image types. If this is "RGB" (default),\nimage[:, :, 0] is the red channel, image[:, :, 1] is the\ngreen channel, and image[:, :, 2] is the blue channel. For\nimages coming from libraries like OpenCV, you should set this to\n"BGR" instead.
\n", + "default": null + }, + { + "name": "output_format", + "type_name": "\"JPEG\", \"PNG\", or \"auto\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "The output format to use when transferring the image data. If this\nis "auto" (default), Streamlit identifies the compression type\nbased on the type and format of the image. Photos should use the\n"JPEG" format for lossy compression while diagrams should use\nthe "PNG" format for lossless compression.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If use_container_width is False (default),\nStreamlit sets the image's width according to width. If\nuse_container_width is True, Streamlit sets the width of\nthe image to match the width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/image.py#L47" + }, + "streamlit.info": { + "name": "info", + "signature": "st.info(body, *, icon=None, width=\"stretch\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.info('This is a purely informational message', icon="\u2139\ufe0f")\n\n
Display an informational message.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the alert. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nThe desired width of the alert expressed in pixels. If this is\n"stretch" (default), Streamlit sets the width of the alert to\nmatch the width of the parent container. Otherwise, this must be an\ninteger. If the specified width is greater than the width of the\nparent container, Streamlit sets the width of the alert to match\nthe width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/alert.py#L173" + }, + "streamlit.json": { + "name": "json", + "signature": "st.json(body, *, expanded=True)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.json(\n {\n "foo": "bar",\n "stuff": [\n "stuff 1",\n "stuff 2",\n "stuff 3",\n ],\n "level1": {"level2": {"level3": {"a": "b"}}},\n },\n expanded=2,\n)\n\n
Display an object or string as a pretty-printed, interactive JSON string.
\n", + "args": [ + { + "name": "body", + "type_name": "object or str", + "is_optional": false, + "is_kwarg_only": 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 or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "The initial expansion state of the JSON element. This can be one\nof the following:
\nRegardless of the initial expansion state, users can collapse or\nexpand any key-value pair to show or hide any part of the object.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/json.py#L43" + }, + "streamlit.latex": { + "name": "latex", + "signature": "st.latex(body, *, help=None)", + "example": "\n\n", + "description": "\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
Display mathematical expressions formatted as LaTeX.
\nSupported LaTeX functions are listed at\nhttps://katex.org/docs/supported.html.
\n", + "args": [ + { + "name": "body", + "type_name": "str or SymPy expression", + "is_optional": false, + "is_kwarg_only": 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 or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the LaTeX expression. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/markdown.py#L209" + }, + "streamlit.line_chart": { + "name": "line_chart", + "signature": "st.line_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, width=None, height=None, use_container_width=True)", + "examples": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.line_chart(chart_data)\n\nYou can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": np.random.randn(20),\n "col2": np.random.randn(20),\n "col3": np.random.choice(["A", "B", "C"], 20),\n }\n)\n\nst.line_chart(chart_data, x="col1", y="col2", color="col3")\n\nFinally, if your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple lines with different\ncolors:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n np.random.randn(20, 3), columns=["col1", "col2", "col3"]\n)\n\nst.line_chart(\n chart_data,\n x="col1",\n y=["col2", "col3"],\n color=["#FF0000", "#0000FF"], # Optional\n)\n\n
Display a line chart.
\nThis 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 Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.
\nIf 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": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "Data to be plotted.
\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.
\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.
\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.
\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.
\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The color to use for different lines in this chart.
\nFor a line chart with just one line, this can be:
\nFor a line chart with multiple lines, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:
\nNone, to use the default colors.
\nThe name of a column in the dataset. Data points will be grouped\ninto lines of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.
\nFor example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three lines whose colors will be\nautomatically selected from the default palette.
\nBut, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into three lines, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.
\nFor a line chart with multiple lines, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:
\nDesired width of the chart expressed in pixels. If width is\nNone (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If width is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.
\nTo use width, you must set use_container_width=False.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the chart expressed in pixels. If height is\nNone (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If use_container_width is True (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If use_container_width is False,\nStreamlit sets the chart's width according to width.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L560" + }, + "streamlit.link_button": { + "name": "link_button", + "signature": "st.link_button(label, url, *, help=None, type=\"secondary\", icon=None, disabled=False, use_container_width=False)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.link_button("Go to gallery", "https://streamlit.io/gallery")\n\n
Display a link button element.
\nWhen clicked, a new tab will be opened to the specified URL. This will\ncreate a new session for the user if directed within the app.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "url", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The url to be opened on user click
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string that specifies the button type. This can be one\nof the following:
\nAn optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nAn optional boolean that disables the link button if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.
\nIn both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/button.py#L545" + }, + "streamlit.login": { + "name": "login", + "signature": "st.login(provider=None)", + "examples": "\n\n", + "description": "Example 1: Use an unnamed default identity provider
\nIf you do not specify a name for your provider, specify all settings within\nthe [auth] dictionary of your secrets.toml file. The following\nexample configures Google as the default provider. For information about\nusing OIDC with Google, see Google Identity.
\n.streamlit/secrets.toml:
\n\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://accounts.google.com/.well-known/openid-configuration" # fmt: skip\n\nYour app code:
\n\nimport streamlit as st\n\nif not st.user.is_logged_in:\n if st.button("Log in"):\n st.login()\nelse:\n if st.button("Log out"):\n st.logout()\n st.write(f"Hello, {st.user.name}!")\n\nExample 2: Use a named identity provider
\nIf you specify a name for your provider, save the shared settings in the\n[auth] dictionary of your secrets.toml file, and save the other\nsettings in an [auth.{provider}] dictionary, where {provider} is\nthe name of your provider. The following example configures Microsoft as\nthe provider. The example uses provider="microsoft", but you can use\nany name. This name is internal to Streamlit and is used to match the login\ncommand to its configuration. For information about using OIDC with\nMicrosoft, see Microsoft Entra ID.\nTo configure your {tenant} value in server_metadata_url, see\nMicrosoft identity platform.
\n.streamlit/secrets.toml:
\n\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\n\n[auth.microsoft]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration"\n\nYour app code:
\n\nimport streamlit as st\n\nif not st.user.is_logged_in:\n st.login("microsoft")\nelse:\n st.write(f"Hello, {st.user.name}!")\n\nExample 3: Use multiple, named providers
\nIf you want to give your users a choice of authentication methods,\nconfigure multiple providers and give them each a unique name. The\nfollowing example lets users choose between Okta and Microsoft to log in.\nAlways check with your identity provider to understand the structure of\ntheir identity tokens because the returned fields may differ. Remember to\nset {tenant} and {subdomain} in server_metadata_url for\nMicrosoft and Okta, respectively.
\n\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\n\n[auth.microsoft]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration"\n\n[auth.okta]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://{subdomain}.okta.com/.well-known/openid-configuration" # fmt: skip\n\nYour app code:
\n\nimport streamlit as st\n\nif not st.user.is_logged_in:\n st.header("Log in:")\n if st.button("Microsoft"):\n st.login("microsoft")\n if st.button("Okta"):\n st.login("okta")\nelse:\n if st.button("Log out"):\n st.logout()\n st.write(f"Hello, {st.user.name}!")\n\nExample 4: Change the default connection settings
\nprompt="select_account" may be treated differently by some\nproviders when a user is already logged into their account. If a user is\nlogged into their Google or Microsoft account from a previous session, the\nprovider will prompt them to select the account they want to use, even if\nit's the only one. However, if the user is logged into their Okta or Auth0\naccount from a previous session, the account will automatically be\nselected. st.logout() does not clear a user's related cookies. To force\nusers to log in every time, use prompt="login" as described in Auth0's\nCustomize Signup and Login Prompts.
\n.streamlit/secrets.toml:
\n\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\n\n[auth.auth0]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://{account}.{region}.auth0.com/.well-known/openid-configuration" # fmt: skip\nclient_kwargs = { "prompt" = "login" }\n\nYour app code:
\n\nimport streamlit as st\nif st.button("Log in"):\n st.login("auth0")\nif st.user.is_logged_in:\n if st.button("Log out"):\n st.logout()\n st.write(f"Hello, {st.user.name}!)\n\n
Initiate the login flow for the given provider.
\nThis command redirects the user to an OpenID Connect (OIDC) provider. After\nthe user authenticates their identity, they are redirected back to the\nhome page of your app. Streamlit stores a cookie with the user's identity\ninformation in the user's browser . You can access the identity information\nthrough st.user. Call st.logout() to remove the cookie\nand start a new session.
\nYou can use any OIDC provider, including Google, Microsoft, Okta, and more.\nYou must configure the provider through secrets management. Although OIDC\nis an extension of OAuth 2.0, you can't use generic OAuth providers.\nStreamlit parses the user's identity token and surfaces its attributes in\nst.user. If the provider returns an access token, that\ntoken is ignored. Therefore, this command will not allow your app to act on\nbehalf of a user in a secure system.
\nFor all providers, there are two shared settings, redirect_uri and\ncookie_secret, which you must specify in an [auth] dictionary\nin secrets.toml. Other settings must be defined as described in the\nprovider parameter.
\nIn addition to the shared settings, the following settings are required:
\nFor a complete list of OIDC parameters, see OpenID Connect Core and\nyour provider's documentation. By default, Streamlit sets\nscope="openid profile email" and prompt="select_account". You can\nchange these and other OIDC parameters by passing a dictionary of settings\nto client_kwargs. state and nonce, which are used for\nsecurity, are handled automatically and don't need to be specified. For\nmore information, see Example 4.
\nImportant
\nThe name of your provider configuration to use for login.
\nIf provider is None (default), Streamlit will use all settings\nin the [auth] dictionary within your app's secrets.toml file.\nOtherwise, use an [auth.{provider}] dictionary for the named\nprovider, as shown in the examples that follow. When you pass a string\nto provider, Streamlit will use redirect_uri and\ncookie_secret, while ignoring any other values in the [auth]\ndictionary.
\nDue to internal implementation details, Streamlit does not support\nusing an underscore within provider at this time.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/user_info.py#L54" + }, + "streamlit.logo": { + "name": "logo", + "signature": "st.logo(image, *, size=\"medium\", link=None, icon_image=None)", + "examples": "A common design practice is to use a wider logo in the sidebar, and a\nsmaller, icon-styled logo in your app's main body.
\n\nimport streamlit as st\n\nst.logo(\n LOGO_URL_LARGE,\n link="https://streamlit.io/gallery",\n icon_image=LOGO_URL_SMALL,\n)\n\n
Try switching logos around in the following example:
\n\nimport streamlit as st\n\nHORIZONTAL_RED = "images/horizontal_red.png"\nICON_RED = "images/icon_red.png"\nHORIZONTAL_BLUE = "images/horizontal_blue.png"\nICON_BLUE = "images/icon_blue.png"\n\noptions = [HORIZONTAL_RED, ICON_RED, HORIZONTAL_BLUE, ICON_BLUE]\nsidebar_logo = st.selectbox("Sidebar logo", options, 0)\nmain_body_logo = st.selectbox("Main body logo", options, 1)\n\nst.logo(sidebar_logo, icon_image=main_body_logo)\nst.sidebar.markdown("Hi!")\n\n
Renders a logo in the upper-left corner of your app and its sidebar.
\nIf st.logo is called multiple times within a page, Streamlit will\nrender the image passed in the last call. For the most consistent results,\ncall st.logo early in your page script and choose an image that works\nwell in both light and dark mode. Avoid empty margins around your image.
\nIf your logo does not work well for both light and dark mode, consider\nsetting the theme and hiding the settings menu from users with the\nconfiguration option\nclient.toolbarMode="minimal".
\n", + "args": [ + { + "name": "image", + "type_name": "Anything supported by st.image (except list)", + "is_optional": false, + "is_kwarg_only": false, + "description": "The image to display in the upper-left corner of your app and its\nsidebar. This can be any of the types supported by st.image except\na list. If icon_image is also provided, then Streamlit will only\ndisplay image in the sidebar.
\nStreamlit scales the image to a max height set by size and a max\nwidth to fit within the sidebar.
\n", + "default": null + }, + { + "name": "size", + "type_name": "\"small\", \"medium\", or \"large\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The size of the image displayed in the upper-left corner of the app and its\nsidebar. The possible values are as follows:
\nThe external URL to open when a user clicks on the logo. The URL must\nstart with "http://" or "https://". If link is None (default),\nthe logo will not include a hyperlink.
\n", + "default": null + }, + { + "name": "icon_image", + "type_name": "Anything supported by st.image (except list) or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional, typically smaller image to replace image in the\nupper-left corner when the sidebar is closed. This can be any of the\ntypes supported by st.image except a list. If icon_image is\nNone (default), Streamlit will always display image in the\nupper-left corner, regardless of whether the sidebar is open or closed.\nOtherwise, Streamlit will render icon_image in the upper-left\ncorner of the app when the sidebar is closed.
\nStreamlit scales the image to a max height set by size and a max\nwidth to fit within the sidebar. If the sidebar is closed, the max\nwidth is retained from when it was last open.
\nFor best results, pass a wide or horizontal image to image and a\nsquare image to icon_image. Or, pass a square image to image\nand leave icon_image=None.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/logo.py#L33" + }, + "streamlit.logout": { + "name": "logout", + "signature": "st.logout()", + "example": "\n\n", + "description": ".streamlit/secrets.toml:
\n\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://accounts.google.com/.well-known/openid-configuration" # fmt: skip\n\nYour app code:
\n\nimport streamlit as st\n\nif not st.user.is_logged_in:\n if st.button("Log in"):\n st.login()\nelse:\n if st.button("Log out"):\n st.logout()\n st.write(f"Hello, {st.user.name}!")\n\n
Logout the current user.
\nThis command removes the user's information from st.user,\ndeletes their identity cookie, and redirects them back to your app's home\npage. This creates a new session.
\nIf the user has multiple sessions open in the same browser,\nst.user will not be cleared in any other session.\nst.user only reads from the identity cookie at the start\nof a session. After a session is running, you must call st.login() or\nst.logout() within that session to update st.user.
\nNote
\nThis does not log the user out of their underlying account from the\nidentity provider.
\n\n\n", + "description": "\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\nYou can also customize the size and color of the datapoints:
\n\nst.map(df, size=20, color="#0044ff")\n\nAnd finally, you can choose different columns to use for the latitude\nand longitude components, as well as set size and color of each\ndatapoint dynamically based on other columns:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n {\n "col1": np.random.randn(1000) / 50 + 37.76,\n "col2": np.random.randn(1000) / 50 + -122.4,\n "col3": np.random.randn(1000) * 100,\n "col4": np.random.rand(1000, 4).tolist(),\n }\n)\n\nst.map(df, latitude="col1", longitude="col2", size="col3", color="col4")\n\n
Display a map with a scatterplot overlaid onto it.
\nThis is a wrapper around st.pydeck_chart to quickly create\nscatterplot charts on top of a map, with auto-centering and auto-zoom.
\nWhen using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts\nno responsibility or liability of any kind for Mapbox or for any content\nor information made available by Mapbox.
\nMapbox 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\nuse of Mapbox is governed by Mapbox's Terms of Use.
\nTo 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/develop/api-reference/configuration/config.toml.
\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "The data to be plotted.
\n", + "default": null + }, + { + "name": "latitude", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The name of the column containing the latitude coordinates of\nthe datapoints in the chart.
\nIf None, the latitude data will come from any column named 'lat',\n'latitude', 'LAT', or 'LATITUDE'.
\n", + "default": null + }, + { + "name": "longitude", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The name of the column containing the longitude coordinates of\nthe datapoints in the chart.
\nIf None, the longitude data will come from any column named 'lon',\n'longitude', 'LON', or 'LONGITUDE'.
\n", + "default": null + }, + { + "name": "color", + "type_name": "str or tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The color of the circles representing each datapoint.
\nCan be:
\nThe size of the circles representing each point, in meters.
\nThis can be:
\nZoom level as specified in\nhttps://wiki.openstreetmap.org/wiki/Zoom_levels.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override the map's native width with the width of\nthe parent container. If use_container_width is True\n(default), Streamlit sets the width of the map to match the width\nof the parent container. If use_container_width is False,\nStreamlit sets the width of the chart to fit its contents according\nto the plotting library, up to the width of the parent container.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired width of the chart expressed in pixels. If width is\nNone (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If width is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.
\nTo use width, you must set use_container_width=False.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the chart expressed in pixels. If height is\nNone (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/map.py#L78" + }, + "streamlit.markdown": { + "name": "markdown", + "signature": "st.markdown(body, unsafe_allow_html=False, *, help=None)", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\nst.markdown("*Streamlit* is **really** ***cool***.")\nst.markdown('''\n :red[Streamlit] :orange[can] :green[write] :blue[text] :violet[in]\n :gray[pretty] :rainbow[colors] and :blue-background[highlight] text.''')\nst.markdown("Here's a bouquet —\\\n :tulip::cherry_blossom::rose::hibiscus::sunflower::blossom:")\n\nmulti = '''If you end a line with two spaces,\na soft return is used for the next line.\n\nTwo (or more) newline characters in a row will result in a hard return.\n'''\nst.markdown(multi)\n\n
Display string formatted as Markdown.
\n", + "args": [ + { + "name": "body", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.\nIf anything other than a string is passed, it will be converted\ninto a string behind the scenes using str(body).
\nThis also supports:
\nWhether to render HTML within body. If this is False\n(default), any HTML tags found in body will be escaped and\ntherefore treated as raw text. If this is True, any HTML\nexpressions within body will be rendered.
\nAdding custom HTML to your app impacts safety, styling, and\nmaintainability.
\nNote
\nIf you only want to insert HTML or CSS without Markdown text,\nwe recommend using st.html instead.
\nA tooltip that gets displayed next to the Markdown. If this is\nNone (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/markdown.py#L33" + }, + "streamlit.metric": { + "name": "metric", + "signature": "st.metric(label, value, delta=None, delta_color=\"normal\", help=None, label_visibility=\"visible\", border=False)", + "examples": "\n\n", + "description": "Example 1: Show a metric
\n\nimport streamlit as st\n\nst.metric(label="Temperature", value="70 \u00b0F", delta="1.2 \u00b0F")\n\nExample 2: Create a row of metrics
\nst.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\nExample 3: Modify the delta indicator
\nThe 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, delta_color="inverse")\n\nst.metric(\n label="Active developers", value=123, delta=123, delta_color="off"\n)\n\nExample 4: Create a grid of metric cards
\nAdd borders to your metrics to create a dashboard look.
\n\nimport streamlit as st\n\na, b = st.columns(2)\nc, d = st.columns(2)\n\na.metric("Temperature", "30\u00b0F", "-9\u00b0F", border=True)\nb.metric("Wind", "4 mph", "2 mph", border=True)\n\nc.metric("Humidity", "77%", "5%", border=True)\nd.metric("Pressure", "30.34 inHg", "-2 inHg", border=True)\n\n
Display a metric in big bold font, with an optional indicator of how the metric changed.
\nTip: 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, + "is_kwarg_only": false, + "description": "The header or title for the metric. The label can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, str, or None", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": 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": "\"normal\", \"inverse\", or \"off\"", + "is_optional": false, + "is_kwarg_only": 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 or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the metric label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to show a border around the metric container. If this is\nFalse (default), no border is shown. If this is True, a\nborder is shown.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/metric.py#L51" + }, + "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, *, max_selections=None, placeholder=None, disabled=False, label_visibility=\"visible\", accept_new_options=False)", + "examples": "\n\n", + "description": "Example 1: Use a basic multiselect widget
\nYou can declare one or more initial selections with the default\nparameter.
\n\nimport streamlit as st\n\noptions = st.multiselect(\n "What are your favorite colors?",\n ["Green", "Yellow", "Red", "Blue"],\n default=["Yellow", "Red"],\n)\n\nst.write("You selected:", options)\n\nExample 2: Let users to add new options
\nTo allow users to enter and select new options that aren't included in\nthe options list, use the accept_new_options parameter. To\nprevent users from adding an unbounded number of new options, use the\nmax_selections parameter.
\n\nimport streamlit as st\n\noptions = st.multiselect(\n "What are your favorite cat names?",\n ["Jellybeans", "Fish Biscuit", "Madam President"],\n max_selections=5,\n accept_new_options=True,\n)\n\nst.write("You selected:", options)\n\n
Display a multiselect widget.
\nThe multiselect widget starts as empty.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this select widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.
\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "List of default values. Can also be a single value.
\n", + "default": "values" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "Function to modify the display of the 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 command.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this widget's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "max_selections", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": true, + "description": "The max selections that can be selected at a time.
\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A string to display when no options are selected.\nIf this is None (default), the widget displays one of the two\nfollowing placeholder strings:
\nAn optional boolean that disables the multiselect widget if set\nto True. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + }, + { + "name": "accept_new_options", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the user can add selections that aren't included in options.\nIf this is False (default), the user can only select from the\nitems in options. If this is True, the user can enter new\nitems that don't exist in options.
\nWhen a user enters and selects a new item, it is included in the\nwidget's returned list as a string. The new item is not added to\nthe widget's drop-down menu. Streamlit will use a case-insensitive\nmatch from options before adding a new item, and a new item\ncan't be added if a case-insensitive match is already selected. The\nmax_selections argument is still enforced.
\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.45.1/lib/streamlit/elements/widgets/multiselect.py#L219" + }, + "streamlit.navigation": { + "name": "navigation", + "signature": "st.navigation(pages, *, position=\"sidebar\", expanded=False)", + "examples": "The following examples show different possible entrypoint files, each named\nstreamlit_app.py. An entrypoint file is passed to streamlit run. It\nmanages your app's navigation and serves as a router between pages.
\nExample 1: Use a callable or Python file as a page
\nYou can declare pages from callables or file paths. If you pass callables\nor paths to st.navigation as a page-like objects, they are internally\nconverted to StreamlitPage objects using st.Page. In this case, the\npage titles, icons, and paths are inferred from the file or callable names.
\npage_1.py (in the same directory as your entrypoint file):
\n\nimport streamlit as st\n\nst.title("Page 1")\n\n
streamlit_app.py:
\n\nimport streamlit as st\n\ndef page_2():\n st.title("Page 2")\n\npg = st.navigation(["page_1.py", page_2])\npg.run()\n\n
Example 2: Group pages into sections and customize them with ``st.Page``
\nYou can use a dictionary to create sections within your navigation menu. In\nthe following example, each page is similar to Page 1 in Example 1, and all\npages are in the same directory. However, you can use Python files from\nanywhere in your repository. st.Page is used to give each page a custom\ntitle. For more information, see st.Page.
\nDirectory structure:
\n\nyour_repository/\n\u251c\u2500\u2500 create_account.py\n\u251c\u2500\u2500 learn.py\n\u251c\u2500\u2500 manage_account.py\n\u251c\u2500\u2500 streamlit_app.py\n\u2514\u2500\u2500 trial.py\n\n
streamlit_app.py:
\n\nimport streamlit as st\n\npages = {\n "Your account": [\n st.Page("create_account.py", title="Create your account"),\n st.Page("manage_account.py", title="Manage your account"),\n ],\n "Resources": [\n st.Page("learn.py", title="Learn about us"),\n st.Page("trial.py", title="Try it out"),\n ],\n}\n\npg = st.navigation(pages)\npg.run()\n\n
Example 3: Stateful widgets across multiple pages
\nCall widget functions in your entrypoint file when you want a widget to be\nstateful across pages. Assign keys to your common widgets and access their\nvalues through Session State within your pages.
\nstreamlit_app.py:
\n\nimport streamlit as st\n\ndef page1():\n st.write(st.session_state.foo)\n\ndef page2():\n st.write(st.session_state.bar)\n\n# Widgets shared by all the pages\nst.sidebar.selectbox("Foo", ["A", "B", "C"], key="foo")\nst.sidebar.checkbox("Bar", key="bar")\n\npg = st.navigation([page1, page2])\npg.run()\n\n
Configure the available pages in a multipage app.
\nCall st.navigation in your entrypoint file to define the available\npages for your app. st.navigation returns the current page, which can\nbe executed using .run() method.
\nWhen using st.navigation, your entrypoint file (the file passed to\nstreamlit run) acts like a router or frame of common elements around\neach of your pages. Streamlit executes the entrypoint file with every app\nrerun. To execute the current page, you must call the .run() method on\nthe StreamlitPage object returned by st.navigation.
\nThe set of available pages can be updated with each rerun for dynamic\nnavigation. By default, st.navigation displays the available pages in\nthe sidebar if there is more than one page. This behavior can be changed\nusing the position keyword argument.
\nAs soon as any session of your app executes the st.navigation command,\nyour app will ignore the pages/ directory (across all sessions).
\n", + "args": [ + { + "name": "pages", + "type_name": "Sequence[page-like], Mapping[str, Sequence[page-like]]", + "is_optional": false, + "is_kwarg_only": false, + "description": "The available pages for the app.
\nTo create a navigation menu with no sections or page groupings,\npages must be a list of page-like objects. Page-like objects are\nanything that can be passed to st.Page or a StreamlitPage\nobject returned by st.Page.
\nTo create labeled sections or page groupings within the navigation\nmenu, pages must be a dictionary. Each key is the label of a\nsection and each value is the list of page-like objects for\nthat section.
\nWhen you use a string or path as a page-like object, they are\ninternally passed to st.Page and converted to StreamlitPage\nobjects. In this case, the page will have the default title, icon, and\npath inferred from its path or filename. To customize these attributes\nfor your page, initialize your page with st.Page.
\n", + "default": "title" + }, + { + "name": "position", + "type_name": "\"sidebar\" or \"hidden\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The position of the navigation menu. If this is "sidebar"\n(default), the navigation widget appears at the top of the sidebar. If\nthis is "hidden", the navigation widget is not displayed.
\nIf there is only one page in pages, the navigation will be hidden\nfor any value of position.
\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the navigation menu should be expanded. If this is False\n(default), the navigation menu will be collapsed and will include a\nbutton to view more options when there are too many pages to display.\nIf this is True, the navigation menu will always be expanded; no\nbutton to collapse the menu will be displayed.
\nIf st.navigation changes from expanded=True to\nexpanded=False on a rerun, the menu will stay expanded and a\ncollapse button will be displayed.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "StreamlitPage", + "is_generator": false, + "description": "The current page selected by the user. To run the page, you must use\nthe .run() method on it.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/navigation.py#L83" + }, + "streamlit.number_input": { + "name": "number_input", + "signature": "st.number_input(label, min_value=None, max_value=None, value=\"min\", step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\", icon=None)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nnumber = st.number_input("Insert a number")\nst.write("The current number is ", number)\n\nTo initialize an empty number input, use None as the value:
\n\nimport streamlit as st\n\nnumber = st.number_input(\n "Insert a number", value=None, placeholder="Type a number..."\n)\nst.write("The current number is ", number)\n\n
Display a numeric input widget.
\nNote
\nInteger values exceeding +/- (1<<53) - 1 cannot be accurately\nstored or returned by the widget due to serialization contstraints\nbetween the Python server and JavaScript client. You must handle\nsuch numbers as floats, leading to a loss in precision.
\nA short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The minimum permitted value.\nIf this is None (default), there will be no minimum for float\nvalues and a minimum of - (1<<53) + 1 for integer values.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The maximum permitted value.\nIf this is None (default), there will be no maximum for float\nvalues and a maximum of (1<<53) - 1 for integer values.
\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, \"min\" or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The value of this widget when it first renders. If this is\n"min" (default), the initial value is min_value unless\nmin_value is None. If min_value is None, the widget\ninitializes with a value of 0.0 or 0.
\nIf value is None, the widget will initialize with no value\nand return None until the user provides input.
\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": false, + "description": "A printf-style format string controlling how the interface should\ndisplay numbers. The output must be purely numeric. This does not\nimpact the return value of the widget. For more information about\nthe formatting specification, see sprintf.js.
\nFor example, format="%0.1f" adjusts the displayed decimal\nprecision to only show one digit after the decimal.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this number_input's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": true, + "description": "An optional string displayed when the number input is empty.\nIf None, no placeholder is displayed.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the number input if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display within the input field to the\nleft of the value. If icon is None (default), no icon is\ndisplayed. If icon is a string, the following options are\nvalid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nThe current value of the numeric input widget or None if the widget\nis empty. The return type will match the data type of the value parameter.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/number_input.py#L171" + }, + "streamlit.page_link": { + "name": "page_link", + "signature": "st.page_link(page, *, label=None, icon=None, help=None, disabled=False, use_container_width=None)", + "example": "\n\n", + "description": "Consider the following example given this file structure:
\n\nyour-repository/\n\u251c\u2500\u2500 pages/\n\u2502 \u251c\u2500\u2500 page_1.py\n\u2502 \u2514\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n\n\nimport streamlit as st\n\nst.page_link("your_app.py", label="Home", icon="\ud83c\udfe0")\nst.page_link("pages/page_1.py", label="Page 1", icon="1\ufe0f\u20e3")\nst.page_link("pages/page_2.py", label="Page 2", icon="2\ufe0f\u20e3", disabled=True)\nst.page_link("http://www.google.com", label="Google", icon="\ud83c\udf0e")\n\nThe default navigation is shown here for comparison, but you can hide\nthe default navigation using the client.showSidebarNavigation\nconfiguration option. This allows you to create custom, dynamic\nnavigation menus for your apps!
\n
Display a link to another page in a multipage app or to an external page.
\nIf another page in a multipage app is specified, clicking st.page_link\nstops the current page execution and runs the specified page as if the\nuser clicked on it in the sidebar navigation.
\nIf an external page is specified, clicking st.page_link opens a new\ntab to the specified page. The current script run will continue if not\ncomplete.
\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or st.Page", + "is_optional": false, + "is_kwarg_only": false, + "description": "The file path (relative to the main script) or an st.Page indicating\nthe page to switch to. Alternatively, this can be the URL to an\nexternal page (must start with "http://" or "https://").
\n", + "default": null + }, + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the page link. Labels are required for external pages.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nA tooltip that gets displayed when the link is hovered over. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the page link if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to expand the link's width to fill its parent container.\nThe default is True for page links in the sidebar and False\nfor those in the main app.
\n", + "default": "is" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/button.py#L662" + }, + "streamlit.pills": { + "name": "pills", + "signature": "st.pills(label, options, *, selection_mode=\"single\", default=None, format_func=None, key=None, help=None, on_change=None, args=None, kwargs=None, disabled=False, label_visibility=\"visible\")", + "examples": "\n\n", + "description": "Example 1: Multi-select pills
\nDisplay a multi-select pills widget, and show the selection:
\n\nimport streamlit as st\n\noptions = ["North", "East", "South", "West"]\nselection = st.pills("Directions", options, selection_mode="multi")\nst.markdown(f"Your selected options: {selection}.")\n\nExample 2: Single-select pills with icons
\nDisplay a single-select pills widget with icons:
\n\nimport streamlit as st\n\noption_map = {\n 0: ":material/add:",\n 1: ":material/zoom_in:",\n 2: ":material/zoom_out:",\n 3: ":material/zoom_out_map:",\n}\nselection = st.pills(\n "Tool",\n options=option_map.keys(),\n format_func=lambda option: option_map[option],\n selection_mode="single",\n)\nst.write(\n "Your selected option: "\n f"{None if selection is None else option_map[selection]}"\n)\n\n
Display a pills widget.
\nA pills widget is similar to a st.selectbox or st.multiselect\nwhere the options are displayed as pill-buttons instead of a\ndrop-down list.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable of V", + "is_optional": false, + "is_kwarg_only": false, + "description": "Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default and can\noptionally contain GitHub-flavored Markdown, including the Markdown\ndirectives described in the body parameter of st.markdown.
\n", + "default": "and" + }, + { + "name": "selection_mode", + "type_name": "\"single\" or \"multi\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The selection mode for the widget. If this is "single"\n(default), only one option can be selected. If this is "multi",\nmultiple options can be selected.
\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The value of the widget when it first renders. If the\nselection_mode is multi, this can be a list of values, a\nsingle value, or None. If the selection_mode is\n"single", this can be a single value or None.
\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": true, + "description": "Function to modify the display of the 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 command. The output can optionally contain GitHub-flavored\nMarkdown, including the Markdown directives described in the\nbody parameter of st.markdown.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": true, + "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 or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional callback invoked when this widget's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the widget if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "list of V, V, or None", + "is_generator": false, + "description": "If the selection_mode is multi, this is a list of selected\noptions or an empty list. If the selection_mode is\n"single", this is a selected option or None.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/button_group.py#L454" + }, + "streamlit.plotly_chart": { + "name": "plotly_chart", + "signature": "st.plotly_chart(figure_or_data, use_container_width=True, *, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=('points', 'box', 'lasso'), **kwargs)", + "example": "\n\n", + "description": "The example below comes straight from the examples at\nhttps://plot.ly/python. Note that plotly.figure_factory requires\nscipy to run.
\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)\n\n
Display an interactive Plotly chart.
\nPlotly is a charting library for Python.\nThe arguments to this function closely follow the ones for Plotly's\nplot() function.
\nTo show Plotly charts in Streamlit, call st.plotly_chart wherever\nyou would call Plotly's py.plot or py.iplot.
\nImportant
\nYou must install plotly to use this command. Your app's\nperformance may be enhanced by installing orjson as well.
\nThe Plotly Figure or Data object to render. See\nhttps://plot.ly/python/ for examples of graph descriptions.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to override the figure's native width with the width of\nthe parent container. If use_container_width is True (default),\nStreamlit sets the width of the figure to match the width of the parent\ncontainer. If use_container_width is False, Streamlit sets the\nwidth of the chart to fit its contents according to the plotting library,\nup to the width of the parent container.
\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The theme of the chart. If theme is "streamlit" (default),\nStreamlit uses its own design default. If theme is None,\nStreamlit falls back to the default behavior of the library.
\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string to use for giving this element a stable\nidentity. If key is None (default), this element's identity\nwill be determined based on the values of the other parameters.
\nAdditionally, if selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.
\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\non_select can be one of the following:
\nThe selection mode of the chart. This can be one of the following:
\nAll selections modes are activated by default.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "Any argument accepted by Plotly's plot() function.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element. Otherwise, this command\nreturns a dictionary-like object that supports both key and\nattribute notation. The attributes are described by the\nPlotlyState dictionary schema.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/plotly_chart.py#L305" + }, + "streamlit.popover": { + "name": "popover", + "signature": "st.popover(label, *, help=None, icon=None, disabled=False, use_container_width=False)", + "examples": "\n\n", + "description": "You can use the with notation to insert any element into a popover:
\n\nimport streamlit as st\n\nwith st.popover("Open popover"):\n st.markdown("Hello World \ud83d\udc4b")\n name = st.text_input("What's your name?")\n\nst.write("Your name:", name)\n\nOr you can just call methods directly on the returned objects:
\n\nimport streamlit as st\n\npopover = st.popover("Filter items")\nred = popover.checkbox("Show red items.", True)\nblue = popover.checkbox("Show blue items.", True)\n\nif red:\n st.write(":red[This is a red item.]")\nif blue:\n st.write(":blue[This is a blue item.]")\n\n
Insert a popover container.
\nInserts a multi-element container as a popover. It consists of a button-like\nelement and a container that opens when the button is clicked.
\nOpening and closing the popover will not trigger a rerun. Interacting\nwith widgets inside of an open popover will rerun the app while keeping\nthe popover open. Clicking outside of the popover will close it.
\nTo add elements to the returned container, you can use the "with"\nnotation (preferred) or just call methods directly on the returned object.\nSee examples below.
\nWarning
\nYou may not put a popover inside another popover.
\nThe label of the button that opens the popover container.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed when the popover button is hovered\nover. If this is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nAn optional boolean that disables the popover button if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.
\nIn both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.
\nThe popover containter's minimimun width matches the width of its\nbutton. The popover container may be wider than its button to fit\nthe container's contents.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/layouts.py#L603" + }, + "streamlit.progress": { + "name": "progress", + "signature": "st.progress(value, text=None)", + "example": "\n\n", + "description": "Here is an example of a progress bar increasing over time and disappearing when it reaches completion:
\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.01)\n my_bar.progress(percent_complete + 1, text=progress_text)\ntime.sleep(1)\nmy_bar.empty()\n\nst.button("Rerun")\n\n
Display a progress bar.
\n", + "args": [ + { + "name": "value", + "type_name": "int or float", + "is_optional": false, + "is_kwarg_only": false, + "description": "0 <= value <= 100 for int
\n0.0 <= value <= 1.0 for float
\n", + "default": null + }, + { + "name": "text", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A message to display above the progress bar. The text can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/progress.py#L95" + }, + "streamlit.pydeck_chart": { + "name": "pydeck_chart", + "signature": "st.pydeck_chart(pydeck_obj=None, *, use_container_width=True, width=None, height=None, selection_mode=\"single-object\", on_select=\"ignore\", key=None)", + "example": "\n\n", + "description": "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)\n\nst.pydeck_chart(\n 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\nNote
\nTo make the PyDeck chart's style consistent with Streamlit's theme,\nyou can set map_style=None in the pydeck.Deck object.
\n
Draw a chart using the PyDeck library.
\nThis supports 3D maps, point clouds, and more! More info about PyDeck\nat https://deckgl.readthedocs.io/en/latest/.
\nThese docs are also quite useful:
\nWhen using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts\nno responsibility or liability of any kind for Mapbox or for any content\nor information made available by Mapbox.
\nMapbox 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\nuse of Mapbox is governed by Mapbox's Terms of Use.
\nTo 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/develop/api-reference/configuration/config.toml.
\n", + "args": [ + { + "name": "pydeck_obj", + "type_name": "pydeck.Deck or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Object specifying the PyDeck chart to draw.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override the figure's native width with the width of\nthe parent container. If use_container_width is True (default),\nStreamlit sets the width of the figure to match the width of the parent\ncontainer. If use_container_width is False, Streamlit sets the\nwidth of the chart to fit its contents according to the plotting library,\nup to the width of the parent container.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired width of the chart expressed in pixels. If width is\nNone (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If width is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.
\nTo use width, you must set use_container_width=False.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the chart expressed in pixels. If height is\nNone (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.
\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "How the figure should respond to user selection events. This controls\nwhether or not the chart behaves like an input widget.\non_select can be one of the following:
\nIf on_select is not "ignore", all layers must have a\ndeclared id to keep the chart stateful across reruns.
\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "\"single-object\" or \"multi-object\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The selection mode of the chart. This can be one of the following:
\nAn optional string to use for giving this element a stable\nidentity. If key is None (default), this element's identity\nwill be determined based on the values of the other parameters.
\nAdditionally, if selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element. Otherwise, this method\nreturns a dictionary-like object that supports both key and\nattribute notation. The attributes are described by the\nPydeckState dictionary schema.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/deck_gl_json_chart.py#L289" + }, + "streamlit.pyplot": { + "name": "pyplot", + "signature": "st.pyplot(fig=None, clear_figure=None, use_container_width=True, **kwargs)", + "example": "\n\n", + "description": "\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\nMatplotlib 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\nFor more information, see https://matplotlib.org/faq/usage_faq.html.
\n
Display a matplotlib.pyplot figure.
\nImportant
\nYou must install matplotlib to use this command.
\nThe Matplotlib Figure object to render. See\nhttps://matplotlib.org/stable/gallery/index.html for examples.
\nNote
\nWhen this argument isn't specified, this function will render the global\nMatplotlib figure object. However, this feature is deprecated and\nwill be removed in a later version.
\nIf 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.
\nWhether to override the figure's native width with the width of\nthe parent container. If use_container_width is True\n(default), Streamlit sets the width of the figure to match the\nwidth of the parent container. If use_container_width is\nFalse, Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of the\nparent container.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "Arguments to pass to Matplotlib's savefig function.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/pyplot.py#L34" + }, + "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, captions=None, label_visibility=\"visible\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\ngenre = st.radio(\n "What's your favorite movie genre",\n [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],\n captions=[\n "Laugh out loud.",\n "Get the popcorn.",\n "Never stop learning.",\n ],\n)\n\nif genre == ":rainbow[Comedy]":\n st.write("You selected comedy.")\nelse:\n st.write("You didn't select comedy.")\n\nTo initialize an empty radio widget, use None as the index value:
\n\nimport streamlit as st\n\ngenre = st.radio(\n "What's your favorite movie genre",\n [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],\n index=None,\n)\n\nst.write("You selected:", genre)\n\n
Display a radio button widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this radio group is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.
\nLabels can include markdown as described in the label parameter\nand will be cast to str internally by default.
\n", + "default": null + }, + { + "name": "index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The index of the preselected option on first render. If None,\nwill initialize empty and return None until the user selects an option.\nDefaults to 0 (the first option).
\n", + "default": "0" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this radio's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the radio button if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean, which orients the radio group horizontally.\nThe default is false (vertical buttons).
\n", + "default": "false" + }, + { + "name": "captions", + "type_name": "iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A list of captions to show below each radio button. If None (default),\nno captions are shown.
\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "The selected option or None if no option is selected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/radio.py#L124" + }, + "streamlit.rerun": { + "name": "rerun", + "signature": "st.rerun(*, scope=\"app\")", + "description": "Rerun the script immediately.
\nWhen st.rerun() is called, Streamlit halts the current script run and\nexecutes no further statements. Streamlit immediately queues the script to\nrerun.
\nWhen using st.rerun in a fragment, you can scope the rerun to the\nfragment. However, if a fragment is running as part of a full-app rerun,\na fragment-scoped rerun is not allowed.
\n", + "args": [ + { + "name": "scope", + "type_name": "\"app\" or \"fragment\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies what part of the app should rerun. If scope is "app"\n(default), the full app reruns. If scope is "fragment",\nStreamlit only reruns the fragment from which this command is called.
\nSetting scope="fragment" is only valid inside a fragment during a\nfragment rerun. If st.rerun(scope="fragment") is called during a\nfull-app rerun or outside of a fragment, Streamlit will raise a\nStreamlitAPIException.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/execution_control.py#L104" + }, + "streamlit.scatter_chart": { + "name": "scatter_chart", + "signature": "st.scatter_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, size=None, width=None, height=None, use_container_width=True)", + "examples": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.scatter_chart(chart_data)\n\nYou can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n np.random.randn(20, 3), columns=["col1", "col2", "col3"]\n)\nchart_data["col4"] = np.random.choice(["A", "B", "C"], 20)\n\nst.scatter_chart(\n chart_data,\n x="col1",\n y="col2",\n color="col4",\n size="col3",\n)\n\nFinally, if your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple series with different\ncolors:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n np.random.randn(20, 4), columns=["col1", "col2", "col3", "col4"]\n)\n\nst.scatter_chart(\n chart_data,\n x="col1",\n y=["col2", "col3"],\n size="col4",\n color=["#FF0000", "#0000FF"], # Optional\n)\n\n
Display a scatterplot chart.
\nThis 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 Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.
\nIf st.scatter_chart does not guess the data specification correctly,\ntry specifying your desired chart using st.altair_chart.
\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "Data to be plotted.
\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.
\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.
\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.
\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.
\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The color of the circles representing each datapoint.
\nThis can be:
\nNone, to use the default color.
\nA hex string like "#ffaa00" or "#ffaa0088".
\nAn RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.
\nThe name of a column in the dataset where the color of that\ndatapoint will come from.
\nIf the values in this column are in one of the color formats\nabove (hex string or color tuple), then that color will be used.
\nOtherwise, the color will be automatically picked from the\ndefault palette.
\nFor example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints be shown using three colors from the default palette.
\nBut if this column only contains floats or ints, then those\n1000 datapoints will be shown using a colors from a continuous\ncolor gradient.
\nFinally, if this column only contains the values "#ffaa00",\n"#f0f", "#0000ff", then then each of those 1000 datapoints will\nbe assigned "#ffaa00", "#f0f", or "#0000ff" as appropriate.
\nIf the dataframe is in wide format (that is, y is a Sequence of\ncolumns), this can also be:
\nThe size of the circles representing each point.
\nThis can be:
\nDesired width of the chart expressed in pixels. If width is\nNone (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If width is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.
\nTo use width, you must set use_container_width=False.
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Desired height of the chart expressed in pixels. If height is\nNone (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override width with the width of the parent\ncontainer. If use_container_width is True (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If use_container_width is False,\nStreamlit sets the chart's width according to width.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L1263" + }, + "streamlit.segmented_control": { + "name": "segmented_control", + "signature": "st.segmented_control(label, options, *, selection_mode=\"single\", default=None, format_func=None, key=None, help=None, on_change=None, args=None, kwargs=None, disabled=False, label_visibility=\"visible\")", + "examples": "\n\n", + "description": "Example 1: Multi-select segmented control
\nDisplay a multi-select segmented control widget, and show the\nselection:
\n\nimport streamlit as st\n\noptions = ["North", "East", "South", "West"]\nselection = st.segmented_control(\n "Directions", options, selection_mode="multi"\n)\nst.markdown(f"Your selected options: {selection}.")\n\nExample 2: Single-select segmented control with icons
\nDisplay a single-select segmented control widget with icons:
\n\nimport streamlit as st\n\noption_map = {\n 0: ":material/add:",\n 1: ":material/zoom_in:",\n 2: ":material/zoom_out:",\n 3: ":material/zoom_out_map:",\n}\nselection = st.segmented_control(\n "Tool",\n options=option_map.keys(),\n format_func=lambda option: option_map[option],\n selection_mode="single",\n)\nst.write(\n "Your selected option: "\n f"{None if selection is None else option_map[selection]}"\n)\n\n
Display a segmented control widget.
\nA segmented control widget is a linear set of segments where each of\nthe passed options functions like a toggle button.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable of V", + "is_optional": false, + "is_kwarg_only": false, + "description": "Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default and can\noptionally contain GitHub-flavored Markdown, including the Markdown\ndirectives described in the body parameter of st.markdown.
\n", + "default": "and" + }, + { + "name": "selection_mode", + "type_name": "\"single\" or \"multi\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The selection mode for the widget. If this is "single"\n(default), only one option can be selected. If this is "multi",\nmultiple options can be selected.
\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The value of the widget when it first renders. If the\nselection_mode is multi, this can be a list of values, a\nsingle value, or None. If the selection_mode is\n"single", this can be a single value or None.
\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": true, + "description": "Function to modify the display of the 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 command. The output can optionally contain GitHub-flavored\nMarkdown, including the Markdown directives described in the\nbody parameter of st.markdown.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": true, + "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 or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional callback invoked when this widget's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the widget if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "list of V, V, or None", + "is_generator": false, + "description": "If the selection_mode is multi, this is a list of selected\noptions or an empty list. If the selection_mode is\n"single", this is a selected option or None.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/button_group.py#L664" + }, + "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=[\n "red",\n "orange",\n "yellow",\n "green",\n "blue",\n "indigo",\n "violet",\n ],\n)\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=[\n "red",\n "orange",\n "yellow",\n "green",\n "blue",\n "indigo",\n "violet",\n ],\n value=("red", "blue"),\n)\nst.write("You selected wavelengths between", start_color, "and", end_color)\n\n
Display a slider widget to select items from a list.
\nThis also allows you to render a range slider by passing a two-element\ntuple or list as the value.
\nThe difference between st.select_slider and st.slider is that\nselect_slider accepts any datatype and takes an iterable set of\noptions, while st.slider only accepts numerical or date/time data and\ntakes a range as input.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this slider is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.
\n", + "default": null + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": 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, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this select_slider's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the select slider if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\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.45.1/lib/streamlit/elements/widgets/select_slider.py#L157" + }, + "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, *, placeholder=None, disabled=False, label_visibility=\"visible\", accept_new_options=False)", + "examples": "\n\n", + "description": "Example 1: Use a basic selectbox widget
\nIf no index is provided, the first option is selected by default.
\n\nimport streamlit as st\n\noption = st.selectbox(\n "How would you like to be contacted?",\n ("Email", "Home phone", "Mobile phone"),\n)\n\nst.write("You selected:", option)\n\nExample 2: Use a selectbox widget with no initial selection
\nTo initialize an empty selectbox, use None as the index value.
\n\nimport streamlit as st\n\noption = st.selectbox(\n "How would you like to be contacted?",\n ("Email", "Home phone", "Mobile phone"),\n index=None,\n placeholder="Select contact method...",\n)\n\nst.write("You selected:", option)\n\nExample 3: Let users add a new option
\nTo allow users to add a new option that isn't included in the\noptions list, use the accept_new_options=True parameter. You\ncan also customize the placeholder text.
\n\nimport streamlit as st\n\noption = st.selectbox(\n "Default email",\n ["foo@example.com", "bar@example.com", "baz@example.com"],\n index=None,\n placeholder="Select a saved email or enter a new one",\n accept_new_options=True,\n)\n\nst.write("You selected:", option)\n\n
Display a select widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this select widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.
\n", + "default": null + }, + { + "name": "index", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "The index of the preselected option on first render. If None,\nwill initialize empty and return None until the user selects an option.\nDefaults to 0 (the first option).
\n", + "default": "0" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "Function to modify the display of the 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 command.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this selectbox's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": true, + "description": "A string to display when no options are selected.\nIf this is None (default), the widget displays one of the two\nfollowing placeholder strings:
\nAn optional boolean that disables the selectbox if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + }, + { + "name": "accept_new_options", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the user can add a selection that isn't included in options.\nIf this is False (default), the user can only select from the\nitems in options. If this is True, the user can enter a new\nitem that doesn't exist in options.
\nWhen a user enters a new item, it is returned by the widget as a\nstring. The new item is not added to the widget's drop-down menu.\nStreamlit will use a case-insensitive match from options before\nadding a new item.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "The selected option or None if no option is selected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/selectbox.py#L232" + }, + "streamlit.set_option": { + "name": "set_option", + "signature": "st.set_option(key, value)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.set_option("client.showErrorDetails", True)\n\n
Set a configuration option.
\nCurrently, only client configuration options can be set within the\nscript itself:
\n\n\n\n
\n- client.showErrorDetails
\n- client.showSidebarNavigation
\n- client.toolbarMode
\n
Calling st.set_option with any other option will raise a\nStreamlitAPIException. When changing a configuration option in a\nrunning app, you may need to trigger a rerun after changing the option to\nsee the effects.
\nRun streamlit config show in a terminal to see all available options.
\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show in a terminal.
\n", + "default": null + }, + { + "name": "value", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "The new value to assign to this config option.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/config.py#L125" + }, + "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.
\nNote
\nThis must be the first Streamlit command used on an app page, and must only\nbe set once per page.
\nThe page title, shown in the browser tab. If None, defaults to the\nfilename of the script ("app.py" would show "app \u2022 Streamlit").
\n", + "default": "the" + }, + { + "name": "page_icon", + "type_name": "Anything supported by st.image (except list), str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The page favicon. If page_icon is None (default), the favicon\nwill be a monochrome Streamlit logo.
\nIn addition to the types supported by st.image (except list), the\nfollowing strings are valid:
\nA single-character emoji. For example, you can set page_icon="\ud83e\udd88".
\nAn emoji short code. For example, you can set page_icon=":shark:".\nFor a list of all supported codes, see\nhttps://share.streamlit.io/streamlit/emoji-shortcodes.
\nThe string literal, "random". You can set page_icon="random"\nto set a random emoji from the supported list above.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, page_icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nNote
\nColors are not supported for Material icons. When you use a\nMaterial icon for favicon, it will be black, regardless of browser\ntheme.
\nHow 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\", \"expanded\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "How the sidebar should start out. Defaults to "auto",\nwhich hides the sidebar on small devices and shows it otherwise.\n"expanded" shows the sidebar initially; "collapsed" hides it.\nIn most cases, you should just use "auto", otherwise the app will\nlook bad when embedded and viewed on mobile.
\n", + "default": "s" + }, + { + "name": "menu_items", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": 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:
\nThe 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.45.1/lib/streamlit/commands/page_config.py#L133" + }, + "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\n", + "description": "\nimport streamlit as st\n\nage = st.slider("How old are you?", 0, 130, 25)\nst.write("I'm ", age, "years old")\n\nAnd here's an example of a range slider:
\n\nimport streamlit as st\n\nvalues = st.slider("Select a range of values", 0.0, 100.0, (25.0, 75.0))\nst.write("Values:", values)\n\nThis is a range time slider:
\n\nimport streamlit as st\nfrom datetime import time\n\nappointment = st.slider(\n "Schedule your appointment:", value=(time(11, 30), time(12, 45))\n)\nst.write("You're scheduled for:", appointment)\n\nFinally, 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",\n)\nst.write("Start time:", start_time)\n\n
Display a slider widget.
\nThis supports int, float, date, time, and datetime types.
\nThis also allows you to render a range slider by passing a two-element\ntuple or list as the value.
\nThe 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.
\nNote
\nInteger values exceeding +/- (1<<53) - 1 cannot be accurately\nstored or returned by the widget due to serialization contstraints\nbetween the Python server and JavaScript client. You must handle\nsuch numbers as floats, leading to a loss in precision.
\nA short label explaining to the user what this slider is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "min_value", + "type_name": "a supported type or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The minimum permitted value.\nIf this is None (default), the minimum value depends on the\ntype as follows:
\nThe maximum permitted value.\nIf this is None (default), the maximum value depends on the\ntype as follows:
\nThe 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.\nThis defaults to min_value. If the type is not otherwise\nspecified in any of the numeric parameters, the widget will have an\ninteger value.
\n", + "default": "s" + }, + { + "name": "step", + "type_name": "int, float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": false, + "description": "A printf-style format string controlling how the interface should\ndisplay numbers. This does not impact the return value.
\nFor information about formatting integers and floats, see\nsprintf.js.\nFor example, format="%0.1f" adjusts the displayed decimal\nprecision to only show one digit after the decimal.
\nFor information about formatting datetimes, dates, and times, see\nmomentJS.\nFor example, format="ddd ha" adjusts the displayed datetime to\nshow the day of the week and the hour ("Tue 8pm").
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this slider's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the slider if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\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.45.1/lib/streamlit/elements/widgets/slider.py#L339" + }, + "streamlit.snow": { + "name": "snow", + "signature": "st.snow()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.snow()\n\n...then watch your app and get ready for a cool celebration!
\n
Draw celebratory snowfall.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/snow.py#L27" + }, + "streamlit.spinner": { + "name": "spinner", + "signature": "st.spinner(text=\"In progress...\", *, show_time=False)", + "example": "\n\n", + "description": "\nimport streamlit as st\nimport time\n\nwith st.spinner("Wait for it...", show_time=True):\n time.sleep(5)\nst.success("Done!")\nst.button("Rerun")\n\n
Display a loading spinner while executing a block of code.
\n", + "args": [ + { + "name": "text", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display next to the spinner. This defaults to\n"In progress...".
\nThe text can optionally contain GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional, supported\nMarkdown directives.
\n", + "default": "s" + }, + { + "name": "show_time", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to show the elapsed time next to the spinner text. If this is\nFalse (default), no time is displayed. If this is True,\nelapsed time is displayed with a precision of 0.1 seconds. The time\nformat is not configurable.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/spinner.py#L28" + }, + "streamlit.status": { + "name": "status", + "signature": "st.status(label, *, expanded=False, state=\"running\")", + "examples": "\n\n", + "description": "You can use the with notation to insert any element into an status container:
\n\nimport time\nimport streamlit as st\n\nwith st.status("Downloading data..."):\n st.write("Searching for data...")\n time.sleep(2)\n st.write("Found URL.")\n time.sleep(1)\n st.write("Downloading data...")\n time.sleep(1)\n\nst.button("Rerun")\n\nYou can also use .update() on the container to change the label, state,\nor expanded state:
\n\nimport time\nimport streamlit as st\n\nwith st.status("Downloading data...", expanded=True) as status:\n st.write("Searching for data...")\n time.sleep(2)\n st.write("Found URL.")\n time.sleep(1)\n st.write("Downloading data...")\n time.sleep(1)\n status.update(\n label="Download complete!", state="complete", expanded=False\n )\n\nst.button("Rerun")\n\n
Insert a status container to display output from long-running tasks.
\nInserts a container into your app that is typically used to show the status and\ndetails of a process or task. The container can hold multiple elements and can\nbe expanded or collapsed by the user similar to st.expander.\nWhen collapsed, all that is visible is the status icon and label.
\nThe label, state, and expanded state can all be updated by calling .update()\non the returned object. To add elements to the returned container, you can\nuse with notation (preferred) or just call methods directly on the returned\nobject.
\nBy default, st.status() initializes in the "running" state. When called using\nwith notation, it automatically updates to the "complete" state at the end\nof the "with" block. See examples below for more details.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The initial label of the status container. The label can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "If True, initializes the status container in "expanded" state. Defaults to\nFalse (collapsed).
\n", + "default": "s" + }, + { + "name": "state", + "type_name": "\"running\", \"complete\", or \"error\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The initial state of the status container which determines which icon is\nshown:
\nA mutable status container that can hold multiple elements. The label, state,\nand expanded state can be updated after creation via .update().
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/layouts.py#L743" + }, + "streamlit.stop": { + "name": "stop", + "signature": "st.stop()", + "example": "\n\n", + "description": "\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
Stops execution immediately.
\nStreamlit will not run any statements after st.stop().\nWe recommend rendering a message to explain why the script has stopped.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/execution_control.py#L34" + }, + "streamlit.subheader": { + "name": "subheader", + "signature": "st.subheader(body, anchor=None, *, help=None, divider=False)", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\nst.subheader("_Streamlit_ is :blue[cool] :sunglasses:")\nst.subheader("This is a subheader with a divider", divider="gray")\nst.subheader("These subheaders have rotating dividers", divider=True)\nst.subheader("One", divider=True)\nst.subheader("Two", divider=True)\nst.subheader("Three", divider=True)\nst.subheader("Four", divider=True)\n\n
Display text in subheader formatting.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": 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 or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the subheader. If this is\nNone (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "divider", + "type_name": "bool or \u201cblue\u201d, \u201cgreen\u201d, \u201corange\u201d, \u201cred\u201d, \u201cviolet\u201d, \u201cgray\u201d/\"grey\", or \u201crainbow\u201d", + "is_optional": false, + "is_kwarg_only": true, + "description": "Shows a colored divider below the header. If True, successive\nheaders will cycle through divider colors. That is, the first\nheader will have a blue line, the second header will have a\ngreen line, and so on. If a string, the color can be set to one of\nthe following: blue, green, orange, red, violet, gray/grey, or\nrainbow.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/heading.py#L115" + }, + "streamlit.success": { + "name": "success", + "signature": "st.success(body, *, icon=None, width=\"stretch\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.success('This is a success message!', icon="\u2705")\n\n
Display a success message.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the alert. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nThe desired width of the alert expressed in pixels. If this is\n"stretch" (default), Streamlit sets the width of the alert to\nmatch the width of the parent container. Otherwise, this must be an\ninteger. If the specified width is greater than the width of the\nparent container, Streamlit sets the width of the alert to match\nthe width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/alert.py#L244" + }, + "streamlit.switch_page": { + "name": "switch_page", + "signature": "st.switch_page(page)", + "example": "\n\n", + "description": "Consider the following example given this file structure:
\n\nyour-repository/\n\u251c\u2500\u2500 pages/\n\u2502 \u251c\u2500\u2500 page_1.py\n\u2502 \u2514\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n\n\nimport streamlit as st\n\nif st.button("Home"):\n st.switch_page("your_app.py")\nif st.button("Page 1"):\n st.switch_page("pages/page_1.py")\nif st.button("Page 2"):\n st.switch_page("pages/page_2.py")\n\n
Programmatically switch the current page in a multipage app.
\nWhen st.switch_page is called, the current page execution stops and\nthe specified page runs as if the user clicked on it in the sidebar\nnavigation. The specified page must be recognized by Streamlit's multipage\narchitecture (your main Python file or a Python file in a pages/\nfolder). Arbitrary Python scripts cannot be passed to st.switch_page.
\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or st.Page", + "is_optional": false, + "is_kwarg_only": false, + "description": "The file path (relative to the main script) or an st.Page indicating\nthe page to switch to.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/commands/execution_control.py#L159" + }, + "streamlit.table": { + "name": "table", + "signature": "st.table(data=None)", + "examples": "\n\n", + "description": "Example 1: Display a simple dataframe as a static table
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n np.random.randn(10, 5), columns=("col %d" % i for i in range(5))\n)\n\nst.table(df)\n\nExample 2: Display a table of Markdown strings
\n\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n {\n "Command": ["**st.table**", "*st.dataframe*"],\n "Type": ["`static`", "`interactive`"],\n "Docs": [\n "[:rainbow[docs]](https://docs.streamlit.io/develop/api-reference/data/st.dataframe)",\n "[:book:](https://docs.streamlit.io/develop/api-reference/data/st.table)",\n ],\n }\n)\nst.table(df)\n\n
Display a static table.
\nWhile st.dataframe is geared towards large datasets and interactive\ndata exploration, st.table is useful for displaying small, styled\ntables without sorting or scrolling. For example, st.table may be\nthe preferred way to display a confusion matrix or leaderboard.\nAdditionally, st.table supports Markdown.
\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "The table data.
\nAll cells including the index and column headers can optionally\ncontain GitHub-flavored Markdown. Syntax information can be found\nat: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/arrow.py#L651" + }, + "streamlit.tabs": { + "name": "tabs", + "signature": "st.tabs(tabs)", + "examples": "\n\n", + "description": "You can use the 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)\nwith tab2:\n st.header("A dog")\n st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\nwith tab3:\n st.header("An owl")\n st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n\nOr you can just call methods directly on 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
Insert containers separated into tabs.
\nInserts a number of multi-element containers as tabs.\nTabs are a navigational element that allows users to easily\nmove between groups of related content.
\nTo add elements to the returned containers, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.
\nWarning
\nAll the content of every tab is always sent to and rendered on the frontend.\nConditional rendering is currently not supported.
\nCreates a tab for each string in the list. The first tab is selected\nby default. The string is used as the name of the tab and can\noptionally contain GitHub-flavored Markdown of the following types:\nBold, Italics, Strikethroughs, Inline Code, Links, and Images.\nImages display like icons, with a max height equal to the font\nheight.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + } + ], + "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.45.1/lib/streamlit/elements/layouts.py#L383" + }, + "streamlit.text": { + "name": "text", + "signature": "st.text(body, *, help=None)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.text("This is text\\n[and more text](that's not a Markdown link).")\n\n
Write text without Markdown or HTML parsing.
\nFor monospace text, use st.code.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The string to display.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the text. If this is None\n(default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/text.py#L29" + }, + "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\n", + "description": "\nimport streamlit as st\n\ntxt = st.text_area(\n "Text to analyze",\n "It was the best of times, it was the worst of times, it was the age of "\n "wisdom, it was the age of foolishness, it was the epoch of belief, it "\n "was the epoch of incredulity, it was the season of Light, it was the "\n "season of Darkness, it was the spring of hope, it was the winter of "\n "despair, (...)",\n)\n\nst.write(f"You wrote {len(txt)} characters.")\n\n
Display a multi-line text input widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "object or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text value of this widget when it first renders. This will be\ncast to str internally. If None, will initialize empty and\nreturn None until the user provides input. Defaults to empty string.
\n", + "default": "empty" + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Desired height of the UI element expressed in pixels. If this is\nNone (default), the widget's initial height fits three lines.\nThe height must be at least 68 pixels, which fits two lines.
\n", + "default": null + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Maximum number of characters allowed in text area.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this text_area's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": true, + "description": "An optional string displayed when the text area is empty. If None,\nno text is displayed.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the text area if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str or None", + "is_generator": false, + "description": "The current value of the text area widget or None if no value has been\nprovided by the user.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/text_widgets.py#L421" + }, + "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\", icon=None)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\ntitle = st.text_input("Movie title", "Life of Brian")\nst.write("The current movie title is", title)\n\n
Display a single-line text input widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "object or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text value of this widget when it first renders. This will be\ncast to str internally. If None, will initialize empty and\nreturn None until the user provides input. Defaults to empty string.
\n", + "default": "empty" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "Max number of characters allowed in text input.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"default\" or \"password\"", + "is_optional": false, + "is_kwarg_only": 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 or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "autocomplete", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": false, + "description": "An optional callback invoked when this text input's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": 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, + "is_kwarg_only": true, + "description": "An optional string displayed when the text input is empty. If None,\nno text is displayed.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the text input if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.
\n", + "default": "is" + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display within the input field to the\nleft of the value. If icon is None (default), no icon is\ndisplayed. If icon is a string, the following options are\nvalid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.
\nThe current value of the text input widget or None if no value has been\nprovided by the user.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/text_widgets.py#L118" + }, + "streamlit.time_input": { + "name": "time_input", + "signature": "st.time_input(label, value=\"now\", key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", step=0:15:00)", + "example": "\n\n", + "description": "\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\nTo initialize an empty time input, use None as the value:
\n\nimport datetime\nimport streamlit as st\n\nt = st.time_input("Set an alarm for", value=None)\nst.write("Alarm is set for", t)\n\n
Display a time input widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this time input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "\"now\", datetime.time, datetime.datetime, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The value of this widget when it first renders. This can be one of\nthe following:
\nAn 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this time_input's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the time input if set to\nTrue. The default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + }, + { + "name": "step", + "type_name": "int or timedelta", + "is_optional": false, + "is_kwarg_only": true, + "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 or None", + "is_generator": false, + "description": "The current value of the time input widget or None if no time has been\nselected.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/time_widgets.py#L348" + }, + "streamlit.title": { + "name": "title", + "signature": "st.title(body, anchor=None, *, help=None)", + "examples": "\n\n", + "description": "\nimport streamlit as st\n\nst.title("This is a title")\nst.title("_Streamlit_ is :blue[cool] :sunglasses:")\n\n
Display text in title formatting.
\nEach document should have a single st.title(), although this is not\nenforced.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": 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 or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A tooltip that gets displayed next to the title. If this is\nNone (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/heading.py#L187" + }, + "streamlit.toast": { + "name": "toast", + "signature": "st.toast(body, *, icon=None)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.toast('Your edited image was saved!', icon='\ud83d\ude0d')\n\n
Display a short message, known as a notification "toast".
\nThe toast appears in the app's top-right corner and disappears after four seconds.
\nWarning
\nst.toast is not compatible with Streamlit's caching and\ncannot be called within a cached function.
\nThe string to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the alert. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\n\n\n", + "description": "\nimport streamlit as st\n\non = st.toggle("Activate feature")\n\nif on:\n st.write("Feature activated!")\n\n
Display a toggle widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "A short label explaining to the user what this toggle is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.
\nUnsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\nFor accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.
\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Preselect the toggle when it first renders. This will be\ncast to bool internally.
\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": 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. No two widgets may have the same key.
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional callback invoked when this toggle's value changes.
\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional tuple of args to pass to the callback.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "An optional dict of kwargs to pass to the callback.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional boolean that disables the toggle if set to True.\nThe default is False.
\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget alligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.
\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "Whether or not the toggle is checked.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/widgets/checkbox.py#L170" + }, + "streamlit.vega_lite_chart": { + "name": "vega_lite_chart", + "signature": "st.vega_lite_chart(data=None, spec=None, *, use_container_width=None, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=None, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(200, 3), columns=["a", "b", "c"])\n\nst.vega_lite_chart(\n chart_data,\n {\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\nExamples 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
Display a chart using the Vega-Lite library.
\nVega-Lite is a high-level\ngrammar for defining interactive graphics.
\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "Either the data to be plotted or a Vega-Lite spec containing the\ndata (which more closely follows the Vega-Lite API).
\n", + "default": null + }, + { + "name": "spec", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The Vega-Lite spec for the chart. If spec is None (default),\nStreamlit uses the spec passed in data. You cannot pass a spec\nto both data and spec. See\nhttps://vega.github.io/vega-lite/docs/ for more info.
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:
\nThe theme of the chart. If theme is "streamlit" (default),\nStreamlit uses its own design default. If theme is None,\nStreamlit falls back to the default behavior of the library.
\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional string to use for giving this element a stable\nidentity. If key is None (default), this element's identity\nwill be determined based on the values of the other parameters.
\nAdditionally, if selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.
\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\non_select can be one of the following:
\nTo use selection events, the Vega-Lite spec defined in data or\nspec must include selection parameters from the charting\nlibrary. To learn about defining interactions in Vega-Lite, see\nDynamic Behaviors with Parameters\nin Vega-Lite's documentation.
\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "str or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "The selection parameters Streamlit should use. If\nselection_mode is None (default), Streamlit will use all\nselection parameters defined in the chart's Vega-Lite spec.
\nWhen Streamlit uses a selection parameter, selections from that\nparameter will trigger a rerun and be included in the selection\nstate. When Streamlit does not use a selection parameter,\nselections from that parameter will not trigger a rerun and not be\nincluded in the selection state.
\nSelection parameters are identified by their name property.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "The Vega-Lite spec for the chart as keywords. This is an alternative\nto spec.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element that can be used with\nthe .add_rows() method. Otherwise, this command returns a\ndictionary-like object that supports both key and attribute\nnotation. The attributes are described by the VegaLiteState\ndictionary schema.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L1661" + }, + "streamlit.video": { + "name": "video", + "signature": "st.video(data, format=\"video/mp4\", start_time=0, *, subtitles=None, end_time=None, loop=False, autoplay=False, muted=False)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nvideo_file = open("myvideo.mp4", "rb")\nvideo_bytes = video_file.read()\n\nst.video(video_bytes)\n\nWhen you include subtitles, they will be turned on by default. A viewer\ncan turn off the subtitles (or captions) from the browser's default video\ncontrol menu, usually located in the lower-right corner of the video.
\nHere is a simple VTT file (subtitles.vtt):
\n\nWEBVTT\n\n0:00:01.000 --> 0:00:02.000\nLook!\n\n0:00:03.000 --> 0:00:05.000\nLook at the pretty stars!\n\nIf the above VTT file lives in the same directory as your app, you can\nadd subtitles like so:
\n\nimport streamlit as st\n\nVIDEO_URL = "https://example.com/not-youtube.mp4"\nst.video(VIDEO_URL, subtitles="subtitles.vtt")\n\nSee additional examples of supported subtitle input types in our\nvideo subtitles feature demo.
\n\n\nNote
\nSome 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
Display a video player.
\n", + "args": [ + { + "name": "data", + "type_name": "str, Path, bytes, io.BytesIO, numpy.ndarray, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "The video to play. This can be one of the following:
\nThe MIME type for the video file. This defaults to "video/mp4".\nFor more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.
\n", + "default": "s" + }, + { + "name": "start_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The time from which the element should start playing. This can be\none of the following:
\nOptional subtitle data for the video, supporting several input types:
\nWhen provided, subtitles are displayed by default. For multiple\ntracks, the first one is displayed by default. If you don't want any\nsubtitles displayed by default, use an empty string for the value\nin a dictrionary's first pair: {"None": "", "English": "path/to/english.vtt"}
\nNot supported for YouTube videos.
\n", + "default": null + }, + { + "name": "end_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The time at which the element should stop playing. This can be\none of the following:
\nWhether the video should loop playback.
\n", + "default": null + }, + { + "name": "autoplay", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the video should start playing automatically. This is\nFalse by default. Browsers will not autoplay unmuted videos\nif the user has not interacted with the page by clicking somewhere.\nTo enable autoplay without user interaction, you must also set\nmuted=True.
\n", + "default": null + }, + { + "name": "muted", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the video should play with the audio silenced. This is\nFalse by default. Use this in conjunction with autoplay=True\nto enable autoplay without user interaction.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/media.py#L213" + }, + "streamlit.warning": { + "name": "warning", + "signature": "st.warning(body, *, icon=None, width=\"stretch\")", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nst.warning('This is a warning', icon="\u26a0\ufe0f")\n\n
Display warning message.
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.
\nSee the body parameter of st.markdown for additional,\nsupported Markdown directives.
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional emoji or icon to display next to the alert. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:
\nA single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.
\nAn icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.
\nFor example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.
\nThe desired width of the alert expressed in pixels. If this is\n"stretch" (default), Streamlit sets the width of the alert to\nmatch the width of the parent container. Otherwise, this must be an\ninteger. If the specified width is greater than the width of the\nparent container, Streamlit sets the width of the alert to match\nthe width of the parent container.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/alert.py#L103" + }, + "streamlit.write": { + "name": "write", + "signature": "st.write(*args, unsafe_allow_html=False, **kwargs)", + "examples": "\n\n", + "description": "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\nAs 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(\n pd.DataFrame(\n {\n "first column": [1, 2, 3, 4],\n "second column": [10, 20, 30, 40],\n }\n )\n)\n\nFinally, 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\nOh, 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(np.random.randn(200, 3), columns=["a", "b", "c"])\nc = (\n alt.Chart(df)\n .mark_circle()\n .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"])\n)\n\nst.write(c)\n\n
Displays arguments in the app.
\nThis is the Swiss Army knife of Streamlit commands: it does different\nthings depending on what you throw at it. Unlike other Streamlit\ncommands, st.write() has some unique properties:
\nOne or many objects to display in the app.
\nType | \nHandling | \n
---|---|
str | \nUses st.markdown(). | \n
dataframe-like, dict, or list | \nUses st.dataframe(). | \n
Exception | \nUses st.exception(). | \n
function, module, or class | \nUses st.help(). | \n
DeltaGenerator | \nUses st.help(). | \n
Altair chart | \nUses st.altair_chart(). | \n
Bokeh figure | \nUses st.bokeh_chart(). | \n
Graphviz graph | \nUses st.graphviz_chart(). | \n
Keras model | \nConverts model and uses st.graphviz_chart(). | \n
Matplotlib figure | \nUses st.pyplot(). | \n
Plotly figure | \nUses st.plotly_chart(). | \n
PIL.Image | \nUses st.image(). | \n
generator or stream (like openai.Stream) | \nUses st.write_stream(). | \n
SymPy expression | \nUses st.latex(). | \n
An object with ._repr_html() | \nUses st.html(). | \n
Database cursor | \nDisplays DB API 2.0 cursor results in a table. | \n
Any | \nDisplays str(arg) as inline code. | \n
Whether to render HTML within *args. This only applies to\nstrings or objects falling back on _repr_html_(). If this is\nFalse (default), any HTML tags found in body will be\nescaped and therefore treated as raw text. If this is True, any\nHTML expressions within body will be rendered.
\nAdding custom HTML to your app impacts safety, styling, and\nmaintainability.
\nNote
\nIf you only want to insert HTML or CSS without Markdown text,\nwe recommend using st.html instead.
\nKeyword arguments. Not used.
\n", + "default": null, + "deprecated": { + "deprecated": true, + "deprecatedText": "**kwargs is deprecated and will be removed in a later version.\nUse other, more specific Streamlit commands to pass additional\nkeyword arguments.
\n" + } + } + ], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/write.py#L255" + }, + "streamlit.write_stream": { + "name": "write_stream", + "signature": "st.write_stream(stream)", + "example": "\n\n", + "description": "You can pass an OpenAI stream as shown in our tutorial, Build a basic LLM chat app. Alternatively,\nyou can pass a generic generator function as input:
\n\nimport time\nimport numpy as np\nimport pandas as pd\nimport streamlit as st\n\n_LOREM_IPSUM = """\nLorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor\nincididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\nnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n"""\n\n\ndef stream_data():\n for word in _LOREM_IPSUM.split(" "):\n yield word + " "\n time.sleep(0.02)\n\n yield pd.DataFrame(\n np.random.randn(5, 10),\n columns=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"],\n )\n\n for word in _LOREM_IPSUM.split(" "):\n yield word + " "\n time.sleep(0.02)\n\n\nif st.button("Stream data"):\n st.write_stream(stream_data)\n\n
Stream a generator, iterable, or stream-like sequence to the app.
\nst.write_stream iterates through the given sequences and writes all\nchunks to the app. String chunks will be written using a typewriter effect.\nOther data types will be written using st.write.
\n", + "args": [ + { + "name": "stream", + "type_name": "Callable, Generator, Iterable, OpenAI Stream, or LangChain Stream", + "is_optional": false, + "is_kwarg_only": false, + "description": "The generator or iterable to stream.
\nIf you pass an async generator, Streamlit will internally convert\nit to a sync generator.
\nNote
\nTo use additional LLM libraries, you can create a wrapper to\nmanually define a generator function and include custom output\nparsing.
\nThe full response. If the streamed output only contains text, this\nis a string. Otherwise, this is a list of all the streamed objects.\nThe return value is fully compatible as input for st.write.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/write.py#L69" + }, + "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.45.1/lib/streamlit/runtime/caching/cache_data_api.py#L593" + }, + "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.45.1/lib/streamlit/runtime/caching/cache_resource_api.py#L442" + }, + "streamlit.query_params.clear": { + "name": "clear", + "signature": "st.query_params.clear()", + "description": "Clear all query parameters from the URL of the app.
\n", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/state/query_params_proxy.py#L135" + }, + "streamlit.query_params.from_dict": { + "name": "from_dict", + "signature": "st.query_params.from_dict(params)", + "example": "\nimport streamlit as st\n\nst.query_params.from_dict({"foo": "bar", "baz": [1, "two"]})\n\n", + "description": "
Set all of the query parameters from a dictionary or dictionary-like object.
\nThis method primarily exists for advanced users who want to control\nmultiple query parameters in a single update. To set individual query\nparameters, use key or attribute notation instead.
\nThis method inherits limitations from st.query_params and can't be\nused to set embedding options as described in Embed your app.
\nTo handle repeated keys, the value in a key-value pair should be a list.
\nNote
\n.from_dict() is not a direct inverse of .to_dict() if\nyou are working with repeated keys. A true inverse operation is\n{key: st.query_params.get_all(key) for key in st.query_params}.
\nA dictionary used to replace the current query parameters.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/state/query_params_proxy.py#L177" + }, + "streamlit.query_params.get_all": { + "name": "get_all", + "signature": "st.query_params.get_all(key)", + "description": "Get a list of all query parameter values associated to a given key.
\nWhen a key is repeated as a query parameter within the URL, this method\nallows all values to be obtained. In contrast, dict-like methods only\nretrieve the last value when a key is repeated in the URL.
\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label of the query parameter in the URL.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "List[str]", + "is_generator": false, + "description": "A list of values associated to the given key. May return zero, one,\nor multiple values.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/state/query_params_proxy.py#L112" + }, + "streamlit.query_params.to_dict": { + "name": "to_dict", + "signature": "st.query_params.to_dict()", + "description": "Get all query parameters as a dictionary.
\nThis method primarily exists for internal use and is not needed for\nmost cases. st.query_params returns an object that inherits from\ndict by default.
\nWhen a key is repeated as a query parameter within the URL, this method\nwill return only the last value of each unique key.
\n", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "A dictionary of the current query paramters in the app's URL.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/state/query_params_proxy.py#L147" + }, + "streamlit.query_params.update": { + "name": "update", + "signature": "st.query_params.update(other=(), /, **kwds)", + "description": "Update one or more values in query_params at once from a dictionary or
\ndictionary-like object.
\nSee Mapping.update() from Python's collections library.
\n", + "args": [ + { + "name": "other", + "type_name": "SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]", + "is_optional": false, + "is_kwarg_only": false, + "description": "A dictionary or mapping of strings to strings.
\n", + "default": null + }, + { + "name": "**kwds", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "Additional key/value pairs to update passed as keyword arguments.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/state/query_params_proxy.py#L90" + }, + "streamlit.connections.BaseConnection": { + "name": "BaseConnection", + "signature": "st.connections.BaseConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L27", + "description": "The abstract base class that all Streamlit Connections must inherit from.
\nThis base class provides connection authors with a standardized way to hook into the\nst.connection() factory function: connection authors are required to provide an\nimplementation for the abstract method _connect in their subclasses.
\nAdditionally, 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
\nNote
\nWhile 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\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L27", + "description": "The abstract base class that all Streamlit Connections must inherit from.
\nThis base class provides connection authors with a standardized way to hook into the\nst.connection() factory function: connection authors are required to provide an\nimplementation for the abstract method _connect in their subclasses.
\nAdditionally, 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
\nNote
\nWhile 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.
\nCall .connect() on the underlying SQLAlchemy Engine, returning a new connection object.
", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.Connection", + "is_generator": false, + "description": "A new SQLAlchemy connection object.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L353" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query(\n "SELECT * FROM pet_owners WHERE owner = :owner",\n ttl=3600,\n params={"owner": "barbara"},\n)\nst.dataframe(df)\n\n
Run a read-only query.
", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The read-only SQL query to execute.
\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.
\n", + "default": "to" + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "description": "Column(s) to set as index(MultiIndex). Default is None.
\n", + "default": "None" + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "description": "Additional keyword arguments are passed to pandas.read_sql.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.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.45.1/lib/streamlit/connections/sql_connection.py#L223" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + } + ], + "properties": [ + { + "name": "driver", + "signature": "st.connections.driver.driver", + "description": "The name of the driver used by the underlying SQLAlchemy Engine.
", + "args": [], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "The name of the driver. For example, "pyodbc" or "psycopg2".
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L382" + }, + { + "name": "engine", + "signature": "st.connections.engine.engine", + "description": "The underlying SQLAlchemy Engine.
", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.base.Engine", + "is_generator": false, + "description": "The underlying SQLAlchemy Engine.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L369" + }, + { + "name": "session", + "signature": "st.connections.session.session", + "example": "\n\n", + "description": "\nimport streamlit as st\nconn = st.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
Return a SQLAlchemy Session.
", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.orm.Session", + "is_generator": false, + "description": "A SQLAlchemy Session.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L395" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L54", + "examples": "\n\n", + "description": "Example 1: Configuration with URL
\nYou can configure your SQL connection using Streamlit's\nSecrets management.\nThe following example specifies a SQL connection URL.
\n.streamlit/secrets.toml:
\n\n[connections.sql]\nurl = "xxx+xxx://xxx:xxx@xxx:xxx/xxx"\n\nYour app code:
\n\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n\nExample 2: Configuration with dialect, host, and username
\nIf you do not specify url, you must at least specify dialect,\nhost, and username instead. The following example also includes\npassword.
\n.streamlit/secrets.toml:
\n\n[connections.sql]\ndialect = "xxx"\nhost = "xxx"\nusername = "xxx"\npassword = "xxx"\n\nYour app code:
\n\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n\nExample 3: Configuration with keyword arguments
\nYou can configure your SQL connection with keyword arguments (with or\nwithout secrets.toml). For example, if you use Microsoft Entra ID with\na Microsoft Azure SQL server, you can quickly set up a local connection for\ndevelopment using interactive authentication.
\nThis example requires the Microsoft ODBC Driver for SQL Server\nfor Windows in addition to the sqlalchemy and pyodbc packages for\nPython.
\n\nimport streamlit as st\n\nconn = st.connection(\n "sql",\n dialect="mssql",\n driver="pyodbc",\n host="xxx.database.windows.net",\n database="xxx",\n username="xxx",\n query={\n "driver": "ODBC Driver 18 for SQL Server",\n "authentication": "ActiveDirectoryInteractive",\n "encrypt": "yes",\n },\n)\n\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n\n
A connection to a SQL database using a SQLAlchemy Engine.
\nInitialize this connection object using st.connection("sql") or\nst.connection("<name>", type="sql"). Connection parameters for a\nSQLConnection can be specified using secrets.toml and/or **kwargs.\nPossible connection parameters include:
\nIf url exists as a connection parameter, Streamlit will pass it to\nsqlalchemy.engine.make_url(). Otherwise, Streamlit requires (at a\nminimum) dialect, username, and host. Streamlit will use\ndialect and driver (if defined) to derive drivername, then pass\nthe relevant connection parameters to sqlalchemy.engine.URL.create().
\nIn addition to the default keyword arguments for sqlalchemy.create_engine(),\nyour dialect may accept additional keyword arguments. For example, if you\nuse dialect="snowflake" with Snowflake SQLAlchemy,\nyou can pass a value for private_key to use key-pair authentication. If\nyou use dialect="bigquery" with Google BigQuery,\nyou can pass a value for location.
\nSQLConnection provides the .query() convenience method, which can be\nused to run simple, read-only queries with both caching and simple error\nhandling/retries. More complex database interactions can be performed by\nusing the .session property to receive a regular SQLAlchemy Session.
\nImportant
\nSQLAlchemy must be installed\nin your environment to use this connection. You must also install your\ndriver, such as pyodbc or psycopg2.
\n\n\n", + "description": "The following example uses a cursor to insert multiple rows into a\ntable. The qmark parameter style is specified as an optional\nkeyword argument. Alternatively, the parameter style can be declared in\nyour connection configuration file. For more information, see the\nSnowflake Connector for Python documentation.
\n\nimport streamlit as st\n\nconn = st.connection("snowflake", "paramstyle"="qmark")\nrows_to_insert = [("Mary", "dog"), ("John", "cat"), ("Robert", "bird")]\nconn.cursor().executemany(\n "INSERT INTO mytable (name, pet) VALUES (?, ?)", rows_to_insert\n)\n\n
Create a new cursor object from this connection.
", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.cursor.SnowflakeCursor", + "is_generator": false, + "description": "A cursor object for the connection.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L455" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\nst.dataframe(df)\n\n
Run a read-only SQL query.
", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The read-only SQL query to execute.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of seconds to keep results in the cache. If this\nis None (default), cached results do not expire with time.
\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to enable the spinner. When a cached query is executed, no\nspinner is displayed because the result is immediately available.\nWhen a new query is executed, the default is to show a spinner with\nthe message "Running snowflake.query(...)."
\nIf this is False, no spinner displays while executing the\nquery. If this is a string, the string will be used as the message\nfor the spinner.
\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "List of parameters to pass to the Snowflake Connector for Python\nCursor.execute() method. This connector supports binding data\nto a SQL statement using qmark bindings. For more information and\nexamples, see the Snowflake Connector for Python documentation.\nThis defaults to None.
\n", + "default": "s" + } + ], + "returns": [ + { + "type_name": "pandas.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.45.1/lib/streamlit/connections/snowflake_connection.py#L277" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + }, + { + "name": "session", + "signature": "st.connections.session.session()", + "example": "\n\n", + "description": "The following example creates a new Snowpark session and uses it to run\na query.
\n\nimport streamlit as st\n\nconn = st.connection("snowflake")\nsession = conn.session()\ndf = session.sql("SELECT * FROM my_table").collect()\n\n
Create a new Snowpark session from this connection.
", + "args": [], + "returns": [ + { + "type_name": "snowflake.snowpark.Session", + "is_generator": false, + "description": "A new Snowpark session for this connection.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L527" + }, + { + "name": "write_pandas", + "signature": "st.connections.write_pandas.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "example": "\n\n", + "description": "The following example uses the database and schema currently in use in\nthe session and copies the data into a table named "my_table."
\n\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n {"Name": ["Mary", "John", "Robert"], "Pet": ["dog", "cat", "bird"]}\n)\nconn = st.connection("snowflake")\nconn.write_pandas(df, "my_table")\n\n
Write a pandas.DataFrame to a table in a Snowflake database.
", + "args": [ + { + "name": "df", + "type_name": "pandas.DataFrame", + "is_optional": false, + "is_kwarg_only": false, + "description": "The pandas.DataFrame object containing the data to be copied\ninto the table.
\n", + "default": null + }, + { + "name": "table_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "Name of the table where the data should be copied to.
\n", + "default": null + }, + { + "name": "database", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "Name of the database containing the table. By default, the function\nwrites to the database that is currently in use in the session.
\nNote
\nIf you specify this parameter, you must also specify the schema\nparameter.
\nName of the schema containing the table. By default, the function\nwrites to the table in the schema that is currently in use in the\nsession.
\n", + "default": null + }, + { + "name": "chunk_size", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "Number of elements to insert at a time. By default, the function\ninserts all elements in one chunk.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "Additional keyword arguments for\nsnowflake.connector.pandas_tools.write_pandas().
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "A tuple containing three values:
\n\n\n", + "description": "The following example uses a cursor to submit an asynchronous query,\nsaves the query ID, then periodically checks the query status through\nthe connection before retrieving the results.
\n\nimport streamlit as st\nimport time\n\nconn = st.connection("snowflake")\ncur = conn.cursor()\ncur.execute_async("SELECT * FROM my_table")\nquery_id = cur.sfqid\nwhile True:\n status = conn.raw_connection.get_query_status(query_id)\n if conn.raw_connection.is_still_running(status):\n time.sleep(1)\n else:\n break\ncur.get_results_from_sfqid(query_id)\ndf = cur.fetchall()\n\n
Access the underlying connection object from the Snowflake Connector for Python.
", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.connection.SnowflakeConnection", + "is_generator": false, + "description": "The connection object.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L488" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L45", + "examples": "\n\n", + "description": "Example 1: Configuration with Streamlit secrets
\nYou can configure your Snowflake connection using Streamlit's\nSecrets management.\nFor example, if you have MFA enabled on your account, you can connect using\nkey-pair authentication.
\n.streamlit/secrets.toml:
\n\n[connections.snowflake]\naccount = "xxx-xxx"\nuser = "xxx"\nprivate_key_file = "/xxx/xxx/xxx.p8"\nrole = "xxx"\nwarehouse = "xxx"\ndatabase = "xxx"\nschema = "xxx"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n\nExample 2: Configuration with keyword arguments and external authentication
\nYou can configure your Snowflake connection with keyword arguments. The\nkeyword arguments are merged with (and take precedence over) the values in\nsecrets.toml. However, if you name your connection "snowflake" and\ndon't have a [connections.snowflake] dictionary in your\nsecrets.toml file, Streamlit will ignore any keyword arguments and use\nthe default Snowflake connection as described in Example 5 and Example 6.\nTo configure your connection using only keyword arguments, declare a name\nfor the connection other than "snowflake".
\nFor example, if your Snowflake account supports SSO, you can set up a quick\nlocal connection for development using browser-based SSO.\nBecause there is nothing configured in secrets.toml, the name is an\nempty string and the type is set to "snowflake". This prevents\nStreamlit from ignoring the keyword arguments and using a default\nSnowflake connection.
\n\nimport streamlit as st\nconn = st.connection(\n "",\n type="snowflake",\n account="xxx-xxx",\n user="xxx",\n authenticator="externalbrowser",\n)\ndf = conn.query("SELECT * FROM my_table")\n\nExample 3: Named connection with Snowflake's connection configuration file
\nSnowflake's Python Connector supports a connection configuration file,\nwhich is well integrated with Streamlit's SnowflakeConnection. If you\nalready have one or more connections configured, all you need to do is pass\nthe name of the connection to use.
\n~/.snowflake/connections.toml:
\n\n[my_connection]\naccount = "xxx-xxx"\nuser = "xxx"\npassword = "xxx"\nwarehouse = "xxx"\ndatabase = "xxx"\nschema = "xxx"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection("my_connection", type="snowflake")\ndf = conn.query("SELECT * FROM my_table")\n\nExample 4: Named connection with Streamlit secrets and Snowflake's connection configuration file
\nIf you have a Snowflake configuration file with a connection named\nmy_connection as in Example 3, you can pass the connection name through\nsecrets.toml.
\n.streamlit/secrets.toml:
\n\n[connections.snowflake]\nconnection_name = "my_connection"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n\nExample 5: Default connection with an environment variable
\nIf you don't have a [connections.snowflake] dictionary in your\nsecrets.toml file and use st.connection("snowflake"), Streamlit\nwill use the default connection for the Snowflake Python Connector.
\nIf you have a Snowflake configuration file with a connection named\nmy_connection as in Example 3, you can set an environment variable to\ndeclare it as the default Snowflake connection.
\n\nSNOWFLAKE_DEFAULT_CONNECTION_NAME = "my_connection"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n\nExample 6: Default connection in Snowflake's connection configuration file
\nIf you have a Snowflake configuration file that defines your default\nconnection, Streamlit will automatically use it if no other connection is\ndeclared.
\n~/.snowflake/connections.toml:
\n\n[default]\naccount = "xxx-xxx"\nuser = "xxx"\npassword = "xxx"\nwarehouse = "xxx"\ndatabase = "xxx"\nschema = "xxx"\n\nYour app code:
\n\nimport streamlit as st\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n\n
A connection to Snowflake using the Snowflake Connector for Python.
\nInitialize this connection object using st.connection("snowflake") or\nst.connection("<name>", type="snowflake"). Connection parameters for a\nSnowflakeConnection can be specified using secrets.toml and/or\n**kwargs. Connection parameters are passed to\nsnowflake.connector.connect().
\nWhen an app is running in Streamlit in Snowflake,\nst.connection("snowflake") connects automatically using the app owner's\nrole without further configuration. **kwargs will be ignored in this\ncase. Use secrets.toml and **kwargs to configure your connection\nfor local development.
\nSnowflakeConnection includes several convenience methods. For example, you\ncan directly execute a SQL query with .query() or access the underlying\nSnowflake Connector object with .raw_connection.
\nTip
\nsnowflake-snowpark-python\nmust be installed in your environment to use this connection. You can\ninstall Snowflake extras along with Streamlit:
\n\n>>> pip install streamlit[snowflake]\n\n
Important
\nAccount identifiers must be of the form <orgname>-<account_name>\nwhere <orgname> is the name of your Snowflake organization and\n<account_name> is the unique name of your account within your\norganization. This is dash-separated, not dot-separated like when used\nin SQL queries. For more information, see Account identifiers.
\n\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("snowpark")\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n\n
Run a read-only SQL query.
", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The read-only SQL query to execute.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": 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": "pandas.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.45.1/lib/streamlit/connections/snowpark_connection.py#L96" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + }, + { + "name": "safe_session", + "signature": "st.connections.safe_session.safe_session()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("snowpark")\nwith conn.safe_session() as session:\n df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n\n
Grab the underlying Snowpark session in a thread-safe manner.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowpark_connection.py#L189" + } + ], + "properties": [ + { + "name": "session", + "signature": "st.connections.session.session", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nsession = st.connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n\n
Access the underlying Snowpark session.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowpark_connection.py#L166" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowpark_connection.py#L48", + "description": "A connection to Snowpark using snowflake.snowpark.session.Session. Initialize using
\nst.connection("<name>", type="snowpark").
\nIn addition to providing access to the Snowpark Session, SnowparkConnection supports\ndirect SQL querying using query("...") and thread safe access using\nwith conn.safe_session():. See methods below for more information.\nSnowparkConnections should always be created using st.connection(), not\ninitialized directly.
\nNote
\nWe 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.
\nCall .connect() on the underlying SQLAlchemy Engine, returning a new connection object.
\nCalling this method is equivalent to calling self._instance.connect().
\nNOTE: This method should not be confused with the internal _connect method used\nto implement a Streamlit Connection.
\n", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.Connection", + "is_generator": false, + "description": "A new SQLAlchemy connection object.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L353" + }, + "streamlit.connections.SQLConnection.driver": { + "name": "driver", + "signature": "SQLConnection.driver", + "description": "The name of the driver used by the underlying SQLAlchemy Engine.
\nThis is equivalent to accessing self._instance.driver.
\n", + "args": [], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "The name of the driver. For example, "pyodbc" or "psycopg2".
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L382" + }, + "streamlit.connections.SQLConnection.engine": { + "name": "engine", + "signature": "SQLConnection.engine", + "description": "The underlying SQLAlchemy Engine.
\nThis is equivalent to accessing self._instance.
\n", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.base.Engine", + "is_generator": false, + "description": "The underlying SQLAlchemy Engine.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L369" + }, + "streamlit.connections.SQLConnection.query": { + "name": "query", + "signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query(\n "SELECT * FROM pet_owners WHERE owner = :owner",\n ttl=3600,\n params={"owner": "barbara"},\n)\nst.dataframe(df)\n\n
Run a read-only query.
\nThis method implements query result caching and simple error\nhandling/retries. The caching behavior is identical to that of using\n@st.cache_data.
\nNote
\nQueries that are run without a specified ttl are cached indefinitely.
\nAll keyword arguments passed to this function are passed down to\npandas.read_sql, except ttl.
\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The read-only SQL query to execute.
\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.
\n", + "default": "to" + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "description": "Column(s) to set as index(MultiIndex). Default is None.
\n", + "default": "None" + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "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, + "is_kwarg_only": true, + "description": "Additional keyword arguments are passed to pandas.read_sql.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.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.45.1/lib/streamlit/connections/sql_connection.py#L223" + }, + "streamlit.connections.SQLConnection.reset": { + "name": "reset", + "signature": "SQLConnection.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
\nThis 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": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + }, + "streamlit.connections.SQLConnection.session": { + "name": "session", + "signature": "SQLConnection.session", + "example": "\n\n", + "description": "\nimport streamlit as st\nconn = st.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
Return a SQLAlchemy Session.
\nUsers of this connection should use the contextmanager pattern for writes,\ntransactions, and anything more complex than simple read queries.
\nSee 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": [ + { + "type_name": "sqlalchemy.orm.Session", + "is_generator": false, + "description": "A SQLAlchemy Session.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/sql_connection.py#L395" + }, + "streamlit.connections.SnowparkConnection.query": { + "name": "query", + "signature": "SnowparkConnection.query(sql, ttl=None)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("snowpark")\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n\n
Run a read-only SQL query.
\nThis method implements both query result caching (with caching behavior\nidentical to that of using @st.cache_data) as well as simple error handling/retries.
\nNote
\nQueries that are run without a specified ttl are cached indefinitely.
\nThe read-only SQL query to execute.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": 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": "pandas.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.45.1/lib/streamlit/connections/snowpark_connection.py#L96" + }, + "streamlit.connections.SnowparkConnection.reset": { + "name": "reset", + "signature": "SnowparkConnection.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
\nThis 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": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + }, + "streamlit.connections.SnowparkConnection.safe_session": { + "name": "safe_session", + "signature": "SnowparkConnection.safe_session()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("snowpark")\nwith conn.safe_session() as session:\n df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n\n
Grab the underlying Snowpark session in a thread-safe manner.
\nAs 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.
\nInformation on how to use Snowpark sessions can be found in the Snowpark documentation.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowpark_connection.py#L189" + }, + "streamlit.connections.SnowparkConnection.session": { + "name": "session", + "signature": "SnowparkConnection.session", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nsession = st.connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n\n
Access the underlying Snowpark session.
\nNote
\nSnowpark 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.
\nInformation on how to use Snowpark sessions can be found in the Snowpark documentation.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowpark_connection.py#L166" + }, + "streamlit.connections.SnowflakeConnection.cursor": { + "name": "cursor", + "signature": "SnowflakeConnection.cursor()", + "example": "\n\n", + "description": "The following example uses a cursor to insert multiple rows into a\ntable. The qmark parameter style is specified as an optional\nkeyword argument. Alternatively, the parameter style can be declared in\nyour connection configuration file. For more information, see the\nSnowflake Connector for Python documentation.
\n\nimport streamlit as st\n\nconn = st.connection("snowflake", "paramstyle"="qmark")\nrows_to_insert = [("Mary", "dog"), ("John", "cat"), ("Robert", "bird")]\nconn.cursor().executemany(\n "INSERT INTO mytable (name, pet) VALUES (?, ?)", rows_to_insert\n)\n\n
Create a new cursor object from this connection.
\nSnowflake Connector cursors implement the Python Database API v2.0\nspecification (PEP-249). For more information, see the\nSnowflake Connector for Python documentation.
\n", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.cursor.SnowflakeCursor", + "is_generator": false, + "description": "A cursor object for the connection.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L455" + }, + "streamlit.connections.SnowflakeConnection.query": { + "name": "query", + "signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\nst.dataframe(df)\n\n
Run a read-only SQL query.
\nThis method implements query result caching and simple error\nhandling/retries. The caching behavior is identical to that of using\n@st.cache_data.
\nNote
\nQueries that are run without a specified ttl are cached\nindefinitely.
\nThe read-only SQL query to execute.
\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of seconds to keep results in the cache. If this\nis None (default), cached results do not expire with time.
\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether to enable the spinner. When a cached query is executed, no\nspinner is displayed because the result is immediately available.\nWhen a new query is executed, the default is to show a spinner with\nthe message "Running snowflake.query(...)."
\nIf this is False, no spinner displays while executing the\nquery. If this is a string, the string will be used as the message\nfor the spinner.
\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "List of parameters to pass to the Snowflake Connector for Python\nCursor.execute() method. This connector supports binding data\nto a SQL statement using qmark bindings. For more information and\nexamples, see the Snowflake Connector for Python documentation.\nThis defaults to None.
\n", + "default": "s" + } + ], + "returns": [ + { + "type_name": "pandas.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.45.1/lib/streamlit/connections/snowflake_connection.py#L277" + }, + "streamlit.connections.SnowflakeConnection.raw_connection": { + "name": "raw_connection", + "signature": "SnowflakeConnection.raw_connection", + "example": "\n\n", + "description": "The following example uses a cursor to submit an asynchronous query,\nsaves the query ID, then periodically checks the query status through\nthe connection before retrieving the results.
\n\nimport streamlit as st\nimport time\n\nconn = st.connection("snowflake")\ncur = conn.cursor()\ncur.execute_async("SELECT * FROM my_table")\nquery_id = cur.sfqid\nwhile True:\n status = conn.raw_connection.get_query_status(query_id)\n if conn.raw_connection.is_still_running(status):\n time.sleep(1)\n else:\n break\ncur.get_results_from_sfqid(query_id)\ndf = cur.fetchall()\n\n
Access the underlying connection object from the Snowflake Connector for Python.
\nFor information on how to use the Snowflake Connector for Python, see\nthe Snowflake Connector for Python documentation.
\n", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.connection.SnowflakeConnection", + "is_generator": false, + "description": "The connection object.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L488" + }, + "streamlit.connections.SnowflakeConnection.reset": { + "name": "reset", + "signature": "SnowflakeConnection.reset()", + "example": "\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
\nThis 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": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + }, + "streamlit.connections.SnowflakeConnection.session": { + "name": "session", + "signature": "SnowflakeConnection.session()", + "example": "\n\n", + "description": "The following example creates a new Snowpark session and uses it to run\na query.
\n\nimport streamlit as st\n\nconn = st.connection("snowflake")\nsession = conn.session()\ndf = session.sql("SELECT * FROM my_table").collect()\n\n
Create a new Snowpark session from this connection.
\nFor information on how to use Snowpark sessions, see the\nSnowpark developer guide\nand Snowpark API Reference.
\n", + "args": [], + "returns": [ + { + "type_name": "snowflake.snowpark.Session", + "is_generator": false, + "description": "A new Snowpark session for this connection.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/snowflake_connection.py#L527" + }, + "streamlit.connections.SnowflakeConnection.write_pandas": { + "name": "write_pandas", + "signature": "SnowflakeConnection.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "example": "\n\n", + "description": "The following example uses the database and schema currently in use in\nthe session and copies the data into a table named "my_table."
\n\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n {"Name": ["Mary", "John", "Robert"], "Pet": ["dog", "cat", "bird"]}\n)\nconn = st.connection("snowflake")\nconn.write_pandas(df, "my_table")\n\n
Write a pandas.DataFrame to a table in a Snowflake database.
\nThis convenience method is a thin wrapper around\nsnowflake.connector.pandas_tools.write_pandas() using the\nunderlying connection. The conn parameter is passed automatically.\nFor more information and additional keyword arguments, see the\nSnowflake Connector for Python documentation.
\n", + "args": [ + { + "name": "df", + "type_name": "pandas.DataFrame", + "is_optional": false, + "is_kwarg_only": false, + "description": "The pandas.DataFrame object containing the data to be copied\ninto the table.
\n", + "default": null + }, + { + "name": "table_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "Name of the table where the data should be copied to.
\n", + "default": null + }, + { + "name": "database", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "Name of the database containing the table. By default, the function\nwrites to the database that is currently in use in the session.
\nNote
\nIf you specify this parameter, you must also specify the schema\nparameter.
\nName of the schema containing the table. By default, the function\nwrites to the table in the schema that is currently in use in the\nsession.
\n", + "default": null + }, + { + "name": "chunk_size", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "Number of elements to insert at a time. By default, the function\ninserts all elements in one chunk.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "Additional keyword arguments for\nsnowflake.connector.pandas_tools.write_pandas().
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "A tuple containing three values:
\n\n\n", + "description": "\nimport streamlit as st\n\nconn = st.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
Reset this connection so that it gets reinitialized the next time it's used.
\nThis 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": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/connections/base_connection.py#L121" + }, + "streamlit.column_config.AreaChartColumn": { + "name": "AreaChartColumn", + "signature": "st.column_config.AreaChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.AreaChartColumn(\n "Sales (last 6 months)",\n width="medium",\n help="The sales volume in the last 6 months",\n y_min=0,\n y_max=100,\n ),\n },\n hide_index=True,\n)\n\n
Configure an area chart column in st.dataframe or st.data_editor.
\nCells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the column_config parameter\nof st.dataframe or st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the minimum of its data.
\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the maximum of its data.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1209" + }, + "streamlit.column_config.BarChartColumn": { + "name": "BarChartColumn", + "signature": "st.column_config.BarChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.BarChartColumn(\n "Sales (last 6 months)",\n help="The sales volume in the last 6 months",\n y_min=0,\n y_max=100,\n ),\n },\n hide_index=True,\n)\n\n
Configure a bar chart column in st.dataframe or st.data_editor.
\nCells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the column_config parameter\nof st.dataframe or st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the minimum of its data.
\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the maximum of its data.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1016" + }, + "streamlit.column_config.CheckboxColumn": { + "name": "CheckboxColumn", + "signature": "st.column_config.CheckboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],\n "favorite": [True, False, False, True],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "favorite": st.column_config.CheckboxColumn(\n "Your favorite?",\n help="Select your **favorite** widgets",\n default=False,\n )\n },\n disabled=["widgets"],\n hide_index=True,\n)\n\n
Configure a checkbox column in st.dataframe or st.data_editor.
\nThis is the default column type for boolean values. This command needs to be used in\nthe column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled with a checkbox widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L784" + }, + "streamlit.column_config.Column": { + "name": "Column", + "signature": "st.column_config.Column(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "widgets": st.column_config.Column(\n "Streamlit Widgets",\n help="Streamlit **widget** commands \ud83c\udf88",\n width="medium",\n required=True,\n )\n },\n hide_index=True,\n num_rows="dynamic",\n)\n\n
Configure a generic column in st.dataframe or st.data_editor.
\nThe type of the column will be automatically inferred from the data type.\nThis command needs to be used in the column_config parameter of st.dataframe\nor st.data_editor.
\nTo change the type of the column and enable type-specific configuration options,\nuse one of the column types in the st.column_config namespace,\ne.g. st.column_config.NumberColumn.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L244" + }, + "streamlit.column_config.DateColumn": { + "name": "DateColumn", + "signature": "st.column_config.DateColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "\n\n", + "description": "\nfrom datetime import date\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "birthday": [\n date(1980, 1, 1),\n date(1990, 5, 3),\n date(1974, 5, 19),\n date(2001, 8, 17),\n ]\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "birthday": st.column_config.DateColumn(\n "Birthday",\n min_value=date(1900, 1, 1),\n max_value=date(2005, 1, 1),\n format="DD.MM.YYYY",\n step=1,\n ),\n },\n hide_index=True,\n)\n\n
Configure a date column in st.dataframe or st.data_editor.
\nThis is the default column type for date values. This command needs to be used in\nthe column_config parameter of st.dataframe or st.data_editor. When used\nwith st.data_editor, editing will be enabled with a date picker widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"localized\", \"distance\", \"iso8601\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A format string controlling how dates are displayed.\nThis can be one of the following values:
\nFormatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.
\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum date that can be entered. If this is None (default),\nthere will be no minimum.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum date that can be entered. If this is None (default),\nthere will be no maximum.
\n", + "default": null + }, + { + "name": "step", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The stepping interval in days. If this is None (default), the step\nwill be 1 day.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1797" + }, + "streamlit.column_config.DatetimeColumn": { + "name": "DatetimeColumn", + "signature": "st.column_config.DatetimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, format=None, min_value=None, max_value=None, step=None, timezone=None)", + "examples": "\n\n", + "description": "\nfrom datetime import datetime\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "appointment": [\n datetime(2024, 2, 5, 12, 30),\n datetime(2023, 11, 10, 18, 0),\n datetime(2024, 3, 11, 20, 10),\n datetime(2023, 9, 12, 3, 0),\n ]\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "appointment": st.column_config.DatetimeColumn(\n "Appointment",\n min_value=datetime(2023, 6, 1),\n max_value=datetime(2025, 1, 1),\n format="D MMM YYYY, h:mm a",\n step=60,\n ),\n },\n hide_index=True,\n)\n\n
Configure a datetime column in st.dataframe or st.data_editor.
\nThis is the default column type for datetime values. This command needs to be\nused in the column_config parameter of st.dataframe or\nst.data_editor. When used with st.data_editor, editing will be enabled\nwith a datetime picker widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"localized\", \"distance\", \"calendar\", \"iso8601\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A format string controlling how datetimes are displayed.\nThis can be one of the following values:
\nFormatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.
\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum datetime that can be entered. If this is None\n(default), there will be no minimum.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum datetime that can be entered. If this is None\n(default), there will be no maximum.
\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, datetime.timedelta, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The stepping interval in seconds. If this is None (default), the\nstep will be 1 second.
\n", + "default": null + }, + { + "name": "timezone", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The timezone of this column. If this is None (default), the\ntimezone is inferred from the underlying data.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1480" + }, + "streamlit.column_config.ImageColumn": { + "name": "ImageColumn", + "signature": "st.column_config.ImageColumn(label=None, *, width=None, help=None, pinned=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "apps": [\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/5435b8cb-6c6c-490b-9608-799b543655d3/Home_Page.png",\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/ef9a7627-13f2-47e5-8f65-3f69bb38a5c2/Home_Page.png",\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/31b99099-8eae-4ff8-aa89-042895ed3843/Home_Page.png",\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/6a399b09-241e-4ae7-a31f-7640dc1d181e/Home_Page.png",\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "apps": st.column_config.ImageColumn(\n "Preview Image", help="Streamlit app preview screenshots"\n )\n },\n hide_index=True,\n)\n\n
Configure an image column in st.dataframe or st.data_editor.
\nThe cell values need to be one of:
\nImage columns are not editable at the moment. This command needs to be used in the\ncolumn_config parameter of st.dataframe or st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1306" + }, + "streamlit.column_config.JsonColumn": { + "name": "JsonColumn", + "signature": "st.column_config.JsonColumn(label=None, *, width=None, help=None, pinned=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "json": [\n {"foo": "bar", "bar": "baz"},\n {"foo": "baz", "bar": "qux"},\n {"foo": "qux", "bar": "foo"},\n None,\n ],\n }\n)\n\nst.dataframe(\n data_df,\n column_config={\n "json": st.column_config.JsonColumn(\n "JSON Data",\n help="JSON strings or objects",\n width="large",\n ),\n },\n hide_index=True,\n)\n\n
Configure a JSON column in st.dataframe or st.data_editor.
\nCells need to contain JSON strings or JSON-compatible objects. JSON columns\nare not editable at the moment. This command needs to be used in the\ncolumn_config parameter of st.dataframe or st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L2074" + }, + "streamlit.column_config.LineChartColumn": { + "name": "LineChartColumn", + "signature": "st.column_config.LineChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.LineChartColumn(\n "Sales (last 6 months)",\n width="medium",\n help="The sales volume in the last 6 months",\n y_min=0,\n y_max=100,\n ),\n },\n hide_index=True,\n)\n\n
Configure a line chart column in st.dataframe or st.data_editor.
\nCells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the column_config parameter\nof st.dataframe or st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the minimum of its data.
\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the maximum of its data.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1112" + }, + "streamlit.column_config.LinkColumn": { + "name": "LinkColumn", + "signature": "st.column_config.LinkColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, max_chars=None, validate=None, display_text=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "apps": [\n "https://roadmap.streamlit.app",\n "https://extras.streamlit.app",\n "https://issues.streamlit.app",\n "https://30days.streamlit.app",\n ],\n "creator": [\n "https://github.com/streamlit",\n "https://github.com/arnaudmiribel",\n "https://github.com/streamlit",\n "https://github.com/streamlit",\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "apps": st.column_config.LinkColumn(\n "Trending apps",\n help="The top trending Streamlit apps",\n validate=r"^https://[a-z]+\\.streamlit\\.app$",\n max_chars=100,\n display_text=r"https://(.*?)\\.streamlit\\.app"\n ),\n "creator": st.column_config.LinkColumn(\n "App Creator", display_text="Open profile"\n ),\n },\n hide_index=True,\n)\n\n
Configure a link column in st.dataframe or st.data_editor.
\nThe cell values need to be string and will be shown as clickable links.\nThis command needs to be used in the column_config parameter of st.dataframe\nor st.data_editor. When used with st.data_editor, editing will be enabled\nwith a text input widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of characters that can be entered. If this is\nNone (default), there will be no maximum.
\n", + "default": null + }, + { + "name": "validate", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A JS-flavored regular expression (e.g. "^https://.+$") that edited\nvalues are validated against. If the user input is invalid, it will not\nbe submitted.
\n", + "default": null + }, + { + "name": "display_text", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The text that is displayed in the cell. This can be one of the\nfollowing:
\nFor more complex cases, you may use Pandas Styler's format\nfunction on the underlying dataframe. Note that this makes the app slow,\ndoesn't work with editable columns, and might be removed in the future.\nText formatting from column_config always takes precedence over\ntext formatting from pandas.Styler.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L625" + }, + "streamlit.column_config.ListColumn": { + "name": "ListColumn", + "signature": "st.column_config.ListColumn(label=None, *, width=None, help=None, pinned=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.ListColumn(\n "Sales (last 6 months)",\n help="The sales volume in the last 6 months",\n width="medium",\n ),\n },\n hide_index=True,\n)\n\n
Configure a list column in st.dataframe or st.data_editor.
\nThis is the default column type for list-like values. List columns are not editable\nat the moment. This command needs to be used in the column_config parameter of\nst.dataframe or st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1396" + }, + "streamlit.column_config.NumberColumn": { + "name": "NumberColumn", + "signature": "st.column_config.NumberColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "price": [20, 950, 250, 500],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "price": st.column_config.NumberColumn(\n "Price (in USD)",\n help="The price of the product in USD",\n min_value=0,\n max_value=1000,\n step=1,\n format="$%d",\n )\n },\n hide_index=True,\n)\n\n
Configure a number column in st.dataframe or st.data_editor.
\nThis is the default column type for integer and float values. This command needs to\nbe used in the column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled with a numeric input widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"plain\", \"localized\", \"percent\", \"dollar\", \"euro\", \"accounting\", \"compact\", \"scientific\", \"engineering\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A format string controlling how numbers are displayed.\nThis can be one of the following values:
\nFormatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.
\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum value that can be entered. If this is None (default),\nthere will be no minimum.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum value that can be entered. If this is None (default),\nthere will be no maximum.
\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The precision of numbers that can be entered. If this None\n(default), integer columns will have a step of 1 and float columns will\nhave unrestricted precision. In this case, some floats may display like\nintegers. Setting step for float columns will ensure a consistent\nnumber of digits after the decimal even without setting format.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L347" + }, + "streamlit.column_config.ProgressColumn": { + "name": "ProgressColumn", + "signature": "st.column_config.ProgressColumn(label=None, *, width=None, help=None, pinned=None, format=None, min_value=None, max_value=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [200, 550, 1000, 80],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.ProgressColumn(\n "Sales volume",\n help="The sales volume in USD",\n format="$%f",\n min_value=0,\n max_value=1000,\n ),\n },\n hide_index=True,\n)\n\n
Configure a progress column in st.dataframe or st.data_editor.
\nCells need to contain a number. Progress columns are not editable at the moment.\nThis command needs to be used in the column_config parameter of st.dataframe\nor st.data_editor.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "format", + "type_name": "str, \"plain\", \"localized\", \"percent\", \"dollar\", \"euro\", \"accounting\", \"compact\", \"scientific\", \"engineering\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A format string controlling how the numbers are displayed.\nThis can be one of the following values:
\nNumber formatting from column_config always takes precedence over\nnumber formatting from pandas.Styler. The number formatting does\nnot impact the return value when used in st.data_editor.
\n", + "default": "locale" + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum value of the progress bar. If this is None (default),\nthe minimum will be 0.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum value of the progress bar. If this is None (default),\nthe maximum will be 100 for integer values and 1.0 for float values.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1951" + }, + "streamlit.column_config.SelectboxColumn": { + "name": "SelectboxColumn", + "signature": "st.column_config.SelectboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, options=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "category": [\n "\ud83d\udcca Data Exploration",\n "\ud83d\udcc8 Data Visualization",\n "\ud83e\udd16 LLM",\n "\ud83d\udcca Data Exploration",\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "category": st.column_config.SelectboxColumn(\n "App Category",\n help="The category of the app",\n width="medium",\n options=[\n "\ud83d\udcca Data Exploration",\n "\ud83d\udcc8 Data Visualization",\n "\ud83e\udd16 LLM",\n ],\n required=True,\n )\n },\n hide_index=True,\n)\n\n
Configure a selectbox column in st.dataframe or st.data_editor.
\nThis is the default column type for Pandas categorical values. This command needs to\nbe used in the column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled with a selectbox widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "str, int, float, bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "options", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The options that can be selected during editing. If this is None\n(default), the options will be inferred from the underlying dataframe\ncolumn if its dtype is "category". For more information, see Pandas docs).
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L891" + }, + "streamlit.column_config.TextColumn": { + "name": "TextColumn", + "signature": "st.column_config.TextColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, max_chars=None, validate=None)", + "examples": "\n\n", + "description": "\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "widgets": st.column_config.TextColumn(\n "Widgets",\n help="Streamlit **widget** commands \ud83c\udf88",\n default="st.",\n max_chars=50,\n validate=r"^st\\.[a-z_]+$",\n )\n },\n hide_index=True,\n)\n\n
Configure a text column in st.dataframe or st.data_editor.
\nThis is the default column type for string values. This command needs to be used in the\ncolumn_config parameter of st.dataframe or st.data_editor. When used with\nst.data_editor, editing will be enabled with a text input widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of characters that can be entered. If this is\nNone (default), there will be no maximum.
\n", + "default": null + }, + { + "name": "validate", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A JS-flavored regular expression (e.g. "^[a-z]+$") that edited\nvalues are validated against. If the user input is invalid, it will not\nbe submitted.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L505" + }, + "streamlit.column_config.TimeColumn": { + "name": "TimeColumn", + "signature": "st.column_config.TimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "\n\n", + "description": "\nfrom datetime import time\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "appointment": [\n time(12, 30),\n time(18, 0),\n time(9, 10),\n time(16, 25),\n ]\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "appointment": st.column_config.TimeColumn(\n "Appointment",\n min_value=time(8, 0, 0),\n max_value=time(19, 0, 0),\n format="hh:mm a",\n step=60,\n ),\n },\n hide_index=True,\n)\n\n
Configure a time column in st.dataframe or st.data_editor.
\nThis is the default column type for time values. This command needs to be used in\nthe column_config parameter of st.dataframe or st.data_editor. When\nused with st.data_editor, editing will be enabled with a time picker widget.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The label shown at the top of the column. If this is None\n(default), the column name is used.
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:
\nA tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.
\nThe tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether editing should be disabled for this column. If this is None\n(default), Streamlit will decide: indices are disabled and data columns\nare not.
\nIf a column has mixed types, it may become uneditable regardless of\ndisabled.
\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.
\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.
\n", + "default": null + }, + { + "name": "default", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.
\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"localized\", \"iso8601\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A format string controlling how times are displayed.\nThis can be one of the following values:
\nFormatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.
\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The minimum time that can be entered. If this is None (default),\nthere will be no minimum.
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum time that can be entered. If this is None (default),\nthere will be no maximum.
\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, datetime.timedelta, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The stepping interval in seconds. If this is None (default), the\nstep will be 1 second.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/column_types.py#L1644" + }, + "streamlit.components.v1.declare_component": { + "name": "declare_component", + "signature": "st.components.v1.declare_component(name, path=None, url=None)", + "description": "Create a custom component and register it if there is a ScriptRunContext.
\nThe component is not registered when there is no ScriptRunContext.\nThis can happen when a CustomComponent is executed as standalone\ncommand (e.g. for testing).
\nTo use this function, import it from the streamlit.components.v1\nmodule.
\nWarning
\nUsing st.components.v1.declare_component directly (instead of\nimporting its module) is deprecated and will be disallowed in a later\nversion.
\nA short, descriptive name for the component, like "slider".
\n", + "default": null + }, + { + "name": "path", + "type_name": "str, Path, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The path to serve the component's frontend files from. The path should\nbe absolute. If path is None (default), Streamlit will serve\nthe component from the location in url. Either path or url\nmust be specified, but not both.
\n", + "default": null + }, + { + "name": "url", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "The URL that the component is served from. If url is None\n(default), Streamlit will serve the component from the location in\npath. Either path or url must be specified, but not both.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "CustomComponent", + "is_generator": false, + "description": "A CustomComponent that can be called like a function.\nCalling the component will create a new instance of the component\nin the Streamlit app.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/components/v1/component_registry.py#L51" + }, + "streamlit.components.v1.html": { + "name": "html", + "signature": "st.components.v1.html(html, width=None, height=None, scrolling=False, *, tab_index=None)", + "example": "\n\n", + "description": "\nimport streamlit.components.v1 as components\n\ncomponents.html(\n "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"\n)\n\n
Display an HTML string in an iframe.
\nTo use this function, import it from the streamlit.components.v1\nmodule.
\nIf you want to insert HTML text into your app without an iframe, try\nst.html instead.
\nWarning
\nUsing st.components.v1.html directly (instead of importing\nits module) is deprecated and will be disallowed in a later version.
\nThe HTML string to embed in the iframe.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "The width of the iframe in CSS pixels. By default, this is the\napp's default element width.
\n", + "default": "element" + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "The height of the frame in CSS pixels. By default, this is 150.
\n", + "default": null + }, + { + "name": "scrolling", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to allow scrolling in the iframe. If this False\n(default), Streamlit crops any content larger than the iframe and\ndoes not show a scrollbar. If this is True, Streamlit shows a\nscrollbar when the content is larger than the iframe.
\n", + "default": null + }, + { + "name": "tab_index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies how and if the iframe is sequentially focusable.\nUsers typically use the Tab key for sequential focus\nnavigation.
\nThis can be one of the following values:
\nFor more information, see the tabindex\ndocumentation on MDN.
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/iframe.py#L105" + }, + "streamlit.components.v1.iframe": { + "name": "iframe", + "signature": "st.components.v1.iframe(src, width=None, height=None, scrolling=False, *, tab_index=None)", + "example": "\n\n", + "description": "\nimport streamlit.components.v1 as components\n\ncomponents.iframe("https://example.com", height=500)\n\n
Load a remote URL in an iframe.
\nTo use this function, import it from the streamlit.components.v1\nmodule.
\nWarning
\nUsing st.components.v1.iframe directly (instead of importing\nits module) is deprecated and will be disallowed in a later version.
\nThe URL of the page to embed.
\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "The width of the iframe in CSS pixels. By default, this is the\napp's default element width.
\n", + "default": "element" + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "The height of the frame in CSS pixels. By default, this is 150.
\n", + "default": null + }, + { + "name": "scrolling", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "Whether to allow scrolling in the iframe. If this False\n(default), Streamlit crops any content larger than the iframe and\ndoes not show a scrollbar. If this is True, Streamlit shows a\nscrollbar when the content is larger than the iframe.
\n", + "default": null + }, + { + "name": "tab_index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "Specifies how and if the iframe is sequentially focusable.\nUsers typically use the Tab key for sequential focus\nnavigation.
\nThis can be one of the following values:
\nFor more information, see the tabindex\ndocumentation on MDN.
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/iframe.py#L28" + }, + "DeltaGenerator.add_rows": { + "name": "add_rows", + "signature": "element.add_rows(data=None, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf1 = pd.DataFrame(\n np.random.randn(50, 20), columns=("col %d" % i for i in range(20))\n)\n\nmy_table = st.table(df1)\n\ndf2 = pd.DataFrame(\n np.random.randn(50, 20), columns=("col %d" % i for i in range(20))\n)\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\nYou 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\nAnd 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 {\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 }\n)\nmy_chart.add_rows(some_fancy_name=df2) # <-- name used as keyword\n\n
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, + "is_kwarg_only": false, + "description": "Table to concat. Optional.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "pandas.DataFrame, numpy.ndarray, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": true, + "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.45.1/lib/streamlit/elements/arrow.py#L735" + }, + "StatusContainer.update": { + "name": "update", + "signature": "StatusContainer.update(*, label=None, expanded=None, state=None)", + "description": "Update the status container.
\nOnly specified arguments are updated. Container contents and unspecified\narguments remain unchanged.
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "A new label of the status container. If None, the label is not\nchanged.
\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The new expanded state of the status container. If None,\nthe expanded state is not changed.
\n", + "default": null + }, + { + "name": "state", + "type_name": "\"running\", \"complete\", \"error\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The new state of the status container. This mainly changes the\nicon. If None, the state is not changed.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/lib/mutable_status_container.py#L99" + }, + "streamlit.testing.v1.AppTest": { + "name": "AppTest", + "signature": "st.testing.v1.AppTest(script_path, *, default_timeout, args=None, kwargs=None)", + "is_class": true, + "methods": [ + { + "name": "get", + "signature": "st.testing.v1.get.get(element_type)", + "description": "Get elements or widgets of the specified type.
", + "args": [ + { + "name": "element_type", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "An element attribute of AppTest. For example, "button",\n"caption", or "chat_input".
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of Elements", + "is_generator": false, + "description": "Sequence of elements of the given type. Individual elements can\nbe accessed from a Sequence by index (order on the page). When\ngetting and element_type that is a widget, individual widgets\ncan be accessed by key. For example, at.get("text")[0] for the\nfirst st.text element or at.get("slider")(key="my_key") for\nthe st.slider widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L1024" + }, + { + "name": "run", + "signature": "st.testing.v1.run.run(*, timeout=None)", + "description": "Run the script from the current state.
", + "args": [ + { + "name": "timeout", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. If timeout is\nNone (default), Streamlit uses the default timeout set for the\ninstance of AppTest.
\n", + "default": "timeout" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "self
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L367" + }, + { + "name": "switch_page", + "signature": "st.testing.v1.switch_page.switch_page(page_path)", + "description": "Switch to another page of the app.
", + "args": [ + { + "name": "page_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "Path of the page to switch to. The path must be relative to the\nmain script's location (e.g. "pages/my_page.py").
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "self
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L390" + } + ], + "properties": [ + { + "name": "button", + "signature": "st.testing.v1.button.button", + "description": "Sequence of all st.button and st.form_submit_button widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Button", + "is_generator": false, + "description": "Sequence of all st.button and st.form_submit_button\nwidgets. Individual widgets can be accessed from a WidgetList by\nindex (order on the page) or key. For example, at.button[0] for\nthe first widget or at.button(key="my_key") for a widget with a\ngiven key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L445" + }, + { + "name": "button_group", + "signature": "st.testing.v1.button_group.button_group", + "description": "Sequence of all st.feedback widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "Sequence of all st.feedback widgets. Individual widgets can be\naccessed from a WidgetList by index (order on the page) or key. For\nexample, at.button_group[0] for the first widget or\nat.button_group(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L460" + }, + { + "name": "caption", + "signature": "st.testing.v1.caption.caption", + "description": "Sequence of all st.caption elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Caption", + "is_generator": false, + "description": "Sequence of all st.caption elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.caption[0] for the first element. Caption is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L474" + }, + { + "name": "chat_input", + "signature": "st.testing.v1.chat_input.chat_input", + "description": "Sequence of all st.chat_input widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ChatInput", + "is_generator": false, + "description": "Sequence of all st.chat_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.chat_input[0] for the first widget or\nat.chat_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L488" + }, + { + "name": "chat_message", + "signature": "st.testing.v1.chat_message.chat_message", + "description": "Sequence of all st.chat_message elements.
", + "args": [], + "returns": [ + { + "type_name": "Sequence of ChatMessage", + "is_generator": false, + "description": "Sequence of all st.chat_message elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.chat_message[0] for the first element. ChatMessage\nis an extension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L502" + }, + { + "name": "checkbox", + "signature": "st.testing.v1.checkbox.checkbox", + "description": "Sequence of all st.checkbox widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Checkbox", + "is_generator": false, + "description": "Sequence of all st.checkbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.checkbox[0] for the first widget or\nat.checkbox(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L516" + }, + { + "name": "code", + "signature": "st.testing.v1.code.code", + "description": "Sequence of all st.code elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Code", + "is_generator": false, + "description": "Sequence of all st.code elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.code[0] for the first element. Code is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L530" + }, + { + "name": "color_picker", + "signature": "st.testing.v1.color_picker.color_picker", + "description": "Sequence of all st.color_picker widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ColorPicker", + "is_generator": false, + "description": "Sequence of all st.color_picker widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.color_picker[0] for the first widget or\nat.color_picker(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L544" + }, + { + "name": "columns", + "signature": "st.testing.v1.columns.columns", + "description": "Sequence of all columns within st.columns elements.
", + "args": [], + "returns": [ + { + "type_name": "Sequence of Column", + "is_generator": false, + "description": "Sequence of all columns within st.columns elements. Individual\ncolumns can be accessed from an ElementList by index (order on the\npage). For example, at.columns[0] for the first column. Column\nis an extension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L558" + }, + { + "name": "dataframe", + "signature": "st.testing.v1.dataframe.dataframe", + "description": "Sequence of all st.dataframe elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Dataframe", + "is_generator": false, + "description": "Sequence of all st.dataframe elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.dataframe[0] for the first element. Dataframe is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L575" + }, + { + "name": "date_input", + "signature": "st.testing.v1.date_input.date_input", + "description": "Sequence of all st.date_input widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateInput", + "is_generator": false, + "description": "Sequence of all st.date_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.date_input[0] for the first widget or\nat.date_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L589" + }, + { + "name": "divider", + "signature": "st.testing.v1.divider.divider", + "description": "Sequence of all st.divider elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Divider", + "is_generator": false, + "description": "Sequence of all st.divider elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.divider[0] for the first element. Divider is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L603" + }, + { + "name": "error", + "signature": "st.testing.v1.error.error", + "description": "Sequence of all st.error elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Error", + "is_generator": false, + "description": "Sequence of all st.error elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.error[0] for the first element. Error is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L617" + }, + { + "name": "exception", + "signature": "st.testing.v1.exception.exception", + "description": "Sequence of all st.exception elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Exception", + "is_generator": false, + "description": "Sequence of all st.exception elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.exception[0] for the first element. Exception is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L631" + }, + { + "name": "expander", + "signature": "st.testing.v1.expander.expander", + "description": "Sequence of all st.expander elements.
", + "args": [], + "returns": [ + { + "type_name": "Sequence of Expandable", + "is_generator": false, + "description": "Sequence of all st.expander elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.expander[0] for the first element. Expandable is an\nextension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L645" + }, + { + "name": "header", + "signature": "st.testing.v1.header.header", + "description": "Sequence of all st.header elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Header", + "is_generator": false, + "description": "Sequence of all st.header elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.header[0] for the first element. Header is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L659" + }, + { + "name": "info", + "signature": "st.testing.v1.info.info", + "description": "Sequence of all st.info elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Info", + "is_generator": false, + "description": "Sequence of all st.info elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.info[0] for the first element. Info is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L673" + }, + { + "name": "json", + "signature": "st.testing.v1.json.json", + "description": "Sequence of all st.json elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Json", + "is_generator": false, + "description": "Sequence of all st.json elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.json[0] for the first element. Json is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L687" + }, + { + "name": "latex", + "signature": "st.testing.v1.latex.latex", + "description": "Sequence of all st.latex elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Latex", + "is_generator": false, + "description": "Sequence of all st.latex elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.latex[0] for the first element. Latex is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L701" + }, + { + "name": "main", + "signature": "st.testing.v1.main.main", + "description": "Sequence of elements within the main body of the app.
", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L419" + }, + { + "name": "markdown", + "signature": "st.testing.v1.markdown.markdown", + "description": "Sequence of all st.markdown elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Markdown", + "is_generator": false, + "description": "Sequence of all st.markdown elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.markdown[0] for the first element. Markdown is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L715" + }, + { + "name": "metric", + "signature": "st.testing.v1.metric.metric", + "description": "Sequence of all st.metric elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Metric", + "is_generator": false, + "description": "Sequence of all st.metric elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.metric[0] for the first element. Metric is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L729" + }, + { + "name": "multiselect", + "signature": "st.testing.v1.multiselect.multiselect", + "description": "Sequence of all st.multiselect widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Multiselect", + "is_generator": false, + "description": "Sequence of all st.multiselect widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.multiselect[0] for the first widget or\nat.multiselect(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L743" + }, + { + "name": "number_input", + "signature": "st.testing.v1.number_input.number_input", + "description": "Sequence of all st.number_input widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of NumberInput", + "is_generator": false, + "description": "Sequence of all st.number_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.number_input[0] for the first widget or\nat.number_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L757" + }, + { + "name": "radio", + "signature": "st.testing.v1.radio.radio", + "description": "Sequence of all st.radio widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Radio", + "is_generator": false, + "description": "Sequence of all st.radio widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.radio[0] for the first widget or\nat.radio(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L771" + }, + { + "name": "select_slider", + "signature": "st.testing.v1.select_slider.select_slider", + "description": "Sequence of all st.select_slider widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of SelectSlider", + "is_generator": false, + "description": "Sequence of all st.select_slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.select_slider[0] for the first widget or\nat.select_slider(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L785" + }, + { + "name": "selectbox", + "signature": "st.testing.v1.selectbox.selectbox", + "description": "Sequence of all st.selectbox widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Selectbox", + "is_generator": false, + "description": "Sequence of all st.selectbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.selectbox[0] for the first widget or\nat.selectbox(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L799" + }, + { + "name": "sidebar", + "signature": "st.testing.v1.sidebar.sidebar", + "description": "Sequence of all elements within st.sidebar.
", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L432" + }, + { + "name": "slider", + "signature": "st.testing.v1.slider.slider", + "description": "Sequence of all st.slider widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Slider", + "is_generator": false, + "description": "Sequence of all st.slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.slider[0] for the first widget or\nat.slider(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L813" + }, + { + "name": "status", + "signature": "st.testing.v1.status.status", + "description": "Sequence of all st.status elements.
", + "args": [], + "returns": [ + { + "type_name": "Sequence of Status", + "is_generator": false, + "description": "Sequence of all st.status elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.status[0] for the first element. Status is an\nextension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L855" + }, + { + "name": "subheader", + "signature": "st.testing.v1.subheader.subheader", + "description": "Sequence of all st.subheader elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Subheader", + "is_generator": false, + "description": "Sequence of all st.subheader elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.subheader[0] for the first element. Subheader is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L827" + }, + { + "name": "success", + "signature": "st.testing.v1.success.success", + "description": "Sequence of all st.success elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Success", + "is_generator": false, + "description": "Sequence of all st.success elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.success[0] for the first element. Success is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L841" + }, + { + "name": "table", + "signature": "st.testing.v1.table.table", + "description": "Sequence of all st.table elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Table", + "is_generator": false, + "description": "Sequence of all st.table elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.table[0] for the first element. Table is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L869" + }, + { + "name": "tabs", + "signature": "st.testing.v1.tabs.tabs", + "description": "Sequence of all tabs within st.tabs elements.
", + "args": [], + "returns": [ + { + "type_name": "Sequence of Tab", + "is_generator": false, + "description": "Sequence of all tabs within st.tabs elements. Individual\ntabs can be accessed from an ElementList by index (order on the\npage). For example, at.tabs[0] for the first tab. Tab is an\nextension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L883" + }, + { + "name": "text", + "signature": "st.testing.v1.text.text", + "description": "Sequence of all st.text elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Text", + "is_generator": false, + "description": "Sequence of all st.text elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.text[0] for the first element. Text is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L903" + }, + { + "name": "text_area", + "signature": "st.testing.v1.text_area.text_area", + "description": "Sequence of all st.text_area widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextArea", + "is_generator": false, + "description": "Sequence of all st.text_area widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_area[0] for the first widget or\nat.text_area(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L917" + }, + { + "name": "text_input", + "signature": "st.testing.v1.text_input.text_input", + "description": "Sequence of all st.text_input widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextInput", + "is_generator": false, + "description": "Sequence of all st.text_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_input[0] for the first widget or\nat.text_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L931" + }, + { + "name": "time_input", + "signature": "st.testing.v1.time_input.time_input", + "description": "Sequence of all st.time_input widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TimeInput", + "is_generator": false, + "description": "Sequence of all st.time_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.time_input[0] for the first widget or\nat.time_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L945" + }, + { + "name": "title", + "signature": "st.testing.v1.title.title", + "description": "Sequence of all st.title elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Title", + "is_generator": false, + "description": "Sequence of all st.title elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.title[0] for the first element. Title is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L959" + }, + { + "name": "toast", + "signature": "st.testing.v1.toast.toast", + "description": "Sequence of all st.toast elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Toast", + "is_generator": false, + "description": "Sequence of all st.toast elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.toast[0] for the first element. Toast is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L973" + }, + { + "name": "toggle", + "signature": "st.testing.v1.toggle.toggle", + "description": "Sequence of all st.toggle widgets.
", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Toggle", + "is_generator": false, + "description": "Sequence of all st.toggle widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.toggle[0] for the first widget or\nat.toggle(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L987" + }, + { + "name": "warning", + "signature": "st.testing.v1.warning.warning", + "description": "Sequence of all st.warning elements.
", + "args": [], + "returns": [ + { + "type_name": "ElementList of Warning", + "is_generator": false, + "description": "Sequence of all st.warning elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.warning[0] for the first element. Warning is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L1001" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L98", + "description": "A simulated Streamlit app to check the correctness of displayed elements and outputs.
\nAn instance of AppTest simulates a running Streamlit app. This class\nprovides methods to set up, manipulate, and inspect the app contents via\nAPI instead of a browser UI. It can be used to write automated tests of an\napp in various scenarios. These can then be run using a tool like pytest.
\nAppTest can be initialized by one of three class methods:
\nOnce initialized, Session State and widget values can be updated and the\nscript can be run. Unlike an actual live-running Streamlit app, you need to\ncall AppTest.run() explicitly to re-run the app after changing a widget\nvalue. Switching pages also requires an explicit, follow-up call to\nAppTest.run().
\nAppTest enables developers to build tests on their app as-is, in the\nfamiliar python test format, without major refactoring or abstracting out\nlogic to be tested separately from the UI. Tests can run quickly with very\nlow overhead. A typical pattern is to build a suite of tests for an app\nthat ensure consistent functionality as the app evolves, and run the tests\nlocally and/or in a CI environment like Github Actions.
\nNote
\nAppTest only supports testing a single page of an app per\ninstance. For multipage apps, each page will need to be tested\nseparately. AppTest is not yet compatible with multipage apps\nusing st.navigation and st.Page.
\nDictionary of secrets to be used the simulated app. Use dict-like\nsyntax to set secret values for the simulated app.
\n", + "default": null + }, + { + "name": "session_state", + "type_name": "SafeSessionState", + "is_optional": false, + "description": "Session State for the simulated app. SafeSessionState object supports\nread and write operations as usual for Streamlit apps.
\n", + "default": null + }, + { + "name": "query_params", + "type_name": "dict[str, Any]", + "is_optional": false, + "description": "Dictionary of query parameters to be used by the simluated app. Use\ndict-like syntax to set query_params values for the simulated app.
\n", + "default": null + } + ], + "returns": [] + }, + "AppTest.button": { + "name": "button", + "signature": "AppTest.button", + "description": "Sequence of all st.button and st.form_submit_button widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Button", + "is_generator": false, + "description": "Sequence of all st.button and st.form_submit_button\nwidgets. Individual widgets can be accessed from a WidgetList by\nindex (order on the page) or key. For example, at.button[0] for\nthe first widget or at.button(key="my_key") for a widget with a\ngiven key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L445" + }, + "AppTest.button_group": { + "name": "button_group", + "signature": "AppTest.button_group", + "description": "Sequence of all st.feedback widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "Sequence of all st.feedback widgets. Individual widgets can be\naccessed from a WidgetList by index (order on the page) or key. For\nexample, at.button_group[0] for the first widget or\nat.button_group(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L460" + }, + "AppTest.caption": { + "name": "caption", + "signature": "AppTest.caption", + "description": "Sequence of all st.caption elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Caption", + "is_generator": false, + "description": "Sequence of all st.caption elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.caption[0] for the first element. Caption is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L474" + }, + "AppTest.chat_input": { + "name": "chat_input", + "signature": "AppTest.chat_input", + "description": "Sequence of all st.chat_input widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ChatInput", + "is_generator": false, + "description": "Sequence of all st.chat_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.chat_input[0] for the first widget or\nat.chat_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L488" + }, + "AppTest.chat_message": { + "name": "chat_message", + "signature": "AppTest.chat_message", + "description": "Sequence of all st.chat_message elements.
\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of ChatMessage", + "is_generator": false, + "description": "Sequence of all st.chat_message elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.chat_message[0] for the first element. ChatMessage\nis an extension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L502" + }, + "AppTest.checkbox": { + "name": "checkbox", + "signature": "AppTest.checkbox", + "description": "Sequence of all st.checkbox widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Checkbox", + "is_generator": false, + "description": "Sequence of all st.checkbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.checkbox[0] for the first widget or\nat.checkbox(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L516" + }, + "AppTest.code": { + "name": "code", + "signature": "AppTest.code", + "description": "Sequence of all st.code elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Code", + "is_generator": false, + "description": "Sequence of all st.code elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.code[0] for the first element. Code is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L530" + }, + "AppTest.color_picker": { + "name": "color_picker", + "signature": "AppTest.color_picker", + "description": "Sequence of all st.color_picker widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ColorPicker", + "is_generator": false, + "description": "Sequence of all st.color_picker widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.color_picker[0] for the first widget or\nat.color_picker(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L544" + }, + "AppTest.columns": { + "name": "columns", + "signature": "AppTest.columns", + "description": "Sequence of all columns within st.columns elements.
\nEach column within a single st.columns will be returned as a\nseparate Column in the Sequence.
\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Column", + "is_generator": false, + "description": "Sequence of all columns within st.columns elements. Individual\ncolumns can be accessed from an ElementList by index (order on the\npage). For example, at.columns[0] for the first column. Column\nis an extension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L558" + }, + "AppTest.dataframe": { + "name": "dataframe", + "signature": "AppTest.dataframe", + "description": "Sequence of all st.dataframe elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Dataframe", + "is_generator": false, + "description": "Sequence of all st.dataframe elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.dataframe[0] for the first element. Dataframe is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L575" + }, + "AppTest.date_input": { + "name": "date_input", + "signature": "AppTest.date_input", + "description": "Sequence of all st.date_input widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateInput", + "is_generator": false, + "description": "Sequence of all st.date_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.date_input[0] for the first widget or\nat.date_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L589" + }, + "AppTest.divider": { + "name": "divider", + "signature": "AppTest.divider", + "description": "Sequence of all st.divider elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Divider", + "is_generator": false, + "description": "Sequence of all st.divider elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.divider[0] for the first element. Divider is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L603" + }, + "AppTest.error": { + "name": "error", + "signature": "AppTest.error", + "description": "Sequence of all st.error elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Error", + "is_generator": false, + "description": "Sequence of all st.error elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.error[0] for the first element. Error is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L617" + }, + "AppTest.exception": { + "name": "exception", + "signature": "AppTest.exception", + "description": "Sequence of all st.exception elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Exception", + "is_generator": false, + "description": "Sequence of all st.exception elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.exception[0] for the first element. Exception is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L631" + }, + "AppTest.expander": { + "name": "expander", + "signature": "AppTest.expander", + "description": "Sequence of all st.expander elements.
\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Expandable", + "is_generator": false, + "description": "Sequence of all st.expander elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.expander[0] for the first element. Expandable is an\nextension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L645" + }, + "AppTest.from_file": { + "name": "from_file", + "signature": "AppTest.from_file(cls, script_path, *, default_timeout=3)", + "description": "Create an instance of AppTest to simulate an app page defined within a file.
\nThis option is most convenient for CI workflows and testing of\npublished apps. The script must be executable on its own and so must\ncontain all necessary imports.
\n", + "args": [ + { + "name": "script_path", + "type_name": "str | Path", + "is_optional": false, + "is_kwarg_only": false, + "description": "Path to a script file. The path should be absolute or relative to\nthe file calling .from_file.
\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "Default time in seconds before a script run is timed out. Can be\noverridden for individual .run() calls.
\n", + "default": "time" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "A simulated Streamlit app for testing. The simulated app can be\nexecuted via .run().
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L267" + }, + "AppTest.from_function": { + "name": "from_function", + "signature": "AppTest.from_function(cls, script, *, default_timeout=3, args=None, kwargs=None)", + "description": "Create an instance of AppTest to simulate an app page defined within a function.
\nThis is similar to AppTest.from_string(), but more convenient to\nwrite with IDE assistance. The script must be executable on its own and\nso must contain all necessary imports.
\n", + "args": [ + { + "name": "script", + "type_name": "Callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "A function whose body will be used as a script. Must be runnable\nin isolation, so it must include any necessary imports.
\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "Default time in seconds before a script run is timed out. Can be\noverridden for individual .run() calls.
\n", + "default": "time" + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional tuple of args to pass to the script function.
\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "An optional dict of kwargs to pass to the script function.
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "A simulated Streamlit app for testing. The simulated app can be\nexecuted via .run().
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L220" + }, + "AppTest.from_string": { + "name": "from_string", + "signature": "AppTest.from_string(cls, script, *, default_timeout=3)", + "description": "Create an instance of AppTest to simulate an app page defined within a string.
\nThis is useful for testing short scripts that fit comfortably as an\ninline string in the test itself, without having to create a separate\nfile for it. The script must be executable on its own and so must\ncontain all necessary imports.
\n", + "args": [ + { + "name": "script", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "The string contents of the script to be run.
\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "Default time in seconds before a script run is timed out. Can be\noverridden for individual .run() calls.
\n", + "default": "time" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "A simulated Streamlit app for testing. The simulated app can be\nexecuted via .run().
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L178" + }, + "AppTest.get": { + "name": "get", + "signature": "AppTest.get(element_type)", + "description": "Get elements or widgets of the specified type.
\nThis method returns the collection of all elements or widgets of\nthe specified type on the current page. Retrieve a specific element by\nusing its index (order on page) or key lookup.
\n", + "args": [ + { + "name": "element_type", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "An element attribute of AppTest. For example, "button",\n"caption", or "chat_input".
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of Elements", + "is_generator": false, + "description": "Sequence of elements of the given type. Individual elements can\nbe accessed from a Sequence by index (order on the page). When\ngetting and element_type that is a widget, individual widgets\ncan be accessed by key. For example, at.get("text")[0] for the\nfirst st.text element or at.get("slider")(key="my_key") for\nthe st.slider widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L1024" + }, + "AppTest.header": { + "name": "header", + "signature": "AppTest.header", + "description": "Sequence of all st.header elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Header", + "is_generator": false, + "description": "Sequence of all st.header elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.header[0] for the first element. Header is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L659" + }, + "AppTest.info": { + "name": "info", + "signature": "AppTest.info", + "description": "Sequence of all st.info elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Info", + "is_generator": false, + "description": "Sequence of all st.info elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.info[0] for the first element. Info is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L673" + }, + "AppTest.json": { + "name": "json", + "signature": "AppTest.json", + "description": "Sequence of all st.json elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Json", + "is_generator": false, + "description": "Sequence of all st.json elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.json[0] for the first element. Json is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L687" + }, + "AppTest.latex": { + "name": "latex", + "signature": "AppTest.latex", + "description": "Sequence of all st.latex elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Latex", + "is_generator": false, + "description": "Sequence of all st.latex elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.latex[0] for the first element. Latex is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L701" + }, + "AppTest.main": { + "name": "main", + "signature": "AppTest.main", + "description": "Sequence of elements within the main body of the app.
\n", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L419" + }, + "AppTest.markdown": { + "name": "markdown", + "signature": "AppTest.markdown", + "description": "Sequence of all st.markdown elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Markdown", + "is_generator": false, + "description": "Sequence of all st.markdown elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.markdown[0] for the first element. Markdown is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L715" + }, + "AppTest.metric": { + "name": "metric", + "signature": "AppTest.metric", + "description": "Sequence of all st.metric elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Metric", + "is_generator": false, + "description": "Sequence of all st.metric elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.metric[0] for the first element. Metric is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L729" + }, + "AppTest.multiselect": { + "name": "multiselect", + "signature": "AppTest.multiselect", + "description": "Sequence of all st.multiselect widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Multiselect", + "is_generator": false, + "description": "Sequence of all st.multiselect widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.multiselect[0] for the first widget or\nat.multiselect(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L743" + }, + "AppTest.number_input": { + "name": "number_input", + "signature": "AppTest.number_input", + "description": "Sequence of all st.number_input widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of NumberInput", + "is_generator": false, + "description": "Sequence of all st.number_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.number_input[0] for the first widget or\nat.number_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L757" + }, + "AppTest.radio": { + "name": "radio", + "signature": "AppTest.radio", + "description": "Sequence of all st.radio widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Radio", + "is_generator": false, + "description": "Sequence of all st.radio widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.radio[0] for the first widget or\nat.radio(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L771" + }, + "AppTest.run": { + "name": "run", + "signature": "AppTest.run(*, timeout=None)", + "description": "Run the script from the current state.
\nThis is equivalent to manually rerunning the app or the rerun that\noccurs upon user interaction. AppTest.run() must be manually called\nafter updating a widget value or switching pages as script reruns do\nnot occur automatically as they do for live-running Streamlit apps.
\n", + "args": [ + { + "name": "timeout", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. If timeout is\nNone (default), Streamlit uses the default timeout set for the\ninstance of AppTest.
\n", + "default": "timeout" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "self
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L367" + }, + "AppTest.select_slider": { + "name": "select_slider", + "signature": "AppTest.select_slider", + "description": "Sequence of all st.select_slider widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of SelectSlider", + "is_generator": false, + "description": "Sequence of all st.select_slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.select_slider[0] for the first widget or\nat.select_slider(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L785" + }, + "AppTest.selectbox": { + "name": "selectbox", + "signature": "AppTest.selectbox", + "description": "Sequence of all st.selectbox widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Selectbox", + "is_generator": false, + "description": "Sequence of all st.selectbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.selectbox[0] for the first widget or\nat.selectbox(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L799" + }, + "AppTest.sidebar": { + "name": "sidebar", + "signature": "AppTest.sidebar", + "description": "Sequence of all elements within st.sidebar.
\n", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L432" + }, + "AppTest.slider": { + "name": "slider", + "signature": "AppTest.slider", + "description": "Sequence of all st.slider widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Slider", + "is_generator": false, + "description": "Sequence of all st.slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.slider[0] for the first widget or\nat.slider(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L813" + }, + "AppTest.status": { + "name": "status", + "signature": "AppTest.status", + "description": "Sequence of all st.status elements.
\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Status", + "is_generator": false, + "description": "Sequence of all st.status elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.status[0] for the first element. Status is an\nextension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L855" + }, + "AppTest.subheader": { + "name": "subheader", + "signature": "AppTest.subheader", + "description": "Sequence of all st.subheader elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Subheader", + "is_generator": false, + "description": "Sequence of all st.subheader elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.subheader[0] for the first element. Subheader is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L827" + }, + "AppTest.success": { + "name": "success", + "signature": "AppTest.success", + "description": "Sequence of all st.success elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Success", + "is_generator": false, + "description": "Sequence of all st.success elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.success[0] for the first element. Success is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L841" + }, + "AppTest.switch_page": { + "name": "switch_page", + "signature": "AppTest.switch_page(page_path)", + "description": "Switch to another page of the app.
\nThis method does not automatically rerun the app. Use a follow-up call\nto AppTest.run() to obtain the elements on the selected page.
\n", + "args": [ + { + "name": "page_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "Path of the page to switch to. The path must be relative to the\nmain script's location (e.g. "pages/my_page.py").
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "self
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L390" + }, + "AppTest.table": { + "name": "table", + "signature": "AppTest.table", + "description": "Sequence of all st.table elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Table", + "is_generator": false, + "description": "Sequence of all st.table elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.table[0] for the first element. Table is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L869" + }, + "AppTest.tabs": { + "name": "tabs", + "signature": "AppTest.tabs", + "description": "Sequence of all tabs within st.tabs elements.
\nEach tab within a single st.tabs will be returned as a separate Tab\nin the Sequence. Additionally, the tab labels are forwarded to each\nTab element as a property. For example, st.tabs("A","B") will\nyield two Tab objects, with Tab.label returning "A" and "B",\nrespectively.
\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Tab", + "is_generator": false, + "description": "Sequence of all tabs within st.tabs elements. Individual\ntabs can be accessed from an ElementList by index (order on the\npage). For example, at.tabs[0] for the first tab. Tab is an\nextension of the Block class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L883" + }, + "AppTest.text": { + "name": "text", + "signature": "AppTest.text", + "description": "Sequence of all st.text elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Text", + "is_generator": false, + "description": "Sequence of all st.text elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.text[0] for the first element. Text is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L903" + }, + "AppTest.text_area": { + "name": "text_area", + "signature": "AppTest.text_area", + "description": "Sequence of all st.text_area widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextArea", + "is_generator": false, + "description": "Sequence of all st.text_area widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_area[0] for the first widget or\nat.text_area(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L917" + }, + "AppTest.text_input": { + "name": "text_input", + "signature": "AppTest.text_input", + "description": "Sequence of all st.text_input widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextInput", + "is_generator": false, + "description": "Sequence of all st.text_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_input[0] for the first widget or\nat.text_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L931" + }, + "AppTest.time_input": { + "name": "time_input", + "signature": "AppTest.time_input", + "description": "Sequence of all st.time_input widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TimeInput", + "is_generator": false, + "description": "Sequence of all st.time_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.time_input[0] for the first widget or\nat.time_input(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L945" + }, + "AppTest.title": { + "name": "title", + "signature": "AppTest.title", + "description": "Sequence of all st.title elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Title", + "is_generator": false, + "description": "Sequence of all st.title elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.title[0] for the first element. Title is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L959" + }, + "AppTest.toast": { + "name": "toast", + "signature": "AppTest.toast", + "description": "Sequence of all st.toast elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Toast", + "is_generator": false, + "description": "Sequence of all st.toast elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.toast[0] for the first element. Toast is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L973" + }, + "AppTest.toggle": { + "name": "toggle", + "signature": "AppTest.toggle", + "description": "Sequence of all st.toggle widgets.
\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Toggle", + "is_generator": false, + "description": "Sequence of all st.toggle widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.toggle[0] for the first widget or\nat.toggle(key="my_key") for a widget with a given key.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L987" + }, + "AppTest.warning": { + "name": "warning", + "signature": "AppTest.warning", + "description": "Sequence of all st.warning elements.
\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Warning", + "is_generator": false, + "description": "Sequence of all st.warning elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.warning[0] for the first element. Warning is an\nextension of the Element class.
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/app_test.py#L1001" + }, + "streamlit.testing.v1.element_tree.Button": { + "name": "Button", + "signature": "st.testing.v1.element_tree.Button(proto, root)", + "is_class": true, + "methods": [ + { + "name": "click", + "signature": "st.testing.v1.element_tree.click.click()", + "description": "Set the value of the button to True.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L339" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the button.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L334" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The value of the button. (bool)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L324" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L301", + "description": "A representation of st.button and st.form_submit_button.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ButtonGroup": { + "name": "ButtonGroup", + "signature": "st.testing.v1.element_tree.ButtonGroup(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "Add a selection to the widget. Do nothing if the value is already selected. If testing a multiselect widget with repeated options, use set_value instead.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L749" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the multiselect widget. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L743" + }, + { + "name": "unselect", + "signature": "st.testing.v1.element_tree.unselect.unselect(v)", + "description": "Remove a selection from the widget. Do nothing if the value is not already selected. If a value is selected multiple times, the first instance is removed.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L764" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "The widget's formatting function for displaying options. (callable)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L737" + }, + { + "name": "indices", + "signature": "st.testing.v1.element_tree.indices.indices", + "description": "The indices of the currently selected values from the options. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L732" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected values from the options. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L722" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L696", + "description": "A representation of button_group that is used by st.feedback.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ChatInput": { + "name": "ChatInput", + "signature": "st.testing.v1.element_tree.ChatInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L356" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The value of the widget. (str)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L369" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L344", + "description": "A representation of st.chat_input.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Checkbox": { + "name": "Checkbox", + "signature": "st.testing.v1.element_tree.Checkbox(proto, root)", + "is_class": true, + "methods": [ + { + "name": "check", + "signature": "st.testing.v1.element_tree.check.check()", + "description": "Set the value of the widget to True.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L417" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L412" + }, + { + "name": "uncheck", + "signature": "st.testing.v1.element_tree.uncheck.uncheck()", + "description": "Set the value of the widget to False.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L421" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The value of the widget. (bool)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L402" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L380", + "description": "A representation of st.checkbox.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ColorPicker": { + "name": "ColorPicker", + "signature": "st.testing.v1.element_tree.ColorPicker(proto, root)", + "is_class": true, + "methods": [ + { + "name": "pick", + "signature": "st.testing.v1.element_tree.pick.pick(v)", + "description": "Set the value of the widget as a hex string. May omit the "#" prefix.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L489" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget as a hex string.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L484" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected value as a hex string. (str)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L463" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L448", + "description": "A representation of st.color_picker.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.DateInput": { + "name": "DateInput", + "signature": "st.testing.v1.element_tree.DateInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L535" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The value of the widget. (date or Tuple of date)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L549" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L515", + "description": "A representation of st.date_input.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Element": { + "name": "Element", + "signature": "st.testing.v1.element_tree.Element(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The value or contents of the element.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L132" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L103", + "description": "Element base class for testing.
\nThis class's methods and attributes are universal for all elements\nimplemented in testing. For example, Caption, Code, Text, and\nTitle inherit from Element. All widget classes also\ninherit from Element, but have additional methods specific to each\nwidget type. See the AppTest class for the full list of supported\nelements.
\nFor all element classes, parameters of the original element can be obtained\nas properties. For example, Button.label, Caption.help, and\nToast.icon.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Multiselect": { + "name": "Multiselect", + "signature": "st.testing.v1.element_tree.Multiselect(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "Add a selection to the widget. Do nothing if the value is already selected. If testing a multiselect widget with repeated options, use set_value instead.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L842" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the multiselect widget. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L836" + }, + { + "name": "unselect", + "signature": "st.testing.v1.element_tree.unselect.unselect(v)", + "description": "Remove a selection from the widget. Do nothing if the value is not already selected. If a value is selected multiple times, the first instance is removed.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L857" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "The widget's formatting function for displaying options. (callable)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L830" + }, + { + "name": "indices", + "signature": "st.testing.v1.element_tree.indices.indices", + "description": "The indices of the currently selected values from the options. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L820" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected values from the options. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L810" + }, + { + "name": "values", + "signature": "st.testing.v1.element_tree.values.values", + "description": "The currently selected values from the options. (list)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L825" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L781", + "description": "A representation of st.multiselect.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.NumberInput": { + "name": "NumberInput", + "signature": "st.testing.v1.element_tree.NumberInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "decrement", + "signature": "st.testing.v1.element_tree.decrement.decrement()", + "description": "Decrement the st.number_input widget as if the user clicked "-".
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L930" + }, + { + "name": "increment", + "signature": "st.testing.v1.element_tree.increment.increment()", + "description": "Increment the st.number_input widget as if the user clicked "+".
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L922" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the st.number_input widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L897" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "Get the current value of the st.number_input widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L910" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L877", + "description": "A representation of st.number_input.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Radio": { + "name": "Radio", + "signature": "st.testing.v1.element_tree.Radio(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the selection by value.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L981" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "The widget's formatting function for displaying options. (callable)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L975" + }, + { + "name": "index", + "signature": "st.testing.v1.element_tree.index.index", + "description": "The index of the current selection. (int)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L958" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected value from the options. (Any)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L965" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L939", + "description": "A representation of st.radio.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.SelectSlider": { + "name": "SelectSlider", + "signature": "st.testing.v1.element_tree.SelectSlider(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_range", + "signature": "st.testing.v1.element_tree.set_range.set_range(lower, upper)", + "description": "Set the ranged selection by values.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1127" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the (single) selection by value.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1089" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "The widget's formatting function for displaying options. (callable)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1121" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected value or range. (Any or Sequence of Any)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1110" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1071", + "description": "A representation of st.select_slider.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Selectbox": { + "name": "Selectbox", + "signature": "st.testing.v1.element_tree.Selectbox(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "Set the selection by value.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1048" + }, + { + "name": "select_index", + "signature": "st.testing.v1.element_tree.select_index.select_index(index)", + "description": "Set the selection by index.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1052" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the selection by value.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1043" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "The widget's formatting function for displaying options. (callable)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1037" + }, + { + "name": "index", + "signature": "st.testing.v1.element_tree.index.index", + "description": "The index of the current selection. (int)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1017" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected value from the options. (Any)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1027" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L999", + "description": "A representation of st.selectbox.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Slider": { + "name": "Slider", + "signature": "st.testing.v1.element_tree.Slider(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_range", + "signature": "st.testing.v1.element_tree.set_range.set_range(lower, upper)", + "description": "Set the ranged value of the slider.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1180" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the (single) value of the slider.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1151" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The currently selected value or range. (Any or Sequence of Any)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1169" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1132", + "description": "A representation of st.slider.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TextArea": { + "name": "TextArea", + "signature": "st.testing.v1.element_tree.TextArea(proto, root)", + "is_class": true, + "methods": [ + { + "name": "input", + "signature": "st.testing.v1.element_tree.input.input(v)", + "description": "Set the value of the widget only if the value does not exceed the maximum allowed characters.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1261" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1237" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The current value of the widget. (str)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1250" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1219", + "description": "A representation of st.text_area.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TextInput": { + "name": "TextInput", + "signature": "st.testing.v1.element_tree.TextInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "input", + "signature": "st.testing.v1.element_tree.input.input(v)", + "description": "Set the value of the widget only if the value does not exceed the maximum allowed characters.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1314" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1290" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The current value of the widget. (str)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1303" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1272", + "description": "A representation of st.text_input.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TimeInput": { + "name": "TimeInput", + "signature": "st.testing.v1.element_tree.TimeInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "decrement", + "signature": "st.testing.v1.element_tree.decrement.decrement()", + "description": "Select the previous available time.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1379" + }, + { + "name": "increment", + "signature": "st.testing.v1.element_tree.increment.increment()", + "description": "Select the next available time.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1372" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1344" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The current value of the widget. (time)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1360" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1328", + "description": "A representation of st.time_input.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Toggle": { + "name": "Toggle", + "signature": "st.testing.v1.element_tree.Toggle(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1436" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The current value of the widget. (bool)
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1426" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L1403", + "description": "A representation of st.toggle.
\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Widget": { + "name": "Widget", + "signature": "st.testing.v1.element_tree.Widget(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "Run the AppTest script which contains the element.
", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "The maximum number of seconds to run the script. None means\nuse the AppTest's default.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L142" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "Set the value of the widget.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L193" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "The value or contents of the element.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L132" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/testing/v1/element_tree.py#L178", + "description": "Widget base class for testing.
\n", + "args": [], + "returns": [] + }, + "streamlit.user.to_dict": { + "name": "to_dict", + "signature": "st.user.to_dict()", + "description": "Get user info as a dictionary.
\nThis method primarily exists for internal use and is not needed for\nmost cases. st.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.45.1/lib/streamlit/user_info.py#L509" + }, + "context.cookies": { + "name": "cookies", + "signature": "context.cookies", + "examples": "\n\n", + "description": "Example 1: Access all available cookies
\nShow a dictionary of cookies:
\n\nimport streamlit as st\n\nst.context.cookies\n\nExample 2: Access a specific cookie
\nShow the value of a specific cookie:
\n\nimport streamlit as st\n\nst.context.cookies["_ga"]\n\n
A read-only, dict-like object containing cookies sent in the initial request.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L184" + }, + "context.headers": { + "name": "headers", + "signature": "context.headers", + "examples": "\n\n", + "description": "Example 1: Access all available headers
\nShow a dictionary of headers (with only the last instance of any\nrepeated key):
\n\nimport streamlit as st\n\nst.context.headers\n\nExample 2: Access a specific header
\nShow the value of a specific header (or the last instance if it's\nrepeated):
\n\nimport streamlit as st\n\nst.context.headers["host"]\n\nShow of list of all headers for a given key:
\n\nimport streamlit as st\n\nst.context.headers.get_all("pragma")\n\n
A read-only, dict-like object containing headers sent in the initial request.
\nKeys are case-insensitive and may be repeated. When keys are repeated,\ndict-like methods will only return the last instance of each key. Use\n.get_all(key="your_repeated_key") to see all values if the same\nheader is set multiple times.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L138" + }, + "context.ip_address": { + "name": "ip_address", + "signature": "context.ip_address", + "example": "\n\n", + "description": "Check if the user has an IPv4 or IPv6 address:
\n\nimport streamlit as st\n\nip = st.context.ip_address\nif ip is None:\n st.write("No IP address. This is expected in local development.")\nelif ip.contains(":"):\n st.write("You have an IPv6 address.")\nelif ip.contains("."):\n st.write("You have an IPv4 address.")\nelse:\n st.error("This should not happen.")\n\n
The read-only IP address of the user's connection.
\nThis should not be used for security measures because it can easily be\nspoofed. When a user accesses the app through localhost, the IP\naddress is None. Otherwise, the IP address is determined from the\nremote_ip attribute of the Tornado request object and may be an\nIPv4 or IPv6 address.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L337" + }, + "context.is_embedded": { + "name": "is_embedded", + "signature": "context.is_embedded", + "example": "\n\n", + "description": "Conditionally show content when the app is running in an embedded\ncontext:
\n\nimport streamlit as st\n\nif st.context.is_embedded:\n st.write("You are running the app in an embedded context.")\n\n
Whether the app is embedded.
\nThis property returns a boolean value indicating whether the app is\nrunning in an embedded context. This is determined by the presence of\nembed=true as a query parameter in the URL. This is the only way to\ndetermine if the app is currently configured for embedding because\nembedding settings are not accessible through st.query_params or\nst.context.url.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L375" + }, + "context.locale": { + "name": "locale", + "signature": "context.locale", + "example": "\n\n", + "description": "Access the user's locale to display locally:
\n\nimport streamlit as st\n\nif st.context.locale == "fr-FR":\n st.write("Bonjour!")\nelse:\n st.write("Hello!")\n\n
The read-only locale of the user's browser.
\nst.context.locale returns the value of navigator.language from\nthe user's DOM. This is a string representing the user's preferred\nlanguage (e.g. "en-US").
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L274" + }, + "context.timezone": { + "name": "timezone", + "signature": "context.timezone", + "example": "\n\n", + "description": "Access the user's timezone, and format a datetime to display locally:
\n\nimport streamlit as st\nfrom datetime import datetime, timezone\nimport pytz\n\ntz = st.context.timezone\ntz_obj = pytz.timezone(tz)\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n\n
The read-only timezone of the user's browser.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L218" + }, + "context.timezone_offset": { + "name": "timezone_offset", + "signature": "context.timezone_offset", + "example": "\n\n", + "description": "Access the user's timezone offset, and format a datetime to display locally:
\n\nimport streamlit as st\nfrom datetime import datetime, timezone, timedelta\n\ntzoff = st.context.timezone_offset\ntz_obj = timezone(-timedelta(minutes=tzoff))\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n\n
The read-only timezone offset of the user's browser.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L247" + }, + "context.url": { + "name": "url", + "signature": "context.url", + "example": "\n\n", + "description": "Conditionally show content when you access your app through\nlocalhost:
\n\nimport streamlit as st\n\nif st.context.url.startswith("http://localhost"):\n st.write("You are running the app locally.")\n\n
The read-only URL of the app in the user's browser.
\nst.context.url returns the URL through which the user is accessing\nthe app. This includes the scheme, domain name, port, and path. If\nquery parameters or anchors are present in the URL, they are removed\nand not included in this value.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L303" + }, + "CachedFunc.clear": { + "name": "clear", + "signature": "CachedFunc.clear(*args, **kwargs)", + "example": "\n\n", + "description": "\nimport streamlit as st\nimport time\n\n@st.cache_data\ndef foo(bar):\n time.sleep(2)\n st.write(f"Executed foo({bar}).")\n return bar\n\nif st.button("Clear all cached values for `foo`", on_click=foo.clear):\n foo.clear()\n\nif st.button("Clear the cached value of `foo(1)`"):\n foo.clear(1)\n\nfoo(1)\nfoo(2)\n\n
Clear the cached function's associated cache.
\nIf no arguments are passed, Streamlit will clear all values cached for\nthe function. If arguments are passed, Streamlit will clear the cached\nvalue for these arguments only.
\n", + "args": [ + { + "name": "*args", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "Arguments of the cached functions.
\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "Keyword arguments of the cached function.
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/caching/cache_utils.py#L349" + }, + "StreamlitPage": { + "name": "StreamlitPage", + "signature": "StreamlitPage(page, *, title=None, icon=None, url_path=None, default=False)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": ".run.run()", + "description": "Execute the page.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L268" + } + ], + "properties": [ + { + "name": "icon", + "signature": ".icon.icon", + "description": "The icon of the page.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L245" + }, + { + "name": "title", + "signature": ".title.title", + "description": "The title of the page.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L234" + }, + { + "name": "url_path", + "signature": ".url_path.url_path", + "description": "The page's URL pathname, which is the path relative to the app's root URL.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L253" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L128", + "description": "A page within a multipage Streamlit app.
\nUse st.Page to initialize a StreamlitPage object.
\n", + "args": [ + { + "name": "icon", + "type_name": "str", + "is_optional": false, + "description": "The icon of the page.
\nIf no icon was declared in st.Page, this property returns "".
\n", + "default": null + }, + { + "name": "title", + "type_name": "str", + "is_optional": false, + "description": "The title of the page.
\nUnless declared otherwise in st.Page, the page title is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.
\n", + "default": null + }, + { + "name": "url_path", + "type_name": "str", + "is_optional": false, + "description": "The page's URL pathname, which is the path relative to the app's root\nURL.
\nUnless declared otherwise in st.Page, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.
\nThe default page will always have a url_path of "" to indicate\nthe root URL (e.g. homepage).
\n", + "default": "page" + } + ], + "returns": [] + }, + "StreamlitPage.icon": { + "name": "icon", + "signature": "StreamlitPage.icon", + "description": "The icon of the page.
\nIf no icon was declared in st.Page, this property returns "".
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L245" + }, + "StreamlitPage.run": { + "name": "run", + "signature": "StreamlitPage.run()", + "description": "Execute the page.
\nWhen a page is returned by st.navigation, use the .run() method\nwithin your entrypoint file to render the page. You can only call this\nmethod on the page returned by st.navigation. You can only call\nthis method once per run of your entrypoint file.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L268" + }, + "StreamlitPage.title": { + "name": "title", + "signature": "StreamlitPage.title", + "description": "The title of the page.
\nUnless declared otherwise in st.Page, the page title is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L234" + }, + "StreamlitPage.url_path": { + "name": "url_path", + "signature": "StreamlitPage.url_path", + "description": "The page's URL pathname, which is the path relative to the app's root URL.
\nUnless declared otherwise in st.Page, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.
\nThe default page will always have a url_path of "" to indicate\nthe root URL (e.g. homepage).
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/navigation/page.py#L253" + }, + "streamlit.user": { + "name": "user", + "signature": "st.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.45.1/lib/streamlit/user_info.py#L509" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/user_info.py#L374", + "examples": "Example 1: Google's identity token
\nIf you configure a basic Google OIDC connection as shown in Example 1 of\nst.login(), the following data is available in\nst.user. Streamlit adds the is_logged_in attribute.\nAdditional attributes may be available depending on the configuration of\nthe user's Google account. For more information about Google's identity\ntokens, see Obtain user information from the ID token\nin Google's docs.
\nYour app code:
\n\nimport streamlit as st\n\nif st.user.is_logged_in:\n st.write(st.user)\n\n
Displayed data when a user is logged in:
\n\n{\n "is_logged_in":true\n "iss":"https://accounts.google.com"\n "azp":"{client_id}.apps.googleusercontent.com"\n "aud":"{client_id}.apps.googleusercontent.com"\n "sub":"{unique_user_id}"\n "email":"{user}@gmail.com"\n "email_verified":true\n "at_hash":"{access_token_hash}"\n "nonce":"{nonce_string}"\n "name":"{full_name}"\n "picture":"https://lh3.googleusercontent.com/a/{content_path}"\n "given_name":"{given_name}"\n "family_name":"{family_name}"\n "iat":{issued_time}\n "exp":{expiration_time}\n}\n\n
Example 2: Microsoft's identity token
\nIf you configure a basic Microsoft OIDC connection as shown in Example 2 of\nst.login(), the following data is available in\nst.user. For more information about Microsoft's identity\ntokens, see ID token claims reference\nin Microsoft's docs.
\nYour app code:
\n\nimport streamlit as st\n\nif st.user.is_logged_in:\n st.write(st.user)\n\n
Displayed data when a user is logged in:
\n\n{\n "is_logged_in":true\n "ver":"2.0"\n "iss":"https://login.microsoftonline.com/{tenant_id}/v2.0"\n "sub":"{application_user_id}"\n "aud":"{application_id}"\n "exp":{expiration_time}\n "iat":{issued_time}\n "nbf":{start_time}\n "name":"{full_name}"\n "preferred_username":"{username}"\n "oid":"{user_GUID}"\n "email":"{email}"\n "tid":"{tenant_id}"\n "nonce":"{nonce_string}"\n "aio":"{opaque_string}"\n}\n\n", + "description": "
A read-only, dict-like object for accessing information about the current user.
\nst.user is dependent on the host platform running your\nStreamlit app. If your host platform has not configured the object,\nst.user will behave as it does in a locally running app.
\nWhen authentication is configured in secrets.toml, Streamlit will parse\nthe OpenID Connect (OIDC) identity token and copy the attributes to\nst.user. Check your provider's documentation for their\navailable attributes (known as claims).
\nWhen authentication is not configured, st.user has no\nattributes.
\nYou can access values via key or attribute notation. For example, use\nst.user["email"] or st.user.email to\naccess the email attribute.
\nImportant
\nIdentity tokens include an issuance and expiration time. Streamlit does\nnot implicitly check these. If you want to automatically expire a\nuser's authentication, check these values manually and programmatically\nlog out your user (st.logout()) when needed.
\nWhether a user is logged in. For a locally running app, this attribute\nis only available when authentication (st.login()) is configured in\nsecrets.toml. Otherwise, it does not exist.
\n", + "default": null + } + ], + "returns": [] + }, + "streamlit.context": { + "name": "context", + "signature": "st.context()", + "is_class": true, + "methods": [], + "properties": [ + { + "name": "cookies", + "signature": "st.cookies.cookies", + "examples": "\n\n", + "description": "Example 1: Access all available cookies
\nShow a dictionary of cookies:
\n\nimport streamlit as st\n\nst.context.cookies\n\nExample 2: Access a specific cookie
\nShow the value of a specific cookie:
\n\nimport streamlit as st\n\nst.context.cookies["_ga"]\n\n
A read-only, dict-like object containing cookies sent in the initial request.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L184" + }, + { + "name": "headers", + "signature": "st.headers.headers", + "examples": "\n\n", + "description": "Example 1: Access all available headers
\nShow a dictionary of headers (with only the last instance of any\nrepeated key):
\n\nimport streamlit as st\n\nst.context.headers\n\nExample 2: Access a specific header
\nShow the value of a specific header (or the last instance if it's\nrepeated):
\n\nimport streamlit as st\n\nst.context.headers["host"]\n\nShow of list of all headers for a given key:
\n\nimport streamlit as st\n\nst.context.headers.get_all("pragma")\n\n
A read-only, dict-like object containing headers sent in the initial request.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L138" + }, + { + "name": "ip_address", + "signature": "st.ip_address.ip_address", + "example": "\n\n", + "description": "Check if the user has an IPv4 or IPv6 address:
\n\nimport streamlit as st\n\nip = st.context.ip_address\nif ip is None:\n st.write("No IP address. This is expected in local development.")\nelif ip.contains(":"):\n st.write("You have an IPv6 address.")\nelif ip.contains("."):\n st.write("You have an IPv4 address.")\nelse:\n st.error("This should not happen.")\n\n
The read-only IP address of the user's connection.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L337" + }, + { + "name": "is_embedded", + "signature": "st.is_embedded.is_embedded", + "example": "\n\n", + "description": "Conditionally show content when the app is running in an embedded\ncontext:
\n\nimport streamlit as st\n\nif st.context.is_embedded:\n st.write("You are running the app in an embedded context.")\n\n
Whether the app is embedded.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L375" + }, + { + "name": "locale", + "signature": "st.locale.locale", + "example": "\n\n", + "description": "Access the user's locale to display locally:
\n\nimport streamlit as st\n\nif st.context.locale == "fr-FR":\n st.write("Bonjour!")\nelse:\n st.write("Hello!")\n\n
The read-only locale of the user's browser.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L274" + }, + { + "name": "timezone", + "signature": "st.timezone.timezone", + "example": "\n\n", + "description": "Access the user's timezone, and format a datetime to display locally:
\n\nimport streamlit as st\nfrom datetime import datetime, timezone\nimport pytz\n\ntz = st.context.timezone\ntz_obj = pytz.timezone(tz)\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n\n
The read-only timezone of the user's browser.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L218" + }, + { + "name": "timezone_offset", + "signature": "st.timezone_offset.timezone_offset", + "example": "\n\n", + "description": "Access the user's timezone offset, and format a datetime to display locally:
\n\nimport streamlit as st\nfrom datetime import datetime, timezone, timedelta\n\ntzoff = st.context.timezone_offset\ntz_obj = timezone(-timedelta(minutes=tzoff))\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n\n
The read-only timezone offset of the user's browser.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L247" + }, + { + "name": "url", + "signature": "st.url.url", + "example": "\n\n", + "description": "Conditionally show content when you access your app through\nlocalhost:
\n\nimport streamlit as st\n\nif st.context.url.startswith("http://localhost"):\n st.write("You are running the app locally.")\n\n
The read-only URL of the app in the user's browser.
", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L303" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/runtime/context.py#L127", + "description": "An interface to access user session context.
\nst.context provides a read-only interface to access headers and cookies\nfor the current user session.
\nEach property (st.context.headers and st.context.cookies) returns\na dictionary of named values.
\n", + "args": [], + "returns": [] + }, + "PlotlyState": { + "name": "PlotlyState", + "signature": "PlotlyState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/plotly_chart.py#L168", + "example": "Try selecting points by any of the three available methods (direct click,\nbox, or lasso). The current selection state is available through Session\nState or as the output of the chart function.
\n\nimport streamlit as st\nimport plotly.express as px\n\ndf = px.data.iris() # iris is a pandas DataFrame\nfig = px.scatter(df, x="sepal_width", y="sepal_length")\n\nevent = st.plotly_chart(fig, key="iris", on_select="rerun")\n\nevent\n\n
The schema for the Plotly chart event state.
\nThe event state is stored in a dictionary-like object that supports both\nkey and attribute notation. Event states cannot be programmatically\nchanged or set through Session State.
\nOnly selection events are supported at this time.
\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by the PlotlySelectionState dictionary\nschema.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PlotlySelectionState": { + "name": "PlotlySelectionState", + "signature": "PlotlySelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/plotly_chart.py#L80", + "example": "When working with more complicated graphs, the points attribute\ndisplays additional information. Try selecting points in the following\nexample:
\n\nimport streamlit as st\nimport plotly.express as px\n\ndf = px.data.iris()\nfig = px.scatter(\n df,\n x="sepal_width",\n y="sepal_length",\n color="species",\n size="petal_length",\n hover_data=["petal_width"],\n)\n\nevent = st.plotly_chart(fig, key="iris", on_select="rerun")\n\nevent.selection\n\n
This is an example of the selection state when selecting a single point:
\n\n{\n "points": [\n {\n "curve_number": 2,\n "point_number": 9,\n "point_index": 9,\n "x": 3.6,\n "y": 7.2,\n "customdata": [\n 2.5\n ],\n "marker_size": 6.1,\n "legendgroup": "virginica"\n }\n ],\n "point_indices": [\n 9\n ],\n "box": [],\n "lasso": []\n}\n\n", + "description": "
The schema for the Plotly chart selection state.
\nThe selection state is stored in a dictionary-like object that supports both\nkey and attribute notation. Selection states cannot be programmatically\nchanged or set through Session State.
\n", + "args": [ + { + "name": "points", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "The selected data points in the chart, including the data points\nselected by the box and lasso mode. The data includes the values\nassociated to each point and a point index used to populate\npoint_indices. If additional information has been assigned to your\npoints, such as size or legend group, this is also included.
\n", + "default": null + }, + { + "name": "point_indices", + "type_name": "list[int]", + "is_optional": false, + "description": "The numerical indices of all selected data points in the chart. The\ndetails of each identified point are included in points.
\n", + "default": null + }, + { + "name": "box", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "The metadata related to the box selection. This includes the\ncoordinates of the selected area.
\n", + "default": null + }, + { + "name": "lasso", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "The metadata related to the lasso selection. This includes the\ncoordinates of the selected area.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "VegaLiteState": { + "name": "VegaLiteState", + "signature": "VegaLiteState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/vega_charts.py#L109", + "examples": "The following two examples have equivalent definitions. Each one has a\npoint and interval selection parameter include in the chart definition.\nThe point selection parameter is named "point_selection". The interval\nor box selection parameter is named "interval_selection".
\nThe follow example uses st.altair_chart:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nif "data" not in st.session_state:\n st.session_state.data = pd.DataFrame(\n np.random.randn(20, 3), columns=["a", "b", "c"]\n )\ndf = st.session_state.data\n\npoint_selector = alt.selection_point("point_selection")\ninterval_selector = alt.selection_interval("interval_selection")\nchart = (\n alt.Chart(df)\n .mark_circle()\n .encode(\n x="a",\n y="b",\n size="c",\n color="c",\n tooltip=["a", "b", "c"],\n fillOpacity=alt.condition(point_selector, alt.value(1), alt.value(0.3)),\n )\n .add_params(point_selector, interval_selector)\n)\n\nevent = st.altair_chart(chart, key="alt_chart", on_select="rerun")\n\nevent\n\n
The following example uses st.vega_lite_chart:
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nif "data" not in st.session_state:\n st.session_state.data = pd.DataFrame(\n np.random.randn(20, 3), columns=["a", "b", "c"]\n )\n\nspec = {\n "mark": {"type": "circle", "tooltip": True},\n "params": [\n {"name": "interval_selection", "select": "interval"},\n {"name": "point_selection", "select": "point"},\n ],\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 "fillOpacity": {\n "condition": {"param": "point_selection", "value": 1},\n "value": 0.3,\n },\n },\n}\n\nevent = st.vega_lite_chart(\n st.session_state.data, spec, key="vega_chart", on_select="rerun"\n)\n\nevent\n\n
Try selecting points in this interactive example. When you click a point,\nthe selection will appear under the attribute, "point_selection", which\nis the name given to the point selection parameter. Similarly, when you\nmake an interval selection, it will appear under the attribute\n"interval_selection". You can give your selection parameters other\nnames if desired.
\nIf you hold Shift while selecting points, existing point selections\nwill be preserved. Interval selections are not preserved when making\nadditional selections.
\nThe schema for the Vega-Lite event state.
\nThe event state is stored in a dictionary-like object that supports both\nkey and attribute notation. Event states cannot be programmatically\nchanged or set through Session State.
\nOnly selection events are supported at this time.
\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe name of each Vega-Lite selection parameter becomes an attribute in\nthe selection dictionary. The format of the data within each\nattribute is determined by the selection parameter definition within\nVega-Lite.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataframeState": { + "name": "DataframeState", + "signature": "DataframeState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/arrow.py#L135", + "description": "The schema for the dataframe event state.
\nThe event state is stored in a dictionary-like object that supports both\nkey and attribute notation. Event states cannot be programmatically\nchanged or set through Session State.
\nOnly selection events are supported at this time.
\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by the DataframeSelectionState\ndictionary schema.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataframeSelectionState": { + "name": "DataframeSelectionState", + "signature": "DataframeSelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/arrow.py#L77", + "example": "The following example has multi-row and multi-column selections enabled.\nTry selecting some rows. To select multiple columns, hold Ctrl while\nselecting columns. Hold Shift to select a range of columns.
\n\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nif "df" not in st.session_state:\n st.session_state.df = pd.DataFrame(\n np.random.randn(12, 5), columns=["a", "b", "c", "d", "e"]\n )\n\nevent = st.dataframe(\n st.session_state.df,\n key="data",\n on_select="rerun",\n selection_mode=["multi-row", "multi-column"],\n)\n\nevent.selection\n\n
The schema for the dataframe selection state.
\nThe selection state is stored in a dictionary-like object that supports both\nkey and attribute notation. Selection states cannot be programmatically\nchanged or set through Session State.
\nWarning
\nIf a user sorts a dataframe, row selections will be reset. If your\nusers need to sort and filter the dataframe to make selections, direct\nthem to use the search function in the dataframe toolbar instead.
\nThe selected rows, identified by their integer position. The integer\npositions match the original dataframe, even if the user sorts the\ndataframe in their browser. For a pandas.DataFrame, you can\nretrieve data from its interger position using methods like .iloc[]\nor .iat[].
\n", + "default": null + }, + { + "name": "columns", + "type_name": "list[str]", + "is_optional": false, + "description": "The selected columns, identified by their names.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PydeckState": { + "name": "PydeckState", + "signature": "PydeckState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/deck_gl_json_chart.py#L209", + "description": "The schema for the PyDeck event state.
\nThe event state is stored in a dictionary-like object that supports both\nkey and attribute notation. Event states cannot be programmatically changed\nor set through Session State.
\nOnly selection events are supported at this time.
\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by the PydeckSelectionState\ndictionary schema.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PydeckSelectionState": { + "name": "PydeckSelectionState", + "signature": "PydeckSelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.45.1/lib/streamlit/elements/deck_gl_json_chart.py#L102", + "examples": "The following example has multi-object selection enabled. The chart\ndisplays US state capitals by population (2023 US Census estimate). You\ncan access this data\nfrom GitHub.
\n\nimport streamlit as st\nimport pydeck\nimport pandas as pd\n\ncapitals = pd.read_csv(\n "capitals.csv",\n header=0,\n names=[\n "Capital",\n "State",\n "Abbreviation",\n "Latitude",\n "Longitude",\n "Population",\n ],\n)\ncapitals["size"] = capitals.Population / 10\n\npoint_layer = pydeck.Layer(\n "ScatterplotLayer",\n data=capitals,\n id="capital-cities",\n get_position=["Longitude", "Latitude"],\n get_color="[255, 75, 75]",\n pickable=True,\n auto_highlight=True,\n get_radius="size",\n)\n\nview_state = pydeck.ViewState(\n latitude=40, longitude=-117, controller=True, zoom=2.4, pitch=30\n)\n\nchart = pydeck.Deck(\n point_layer,\n initial_view_state=view_state,\n tooltip={"text": "{Capital}, {Abbreviation}\\nPopulation: {Population}"},\n)\n\nevent = st.pydeck_chart(chart, on_select="rerun", selection_mode="multi-object")\n\nevent.selection\n\n
This is an example of the selection state when selecting a single object\nfrom a layer with id, "captial-cities":
\n\n{\n "indices":{\n "capital-cities":[\n 2\n ]\n },\n "objects":{\n "capital-cities":[\n {\n "Abbreviation":" AZ"\n "Capital":"Phoenix"\n "Latitude":33.448457\n "Longitude":-112.073844\n "Population":1650070\n "State":" Arizona"\n "size":165007.0\n }\n ]\n }\n}\n\n", + "description": "
The schema for the PyDeck chart selection state.
\nThe selection state is stored in a dictionary-like object that supports\nboth key and attribute notation. Selection states cannot be\nprogrammatically changed or set through Session State.
\nYou must define id in pydeck.Layer to ensure statefulness when\nusing selections with st.pydeck_chart.
\n", + "args": [ + { + "name": "indices", + "type_name": "dict[str, list[int]]", + "is_optional": false, + "description": "A dictionary of selected objects by layer. Each key in the dictionary\nis a layer id, and each value is a list of object indices within that\nlayer.
\n", + "default": null + }, + { + "name": "objects", + "type_name": "dict[str, list[dict[str, Any]]]", + "is_optional": false, + "description": "A dictionary of object attributes by layer. Each key in the dictionary\nis a layer id, and each value is a list of metadata dictionaries for\nthe selected objects in that layer.
\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + } } } diff --git a/python/utils.py b/python/utils.py index f35b44f69..8192342c2 100644 --- a/python/utils.py +++ b/python/utils.py @@ -1,32 +1,116 @@ import pathlib import json import logging +import semver +import os +from typing import Dict, Any, Optional +from pathlib import Path -OUT_FILE_NAME = 'streamlit.json' +# Get the directory containing this script +SCRIPT_DIR = Path(__file__).parent -def get_existing_dict(filename=OUT_FILE_NAME): - logging.debug(f'Reading {filename}...') +def get_output_path(filename: str) -> Path: + """ + Get the absolute path for the output file in the python directory. - if pathlib.Path(filename).is_file(): - with open(filename, 'r') as current_json: + Args: + filename: Name of the output file + + Returns: + Absolute path to the output file + """ + return SCRIPT_DIR / filename + + +def get_existing_dict(output_file: Path) -> Dict[str, Any]: + """ + Read and parse a JSON file into a dictionary. + + Args: + output_file: Path to the JSON file to read + + Returns: + Dictionary containing the parsed JSON data + """ + logging.debug(f"Reading {output_file}...") + + if output_file.is_file(): + with open(output_file, "r") as current_json: docstring_dict = json.loads(current_json.read()) - logging.debug(f'Done!') + logging.debug(f"Done!") return docstring_dict return {} def write_to_existing_dict( - streamlit_version, - docstring_dict, - filename=OUT_FILE_NAME - ): - logging.debug(f'Writing {filename}...') + streamlit_version: str, + docstring_dict: Dict[str, Any], + output_file: Path, +) -> None: + """ + Write docstring data for a specific Streamlit version to a JSON file. + + Args: + streamlit_version: The version of Streamlit this data is for + docstring_dict: Dictionary containing the docstring data + output_file: Path to the JSON file to write to + """ + logging.debug(f"Writing {output_file}...") - existing_dict = get_existing_dict(filename) + existing_dict = get_existing_dict(output_file) existing_dict[streamlit_version] = docstring_dict - with open(filename, 'w') as out_file: + with open(output_file, "w") as out_file: out_file.write(json.dumps(existing_dict)) - logging.debug(f'Done!') + logging.debug(f"Done!") + + +def get_latest_version(version_dict: Dict[str, Any]) -> Optional[str]: + """ + Find the latest version in a dictionary using semver. + + Args: + version_dict: Dictionary with version strings as keys + + Returns: + The latest version string, or None if no valid versions found + """ + latest_version = None + for version in version_dict.keys(): + try: + if latest_version is None or semver.compare(version, latest_version) > 0: + latest_version = version + except ValueError: + # Skip non-semver versions + continue + + return latest_version + + +def get_latest_data(json_path: Path) -> Dict[str, Any]: + """ + Read a versioned JSON file and return data for the latest version. + + Args: + json_path: Path to the JSON file + + Returns: + Dictionary containing the data for the latest version + """ + try: + with open(json_path, "r") as f: + data = json.load(f) + + latest_version = get_latest_version(data) + if latest_version is None: + logging.error("No valid version found in JSON file") + return {} + + logging.info(f"Using latest version: {latest_version}") + return data[latest_version] + + except (FileNotFoundError, json.JSONDecodeError, KeyError) as e: + logging.error(f"Error reading JSON file: {str(e)}") + return {}