streamlit-nightly 1.35.1.dev20240613__py2.py3-none-any.whl → 1.35.1.dev20240614__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/__init__.py +1 -1
- streamlit/commands/navigation.py +84 -18
- streamlit/components/v1/component_registry.py +24 -9
- streamlit/elements/arrow.py +17 -6
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/dialog_decorator.py +5 -3
- streamlit/elements/html.py +1 -9
- streamlit/elements/iframe.py +53 -10
- streamlit/elements/layouts.py +40 -4
- streamlit/elements/lib/column_types.py +1 -1
- streamlit/elements/map.py +1 -1
- streamlit/elements/markdown.py +18 -14
- streamlit/elements/plotly_chart.py +5 -2
- streamlit/elements/toast.py +1 -1
- streamlit/elements/vega_charts.py +93 -41
- streamlit/elements/widgets/button.py +6 -3
- streamlit/elements/widgets/data_editor.py +1 -1
- streamlit/elements/widgets/file_uploader.py +1 -1
- streamlit/elements/write.py +11 -10
- streamlit/hello/Mapping_Demo.py +1 -1
- streamlit/navigation/page.py +107 -19
- streamlit/runtime/caching/cache_data_api.py +5 -4
- streamlit/runtime/caching/cache_errors.py +1 -1
- streamlit/runtime/caching/cache_resource_api.py +5 -4
- streamlit/runtime/caching/legacy_cache_api.py +13 -12
- streamlit/runtime/fragment.py +57 -27
- streamlit/runtime/runtime_util.py +1 -1
- streamlit/runtime/scriptrunner/script_run_context.py +1 -1
- streamlit/runtime/secrets.py +2 -2
- streamlit/runtime/state/session_state.py +1 -1
- streamlit/runtime/state/session_state_proxy.py +1 -1
- streamlit/static/asset-manifest.json +4 -4
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{8427.59805a7f.chunk.js → 8427.5192ee0c.chunk.js} +1 -1
- streamlit/static/static/js/8536.f7b26b02.chunk.js +1 -0
- streamlit/static/static/js/{main.d4bbfd37.js → main.7994a814.js} +2 -2
- streamlit/testing/v1/app_test.py +4 -3
- streamlit/user_info.py +2 -4
- {streamlit_nightly-1.35.1.dev20240613.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/METADATA +9 -9
- {streamlit_nightly-1.35.1.dev20240613.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/RECORD +45 -45
- streamlit/static/static/js/8536.f8de3d9a.chunk.js +0 -1
- /streamlit/static/static/js/{main.d4bbfd37.js.LICENSE.txt → main.7994a814.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.35.1.dev20240613.data → streamlit_nightly-1.35.1.dev20240614.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.35.1.dev20240613.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.35.1.dev20240613.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.35.1.dev20240613.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/top_level.txt +0 -0
@@ -113,11 +113,13 @@ class VegaLiteState(TypedDict, total=False):
|
|
113
113
|
|
114
114
|
Attributes
|
115
115
|
----------
|
116
|
-
selection :
|
117
|
-
The state of the ``on_select`` event.
|
118
|
-
|
119
|
-
|
120
|
-
|
116
|
+
selection : dict
|
117
|
+
The state of the ``on_select`` event. This attribure returns a
|
118
|
+
dictionary-like object that supports both key and attribute notation.
|
119
|
+
The name of each Vega-Lite selection parameter becomes an attribute in
|
120
|
+
the ``selection`` dictionary. The format of the data within each
|
121
|
+
attribute is determined by the selection parameter definition within
|
122
|
+
Vega-Lite.
|
121
123
|
|
122
124
|
Examples
|
123
125
|
--------
|
@@ -584,23 +586,32 @@ class VegaChartsMixin:
|
|
584
586
|
|
585
587
|
Parameters
|
586
588
|
----------
|
587
|
-
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray,
|
589
|
+
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, \
|
590
|
+
pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, \
|
591
|
+
snowflake.snowpark.table.Table, Iterable, dict or None
|
588
592
|
Data to be plotted.
|
589
593
|
|
590
594
|
x : str or None
|
591
|
-
Column name
|
595
|
+
Column name or key associated to the x-axis data. If ``x`` is
|
596
|
+
``None`` (default), Streamlit uses the data index for the x-axis
|
597
|
+
values.
|
592
598
|
|
593
599
|
y : str, Sequence of str, or None
|
594
|
-
Column name(s)
|
595
|
-
|
596
|
-
|
597
|
-
|
600
|
+
Column name(s) or key(s) associated to the y-axis data. If this is
|
601
|
+
``None`` (default), Streamlit draws the data of all remaining
|
602
|
+
columns as data series. If this is a ``Sequence`` of strings,
|
603
|
+
Streamlit draws several series on the same chart by melting your
|
604
|
+
wide-format table into a long-format table behind the scenes.
|
598
605
|
|
599
606
|
x_label : str or None
|
600
|
-
The label for the x-axis. If
|
607
|
+
The label for the x-axis. If this is ``None`` (default), Streamlit
|
608
|
+
will use the column name specified in ``x`` if available, or else
|
609
|
+
no label will be displayed.
|
601
610
|
|
602
611
|
y_label : str or None
|
603
|
-
The label for the y-axis. If
|
612
|
+
The label for the y-axis. If this is ``None`` (default), Streamlit
|
613
|
+
will use the column name(s) specified in ``y`` if available, or
|
614
|
+
else no label will be displayed.
|
604
615
|
|
605
616
|
color : str, tuple, Sequence of str, Sequence of tuple, or None
|
606
617
|
The color to use for different lines in this chart.
|
@@ -768,23 +779,32 @@ class VegaChartsMixin:
|
|
768
779
|
|
769
780
|
Parameters
|
770
781
|
----------
|
771
|
-
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray,
|
782
|
+
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, \
|
783
|
+
pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, \
|
784
|
+
snowflake.snowpark.table.Table, Iterable, or dict
|
772
785
|
Data to be plotted.
|
773
786
|
|
774
787
|
x : str or None
|
775
|
-
Column name
|
788
|
+
Column name or key associated to the x-axis data. If ``x`` is
|
789
|
+
``None`` (default), Streamlit uses the data index for the x-axis
|
790
|
+
values.
|
776
791
|
|
777
792
|
y : str, Sequence of str, or None
|
778
|
-
Column name(s)
|
779
|
-
|
780
|
-
|
781
|
-
|
793
|
+
Column name(s) or key(s) associated to the y-axis data. If this is
|
794
|
+
``None`` (default), Streamlit draws the data of all remaining
|
795
|
+
columns as data series. If this is a ``Sequence`` of strings,
|
796
|
+
Streamlit draws several series on the same chart by melting your
|
797
|
+
wide-format table into a long-format table behind the scenes.
|
782
798
|
|
783
799
|
x_label : str or None
|
784
|
-
The label for the x-axis. If
|
800
|
+
The label for the x-axis. If this is ``None`` (default), Streamlit
|
801
|
+
will use the column name specified in ``x`` if available, or else
|
802
|
+
no label will be displayed.
|
785
803
|
|
786
804
|
y_label : str or None
|
787
|
-
The label for the y-axis. If
|
805
|
+
The label for the y-axis. If this is ``None`` (default), Streamlit
|
806
|
+
will use the column name(s) specified in ``y`` if available, or
|
807
|
+
else no label will be displayed.
|
788
808
|
|
789
809
|
color : str, tuple, Sequence of str, Sequence of tuple, or None
|
790
810
|
The color to use for different series in this chart.
|
@@ -953,23 +973,32 @@ class VegaChartsMixin:
|
|
953
973
|
|
954
974
|
Parameters
|
955
975
|
----------
|
956
|
-
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray,
|
976
|
+
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, \
|
977
|
+
pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, \
|
978
|
+
snowflake.snowpark.table.Table, Iterable, or dict
|
957
979
|
Data to be plotted.
|
958
980
|
|
959
981
|
x : str or None
|
960
|
-
Column name
|
982
|
+
Column name or key associated to the x-axis data. If ``x`` is
|
983
|
+
``None`` (default), Streamlit uses the data index for the x-axis
|
984
|
+
values.
|
961
985
|
|
962
986
|
y : str, Sequence of str, or None
|
963
|
-
Column name(s)
|
964
|
-
|
965
|
-
|
966
|
-
|
987
|
+
Column name(s) or key(s) associated to the y-axis data. If this is
|
988
|
+
``None`` (default), Streamlit draws the data of all remaining
|
989
|
+
columns as data series. If this is a ``Sequence`` of strings,
|
990
|
+
Streamlit draws several series on the same chart by melting your
|
991
|
+
wide-format table into a long-format table behind the scenes.
|
967
992
|
|
968
993
|
x_label : str or None
|
969
|
-
The label for the x-axis. If
|
994
|
+
The label for the x-axis. If this is ``None`` (default), Streamlit
|
995
|
+
will use the column name specified in ``x`` if available, or else
|
996
|
+
no label will be displayed.
|
970
997
|
|
971
998
|
y_label : str or None
|
972
|
-
The label for the y-axis. If
|
999
|
+
The label for the y-axis. If this is ``None`` (default), Streamlit
|
1000
|
+
will use the column name(s) specified in ``y`` if available, or
|
1001
|
+
else no label will be displayed.
|
973
1002
|
|
974
1003
|
color : str, tuple, Sequence of str, Sequence of tuple, or None
|
975
1004
|
The color to use for different series in this chart.
|
@@ -1012,9 +1041,10 @@ class VegaChartsMixin:
|
|
1012
1041
|
for three lines).
|
1013
1042
|
|
1014
1043
|
horizontal : bool
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1044
|
+
Whether to make the bars horizontal. If this is ``False``
|
1045
|
+
(default), the bars display vertically. If this is ``True``,
|
1046
|
+
Streamlit swaps the x-axis and y-axis and the bars display
|
1047
|
+
horizontally.
|
1018
1048
|
|
1019
1049
|
width : int or None
|
1020
1050
|
Desired width of the chart expressed in pixels. If ``width`` is
|
@@ -1074,7 +1104,7 @@ class VegaChartsMixin:
|
|
1074
1104
|
https://doc-bar-chart1.streamlit.app/
|
1075
1105
|
height: 440px
|
1076
1106
|
|
1077
|
-
|
1107
|
+
If your dataframe is in wide format, you can group multiple
|
1078
1108
|
columns under the y argument to show multiple series with different
|
1079
1109
|
colors:
|
1080
1110
|
|
@@ -1094,6 +1124,19 @@ class VegaChartsMixin:
|
|
1094
1124
|
https://doc-bar-chart2.streamlit.app/
|
1095
1125
|
height: 440px
|
1096
1126
|
|
1127
|
+
You can rotate your bar charts to display horizontally.
|
1128
|
+
|
1129
|
+
>>> import streamlit as st
|
1130
|
+
>>> from vega_datasets import data
|
1131
|
+
>>>
|
1132
|
+
>>> source = data.barley()
|
1133
|
+
>>>
|
1134
|
+
>>> st.bar_chart(source, x="variety", y="yield", color="site", horizontal=True)
|
1135
|
+
|
1136
|
+
.. output::
|
1137
|
+
https://doc-bar-chart-horizontal.streamlit.app/
|
1138
|
+
height: 440px
|
1139
|
+
|
1097
1140
|
"""
|
1098
1141
|
|
1099
1142
|
bar_chart_type = (
|
@@ -1149,23 +1192,32 @@ class VegaChartsMixin:
|
|
1149
1192
|
|
1150
1193
|
Parameters
|
1151
1194
|
----------
|
1152
|
-
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray,
|
1195
|
+
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, \
|
1196
|
+
pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, \
|
1197
|
+
snowflake.snowpark.table.Table, Iterable, dict or None
|
1153
1198
|
Data to be plotted.
|
1154
1199
|
|
1155
1200
|
x : str or None
|
1156
|
-
Column name
|
1201
|
+
Column name or key associated to the x-axis data. If ``x`` is
|
1202
|
+
``None`` (default), Streamlit uses the data index for the x-axis
|
1203
|
+
values.
|
1157
1204
|
|
1158
1205
|
y : str, Sequence of str, or None
|
1159
|
-
Column name(s)
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1206
|
+
Column name(s) or key(s) associated to the y-axis data. If this is
|
1207
|
+
``None`` (default), Streamlit draws the data of all remaining
|
1208
|
+
columns as data series. If this is a ``Sequence`` of strings,
|
1209
|
+
Streamlit draws several series on the same chart by melting your
|
1210
|
+
wide-format table into a long-format table behind the scenes.
|
1163
1211
|
|
1164
1212
|
x_label : str or None
|
1165
|
-
The label for the x-axis. If
|
1213
|
+
The label for the x-axis. If this is ``None`` (default), Streamlit
|
1214
|
+
will use the column name specified in ``x`` if available, or else
|
1215
|
+
no label will be displayed.
|
1166
1216
|
|
1167
1217
|
y_label : str or None
|
1168
|
-
The label for the y-axis. If
|
1218
|
+
The label for the y-axis. If this is ``None`` (default), Streamlit
|
1219
|
+
will use the column name(s) specified in ``y`` if available, or
|
1220
|
+
else no label will be displayed.
|
1169
1221
|
|
1170
1222
|
color : str, tuple, Sequence of str, Sequence of tuple, or None
|
1171
1223
|
The color of the circles representing each datapoint.
|
@@ -56,7 +56,7 @@ if TYPE_CHECKING:
|
|
56
56
|
FORM_DOCS_INFO: Final = """
|
57
57
|
|
58
58
|
For more information, refer to the
|
59
|
-
[documentation for forms](https://docs.streamlit.io/
|
59
|
+
[documentation for forms](https://docs.streamlit.io/develop/api-reference/execution-flow/st.form).
|
60
60
|
"""
|
61
61
|
|
62
62
|
DownloadButtonDataType: TypeAlias = Union[str, bytes, TextIO, BinaryIO, io.RawIOBase]
|
@@ -216,6 +216,10 @@ class ButtonMixin:
|
|
216
216
|
user is connected, so it's a good idea to keep file sizes under a
|
217
217
|
couple hundred megabytes to conserve memory.
|
218
218
|
|
219
|
+
If you want to prevent your app from rerunning when a user clicks the
|
220
|
+
download button, wrap the download button in a `fragment
|
221
|
+
<https://docs.streamlit.io/develop/concepts/architecture/fragments>`_.
|
222
|
+
|
219
223
|
Parameters
|
220
224
|
----------
|
221
225
|
label : str
|
@@ -560,8 +564,7 @@ class ButtonMixin:
|
|
560
564
|
navigation menus for your apps!
|
561
565
|
|
562
566
|
.. |client.showSidebarNavigation| replace:: ``client.showSidebarNavigation``
|
563
|
-
.. _client.showSidebarNavigation: https://docs.streamlit.io/
|
564
|
-
/advanced-features/configuration#client
|
567
|
+
.. _client.showSidebarNavigation: https://docs.streamlit.io/develop/api-reference/configuration/config.toml#client
|
565
568
|
|
566
569
|
.. output ::
|
567
570
|
https://doc-page-link.streamlit.app/
|
@@ -669,7 +669,7 @@ class DataEditorMixin:
|
|
669
669
|
* One of the column types defined under ``st.column_config``, e.g.
|
670
670
|
``st.column_config.NumberColumn("Dollar values”, format=”$ %d")`` to show
|
671
671
|
a column as dollar amounts. See more info on the available column types
|
672
|
-
and config options `here <https://docs.streamlit.io/
|
672
|
+
and config options `here <https://docs.streamlit.io/develop/api-reference/data/st.column_config>`_.
|
673
673
|
|
674
674
|
To configure the index column(s), use ``_index`` as the column name.
|
675
675
|
|
@@ -242,7 +242,7 @@ class FileUploaderMixin:
|
|
242
242
|
By default, uploaded files are limited to 200MB. You can configure
|
243
243
|
this using the ``server.maxUploadSize`` config option. For more info
|
244
244
|
on how to set config options, see
|
245
|
-
https://docs.streamlit.io/
|
245
|
+
https://docs.streamlit.io/develop/api-reference/configuration/config.toml
|
246
246
|
|
247
247
|
Parameters
|
248
248
|
----------
|
streamlit/elements/write.py
CHANGED
@@ -86,7 +86,7 @@ class WriteMixin:
|
|
86
86
|
Example
|
87
87
|
-------
|
88
88
|
You can pass an OpenAI stream as shown in our tutorial, `Build a \
|
89
|
-
basic LLM chat app <https://docs.streamlit.io/
|
89
|
+
basic LLM chat app <https://docs.streamlit.io/develop/tutorials/llms\
|
90
90
|
/build-conversational-apps#build-a-chatgpt-like-app>`_. Alternatively,
|
91
91
|
you can pass a generic generator function as input:
|
92
92
|
|
@@ -272,17 +272,18 @@ class WriteMixin:
|
|
272
272
|
- write(obj) : Prints str(obj) if otherwise unknown.
|
273
273
|
|
274
274
|
unsafe_allow_html : bool
|
275
|
-
|
275
|
+
Whether to render HTML within ``*args``. This only applies to
|
276
|
+
strings or objects falling back on ``_repr_html_()``. If this is
|
277
|
+
``False`` (default), any HTML tags found in ``body`` will be
|
278
|
+
escaped and therefore treated as raw text. If this is ``True``, any
|
279
|
+
HTML expressions within ``body`` will be rendered.
|
276
280
|
|
277
|
-
|
278
|
-
|
279
|
-
setting this argument to True.
|
281
|
+
Adding custom HTML to your app impacts safety, styling, and
|
282
|
+
maintainability.
|
280
283
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
https://github.com/streamlit/streamlit/issues/152
|
284
|
+
.. note::
|
285
|
+
If you only want to insert HTML or CSS without Markdown text,
|
286
|
+
we recommend using ``st.html`` instead.
|
286
287
|
|
287
288
|
**kwargs : any
|
288
289
|
Keyword arguments. Not used.
|
streamlit/hello/Mapping_Demo.py
CHANGED
@@ -108,7 +108,7 @@ st.markdown("# Mapping Demo")
|
|
108
108
|
st.sidebar.header("Mapping Demo")
|
109
109
|
st.write(
|
110
110
|
"""This demo shows how to use
|
111
|
-
[`st.pydeck_chart`](https://docs.streamlit.io/
|
111
|
+
[`st.pydeck_chart`](https://docs.streamlit.io/develop/api-reference/charts/st.pydeck_chart)
|
112
112
|
to display geospatial data."""
|
113
113
|
)
|
114
114
|
|
streamlit/navigation/page.py
CHANGED
@@ -35,30 +35,41 @@ def Page(
|
|
35
35
|
url_path: str | None = None,
|
36
36
|
default: bool = False,
|
37
37
|
):
|
38
|
-
"""Configure a page
|
38
|
+
"""Configure a page for ``st.navigation`` in a multipage app.
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
main script to execute the page code.
|
40
|
+
Call ``st.Page`` to initialize a ``StreamlitPage`` object, and pass it to
|
41
|
+
``st.navigation`` to declare a page in your app.
|
43
42
|
|
44
|
-
|
45
|
-
|
43
|
+
When a user navigates to a page, ``st.navigation`` returns the selected
|
44
|
+
``StreamlitPage`` object. Call ``StreamlitPage.run()`` on the returned page
|
45
|
+
to execute the page. You can only run the page returned by
|
46
|
+
``st.navigation``, and you can only run it once per app rerun.
|
47
|
+
|
48
|
+
A page can be defined by a Python file or ``Callable``.
|
46
49
|
|
47
50
|
Parameters
|
48
51
|
----------
|
49
52
|
|
50
|
-
page: str
|
51
|
-
The
|
52
|
-
|
53
|
+
page: str, Path, or callable
|
54
|
+
The page source as a ``Callable`` or path to a Python file. If the page
|
55
|
+
source is defined by a Python file, the path can be a string or
|
56
|
+
``pathlib.Path`` object, but must be declared relative to the
|
57
|
+
entrypoint file. If the page source is defined by a ``Callable``, the
|
58
|
+
``Callable`` can't accept arguments.
|
53
59
|
|
54
60
|
title: str or None
|
55
|
-
The title of the page. If None, the title
|
56
|
-
|
61
|
+
The title of the page. If this is ``None`` (default), the page title
|
62
|
+
(in the browser tab) and label (in the navigation menu) will be
|
63
|
+
inferred from the filename or callable name in ``page``. For more
|
64
|
+
information, see `Overview of multipage apps
|
65
|
+
<https://docs.streamlit.io/st.page.automatic-page-labels>`_.
|
57
66
|
|
58
67
|
icon: str or None
|
59
|
-
An optional emoji or icon to display next to the
|
60
|
-
is ``None`` (default), no icon is displayed
|
61
|
-
|
68
|
+
An optional emoji or icon to display next to the page title and label.
|
69
|
+
If ``icon`` is ``None`` (default), no icon is displayed next to the
|
70
|
+
page label in the navigation menu, and a Streamlit icon is displayed
|
71
|
+
next to the title (in the browser tab). If ``icon`` is a string, the
|
72
|
+
following options are valid:
|
62
73
|
|
63
74
|
* A single-character emoji. For example, you can set ``icon="🚨"``
|
64
75
|
or ``icon="🔥"``. Emoji short codes are not supported.
|
@@ -73,14 +84,27 @@ def Page(
|
|
73
84
|
font library.
|
74
85
|
|
75
86
|
url_path: str or None
|
76
|
-
The URL pathname
|
77
|
-
|
78
|
-
|
87
|
+
The page's URL pathname, which is the path relative to the app's root
|
88
|
+
URL. If this is ``None`` (default), the URL pathname will be inferred
|
89
|
+
from the filename or callable name in ``page``. For more information,
|
90
|
+
see `Overview of multipage apps
|
91
|
+
<https://docs.streamlit.io/st.page.automatic-page-urls>`_.
|
92
|
+
|
93
|
+
The default page will have a pathname of ``""``, indicating the root
|
94
|
+
URL of the app. If you set ``default=True``, ``url_path`` is ignored.
|
79
95
|
|
80
96
|
default: bool
|
81
97
|
Whether this page is the default page to be shown when the app is
|
82
|
-
loaded.
|
83
|
-
|
98
|
+
loaded. If ``default`` is ``False`` (default), the page will have a
|
99
|
+
nonempty URL pathname. However, if no default page is passed to
|
100
|
+
``st.navigation`` and this is the first page, this page will become the
|
101
|
+
default page. If ``default`` is ``True``, then the page will have
|
102
|
+
an empty pathname and ``url_path`` will be ignored.
|
103
|
+
|
104
|
+
Returns
|
105
|
+
-------
|
106
|
+
StreamlitPage
|
107
|
+
The page object associated to the given script.
|
84
108
|
|
85
109
|
Example
|
86
110
|
-------
|
@@ -88,6 +112,7 @@ def Page(
|
|
88
112
|
>>>
|
89
113
|
>>> def page2():
|
90
114
|
>>> st.title("Second page")
|
115
|
+
>>>
|
91
116
|
>>> pg = st.navigation([
|
92
117
|
>>> st.Page("page1.py", title="First page", icon="🔥"),
|
93
118
|
>>> st.Page(page2, title="Second page", icon=":material/favorite:"),
|
@@ -100,6 +125,39 @@ def Page(
|
|
100
125
|
|
101
126
|
|
102
127
|
class StreamlitPage:
|
128
|
+
"""A page within a multipage Streamlit app.
|
129
|
+
|
130
|
+
Use ``st.Page`` to initialize a ``StreamlitPage`` object.
|
131
|
+
|
132
|
+
Attributes
|
133
|
+
----------
|
134
|
+
icon : str
|
135
|
+
The icon of the page.
|
136
|
+
|
137
|
+
If no icon was declared in ``st.Page``, this property returns ``""``.
|
138
|
+
|
139
|
+
title : str
|
140
|
+
The title of the page.
|
141
|
+
|
142
|
+
Unless declared otherwise in ``st.Page``, the page title is inferred
|
143
|
+
from the filename or callable name. For more information, see
|
144
|
+
`Overview of multipage apps
|
145
|
+
<https://docs.streamlit.io/st.page.automatic-page-labels>`_.
|
146
|
+
|
147
|
+
url_path : str
|
148
|
+
The page's URL pathname, which is the path relative to the app's root
|
149
|
+
URL.
|
150
|
+
|
151
|
+
Unless declared otherwise in ``st.Page``, the URL pathname is inferred
|
152
|
+
from the filename or callable name. For more information, see
|
153
|
+
`Overview of multipage apps
|
154
|
+
<https://docs.streamlit.io/st.page.automatic-page-urls>`_.
|
155
|
+
|
156
|
+
The default page will always have a ``url_path`` of ``""`` to indicate
|
157
|
+
the root URL (e.g. homepage).
|
158
|
+
|
159
|
+
"""
|
160
|
+
|
103
161
|
def __init__(
|
104
162
|
self,
|
105
163
|
page: str | Path | Callable[[], None],
|
@@ -161,17 +219,47 @@ class StreamlitPage:
|
|
161
219
|
|
162
220
|
@property
|
163
221
|
def title(self) -> str:
|
222
|
+
"""The title of the page.
|
223
|
+
|
224
|
+
Unless declared otherwise in ``st.Page``, the page title is inferred
|
225
|
+
from the filename or callable name. For more information, see
|
226
|
+
`Overview of multipage apps
|
227
|
+
<https://docs.streamlit.io/st.page.automatic-page-labels>`_.
|
228
|
+
"""
|
164
229
|
return self._title
|
165
230
|
|
166
231
|
@property
|
167
232
|
def icon(self) -> str:
|
233
|
+
"""The icon of the page.
|
234
|
+
|
235
|
+
If no icon was declared in ``st.Page``, this property returns ``""``.
|
236
|
+
"""
|
168
237
|
return self._icon
|
169
238
|
|
170
239
|
@property
|
171
240
|
def url_path(self) -> str:
|
241
|
+
"""The page's URL pathname, which is the path relative to the app's \
|
242
|
+
root URL.
|
243
|
+
|
244
|
+
Unless declared otherwise in ``st.Page``, the URL pathname is inferred
|
245
|
+
from the filename or callable name. For more information, see
|
246
|
+
`Overview of multipage apps
|
247
|
+
<https://docs.streamlit.io/st.page.automatic-page-urls>`_.
|
248
|
+
|
249
|
+
The default page will always have a ``url_path`` of ``""`` to indicate
|
250
|
+
the root URL (e.g. homepage).
|
251
|
+
"""
|
172
252
|
return "" if self._default else self._url_path
|
173
253
|
|
174
254
|
def run(self) -> None:
|
255
|
+
"""Execute the page.
|
256
|
+
|
257
|
+
When a page is returned by ``st.navigation``, use the ``.run()`` method
|
258
|
+
within your entrypoint file to render the page. You can only call this
|
259
|
+
method on the page returned by ``st.navigation``. You can only call
|
260
|
+
this method once per run of your entrypoint file.
|
261
|
+
|
262
|
+
"""
|
175
263
|
if not self._can_be_called:
|
176
264
|
raise StreamlitAPIException(
|
177
265
|
"This page cannot be called directly. Only the page returned from st.navigation can be called once."
|
@@ -414,7 +414,7 @@ class CacheDataAPI:
|
|
414
414
|
cache with ``st.cache_data.clear()``.
|
415
415
|
|
416
416
|
To cache global resources, use ``st.cache_resource`` instead. Learn more
|
417
|
-
about caching at https://docs.streamlit.io/
|
417
|
+
about caching at https://docs.streamlit.io/develop/concepts/architecture/caching.
|
418
418
|
|
419
419
|
Parameters
|
420
420
|
----------
|
@@ -456,9 +456,6 @@ class CacheDataAPI:
|
|
456
456
|
Setting this parameter to True may lead to excessive memory use since the
|
457
457
|
widget value is treated as an additional input parameter to the cache.
|
458
458
|
|
459
|
-
.. note::
|
460
|
-
This parameter is deprecated and will be removed in a future release.
|
461
|
-
|
462
459
|
hash_funcs : dict or None
|
463
460
|
Mapping of types or fully qualified names to hash functions.
|
464
461
|
This is used to override the behavior of the hasher inside Streamlit's
|
@@ -467,6 +464,10 @@ class CacheDataAPI:
|
|
467
464
|
the provided function to generate a hash for it. See below for an example
|
468
465
|
of how this can be used.
|
469
466
|
|
467
|
+
.. deprecated::
|
468
|
+
``experimental_allow_widgets`` is deprecated and will be removed in
|
469
|
+
a later version.
|
470
|
+
|
470
471
|
Example
|
471
472
|
-------
|
472
473
|
>>> import streamlit as st
|
@@ -23,7 +23,7 @@ from streamlit.runtime.caching.cache_type import CacheType, get_decorator_api_na
|
|
23
23
|
if TYPE_CHECKING:
|
24
24
|
from types import FunctionType
|
25
25
|
|
26
|
-
CACHE_DOCS_URL = "https://docs.streamlit.io/
|
26
|
+
CACHE_DOCS_URL = "https://docs.streamlit.io/develop/concepts/architecture/caching"
|
27
27
|
|
28
28
|
|
29
29
|
def get_cached_func_name_md(func: Any) -> str:
|
@@ -284,7 +284,7 @@ class CacheResourceAPI:
|
|
284
284
|
cache with ``st.cache_resource.clear()``.
|
285
285
|
|
286
286
|
To cache data, use ``st.cache_data`` instead. Learn more about caching at
|
287
|
-
https://docs.streamlit.io/
|
287
|
+
https://docs.streamlit.io/develop/concepts/architecture/caching.
|
288
288
|
|
289
289
|
Parameters
|
290
290
|
----------
|
@@ -328,9 +328,6 @@ class CacheResourceAPI:
|
|
328
328
|
Setting this parameter to True may lead to excessive memory use since the
|
329
329
|
widget value is treated as an additional input parameter to the cache.
|
330
330
|
|
331
|
-
.. note::
|
332
|
-
This parameter is deprecated and will be removed in a future release.
|
333
|
-
|
334
331
|
hash_funcs : dict or None
|
335
332
|
Mapping of types or fully qualified names to hash functions.
|
336
333
|
This is used to override the behavior of the hasher inside Streamlit's
|
@@ -339,6 +336,10 @@ class CacheResourceAPI:
|
|
339
336
|
the provided function to generate a hash for it. See below for an example
|
340
337
|
of how this can be used.
|
341
338
|
|
339
|
+
.. deprecated::
|
340
|
+
``experimental_allow_widgets`` is deprecated and will be removed in
|
341
|
+
a later version.
|
342
|
+
|
342
343
|
Example
|
343
344
|
-------
|
344
345
|
>>> import streamlit as st
|
@@ -41,29 +41,30 @@ def cache(
|
|
41
41
|
max_entries: int | None = None,
|
42
42
|
ttl: float | None = None,
|
43
43
|
):
|
44
|
-
"""
|
44
|
+
"""Legacy caching decorator (deprecated).
|
45
|
+
|
46
|
+
Legacy caching with ``st.cache`` has been removed from Streamlit. This is
|
47
|
+
now an alias for ``st.cache_data`` and ``st.cache_resource``.
|
45
48
|
|
46
49
|
Parameters
|
47
50
|
----------
|
48
51
|
func : callable
|
49
|
-
The function to cache. Streamlit hashes the function
|
52
|
+
The function to cache. Streamlit hashes the function's source code.
|
50
53
|
|
51
54
|
persist : bool
|
52
55
|
Whether to persist the cache on disk.
|
53
56
|
|
54
57
|
allow_output_mutation : bool
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
If you know what you're doing and would like to override this warning, set this to True.
|
58
|
+
Whether to use ``st.cache_data`` or ``st.cache_resource``. If this is
|
59
|
+
``False`` (default), the arguments are passed to ``st.cache_data``. If
|
60
|
+
this is ``True``, the arguments are passed to ``st.cache_resource``.
|
59
61
|
|
60
62
|
show_spinner : bool
|
61
|
-
Enable the spinner. Default is True to show a spinner when there is
|
62
|
-
a cache miss.
|
63
|
+
Enable the spinner. Default is ``True`` to show a spinner when there is
|
64
|
+
a "cache miss" and the cached data is being created.
|
63
65
|
|
64
66
|
suppress_st_warning : bool
|
65
|
-
|
66
|
-
the cached function.
|
67
|
+
This is not used.
|
67
68
|
|
68
69
|
hash_funcs : dict or None
|
69
70
|
Mapping of types or fully qualified names to hash functions. This is used to override
|
@@ -73,9 +74,9 @@ def cache(
|
|
73
74
|
for an example of how this can be used.
|
74
75
|
|
75
76
|
max_entries : int or None
|
76
|
-
The maximum number of entries to keep in the cache, or None
|
77
|
+
The maximum number of entries to keep in the cache, or ``None``
|
77
78
|
for an unbounded cache. (When a new entry is added to a full cache,
|
78
|
-
the oldest cached entry will be removed.) The default is None
|
79
|
+
the oldest cached entry will be removed.) The default is ``None``.
|
79
80
|
|
80
81
|
ttl : float or None
|
81
82
|
The maximum number of seconds to keep an entry in the cache, or
|