streamlit-nightly 1.35.1.dev20240612__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.
Files changed (52) hide show
  1. streamlit/__init__.py +1 -1
  2. streamlit/commands/navigation.py +84 -18
  3. streamlit/components/v1/component_registry.py +24 -9
  4. streamlit/config.py +0 -3
  5. streamlit/elements/arrow.py +17 -6
  6. streamlit/elements/deck_gl_json_chart.py +1 -1
  7. streamlit/elements/dialog_decorator.py +5 -3
  8. streamlit/elements/html.py +1 -9
  9. streamlit/elements/iframe.py +53 -10
  10. streamlit/elements/layouts.py +66 -5
  11. streamlit/elements/lib/built_in_chart_utils.py +38 -10
  12. streamlit/elements/lib/column_types.py +1 -1
  13. streamlit/elements/lib/mutable_status_container.py +4 -4
  14. streamlit/elements/map.py +1 -1
  15. streamlit/elements/markdown.py +18 -14
  16. streamlit/elements/plotly_chart.py +5 -2
  17. streamlit/elements/toast.py +1 -1
  18. streamlit/elements/vega_charts.py +101 -39
  19. streamlit/elements/widgets/button.py +6 -3
  20. streamlit/elements/widgets/data_editor.py +1 -1
  21. streamlit/elements/widgets/file_uploader.py +1 -1
  22. streamlit/elements/write.py +11 -10
  23. streamlit/hello/Mapping_Demo.py +1 -1
  24. streamlit/navigation/page.py +107 -19
  25. streamlit/runtime/caching/cache_data_api.py +5 -4
  26. streamlit/runtime/caching/cache_errors.py +1 -1
  27. streamlit/runtime/caching/cache_resource_api.py +5 -4
  28. streamlit/runtime/caching/legacy_cache_api.py +13 -12
  29. streamlit/runtime/fragment.py +57 -27
  30. streamlit/runtime/runtime_util.py +1 -1
  31. streamlit/runtime/scriptrunner/script_run_context.py +1 -1
  32. streamlit/runtime/secrets.py +2 -2
  33. streamlit/runtime/state/session_state.py +1 -1
  34. streamlit/runtime/state/session_state_proxy.py +1 -1
  35. streamlit/static/asset-manifest.json +5 -5
  36. streamlit/static/index.html +1 -1
  37. streamlit/static/static/js/{4335.b492cdb7.chunk.js → 4335.f27a4b4a.chunk.js} +1 -1
  38. streamlit/static/static/js/{8427.59805a7f.chunk.js → 8427.5192ee0c.chunk.js} +1 -1
  39. streamlit/static/static/js/8536.f7b26b02.chunk.js +1 -0
  40. streamlit/static/static/js/main.7994a814.js +2 -0
  41. streamlit/testing/v1/app_test.py +4 -3
  42. streamlit/testing/v1/element_tree.py +2 -2
  43. streamlit/user_info.py +2 -4
  44. {streamlit_nightly-1.35.1.dev20240612.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/METADATA +9 -9
  45. {streamlit_nightly-1.35.1.dev20240612.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/RECORD +50 -50
  46. streamlit/static/static/js/8536.f8de3d9a.chunk.js +0 -1
  47. streamlit/static/static/js/main.0ebf040e.js +0 -2
  48. /streamlit/static/static/js/{main.0ebf040e.js.LICENSE.txt → main.7994a814.js.LICENSE.txt} +0 -0
  49. {streamlit_nightly-1.35.1.dev20240612.data → streamlit_nightly-1.35.1.dev20240614.data}/scripts/streamlit.cmd +0 -0
  50. {streamlit_nightly-1.35.1.dev20240612.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/WHEEL +0 -0
  51. {streamlit_nightly-1.35.1.dev20240612.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/entry_points.txt +0 -0
  52. {streamlit_nightly-1.35.1.dev20240612.dist-info → streamlit_nightly-1.35.1.dev20240614.dist-info}/top_level.txt +0 -0
streamlit/elements/map.py CHANGED
@@ -112,7 +112,7 @@ class MapMixin:
112
112
 
113
113
  To get a token for yourself, create an account at https://mapbox.com.
114
114
  For more info on how to set config options, see
115
- https://docs.streamlit.io/library/advanced-features/configuration
115
+ https://docs.streamlit.io/develop/api-reference/configuration/config.toml.
116
116
 
117
117
  Parameters
118
118
  ----------
@@ -64,15 +64,17 @@ class MarkdownMixin:
64
64
  ``:blue-background[your text here]``.
65
65
 
66
66
  unsafe_allow_html : bool
67
- By default, any HTML tags found in the body will be escaped and
68
- therefore treated as pure text. This behavior may be turned off by
69
- setting this argument to True.
67
+ Whether to render HTML within ``body``. If this is ``False``
68
+ (default), any HTML tags found in ``body`` will be escaped and
69
+ therefore treated as raw text. If this is ``True``, any HTML
70
+ expressions within ``body`` will be rendered.
70
71
 
71
- That said, we *strongly advise against it*. It is hard to write
72
- secure HTML, so by using this argument you may be compromising your
73
- users' security. For more information, see:
72
+ Adding custom HTML to your app impacts safety, styling, and
73
+ maintainability.
74
74
 
75
- https://github.com/streamlit/streamlit/issues/152
75
+ .. note::
76
+ If you only want to insert HTML or CSS without Markdown text,
77
+ we recommend using ``st.html`` instead.
76
78
 
77
79
  help : str
78
80
  An optional tooltip that gets displayed next to the Markdown.
@@ -185,15 +187,17 @@ class MarkdownMixin:
185
187
  ``:blue-background[your text here]``.
186
188
 
187
189
  unsafe_allow_html : bool
188
- By default, any HTML tags found in strings will be escaped and
189
- therefore treated as pure text. This behavior may be turned off by
190
- setting this argument to True.
190
+ Whether to render HTML within ``body``. If this is ``False``
191
+ (default), any HTML tags found in ``body`` will be escaped and
192
+ therefore treated as raw text. If this is ``True``, any HTML
193
+ expressions within ``body`` will be rendered.
191
194
 
192
- That said, *we strongly advise against it*. It is hard to write secure
193
- HTML, so by using this argument you may be compromising your users'
194
- security. For more information, see:
195
+ Adding custom HTML to your app impacts safety, styling, and
196
+ maintainability.
195
197
 
196
- https://github.com/streamlit/streamlit/issues/152
198
+ .. note::
199
+ If you only want to insert HTML or CSS without Markdown text,
200
+ we recommend using ``st.html`` instead.
197
201
 
198
202
  help : str
199
203
  An optional tooltip that gets displayed next to the caption.
@@ -184,8 +184,11 @@ class PlotlyState(TypedDict, total=False):
184
184
 
185
185
  Attributes
186
186
  ----------
187
- selection : PlotlySelectionState
188
- The state of the ``on_select`` event.
187
+ selection : dict
188
+ The state of the ``on_select`` event. This attribure returns a
189
+ dictionary-like object that supports both key and attribute notation.
190
+ The attributes are described by the ``PlotlySelectionState`` dictionary
191
+ schema.
189
192
 
190
193
  Example
191
194
  -------
@@ -48,7 +48,7 @@ class ToastMixin:
48
48
 
49
49
  .. warning::
50
50
  ``st.toast`` is not compatible with Streamlit's `caching \
51
- <https://docs.streamlit.io/library/advanced-features/caching>`_ and
51
+ <https://docs.streamlit.io/develop/concepts/architecture/caching>`_ and
52
52
  cannot be called within a cached function.
53
53
 
54
54
  Parameters
@@ -113,11 +113,13 @@ class VegaLiteState(TypedDict, total=False):
113
113
 
114
114
  Attributes
115
115
  ----------
116
- selection : AttributeDictionary
117
- The state of the ``on_select`` event. The name of each selection
118
- parameter becomes an attribute in the ``selection`` attribute
119
- dictionary. The format of the data within each attribute is determined
120
- by the selection parameter definition within Vega-Lite.
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, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None
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 to use for the x-axis. If None, uses the data index for the x-axis.
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) to use for the y-axis. If a Sequence of strings,
595
- draws several series on the same chart by melting your wide-format
596
- table into a long-format table behind the scenes. If None, draws
597
- the data of all remaining columns as data series.
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 None, either the column name specified in x will be used, or no label will be displayed.
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 None, either the column name specified in y will be used, or no label will be displayed.
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, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict
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 to use for the x-axis. If None, uses the data index for the x-axis.
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) to use for the y-axis. If a Sequence of strings,
779
- draws several series on the same chart by melting your wide-format
780
- table into a long-format table behind the scenes. If None, draws
781
- the data of all remaining columns as data series.
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 None, either the column name specified in x will be used, or no label will be displayed.
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 None, either the column name specified in y will be used, or no label will be displayed.
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.
@@ -936,6 +956,7 @@ class VegaChartsMixin:
936
956
  x_label: str | None = None,
937
957
  y_label: str | None = None,
938
958
  color: str | Color | list[Color] | None = None,
959
+ horizontal: bool = False,
939
960
  width: int | None = None,
940
961
  height: int | None = None,
941
962
  use_container_width: bool = True,
@@ -952,23 +973,32 @@ class VegaChartsMixin:
952
973
 
953
974
  Parameters
954
975
  ----------
955
- data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict
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
956
979
  Data to be plotted.
957
980
 
958
981
  x : str or None
959
- Column name to use for the x-axis. If None, uses the data index for the x-axis.
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.
960
985
 
961
986
  y : str, Sequence of str, or None
962
- Column name(s) to use for the y-axis. If a Sequence of strings,
963
- draws several series on the same chart by melting your wide-format
964
- table into a long-format table behind the scenes. If None, draws
965
- the data of all remaining columns as data series.
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.
966
992
 
967
993
  x_label : str or None
968
- The label for the x-axis. If None, either the column name specified in x will be used, or no label will be displayed.
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.
969
997
 
970
998
  y_label : str or None
971
- The label for the y-axis. If None, either the column name specified in y will be used, or no label will be displayed.
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.
972
1002
 
973
1003
  color : str, tuple, Sequence of str, Sequence of tuple, or None
974
1004
  The color to use for different series in this chart.
@@ -1010,6 +1040,12 @@ class VegaChartsMixin:
1010
1040
  as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
1011
1041
  for three lines).
1012
1042
 
1043
+ horizontal : bool
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.
1048
+
1013
1049
  width : int or None
1014
1050
  Desired width of the chart expressed in pixels. If ``width`` is
1015
1051
  ``None`` (default), Streamlit sets the width of the chart to fit
@@ -1068,7 +1104,7 @@ class VegaChartsMixin:
1068
1104
  https://doc-bar-chart1.streamlit.app/
1069
1105
  height: 440px
1070
1106
 
1071
- Finally, if your dataframe is in wide format, you can group multiple
1107
+ If your dataframe is in wide format, you can group multiple
1072
1108
  columns under the y argument to show multiple series with different
1073
1109
  colors:
1074
1110
 
@@ -1088,10 +1124,27 @@ class VegaChartsMixin:
1088
1124
  https://doc-bar-chart2.streamlit.app/
1089
1125
  height: 440px
1090
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
+
1091
1140
  """
1092
1141
 
1142
+ bar_chart_type = (
1143
+ ChartType.HORIZONTAL_BAR if horizontal else ChartType.VERTICAL_BAR
1144
+ )
1145
+
1093
1146
  chart, add_rows_metadata = generate_chart(
1094
- chart_type=ChartType.BAR,
1147
+ chart_type=bar_chart_type,
1095
1148
  data=data,
1096
1149
  x_from_user=x,
1097
1150
  y_from_user=y,
@@ -1139,23 +1192,32 @@ class VegaChartsMixin:
1139
1192
 
1140
1193
  Parameters
1141
1194
  ----------
1142
- data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None
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
1143
1198
  Data to be plotted.
1144
1199
 
1145
1200
  x : str or None
1146
- Column name to use for the x-axis. If None, uses the data index for the x-axis.
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.
1147
1204
 
1148
1205
  y : str, Sequence of str, or None
1149
- Column name(s) to use for the y-axis. If a Sequence of strings,
1150
- draws several series on the same chart by melting your wide-format
1151
- table into a long-format table behind the scenes. If None, draws
1152
- the data of all remaining columns as data series.
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.
1153
1211
 
1154
1212
  x_label : str or None
1155
- The label for the x-axis. If None, either the column name specified in x will be used, or no label will be displayed.
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.
1156
1216
 
1157
1217
  y_label : str or None
1158
- The label for the y-axis. If None, either the column name specified in y will be used, or no label will be displayed.
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.
1159
1221
 
1160
1222
  color : str, tuple, Sequence of str, Sequence of tuple, or None
1161
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/library/api-reference/control-flow/st.form).
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/library\
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/library/api-reference/data/st.column_config>`_.
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/library/advanced-features/configuration#set-configuration-options
245
+ https://docs.streamlit.io/develop/api-reference/configuration/config.toml
246
246
 
247
247
  Parameters
248
248
  ----------
@@ -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/knowledge-base/tutorials\
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
- This is a keyword-only argument that defaults to False.
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
- By default, any HTML tags found in strings will be escaped and
278
- therefore treated as pure text. This behavior may be turned off by
279
- setting this argument to True.
281
+ Adding custom HTML to your app impacts safety, styling, and
282
+ maintainability.
280
283
 
281
- That said, *we strongly advise against it*. It is hard to write secure
282
- HTML, so by using this argument you may be compromising your users'
283
- security. For more information, see:
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.
@@ -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/library/api-reference/charts/st.pydeck_chart)
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
 
@@ -35,30 +35,41 @@ def Page(
35
35
  url_path: str | None = None,
36
36
  default: bool = False,
37
37
  ):
38
- """Configure a page in `st.navigation` in a multipage app.
38
+ """Configure a page for ``st.navigation`` in a multipage app.
39
39
 
40
- The Page object is passed to `st.navigation` and returned when the user
41
- navigates to that page. Call `Page.run()` on the returned Page in your
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
- Page code can be specified by file path of the page (relative to the main
45
- script) or by passing a Callable such as a function.
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 or Path or callable
51
- The path to the script file or a callable that defines the page.
52
- The path must be relative to the main script.
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 will be inferred from the
56
- page path or callable name.
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 alert. If ``icon``
60
- is ``None`` (default), no icon is displayed. If ``icon`` is a
61
- string, the following options are valid:
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 associated with a page. If None, the URL pathname will be
77
- inferred from the file name, callable name. The default page will have
78
- a url_path of "" to indicate the root url and ignore the value of url_path
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. Only one page can be marked default. If no default page is
83
- provided, the first page will be the default page.
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/library/advanced-features/caching.
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