streamlit 1.48.1__py3-none-any.whl → 1.49.0__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 +3 -10
- streamlit/commands/logo.py +4 -3
- streamlit/commands/navigation.py +1 -1
- streamlit/commands/page_config.py +4 -1
- streamlit/components/v1/custom_component.py +2 -2
- streamlit/config.py +82 -1
- streamlit/connections/snowflake_connection.py +3 -1
- streamlit/delta_generator.py +3 -0
- streamlit/elements/arrow.py +155 -70
- streamlit/elements/bokeh_chart.py +13 -3
- streamlit/elements/deck_gl_json_chart.py +0 -1
- streamlit/elements/dialog_decorator.py +7 -59
- streamlit/elements/form.py +10 -1
- streamlit/elements/graphviz_chart.py +57 -6
- streamlit/elements/heading.py +17 -16
- streamlit/elements/image.py +64 -37
- streamlit/elements/layouts.py +2 -2
- streamlit/elements/lib/built_in_chart_utils.py +2 -5
- streamlit/elements/lib/column_config_utils.py +18 -4
- streamlit/elements/lib/column_types.py +75 -30
- streamlit/elements/lib/dialog.py +3 -3
- streamlit/elements/lib/image_utils.py +19 -11
- streamlit/elements/lib/layout_utils.py +15 -2
- streamlit/elements/lib/utils.py +20 -41
- streamlit/elements/markdown.py +7 -6
- streamlit/elements/media.py +6 -13
- streamlit/elements/metric.py +78 -1
- streamlit/elements/pdf.py +192 -0
- streamlit/elements/plotly_chart.py +3 -2
- streamlit/elements/pyplot.py +53 -11
- streamlit/elements/toast.py +81 -5
- streamlit/elements/vega_charts.py +3 -8
- streamlit/elements/widgets/audio_input.py +0 -1
- streamlit/elements/widgets/button.py +0 -4
- streamlit/elements/widgets/button_group.py +5 -4
- streamlit/elements/widgets/camera_input.py +0 -1
- streamlit/elements/widgets/chat.py +11 -13
- streamlit/elements/widgets/checkbox.py +0 -1
- streamlit/elements/widgets/color_picker.py +0 -1
- streamlit/elements/widgets/data_editor.py +142 -62
- streamlit/elements/widgets/file_uploader.py +74 -37
- streamlit/elements/widgets/multiselect.py +0 -1
- streamlit/elements/widgets/number_input.py +0 -1
- streamlit/elements/widgets/radio.py +0 -1
- streamlit/elements/widgets/select_slider.py +0 -1
- streamlit/elements/widgets/selectbox.py +0 -1
- streamlit/elements/widgets/slider.py +0 -1
- streamlit/elements/widgets/text_widgets.py +0 -2
- streamlit/elements/widgets/time_widgets.py +0 -2
- streamlit/errors.py +11 -0
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/Arrow_pb2.py +14 -8
- streamlit/proto/Arrow_pb2.pyi +11 -3
- streamlit/proto/Block_pb2.py +16 -16
- streamlit/proto/Block_pb2.pyi +2 -0
- streamlit/proto/ChatInput_pb2.py +3 -3
- streamlit/proto/ChatInput_pb2.pyi +2 -0
- streamlit/proto/FileUploader_pb2.py +2 -2
- streamlit/proto/FileUploader_pb2.pyi +5 -1
- streamlit/proto/GraphVizChart_pb2.py +4 -2
- streamlit/proto/GraphVizChart_pb2.pyi +1 -1
- streamlit/proto/Image_pb2.py +4 -2
- streamlit/proto/Image_pb2.pyi +1 -10
- streamlit/proto/Metric_pb2.py +8 -6
- streamlit/proto/Metric_pb2.pyi +34 -10
- streamlit/proto/Toast_pb2.py +2 -2
- streamlit/proto/Toast_pb2.pyi +10 -1
- streamlit/runtime/caching/__init__.py +14 -2
- streamlit/runtime/caching/cache_data_api.py +0 -17
- streamlit/runtime/caching/cache_resource_api.py +0 -16
- streamlit/runtime/caching/cached_message_replay.py +8 -20
- streamlit/runtime/caching/hashing.py +31 -1
- streamlit/runtime/credentials.py +4 -4
- streamlit/runtime/fragment.py +0 -42
- streamlit/runtime/websocket_session_manager.py +1 -1
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +224 -252
- streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
- streamlit/static/static/css/index.COe1010n.css +1 -0
- streamlit/static/static/js/{ErrorOutline.esm.DjObtx4K.js → ErrorOutline.esm.u9XvzxL8.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Bz9nxNC5.js → FileDownload.esm.CaRyZ-b2.js} +1 -1
- streamlit/static/static/js/FileHelper.Dk2SwIi3.js +5 -0
- streamlit/static/static/js/FormClearHelper.l_UPPvkg.js +1 -0
- streamlit/static/static/js/{Hooks.DEoLCfOE.js → Hooks.BxrVEftw.js} +1 -1
- streamlit/static/static/js/InputInstructions.C254RU9X.js +1 -0
- streamlit/static/static/js/Particles.DkY6FDnc.js +1 -0
- streamlit/static/static/js/ProgressBar.BPtSM82n.js +2 -0
- streamlit/static/static/js/Toolbar.BO_3WBaS.js +1 -0
- streamlit/static/static/js/{base-input.BmvSaPd2.js → base-input.egUI4LjJ.js} +4 -4
- streamlit/static/static/js/{checkbox.Cgxgc0et.js → checkbox.ButpszcE.js} +2 -2
- streamlit/static/static/js/createSuper.DYJA5xa6.js +1 -0
- streamlit/static/static/js/data-grid-overlay-editor.C9gQLEnU.js +1 -0
- streamlit/static/static/js/{downloader.M6jQeNDf.js → downloader.B3TjsSPZ.js} +1 -1
- streamlit/static/static/js/es6.BYSNuG4D.js +2 -0
- streamlit/static/static/js/iframeResizer.contentWindow.CNPHJsF2.js +1 -0
- streamlit/static/static/js/index.0tDq1WXk.js +1 -0
- streamlit/static/static/js/index.BBnWuh07.js +976 -0
- streamlit/static/static/js/index.BDZorv41.js +1 -0
- streamlit/static/static/js/{index.CbdWnLqS.js → index.BH79B25f.js} +3 -3
- streamlit/static/static/js/index.BeTC4Yl-.js +197 -0
- streamlit/static/static/js/index.BnOd05Ko.js +2 -0
- streamlit/static/static/js/index.BoJaJReB.js +1 -0
- streamlit/static/static/js/index.Bp1Of6L8.js +1 -0
- streamlit/static/static/js/index.Bpe4-O2W.js +1 -0
- streamlit/static/static/js/index.BrD9sbpx.js +1 -0
- streamlit/static/static/js/index.C1qCS-sd.js +1 -0
- streamlit/static/static/js/index.C3EXAI-u.js +1 -0
- streamlit/static/static/js/index.C77g9sAQ.js +3 -0
- streamlit/static/static/js/{index.BXDq9dj4.js → index.CFePF7s4.js} +1 -1
- streamlit/static/static/js/index.CFjU0x00.js +1 -0
- streamlit/static/static/js/index.Ca3y4ztK.js +1 -0
- streamlit/static/static/js/{index.CgZDfhN4.js → index.Cb9gN2T2.js} +2 -2
- streamlit/static/static/js/{index.tsvTLdio.js → index.CbwuUwu4.js} +9 -9
- streamlit/static/static/js/index.CeXLlclc.js +1 -0
- streamlit/static/static/js/index.CfiZGqj3.js +3 -0
- streamlit/static/static/js/index.CjQnYKID.js +1 -0
- streamlit/static/static/js/index.Cl_966eE.js +3858 -0
- streamlit/static/static/js/{index.Cqa4gqqN.js → index.CqSRo6zQ.js} +1 -1
- streamlit/static/static/js/index.CuEFSQ-o.js +1 -0
- streamlit/static/static/js/index.D4jR1m1z.js +1 -0
- streamlit/static/static/js/index.DGcW849X.js +1 -0
- streamlit/static/static/js/index.DKb-BAE2.js +1 -0
- streamlit/static/static/js/index.DP1rDFP0.js +1 -0
- streamlit/static/static/js/{index.D1EayrNh.js → index.DStzYLqM.js} +2 -2
- streamlit/static/static/js/index.DVKQKDLu.js +1 -0
- streamlit/static/static/js/index.DWedOrkQ.js +1 -0
- streamlit/static/static/js/index.DYbRPmVF.js +1 -0
- streamlit/static/static/js/index.DgpIMUsr.js +1 -0
- streamlit/static/static/js/index.DtwkPJs5.js +5367 -0
- streamlit/static/static/js/{index.D1jHqUJq.js → index.MQLQLR5Z.js} +1 -1
- streamlit/static/static/js/index.uInpwWAP.js +1 -0
- streamlit/static/static/js/index.z992t-BQ.js +7 -0
- streamlit/static/static/js/{input.DZd6EQlV.js → input.CbP5ZuQ7.js} +2 -2
- streamlit/static/static/js/{memory.ptkfuI71.js → memory.BuacVo2L.js} +1 -1
- streamlit/static/static/js/number-overlay-editor.BZb9zRl_.js +9 -0
- streamlit/static/static/js/{possibleConstructorReturn.Bd4ImlQ9.js → possibleConstructorReturn.DSM84rOS.js} +1 -1
- streamlit/static/static/js/{sandbox.DsH8LuID.js → sandbox.C480llMG.js} +1 -1
- streamlit/static/static/js/{timepicker.QVekV78C.js → timepicker.BunxCVp7.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.BJvaP8gb.js → toConsumableArray.B4o8rEx1.js} +3 -3
- streamlit/static/static/js/uniqueId.tii0yosY.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.DB3vMS9V.js → useBasicWidgetState.Bnm4FD6K.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.CBkGkaRt.js → useTextInputAutoExpand.Dgtwc1m0.js} +2 -2
- streamlit/static/static/js/useUpdateUiValue.DjXdMFGw.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.0cy2pVf5.js +1 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
- streamlit/user_info.py +3 -1
- streamlit/web/server/browser_websocket_handler.py +15 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/METADATA +4 -2
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/RECORD +153 -156
- streamlit/static/static/css/index.CQt5TjGB.css +0 -1
- streamlit/static/static/js/FileHelper.BrQvUXVD.js +0 -5
- streamlit/static/static/js/FormClearHelper.DF4gFAOO.js +0 -1
- streamlit/static/static/js/InputInstructions.D8zoMog9.js +0 -1
- streamlit/static/static/js/Particles.CCFySwdL.js +0 -1
- streamlit/static/static/js/ProgressBar.COK9j1l0.js +0 -2
- streamlit/static/static/js/Toolbar.Dt4jIKlY.js +0 -1
- streamlit/static/static/js/createSuper.siQeagI2.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.Ct51iCb_.js +0 -1
- streamlit/static/static/js/es6.CMaUdEZ5.js +0 -2
- streamlit/static/static/js/iframeResizer.contentWindow.C33BryyP.js +0 -1
- streamlit/static/static/js/index.8GJD0eeD.js +0 -1
- streamlit/static/static/js/index.8QEYHMQD.js +0 -1
- streamlit/static/static/js/index.Ay41Wnu9.js +0 -1
- streamlit/static/static/js/index.BLiKiJ7_.js +0 -1
- streamlit/static/static/js/index.BT78cJmU.js +0 -1
- streamlit/static/static/js/index.BdGvnhlM.js +0 -1
- streamlit/static/static/js/index.BfasrT0d.js +0 -1
- streamlit/static/static/js/index.CCdtFMFG.js +0 -1
- streamlit/static/static/js/index.CFRGZDz1.js +0 -1
- streamlit/static/static/js/index.CFSFYiPA.js +0 -5366
- streamlit/static/static/js/index.CeiIiXap.js +0 -1
- streamlit/static/static/js/index.CzX2xpyc.js +0 -1
- streamlit/static/static/js/index.D1ErX5go.js +0 -2
- streamlit/static/static/js/index.D5gweoL5.js +0 -7
- streamlit/static/static/js/index.DByVKZgq.js +0 -1
- streamlit/static/static/js/index.DEND45D1.js +0 -3
- streamlit/static/static/js/index.DKN5MVff.js +0 -781
- streamlit/static/static/js/index.DfoxW1gP.js +0 -3855
- streamlit/static/static/js/index.Dtf1Ac0x.js +0 -1
- streamlit/static/static/js/index.DxrLhpeO.js +0 -1
- streamlit/static/static/js/index.J7o-_HIh.js +0 -1
- streamlit/static/static/js/index.LU8juINp.js +0 -197
- streamlit/static/static/js/index.L_N2iylt.js +0 -1
- streamlit/static/static/js/index.PZUX2kRz.js +0 -3
- streamlit/static/static/js/index.ROjU6K0k.js +0 -1
- streamlit/static/static/js/index.WSNLkF94.js +0 -1
- streamlit/static/static/js/index.X5W3gJLn.js +0 -1
- streamlit/static/static/js/index.k9LYqfSL.js +0 -1
- streamlit/static/static/js/index.pnHtHv_c.js +0 -203
- streamlit/static/static/js/index.tPUXqsfW.js +0 -1
- streamlit/static/static/js/mergeWith.GRNk8iwv.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DXS2qb1U.js +0 -9
- streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
- streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
- streamlit/static/static/js/uniqueId.D_5M8Dgf.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.C7ZKpLQK.js +0 -1
- streamlit/static/static/js/value.CgPGBV_l.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.C-gXt0Rl.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
- {streamlit-1.48.1.data → streamlit-1.49.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/WHEEL +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.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
|
-
|
|
56
|
-
|
|
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
|
|
|
@@ -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.
|
|
217
|
-
|
|
218
|
-
modal dialog will be
|
|
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
|
-
)
|
streamlit/elements/form.py
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
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,
|
|
124
|
-
|
|
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
|
streamlit/elements/heading.py
CHANGED
|
@@ -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,
|
|
83
|
-
Shows a colored divider below the header. If True
|
|
84
|
-
headers will cycle through divider colors
|
|
85
|
-
|
|
86
|
-
green line, and so on. If
|
|
87
|
-
the following: blue, green,
|
|
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
|
|
172
|
-
Shows a colored divider below the header. If True
|
|
173
|
-
headers will cycle through divider colors
|
|
174
|
-
|
|
175
|
-
green line, and so on. If
|
|
176
|
-
the following: blue, green,
|
|
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",
|
streamlit/elements/image.py
CHANGED
|
@@ -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
|
|
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:
|
|
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 =
|
|
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 :
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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 ``
|
|
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
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
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:
|
streamlit/elements/layouts.py
CHANGED
|
@@ -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,
|
|
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.
|
|
122
|
-
|
|
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[
|
|
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,
|
|
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.
|