streamlit 1.48.1__py3-none-any.whl → 1.49.1__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 (203) hide show
  1. streamlit/__init__.py +3 -10
  2. streamlit/commands/logo.py +4 -3
  3. streamlit/commands/navigation.py +1 -1
  4. streamlit/commands/page_config.py +4 -1
  5. streamlit/components/v1/custom_component.py +2 -2
  6. streamlit/config.py +82 -1
  7. streamlit/connections/snowflake_connection.py +3 -1
  8. streamlit/delta_generator.py +3 -0
  9. streamlit/elements/arrow.py +155 -70
  10. streamlit/elements/bokeh_chart.py +13 -3
  11. streamlit/elements/deck_gl_json_chart.py +0 -1
  12. streamlit/elements/dialog_decorator.py +7 -59
  13. streamlit/elements/form.py +10 -1
  14. streamlit/elements/graphviz_chart.py +57 -6
  15. streamlit/elements/heading.py +17 -16
  16. streamlit/elements/image.py +64 -37
  17. streamlit/elements/layouts.py +2 -2
  18. streamlit/elements/lib/built_in_chart_utils.py +2 -5
  19. streamlit/elements/lib/column_config_utils.py +18 -4
  20. streamlit/elements/lib/column_types.py +75 -30
  21. streamlit/elements/lib/dialog.py +3 -3
  22. streamlit/elements/lib/image_utils.py +19 -11
  23. streamlit/elements/lib/layout_utils.py +19 -6
  24. streamlit/elements/lib/utils.py +20 -41
  25. streamlit/elements/markdown.py +7 -6
  26. streamlit/elements/media.py +6 -13
  27. streamlit/elements/metric.py +78 -1
  28. streamlit/elements/pdf.py +192 -0
  29. streamlit/elements/plotly_chart.py +3 -2
  30. streamlit/elements/pyplot.py +53 -11
  31. streamlit/elements/toast.py +81 -5
  32. streamlit/elements/vega_charts.py +3 -8
  33. streamlit/elements/widgets/audio_input.py +0 -1
  34. streamlit/elements/widgets/button.py +0 -4
  35. streamlit/elements/widgets/button_group.py +5 -4
  36. streamlit/elements/widgets/camera_input.py +0 -1
  37. streamlit/elements/widgets/chat.py +11 -13
  38. streamlit/elements/widgets/checkbox.py +0 -1
  39. streamlit/elements/widgets/color_picker.py +0 -1
  40. streamlit/elements/widgets/data_editor.py +142 -62
  41. streamlit/elements/widgets/file_uploader.py +74 -37
  42. streamlit/elements/widgets/multiselect.py +0 -1
  43. streamlit/elements/widgets/number_input.py +0 -1
  44. streamlit/elements/widgets/radio.py +0 -1
  45. streamlit/elements/widgets/select_slider.py +0 -1
  46. streamlit/elements/widgets/selectbox.py +0 -1
  47. streamlit/elements/widgets/slider.py +0 -1
  48. streamlit/elements/widgets/text_widgets.py +0 -2
  49. streamlit/elements/widgets/time_widgets.py +0 -2
  50. streamlit/errors.py +11 -0
  51. streamlit/material_icon_names.py +1 -1
  52. streamlit/proto/Arrow_pb2.py +14 -8
  53. streamlit/proto/Arrow_pb2.pyi +11 -3
  54. streamlit/proto/Block_pb2.py +16 -16
  55. streamlit/proto/Block_pb2.pyi +2 -0
  56. streamlit/proto/ChatInput_pb2.py +3 -3
  57. streamlit/proto/ChatInput_pb2.pyi +2 -0
  58. streamlit/proto/FileUploader_pb2.py +2 -2
  59. streamlit/proto/FileUploader_pb2.pyi +5 -1
  60. streamlit/proto/GraphVizChart_pb2.py +4 -2
  61. streamlit/proto/GraphVizChart_pb2.pyi +1 -1
  62. streamlit/proto/Image_pb2.py +4 -2
  63. streamlit/proto/Image_pb2.pyi +1 -10
  64. streamlit/proto/Metric_pb2.py +8 -6
  65. streamlit/proto/Metric_pb2.pyi +34 -10
  66. streamlit/proto/Toast_pb2.py +2 -2
  67. streamlit/proto/Toast_pb2.pyi +10 -1
  68. streamlit/runtime/caching/__init__.py +14 -2
  69. streamlit/runtime/caching/cache_data_api.py +0 -17
  70. streamlit/runtime/caching/cache_resource_api.py +0 -16
  71. streamlit/runtime/caching/cached_message_replay.py +8 -20
  72. streamlit/runtime/caching/hashing.py +31 -1
  73. streamlit/runtime/credentials.py +4 -4
  74. streamlit/runtime/fragment.py +0 -42
  75. streamlit/runtime/websocket_session_manager.py +1 -1
  76. streamlit/static/index.html +2 -2
  77. streamlit/static/manifest.json +223 -251
  78. streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
  79. streamlit/static/static/css/index.COe1010n.css +1 -0
  80. streamlit/static/static/js/{ErrorOutline.esm.DjObtx4K.js → ErrorOutline.esm.DcGrhbBP.js} +1 -1
  81. streamlit/static/static/js/{FileDownload.esm.Bz9nxNC5.js → FileDownload.esm.DgBvV6Pq.js} +1 -1
  82. streamlit/static/static/js/FileHelper.M6AAaeuA.js +5 -0
  83. streamlit/static/static/js/FormClearHelper.DHh1GFzm.js +1 -0
  84. streamlit/static/static/js/{Hooks.DEoLCfOE.js → Hooks.DGu1od_L.js} +1 -1
  85. streamlit/static/static/js/InputInstructions.z6sVgyYt.js +1 -0
  86. streamlit/static/static/js/Particles.DDVT-6Qc.js +1 -0
  87. streamlit/static/static/js/ProgressBar.BEY0cXXV.js +2 -0
  88. streamlit/static/static/js/Toolbar.DSnK1fUh.js +1 -0
  89. streamlit/static/static/js/{base-input.BmvSaPd2.js → base-input.CK3UVGp1.js} +4 -4
  90. streamlit/static/static/js/{checkbox.Cgxgc0et.js → checkbox.D8W881TL.js} +2 -2
  91. streamlit/static/static/js/createSuper.B6W-Dh9S.js +1 -0
  92. streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +1 -0
  93. streamlit/static/static/js/{downloader.M6jQeNDf.js → downloader.DiKpuU_S.js} +1 -1
  94. streamlit/static/static/js/es6.B8zRNPZ-.js +2 -0
  95. streamlit/static/static/js/iframeResizer.contentWindow.DIewJmmh.js +1 -0
  96. streamlit/static/static/js/index.452cqrrL.js +1 -0
  97. streamlit/static/static/js/index.4eF4NxG2.js +1 -0
  98. streamlit/static/static/js/index.B6U8LQo3.js +1 -0
  99. streamlit/static/static/js/index.B9mjBcgE.js +1 -0
  100. streamlit/static/static/js/index.BXYmrqnf.js +1 -0
  101. streamlit/static/static/js/index.B_8AnktO.js +1 -0
  102. streamlit/static/static/js/index.Bl7zGQSh.js +7 -0
  103. streamlit/static/static/js/index.BnEpvLEz.js +1 -0
  104. streamlit/static/static/js/{index.D1EayrNh.js → index.BnJIOYn9.js} +2 -2
  105. streamlit/static/static/js/index.Bte_9Lyq.js +1 -0
  106. streamlit/static/static/js/index.C1HcTl5K.js +1 -0
  107. streamlit/static/static/js/index.C7fRKRs4.js +1 -0
  108. streamlit/static/static/js/index.C7lSmSOP.js +1 -0
  109. streamlit/static/static/js/index.CD8HuT3N.js +976 -0
  110. streamlit/static/static/js/index.CP5TD2z1.js +1 -0
  111. streamlit/static/static/js/index.C_tmcx4B.js +1 -0
  112. streamlit/static/static/js/index.CcJf6BCU.js +3858 -0
  113. streamlit/static/static/js/{index.CbdWnLqS.js → index.CejBxbg1.js} +3 -3
  114. streamlit/static/static/js/index.Ch7MBCx0.js +5367 -0
  115. streamlit/static/static/js/index.CjXWwH-y.js +1 -0
  116. streamlit/static/static/js/index.CvYYtxD_.js +1 -0
  117. streamlit/static/static/js/index.D2-atlaQ.js +3 -0
  118. streamlit/static/static/js/index.D3K5nOu9.js +197 -0
  119. streamlit/static/static/js/index.D5naqx-J.js +1 -0
  120. streamlit/static/static/js/index.Dk4C7X3i.js +1 -0
  121. streamlit/static/static/js/index.DkKT3LUI.js +1 -0
  122. streamlit/static/static/js/index.DtYN2x4k.js +1 -0
  123. streamlit/static/static/js/index.MTPPBDHk.js +2 -0
  124. streamlit/static/static/js/{index.Cqa4gqqN.js → index.Ts_0SdB9.js} +1 -1
  125. streamlit/static/static/js/{index.CgZDfhN4.js → index.cnnXF7xQ.js} +2 -2
  126. streamlit/static/static/js/index.ho6NIXGl.js +1 -0
  127. streamlit/static/static/js/index.pqW9AMJD.js +3 -0
  128. streamlit/static/static/js/{index.D1jHqUJq.js → index.qhs54UAB.js} +1 -1
  129. streamlit/static/static/js/{index.tsvTLdio.js → index.urHgTgMQ.js} +9 -9
  130. streamlit/static/static/js/index.wzkv_11M.js +1 -0
  131. streamlit/static/static/js/index.yF5AncHY.js +1 -0
  132. streamlit/static/static/js/{index.BXDq9dj4.js → index.zecpGxtj.js} +1 -1
  133. streamlit/static/static/js/{input.DZd6EQlV.js → input.nzVJphXi.js} +2 -2
  134. streamlit/static/static/js/{memory.ptkfuI71.js → memory.CjCgTQz3.js} +1 -1
  135. streamlit/static/static/js/number-overlay-editor.DaRFzZEO.js +9 -0
  136. streamlit/static/static/js/{possibleConstructorReturn.Bd4ImlQ9.js → possibleConstructorReturn.DgiPnZ9N.js} +1 -1
  137. streamlit/static/static/js/{sandbox.DsH8LuID.js → sandbox.mithfq7Z.js} +1 -1
  138. streamlit/static/static/js/{timepicker.QVekV78C.js → timepicker.Dbl5KFh6.js} +4 -4
  139. streamlit/static/static/js/{toConsumableArray.BJvaP8gb.js → toConsumableArray.D-Dx88BQ.js} +3 -3
  140. streamlit/static/static/js/uniqueId.Bh26R_3S.js +1 -0
  141. streamlit/static/static/js/{useBasicWidgetState.DB3vMS9V.js → useBasicWidgetState.DeK-QJpD.js} +1 -1
  142. streamlit/static/static/js/{useTextInputAutoExpand.CBkGkaRt.js → useTextInputAutoExpand.4iAdLWD-.js} +2 -2
  143. streamlit/static/static/js/useUpdateUiValue.CmT7_nJN.js +1 -0
  144. streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +1 -0
  145. streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
  146. streamlit/user_info.py +3 -1
  147. streamlit/web/server/browser_websocket_handler.py +15 -0
  148. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/METADATA +4 -2
  149. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/RECORD +153 -156
  150. streamlit/static/static/css/index.CQt5TjGB.css +0 -1
  151. streamlit/static/static/js/FileHelper.BrQvUXVD.js +0 -5
  152. streamlit/static/static/js/FormClearHelper.DF4gFAOO.js +0 -1
  153. streamlit/static/static/js/InputInstructions.D8zoMog9.js +0 -1
  154. streamlit/static/static/js/Particles.CCFySwdL.js +0 -1
  155. streamlit/static/static/js/ProgressBar.COK9j1l0.js +0 -2
  156. streamlit/static/static/js/Toolbar.Dt4jIKlY.js +0 -1
  157. streamlit/static/static/js/createSuper.siQeagI2.js +0 -1
  158. streamlit/static/static/js/data-grid-overlay-editor.Ct51iCb_.js +0 -1
  159. streamlit/static/static/js/es6.CMaUdEZ5.js +0 -2
  160. streamlit/static/static/js/iframeResizer.contentWindow.C33BryyP.js +0 -1
  161. streamlit/static/static/js/index.8GJD0eeD.js +0 -1
  162. streamlit/static/static/js/index.8QEYHMQD.js +0 -1
  163. streamlit/static/static/js/index.Ay41Wnu9.js +0 -1
  164. streamlit/static/static/js/index.BLiKiJ7_.js +0 -1
  165. streamlit/static/static/js/index.BT78cJmU.js +0 -1
  166. streamlit/static/static/js/index.BdGvnhlM.js +0 -1
  167. streamlit/static/static/js/index.BfasrT0d.js +0 -1
  168. streamlit/static/static/js/index.CCdtFMFG.js +0 -1
  169. streamlit/static/static/js/index.CFRGZDz1.js +0 -1
  170. streamlit/static/static/js/index.CFSFYiPA.js +0 -5366
  171. streamlit/static/static/js/index.CeiIiXap.js +0 -1
  172. streamlit/static/static/js/index.CzX2xpyc.js +0 -1
  173. streamlit/static/static/js/index.D1ErX5go.js +0 -2
  174. streamlit/static/static/js/index.D5gweoL5.js +0 -7
  175. streamlit/static/static/js/index.DByVKZgq.js +0 -1
  176. streamlit/static/static/js/index.DEND45D1.js +0 -3
  177. streamlit/static/static/js/index.DKN5MVff.js +0 -781
  178. streamlit/static/static/js/index.DfoxW1gP.js +0 -3855
  179. streamlit/static/static/js/index.Dtf1Ac0x.js +0 -1
  180. streamlit/static/static/js/index.DxrLhpeO.js +0 -1
  181. streamlit/static/static/js/index.J7o-_HIh.js +0 -1
  182. streamlit/static/static/js/index.LU8juINp.js +0 -197
  183. streamlit/static/static/js/index.L_N2iylt.js +0 -1
  184. streamlit/static/static/js/index.PZUX2kRz.js +0 -3
  185. streamlit/static/static/js/index.ROjU6K0k.js +0 -1
  186. streamlit/static/static/js/index.WSNLkF94.js +0 -1
  187. streamlit/static/static/js/index.X5W3gJLn.js +0 -1
  188. streamlit/static/static/js/index.k9LYqfSL.js +0 -1
  189. streamlit/static/static/js/index.pnHtHv_c.js +0 -203
  190. streamlit/static/static/js/index.tPUXqsfW.js +0 -1
  191. streamlit/static/static/js/mergeWith.GRNk8iwv.js +0 -1
  192. streamlit/static/static/js/number-overlay-editor.DXS2qb1U.js +0 -9
  193. streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
  194. streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
  195. streamlit/static/static/js/uniqueId.D_5M8Dgf.js +0 -1
  196. streamlit/static/static/js/useUpdateUiValue.C7ZKpLQK.js +0 -1
  197. streamlit/static/static/js/value.CgPGBV_l.js +0 -1
  198. streamlit/static/static/js/withFullScreenWrapper.C-gXt0Rl.js +0 -1
  199. streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
  200. {streamlit-1.48.1.data → streamlit-1.49.1.data}/scripts/streamlit.cmd +0 -0
  201. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/WHEEL +0 -0
  202. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/entry_points.txt +0 -0
  203. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/top_level.txt +0 -0
@@ -19,6 +19,9 @@ from __future__ import annotations
19
19
  import json
20
20
  from typing import TYPE_CHECKING, Final, cast
21
21
 
22
+ from streamlit.deprecation_util import (
23
+ show_deprecation_warning,
24
+ )
22
25
  from streamlit.errors import StreamlitAPIException
23
26
  from streamlit.proto.BokehChart_pb2 import BokehChart as BokehChartProto
24
27
  from streamlit.runtime.metrics_util import gather_metrics
@@ -50,10 +53,11 @@ class BokehMixin:
50
53
 
51
54
  .. Important::
52
55
  You must install ``bokeh==2.4.3`` and ``numpy<2`` to use this
53
- command.
56
+ command, which is deprecated and will be removed in a future
57
+ version.
54
58
 
55
- If you need a newer version of Bokeh, use our |streamlit-bokeh|_
56
- custom component instead.
59
+ For more current updates, use the |streamlit-bokeh|_ custom
60
+ component instead.
57
61
 
58
62
  .. |streamlit-bokeh| replace:: ``streamlit-bokeh``
59
63
  .. _streamlit-bokeh: https://github.com/streamlit/streamlit-bokeh
@@ -101,6 +105,12 @@ class BokehMixin:
101
105
  f"[streamlit-bokeh](https://github.com/streamlit/streamlit-bokeh)."
102
106
  )
103
107
 
108
+ show_deprecation_warning(
109
+ "st.bokeh_chart is deprecated and will be removed in a future version. "
110
+ "Please use our custom component, "
111
+ "[streamlit-bokeh](https://github.com/streamlit/streamlit-bokeh), "
112
+ "instead."
113
+ )
104
114
  # Generate element ID from delta path
105
115
  delta_path = self.dg._get_delta_path_str()
106
116
 
@@ -521,7 +521,6 @@ class PydeckMixin:
521
521
  selection_mode=selection_mode,
522
522
  use_container_width=use_container_width,
523
523
  spec=spec,
524
- form_id=pydeck_proto.form_id,
525
524
  )
526
525
 
527
526
  serde = PydeckSelectionSerde()
@@ -21,10 +21,6 @@ from streamlit.delta_generator_singletons import (
21
21
  get_dg_singleton_instance,
22
22
  get_last_dg_added_to_context_stack,
23
23
  )
24
- from streamlit.deprecation_util import (
25
- make_deprecated_name_warning,
26
- show_deprecation_warning,
27
- )
28
24
  from streamlit.errors import StreamlitAPIException
29
25
  from streamlit.runtime.fragment import _fragment
30
26
  from streamlit.runtime.metrics_util import gather_metrics
@@ -67,7 +63,6 @@ def _dialog_decorator(
67
63
  title: str,
68
64
  *,
69
65
  width: DialogWidth = "small",
70
- should_show_deprecation_warning: bool = False,
71
66
  dismissible: bool = True,
72
67
  on_dismiss: Literal["ignore", "rerun"] | WidgetCallback = "ignore",
73
68
  ) -> F:
@@ -89,15 +84,6 @@ def _dialog_decorator(
89
84
  dialog.open()
90
85
 
91
86
  def dialog_content() -> None:
92
- if should_show_deprecation_warning:
93
- show_deprecation_warning(
94
- make_deprecated_name_warning(
95
- "experimental_dialog",
96
- "dialog",
97
- "2025-01-01",
98
- )
99
- )
100
-
101
87
  # if the dialog should be closed, st.rerun() has to be called
102
88
  # (same behavior as with st.fragment)
103
89
  _ = non_optional_func(*args, **kwargs)
@@ -212,10 +198,13 @@ def dialog_decorator(
212
198
  .. |st.markdown| replace:: ``st.markdown``
213
199
  .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
214
200
 
215
- width : "small", "large"
216
- The width of the modal dialog. If ``width`` is ``"small`` (default), the
217
- modal dialog will be 500 pixels wide. If ``width`` is ``"large"``, the
218
- modal dialog will be about 750 pixels wide.
201
+ width : "small", "medium", "large"
202
+ The width of the modal dialog. This can be one of the following:
203
+
204
+ - ``"small"`` (default): The modal dialog will be a maximum of 500
205
+ pixels wide.
206
+ - ``"medium"``: The modal dialog will be up to 750 pixels wide.
207
+ - ``"large"``: The modal dialog will be up to 1280 pixels wide.
219
208
 
220
209
  dismissible : bool
221
210
  Whether the modal dialog can be dismissed by the user. If this is
@@ -295,44 +284,3 @@ def dialog_decorator(
295
284
  return _dialog_decorator(
296
285
  func, "", width=width, dismissible=dismissible, on_dismiss=on_dismiss
297
286
  )
298
-
299
-
300
- @overload
301
- def experimental_dialog_decorator(
302
- title: str, *, width: DialogWidth = "small"
303
- ) -> Callable[[F], F]: ...
304
-
305
-
306
- # 'title' can be a function since `dialog_decorator` is a decorator. We just call it
307
- # 'title' here though to make the user-doc more friendly as we want the user to pass a
308
- # title, not a function. The user is supposed to call it like @st.dialog("my_title"),
309
- # which makes 'title' a positional arg, hence this 'trick'. The overload is required to
310
- # have a good type hint for the decorated function args.
311
- @overload
312
- def experimental_dialog_decorator(title: F, *, width: DialogWidth = "small") -> F: ...
313
-
314
-
315
- @gather_metrics("experimental_dialog")
316
- def experimental_dialog_decorator(
317
- title: F | str, *, width: DialogWidth = "small"
318
- ) -> F | Callable[[F], F]:
319
- """Deprecated alias for @st.dialog.
320
- See the docstring for the decorator's new name.
321
- """
322
- func_or_title = title
323
- if isinstance(func_or_title, str):
324
- # Support passing the params via function decorator
325
- def wrapper(f: F) -> F:
326
- return _dialog_decorator(
327
- non_optional_func=f,
328
- title=func_or_title,
329
- width=width,
330
- should_show_deprecation_warning=True,
331
- )
332
-
333
- return wrapper
334
-
335
- func: F = func_or_title
336
- return _dialog_decorator(
337
- func, "", width=width, should_show_deprecation_warning=True
338
- )
@@ -29,6 +29,7 @@ from streamlit.elements.lib.policies import (
29
29
  check_cache_replay_rules,
30
30
  check_session_state_rules,
31
31
  )
32
+ from streamlit.elements.lib.utils import Key, to_key
32
33
  from streamlit.errors import StreamlitAPIException
33
34
  from streamlit.proto import Block_pb2
34
35
  from streamlit.runtime.metrics_util import gather_metrics
@@ -243,6 +244,7 @@ class FormMixin:
243
244
  args: WidgetArgs | None = None,
244
245
  kwargs: WidgetKwargs | None = None,
245
246
  *, # keyword-only arguments:
247
+ key: Key | None = None,
246
248
  type: Literal["primary", "secondary", "tertiary"] = "secondary",
247
249
  icon: str | None = None,
248
250
  disabled: bool = False,
@@ -297,6 +299,11 @@ class FormMixin:
297
299
  kwargs : dict
298
300
  An optional dict of kwargs to pass to the callback.
299
301
 
302
+ key : str or int
303
+ An optional string or integer to use as the unique key for the widget.
304
+ If this is omitted, a key will be generated for the widget
305
+ based on its content. No two widgets may have the same key.
306
+
300
307
  type : "primary", "secondary", or "tertiary"
301
308
  An optional string that specifies the button type. This can be one
302
309
  of the following:
@@ -390,6 +397,7 @@ class FormMixin:
390
397
  disabled=disabled,
391
398
  ctx=ctx,
392
399
  width=width,
400
+ key=key,
393
401
  )
394
402
 
395
403
  def _form_submit_button(
@@ -400,6 +408,7 @@ class FormMixin:
400
408
  args: WidgetArgs | None = None,
401
409
  kwargs: WidgetKwargs | None = None,
402
410
  *, # keyword-only arguments:
411
+ key: Key | None = None,
403
412
  type: Literal["primary", "secondary", "tertiary"] = "secondary",
404
413
  icon: str | None = None,
405
414
  disabled: bool = False,
@@ -407,7 +416,7 @@ class FormMixin:
407
416
  width: Width = "content",
408
417
  ) -> bool:
409
418
  form_id = current_form_id(self.dg)
410
- submit_button_key = f"FormSubmitter:{form_id}-{label}"
419
+ submit_button_key = to_key(key) or f"FormSubmitter:{form_id}-{label}"
411
420
  return self.dg._button(
412
421
  label=label,
413
422
  key=submit_button_key,
@@ -21,6 +21,15 @@ from typing import TYPE_CHECKING, Union, cast
21
21
  from typing_extensions import TypeAlias
22
22
 
23
23
  from streamlit import type_util
24
+ from streamlit.deprecation_util import (
25
+ make_deprecated_name_warning,
26
+ show_deprecation_warning,
27
+ )
28
+ from streamlit.elements.lib.layout_utils import (
29
+ LayoutConfig,
30
+ Width,
31
+ validate_width,
32
+ )
24
33
  from streamlit.errors import StreamlitAPIException
25
34
  from streamlit.proto.GraphVizChart_pb2 import GraphVizChart as GraphVizChartProto
26
35
  from streamlit.runtime.metrics_util import gather_metrics
@@ -41,7 +50,9 @@ class GraphvizMixin:
41
50
  def graphviz_chart(
42
51
  self,
43
52
  figure_or_dot: FigureOrDot,
44
- use_container_width: bool = False,
53
+ use_container_width: bool | None = None,
54
+ *, # keyword-only arguments:
55
+ width: Width = "content",
45
56
  ) -> DeltaGenerator:
46
57
  """Display a graph using the dagre-d3 library.
47
58
 
@@ -50,7 +61,9 @@ class GraphvizMixin:
50
61
  install all charting dependencies (except Bokeh) as an extra with
51
62
  Streamlit:
52
63
 
53
- >>> pip install streamlit[charts]
64
+ .. code-block:: shell
65
+
66
+ pip install streamlit[charts]
54
67
 
55
68
  Parameters
56
69
  ----------
@@ -65,6 +78,25 @@ class GraphvizMixin:
65
78
  container. If ``use_container_width`` is ``True``, Streamlit sets
66
79
  the width of the figure to match the width of the parent container.
67
80
 
81
+ width : "content", "stretch", or int
82
+ The width of the chart element. This can be one of the following:
83
+
84
+ - ``"content"`` (default): The width of the element matches the
85
+ width of its content, but doesn't exceed the width of the parent
86
+ container.
87
+ - ``"stretch"``: The width of the element matches the width of the
88
+ parent container.
89
+ - An integer specifying the width in pixels: The element has a
90
+ fixed width. If the specified width is greater than the width of
91
+ the parent container, the width of the element matches the width
92
+ of the parent container.
93
+
94
+ .. deprecated::
95
+ ``use_container_width`` is deprecated and will be removed in a
96
+ future release. For ``use_container_width=True``, use
97
+ ``width="stretch"``. For ``use_container_width=False``, use
98
+ ``width="content"``.
99
+
68
100
  Example
69
101
  -------
70
102
  >>> import streamlit as st
@@ -114,14 +146,35 @@ class GraphvizMixin:
114
146
  height: 600px
115
147
 
116
148
  """
149
+ if use_container_width is not None:
150
+ show_deprecation_warning(
151
+ make_deprecated_name_warning(
152
+ "use_container_width",
153
+ "width",
154
+ "2025-12-31",
155
+ "For `use_container_width=True`, use `width='stretch'`. "
156
+ "For `use_container_width=False`, use `width='content'`.",
157
+ include_st_prefix=False,
158
+ ),
159
+ show_in_browser=False,
160
+ )
161
+ width = "stretch" if use_container_width else "content"
162
+
117
163
  # Generate element ID from delta path
118
164
  delta_path = self.dg._get_delta_path_str()
119
165
  element_id = calc_md5(delta_path.encode())
120
166
 
121
167
  graphviz_chart_proto = GraphVizChartProto()
122
168
 
123
- marshall(graphviz_chart_proto, figure_or_dot, use_container_width, element_id)
124
- return self.dg._enqueue("graphviz_chart", graphviz_chart_proto)
169
+ marshall(graphviz_chart_proto, figure_or_dot, element_id)
170
+
171
+ # Validate and set layout configuration
172
+ validate_width(width, allow_content=True)
173
+ layout_config = LayoutConfig(width=width)
174
+
175
+ return self.dg._enqueue(
176
+ "graphviz_chart", graphviz_chart_proto, layout_config=layout_config
177
+ )
125
178
 
126
179
  @property
127
180
  def dg(self) -> DeltaGenerator:
@@ -132,7 +185,6 @@ class GraphvizMixin:
132
185
  def marshall(
133
186
  proto: GraphVizChartProto,
134
187
  figure_or_dot: FigureOrDot,
135
- use_container_width: bool,
136
188
  element_id: str,
137
189
  ) -> None:
138
190
  """Construct a GraphViz chart object.
@@ -153,5 +205,4 @@ def marshall(
153
205
 
154
206
  proto.spec = dot
155
207
  proto.engine = engine
156
- proto.use_container_width = use_container_width
157
208
  proto.element_id = element_id
@@ -79,13 +79,13 @@ class HeadingMixin:
79
79
  including the Markdown directives described in the ``body``
80
80
  parameter of ``st.markdown``.
81
81
 
82
- divider : bool, blue”, green”, orange”, red”, violet”, gray”/"grey", or rainbow
83
- Shows a colored divider below the header. If True, successive
84
- headers will cycle through divider colors. That is, the first
85
- header will have a blue line, the second header will have a
86
- green line, and so on. If a string, the color can be set to one of
87
- the following: blue, green, orange, red, violet, gray/grey, or
88
- rainbow.
82
+ divider : bool, "blue", "green", "orange", "red", "violet", "yellow", "gray"/"grey", or "rainbow"
83
+ Shows a colored divider below the header. If this is ``True``,
84
+ successive headers will cycle through divider colors, except gray
85
+ and rainbow. That is, the first header will have a blue line, the
86
+ second header will have a green line, and so on. If this is a
87
+ string, the color can be set to one of the following: blue, green,
88
+ orange, red, violet, yellow, gray/grey, or rainbow.
89
89
 
90
90
  width : "stretch", "content", or int
91
91
  The width of the header element. This can be one of the following:
@@ -168,13 +168,13 @@ class HeadingMixin:
168
168
  including the Markdown directives described in the ``body``
169
169
  parameter of ``st.markdown``.
170
170
 
171
- divider : bool or “blue”, green”, orange”, red”, violet”, gray”/"grey", or rainbow
172
- Shows a colored divider below the header. If True, successive
173
- headers will cycle through divider colors. That is, the first
174
- header will have a blue line, the second header will have a
175
- green line, and so on. If a string, the color can be set to one of
176
- the following: blue, green, orange, red, violet, gray/grey, or
177
- rainbow.
171
+ divider : bool, "blue", "green", "orange", "red", "violet", "yellow", "gray"/"grey", or "rainbow"
172
+ Shows a colored divider below the header. If this is ``True``,
173
+ successive headers will cycle through divider colors, except gray
174
+ and rainbow. That is, the first header will have a blue line, the
175
+ second header will have a green line, and so on. If this is a
176
+ string, the color can be set to one of the following: blue, green,
177
+ orange, red, violet, yellow, gray/grey, or rainbow.
178
178
 
179
179
  width : "stretch", "content", or int
180
180
  The width of the subheader element. This can be one of the following:
@@ -304,10 +304,11 @@ class HeadingMixin:
304
304
  if divider is True:
305
305
  return "auto"
306
306
  valid_colors = [
307
+ "red",
308
+ "orange",
309
+ "yellow",
307
310
  "blue",
308
311
  "green",
309
- "orange",
310
- "red",
311
312
  "violet",
312
313
  "gray",
313
314
  "grey",
@@ -25,14 +25,17 @@ from typing import TYPE_CHECKING, Literal, Union, cast
25
25
 
26
26
  from typing_extensions import TypeAlias
27
27
 
28
- from streamlit.deprecation_util import show_deprecation_warning
28
+ from streamlit.deprecation_util import (
29
+ make_deprecated_name_warning,
30
+ show_deprecation_warning,
31
+ )
29
32
  from streamlit.elements.lib.image_utils import (
30
33
  Channels,
31
34
  ImageFormatOrAuto,
32
35
  ImageOrImageList,
33
- WidthBehavior,
34
36
  marshall_images,
35
37
  )
38
+ from streamlit.elements.lib.layout_utils import LayoutConfig, Width, validate_width
36
39
  from streamlit.errors import StreamlitAPIException
37
40
  from streamlit.proto.Image_pb2 import ImageList as ImageListProto
38
41
  from streamlit.runtime.metrics_util import gather_metrics
@@ -51,13 +54,13 @@ class ImageMixin:
51
54
  # TODO: Narrow type of caption, dependent on type of image,
52
55
  # by way of overload
53
56
  caption: str | list[str] | None = None,
54
- width: int | None = None,
57
+ width: Width = "content",
55
58
  use_column_width: UseColumnWith = None,
56
59
  clamp: bool = False,
57
60
  channels: Channels = "RGB",
58
61
  output_format: ImageFormatOrAuto = "auto",
59
62
  *,
60
- use_container_width: bool = False,
63
+ use_container_width: bool | None = None,
61
64
  ) -> DeltaGenerator:
62
65
  """Display an image or list of images.
63
66
 
@@ -91,11 +94,21 @@ class ImageMixin:
91
94
 
92
95
  .. |st.markdown| replace:: ``st.markdown``
93
96
  .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
94
- width : int or None
95
- Image width. If this is ``None`` (default), Streamlit will use the
96
- image's native width, up to the width of the parent container.
97
- When using an SVG image without a default width, you should declare
98
- ``width`` or use ``use_container_width=True``.
97
+ width : "content", "stretch", or int
98
+ The width of the image element. This can be one of the following:
99
+
100
+ - ``"content"`` (default): The width of the element matches the
101
+ width of its content, but doesn't exceed the width of the parent
102
+ container.
103
+ - ``"stretch"``: The width of the element matches the width of the
104
+ parent container.
105
+ - An integer specifying the width in pixels: The element has a
106
+ fixed width. If the specified width is greater than the width of
107
+ the parent container, the width of the element matches the width
108
+ of the parent container.
109
+
110
+ When using an SVG image without a default width, use ``"stretch"``
111
+ or an integer.
99
112
  use_column_width : "auto", "always", "never", or bool
100
113
  If "auto", set the image's width to its natural size,
101
114
  but do not exceed the width of the column.
@@ -129,9 +142,15 @@ class ImageMixin:
129
142
  ``use_container_width`` is ``True``, Streamlit sets the width of
130
143
  the image to match the width of the parent container.
131
144
 
145
+ .. deprecated::
146
+ ``use_container_width`` is deprecated and will be removed in a
147
+ future release. For ``use_container_width=True``, use
148
+ ``width="stretch"``. For ``use_container_width=False``, use
149
+ ``width="content"``.
150
+
132
151
  .. deprecated::
133
152
  ``use_column_width`` is deprecated and will be removed in a future
134
- release. Please use the ``use_container_width`` parameter instead.
153
+ release. Please use the ``width`` parameter instead.
135
154
 
136
155
  Example
137
156
  -------
@@ -144,50 +163,58 @@ class ImageMixin:
144
163
 
145
164
  """
146
165
 
147
- if use_container_width is True and use_column_width is not None:
148
- raise StreamlitAPIException(
149
- "`use_container_width` and `use_column_width` cannot be set at the same time.",
150
- "Please utilize `use_container_width` since `use_column_width` is deprecated.",
151
- )
152
-
153
- image_width: int = (
154
- WidthBehavior.ORIGINAL if (width is None or width <= 0) else width
155
- )
156
-
157
166
  if use_column_width is not None:
167
+ if use_container_width is not None:
168
+ raise StreamlitAPIException(
169
+ "`use_container_width` and `use_column_width` cannot be set at the same time.",
170
+ "Please utilize `use_container_width` since `use_column_width` is deprecated.",
171
+ )
172
+
158
173
  show_deprecation_warning(
159
174
  "The `use_column_width` parameter has been deprecated and will be removed "
160
175
  "in a future release. Please utilize the `use_container_width` parameter instead."
161
176
  )
162
-
163
- if use_column_width == "auto":
164
- image_width = WidthBehavior.AUTO
177
+ if use_column_width in {"auto", "never"} or use_column_width is False:
178
+ width = "content"
165
179
  elif use_column_width == "always" or use_column_width is True:
166
- image_width = WidthBehavior.COLUMN
167
- elif use_column_width == "never" or use_column_width is False:
168
- image_width = WidthBehavior.ORIGINAL
169
-
170
- elif use_container_width is True:
171
- image_width = WidthBehavior.MAX_IMAGE_OR_CONTAINER
172
- elif image_width is not None and image_width > 0:
173
- # Use the given width. It will be capped on the frontend if it
174
- # exceeds the container width.
175
- pass
176
- elif use_container_width is False:
177
- image_width = WidthBehavior.MIN_IMAGE_OR_CONTAINER
180
+ width = "stretch"
181
+
182
+ if use_container_width is not None:
183
+ show_deprecation_warning(
184
+ make_deprecated_name_warning(
185
+ "use_container_width",
186
+ "width",
187
+ "2025-12-31",
188
+ "For `use_container_width=True`, use `width='stretch'`. "
189
+ "For `use_container_width=False`, use `width='content'`.",
190
+ include_st_prefix=False,
191
+ ),
192
+ show_in_browser=False,
193
+ )
194
+ if use_container_width is True:
195
+ width = "stretch"
196
+ elif isinstance(width, int):
197
+ # Preserve the existing behavior with respect to use_container_width=False
198
+ # and width=int.
199
+ pass
200
+ else:
201
+ width = "content"
202
+
203
+ validate_width(width, allow_content=True)
204
+ layout_config = LayoutConfig(width=width)
178
205
 
179
206
  image_list_proto = ImageListProto()
180
207
  marshall_images(
181
208
  self.dg._get_delta_path_str(),
182
209
  image,
183
210
  caption,
184
- image_width,
211
+ layout_config,
185
212
  image_list_proto,
186
213
  clamp,
187
214
  channels,
188
215
  output_format,
189
216
  )
190
- return self.dg._enqueue("imgs", image_list_proto)
217
+ return self.dg._enqueue("imgs", image_list_proto, layout_config=layout_config)
191
218
 
192
219
  @property
193
220
  def dg(self) -> DeltaGenerator:
@@ -323,7 +323,7 @@ class LayoutsMixin:
323
323
  # in the future. This might require including more container
324
324
  # parameters in the ID calculation.
325
325
  block_proto.id = compute_and_register_element_id(
326
- "container", user_key=key, form_id=None
326
+ "container", user_key=key, dg=None
327
327
  )
328
328
 
329
329
  return self.dg._block(block_proto)
@@ -1112,7 +1112,7 @@ class LayoutsMixin:
1112
1112
  title: str,
1113
1113
  *,
1114
1114
  dismissible: bool = True,
1115
- width: Literal["small", "large"] = "small",
1115
+ width: Literal["small", "large", "medium"] = "small",
1116
1116
  on_dismiss: Literal["ignore", "rerun"] | WidgetCallback = "ignore",
1117
1117
  ) -> Dialog:
1118
1118
  """Inserts the dialog container.
@@ -118,11 +118,8 @@ _MELTED_Y_COLUMN_TITLE: Final = "value"
118
118
  _MELTED_COLOR_COLUMN_TITLE: Final = "color"
119
119
 
120
120
  # Crazy internal (non-user-visible) names for the index and melted columns, in order to
121
- # avoid collision with existing column names. The suffix below was generated with an
122
- # online random number generator. Rationale: because it makes it even less likely to
123
- # lead to a conflict than something that's human-readable (like "--streamlit-fake-field"
124
- # or something).
125
- _PROTECTION_SUFFIX: Final = "--p5bJXXpQgvPz6yvQMFiy"
121
+ # avoid collision with existing column names.
122
+ _PROTECTION_SUFFIX: Final = " -- streamlit-generated"
126
123
  _SEPARATED_INDEX_COLUMN_NAME: Final = _SEPARATED_INDEX_COLUMN_TITLE + _PROTECTION_SUFFIX
127
124
  _MELTED_Y_COLUMN_NAME: Final = _MELTED_Y_COLUMN_TITLE + _PROTECTION_SUFFIX
128
125
  _MELTED_COLOR_COLUMN_NAME: Final = _MELTED_COLOR_COLUMN_TITLE + _PROTECTION_SUFFIX
@@ -104,6 +104,11 @@ _EDITING_COMPATIBILITY_MAPPING: Final[dict[ColumnType, list[ColumnDataKind]]] =
104
104
  ColumnDataKind.EMPTY,
105
105
  ],
106
106
  "link": [ColumnDataKind.STRING, ColumnDataKind.EMPTY],
107
+ "list": [
108
+ ColumnDataKind.LIST,
109
+ ColumnDataKind.STRING,
110
+ ColumnDataKind.EMPTY,
111
+ ],
107
112
  }
108
113
 
109
114
 
@@ -395,8 +400,14 @@ def determine_dataframe_schema(
395
400
 
396
401
 
397
402
  # A mapping of column names/IDs to column configs.
398
- ColumnConfigMapping: TypeAlias = dict[Union[IndexIdentifierType, str], ColumnConfig]
403
+ ColumnConfigMapping: TypeAlias = dict[
404
+ Union[IndexIdentifierType, str, int], ColumnConfig
405
+ ]
399
406
  ColumnConfigMappingInput: TypeAlias = Mapping[
407
+ # TODO(lukasmasuch): This should also use int here to
408
+ # correctly type the support for positional index. However,
409
+ # allowing int here leads mypy to complain about simple dict[str, ...]
410
+ # as input -> which seems like a mypy bug.
400
411
  Union[IndexIdentifierType, str],
401
412
  Union[ColumnConfig, None, str],
402
413
  ]
@@ -440,7 +451,9 @@ def process_config_mapping(
440
451
 
441
452
 
442
453
  def update_column_config(
443
- column_config_mapping: ColumnConfigMapping, column: str, column_config: ColumnConfig
454
+ column_config_mapping: ColumnConfigMapping,
455
+ column: str | int,
456
+ column_config: ColumnConfig,
444
457
  ) -> None:
445
458
  """Updates the column config value for a single column within the mapping.
446
459
 
@@ -449,8 +462,9 @@ def update_column_config(
449
462
  column_config_mapping : ColumnConfigMapping
450
463
  The column config mapping to update.
451
464
 
452
- column : str
453
- The column to update the config value for.
465
+ column : str | int
466
+ The column to update the config value for. This can be the column name or
467
+ the numerical position of the column.
454
468
 
455
469
  column_config : ColumnConfig
456
470
  The column config to update.