streamlit 1.50.0__py3-none-any.whl → 1.51.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 +4 -1
- streamlit/commands/navigation.py +4 -6
- streamlit/commands/page_config.py +4 -6
- streamlit/components/v2/__init__.py +458 -0
- streamlit/components/v2/bidi_component/__init__.py +20 -0
- streamlit/components/v2/bidi_component/constants.py +29 -0
- streamlit/components/v2/bidi_component/main.py +386 -0
- streamlit/components/v2/bidi_component/serialization.py +265 -0
- streamlit/components/v2/bidi_component/state.py +92 -0
- streamlit/components/v2/component_definition_resolver.py +143 -0
- streamlit/components/v2/component_file_watcher.py +403 -0
- streamlit/components/v2/component_manager.py +431 -0
- streamlit/components/v2/component_manifest_handler.py +122 -0
- streamlit/components/v2/component_path_utils.py +245 -0
- streamlit/components/v2/component_registry.py +409 -0
- streamlit/components/v2/get_bidi_component_manager.py +51 -0
- streamlit/components/v2/manifest_scanner.py +615 -0
- streamlit/components/v2/presentation.py +198 -0
- streamlit/components/v2/types.py +324 -0
- streamlit/config.py +456 -53
- streamlit/config_option.py +4 -1
- streamlit/config_util.py +650 -1
- streamlit/dataframe_util.py +15 -8
- streamlit/delta_generator.py +6 -4
- streamlit/delta_generator_singletons.py +3 -1
- streamlit/deprecation_util.py +17 -6
- streamlit/elements/arrow.py +37 -9
- streamlit/elements/deck_gl_json_chart.py +97 -39
- streamlit/elements/dialog_decorator.py +2 -1
- streamlit/elements/exception.py +3 -1
- streamlit/elements/graphviz_chart.py +1 -3
- streamlit/elements/heading.py +3 -5
- streamlit/elements/image.py +2 -4
- streamlit/elements/layouts.py +31 -11
- streamlit/elements/lib/built_in_chart_utils.py +1 -3
- streamlit/elements/lib/color_util.py +8 -18
- streamlit/elements/lib/column_config_utils.py +4 -8
- streamlit/elements/lib/column_types.py +40 -12
- streamlit/elements/lib/dialog.py +2 -2
- streamlit/elements/lib/image_utils.py +3 -5
- streamlit/elements/lib/layout_utils.py +50 -13
- streamlit/elements/lib/mutable_status_container.py +2 -2
- streamlit/elements/lib/options_selector_utils.py +2 -2
- streamlit/elements/lib/utils.py +4 -4
- streamlit/elements/map.py +80 -37
- streamlit/elements/media.py +5 -7
- streamlit/elements/metric.py +3 -5
- streamlit/elements/pdf.py +2 -4
- streamlit/elements/plotly_chart.py +125 -17
- streamlit/elements/progress.py +2 -4
- streamlit/elements/space.py +113 -0
- streamlit/elements/vega_charts.py +339 -148
- streamlit/elements/widgets/audio_input.py +5 -5
- streamlit/elements/widgets/button.py +2 -4
- streamlit/elements/widgets/button_group.py +33 -7
- streamlit/elements/widgets/camera_input.py +2 -4
- streamlit/elements/widgets/chat.py +7 -1
- streamlit/elements/widgets/color_picker.py +1 -1
- streamlit/elements/widgets/data_editor.py +28 -24
- streamlit/elements/widgets/file_uploader.py +5 -10
- streamlit/elements/widgets/multiselect.py +4 -3
- streamlit/elements/widgets/number_input.py +2 -4
- streamlit/elements/widgets/radio.py +10 -3
- streamlit/elements/widgets/select_slider.py +8 -5
- streamlit/elements/widgets/selectbox.py +6 -3
- streamlit/elements/widgets/slider.py +38 -42
- streamlit/elements/widgets/time_widgets.py +6 -12
- streamlit/elements/write.py +27 -6
- streamlit/emojis.py +1 -1
- streamlit/errors.py +115 -0
- streamlit/hello/hello.py +8 -0
- streamlit/hello/utils.py +2 -1
- streamlit/material_icon_names.py +1 -1
- streamlit/navigation/page.py +4 -1
- streamlit/proto/ArrowData_pb2.py +27 -0
- streamlit/proto/ArrowData_pb2.pyi +46 -0
- streamlit/proto/BidiComponent_pb2.py +34 -0
- streamlit/proto/BidiComponent_pb2.pyi +153 -0
- streamlit/proto/Block_pb2.py +7 -7
- streamlit/proto/Block_pb2.pyi +4 -1
- streamlit/proto/DeckGlJsonChart_pb2.py +10 -4
- streamlit/proto/DeckGlJsonChart_pb2.pyi +9 -3
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +14 -4
- streamlit/proto/HeightConfig_pb2.py +2 -2
- streamlit/proto/HeightConfig_pb2.pyi +6 -3
- streamlit/proto/NewSession_pb2.py +18 -18
- streamlit/proto/NewSession_pb2.pyi +25 -6
- streamlit/proto/PlotlyChart_pb2.py +8 -6
- streamlit/proto/PlotlyChart_pb2.pyi +3 -1
- streamlit/proto/Space_pb2.py +27 -0
- streamlit/proto/Space_pb2.pyi +42 -0
- streamlit/proto/WidgetStates_pb2.py +2 -2
- streamlit/proto/WidgetStates_pb2.pyi +13 -3
- streamlit/proto/WidthConfig_pb2.py +2 -2
- streamlit/proto/WidthConfig_pb2.pyi +6 -3
- streamlit/runtime/app_session.py +27 -1
- streamlit/runtime/caching/cache_data_api.py +4 -4
- streamlit/runtime/caching/cache_errors.py +4 -1
- streamlit/runtime/caching/cache_resource_api.py +3 -2
- streamlit/runtime/caching/cache_utils.py +2 -1
- streamlit/runtime/caching/cached_message_replay.py +3 -3
- streamlit/runtime/caching/hashing.py +3 -4
- streamlit/runtime/caching/legacy_cache_api.py +2 -1
- streamlit/runtime/connection_factory.py +1 -3
- streamlit/runtime/forward_msg_queue.py +4 -1
- streamlit/runtime/fragment.py +2 -1
- streamlit/runtime/memory_media_file_storage.py +1 -1
- streamlit/runtime/metrics_util.py +6 -2
- streamlit/runtime/runtime.py +14 -0
- streamlit/runtime/scriptrunner/exec_code.py +2 -1
- streamlit/runtime/scriptrunner/script_runner.py +2 -2
- streamlit/runtime/scriptrunner_utils/script_run_context.py +3 -6
- streamlit/runtime/secrets.py +2 -4
- streamlit/runtime/session_manager.py +3 -1
- streamlit/runtime/state/common.py +30 -5
- streamlit/runtime/state/presentation.py +85 -0
- streamlit/runtime/state/safe_session_state.py +2 -2
- streamlit/runtime/state/session_state.py +220 -16
- streamlit/runtime/state/widgets.py +19 -3
- streamlit/runtime/websocket_session_manager.py +3 -1
- streamlit/source_util.py +2 -2
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +243 -226
- streamlit/static/static/css/{index.CIiu7Ygf.css → index.BpABIXK9.css} +1 -1
- streamlit/static/static/css/index.DgR7E2CV.css +1 -0
- streamlit/static/static/js/{ErrorOutline.esm.DUpR0_Ka.js → ErrorOutline.esm.YoJdlW1p.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.CN4j9-1w.js → FileDownload.esm.Ddx8VEYy.js} +1 -1
- streamlit/static/static/js/{FileHelper.CaIUKG91.js → FileHelper.90EtOmj9.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DTcdrasw.js → FormClearHelper.BB1Km6eP.js} +1 -1
- streamlit/static/static/js/InputInstructions.jhH15PqV.js +1 -0
- streamlit/static/static/js/{Particles.CElH0XX2.js → Particles.DUsputn1.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DetlP5aY.js → ProgressBar.DLY8H6nE.js} +1 -1
- streamlit/static/static/js/{Toolbar.C77ar7rq.js → Toolbar.D8nHCkuz.js} +1 -1
- streamlit/static/static/js/{base-input.BQft14La.js → base-input.CJGiNqed.js} +3 -3
- streamlit/static/static/js/{checkbox.yZOfXCeX.js → checkbox.Cpdd482O.js} +1 -1
- streamlit/static/static/js/{createSuper.Dh9w1cs8.js → createSuper.CuQIogbW.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DcuHuCyW.js → data-grid-overlay-editor.2Ufgxc6y.js} +1 -1
- streamlit/static/static/js/{downloader.MeHtkq8r.js → downloader.CN0K7xlu.js} +1 -1
- streamlit/static/static/js/{es6.VpBPGCnM.js → es6.BJcsVXQ0.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.yMw_ARIL.js → iframeResizer.contentWindow.XzUvQqcZ.js} +1 -1
- streamlit/static/static/js/index.B1ZQh4P1.js +1 -0
- streamlit/static/static/js/index.BKstZk0M.js +27 -0
- streamlit/static/static/js/{index.Cnpi3o3E.js → index.BMcFsUee.js} +1 -1
- streamlit/static/static/js/{index.DKv_lNO7.js → index.BR-IdcTb.js} +1 -1
- streamlit/static/static/js/{index.FFOzOWzC.js → index.B_dWA3vd.js} +1 -1
- streamlit/static/static/js/{index.Bj9JgOEC.js → index.BgnZEMVh.js} +1 -1
- streamlit/static/static/js/{index.Bxz2yX3P.js → index.BohqXifI.js} +1 -1
- streamlit/static/static/js/{index.Dbe-Q3C-.js → index.Br5nxKNj.js} +1 -1
- streamlit/static/static/js/{index.BjCwMzj4.js → index.BrIKVbNc.js} +2 -2
- streamlit/static/static/js/index.BtWUPzle.js +1 -0
- streamlit/static/static/js/{index.CGYqqs6j.js → index.C0RLraek.js} +1 -1
- streamlit/static/static/js/{index.D2QEXQq_.js → index.CAIjskgG.js} +1 -1
- streamlit/static/static/js/{index.6xX1278W.js → index.CAj-7vWz.js} +131 -157
- streamlit/static/static/js/{index.DK7hD7_w.js → index.CMtEit2O.js} +1 -1
- streamlit/static/static/js/{index.DNLrMXgm.js → index.CkRlykEE.js} +1 -1
- streamlit/static/static/js/{index.ClELlchS.js → index.CmN3FXfI.js} +1 -1
- streamlit/static/static/js/{index.GRUzrudl.js → index.CwbFI1_-.js} +1 -1
- streamlit/static/static/js/{index.Ctn27_AE.js → index.CxIUUfab.js} +27 -27
- streamlit/static/static/js/index.D2KPNy7e.js +1 -0
- streamlit/static/static/js/{index.B0H9IXUJ.js → index.D3GPA5k4.js} +3 -3
- streamlit/static/static/js/{index.BycLveZ4.js → index.DGAh7DMq.js} +1 -1
- streamlit/static/static/js/index.DKb_NvmG.js +197 -0
- streamlit/static/static/js/{index.BPQo7BKk.js → index.DMqgUYKq.js} +1 -1
- streamlit/static/static/js/{index.CH1tqnSs.js → index.DOFlg3dS.js} +1 -1
- streamlit/static/static/js/{index.64ejlaaT.js → index.DPUXkcQL.js} +1 -1
- streamlit/static/static/js/{index.B-hiXRzw.js → index.DX1xY89g.js} +1 -1
- streamlit/static/static/js/index.DYATBCsq.js +2 -0
- streamlit/static/static/js/{index.DHh-U0dK.js → index.DaSmGJ76.js} +3 -3
- streamlit/static/static/js/{index.DuxqVQpd.js → index.Dd7bMeLP.js} +1 -1
- streamlit/static/static/js/{index.B4cAbHP6.js → index.DjmmgI5U.js} +1 -1
- streamlit/static/static/js/{index.DcPNYEUo.js → index.Dq56CyM2.js} +1 -1
- streamlit/static/static/js/{index.CiAQIz1H.js → index.DuiXaS5_.js} +1 -1
- streamlit/static/static/js/index.DvFidMLe.js +2 -0
- streamlit/static/static/js/{index.C9BdUqTi.js → index.DwkhC5Pc.js} +1 -1
- streamlit/static/static/js/{index.B4dUQfni.js → index.Q-3sFn1v.js} +1 -1
- streamlit/static/static/js/{index.CMItVsFA.js → index.QJ5QO9sJ.js} +1 -1
- streamlit/static/static/js/{index.CTBk8Vk2.js → index.VwTaeety.js} +1 -1
- streamlit/static/static/js/{index.Ck8rQ9OL.js → index.YOqQbeX8.js} +1 -1
- streamlit/static/static/js/{input.s6pjQ49A.js → input.D4MN_FzN.js} +1 -1
- streamlit/static/static/js/{memory.Cuvsdfrl.js → memory.DrZjtdGT.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DdgVR5m3.js → number-overlay-editor.DRwAw1In.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.CqidKeei.js → possibleConstructorReturn.exeeJQEP.js} +1 -1
- streamlit/static/static/js/record.B-tDciZb.js +1 -0
- streamlit/static/static/js/{sandbox.CCQREcJx.js → sandbox.ClO3IuUr.js} +1 -1
- streamlit/static/static/js/{timepicker.mkJF97Bb.js → timepicker.DAhu-vcF.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.De7I7KVR.js → toConsumableArray.DNbljYEC.js} +1 -1
- streamlit/static/static/js/{uniqueId.RI1LJdtz.js → uniqueId.oG4Gvj1v.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.CedkNjUW.js → useBasicWidgetState.D6sOH6oI.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.Ca7w8dVs.js → useTextInputAutoExpand.4u3_GcuN.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.DeXelfRH.js → useUpdateUiValue.F2R3eTeR.js} +1 -1
- streamlit/static/static/js/wavesurfer.esm.vI8Eid4k.js +73 -0
- streamlit/static/static/js/{withFullScreenWrapper.C3561XxJ.js → withFullScreenWrapper.zothJIsI.js} +1 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.C7IFxh57.woff2 +0 -0
- streamlit/string_util.py +1 -3
- streamlit/testing/v1/app_test.py +2 -2
- streamlit/testing/v1/element_tree.py +23 -9
- streamlit/testing/v1/util.py +2 -2
- streamlit/type_util.py +3 -4
- streamlit/url_util.py +1 -3
- streamlit/user_info.py +1 -2
- streamlit/util.py +3 -1
- streamlit/watcher/event_based_path_watcher.py +23 -12
- streamlit/watcher/local_sources_watcher.py +11 -1
- streamlit/watcher/path_watcher.py +9 -6
- streamlit/watcher/polling_path_watcher.py +4 -1
- streamlit/watcher/util.py +2 -2
- streamlit/web/cli.py +51 -22
- streamlit/web/server/bidi_component_request_handler.py +193 -0
- streamlit/web/server/component_file_utils.py +97 -0
- streamlit/web/server/component_request_handler.py +8 -21
- streamlit/web/server/oidc_mixin.py +3 -1
- streamlit/web/server/routes.py +2 -2
- streamlit/web/server/server.py +9 -0
- streamlit/web/server/server_util.py +3 -1
- streamlit/web/server/upload_file_request_handler.py +3 -1
- {streamlit-1.50.0.dist-info → streamlit-1.51.0.dist-info}/METADATA +4 -5
- {streamlit-1.50.0.dist-info → streamlit-1.51.0.dist-info}/RECORD +222 -194
- streamlit/static/static/css/index.CHEnSPGk.css +0 -1
- streamlit/static/static/js/Hooks.BRba_Own.js +0 -1
- streamlit/static/static/js/InputInstructions.xnSDuYeQ.js +0 -1
- streamlit/static/static/js/index.Baqa90pe.js +0 -2
- streamlit/static/static/js/index.Bm3VbPB5.js +0 -1
- streamlit/static/static/js/index.CFMf5_ez.js +0 -197
- streamlit/static/static/js/index.Cj7DSzVR.js +0 -73
- streamlit/static/static/js/index.DH71Ezyj.js +0 -1
- streamlit/static/static/js/index.DW0Grddz.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DeCZgS-4.woff2 +0 -0
- {streamlit-1.50.0.data → streamlit-1.51.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.50.0.dist-info → streamlit-1.51.0.dist-info}/WHEEL +0 -0
- {streamlit-1.50.0.dist-info → streamlit-1.51.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.50.0.dist-info → streamlit-1.51.0.dist-info}/top_level.txt +0 -0
streamlit/dataframe_util.py
CHANGED
|
@@ -30,14 +30,14 @@ from typing import (
|
|
|
30
30
|
Any,
|
|
31
31
|
Final,
|
|
32
32
|
Protocol,
|
|
33
|
+
TypeAlias,
|
|
34
|
+
TypeGuard,
|
|
33
35
|
TypeVar,
|
|
34
36
|
Union,
|
|
35
37
|
cast,
|
|
36
38
|
runtime_checkable,
|
|
37
39
|
)
|
|
38
40
|
|
|
39
|
-
from typing_extensions import TypeAlias, TypeGuard
|
|
40
|
-
|
|
41
41
|
from streamlit import config, errors, logger, string_util
|
|
42
42
|
from streamlit.type_util import (
|
|
43
43
|
CustomDict,
|
|
@@ -165,12 +165,12 @@ class DataframeInterchangeCompatible(Protocol):
|
|
|
165
165
|
def __dataframe__(self, allow_copy: bool) -> Any: ...
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
OptionSequence: TypeAlias =
|
|
169
|
-
Iterable[V_co]
|
|
170
|
-
DataFrameGenericAlias[V_co]
|
|
171
|
-
PandasCompatible
|
|
172
|
-
DataframeInterchangeCompatible
|
|
173
|
-
|
|
168
|
+
OptionSequence: TypeAlias = (
|
|
169
|
+
Iterable[V_co]
|
|
170
|
+
| DataFrameGenericAlias[V_co]
|
|
171
|
+
| PandasCompatible
|
|
172
|
+
| DataframeInterchangeCompatible
|
|
173
|
+
)
|
|
174
174
|
|
|
175
175
|
# Various data types supported by our dataframe processing
|
|
176
176
|
# used for commands like `st.dataframe`, `st.table`, `st.map`,
|
|
@@ -528,6 +528,13 @@ def _dict_to_pandas_df(data: dict[Any, Any]) -> DataFrame:
|
|
|
528
528
|
return _fix_column_naming(pd.DataFrame.from_dict(data, orient="index"))
|
|
529
529
|
|
|
530
530
|
|
|
531
|
+
def has_range_index(df: DataFrame) -> bool:
|
|
532
|
+
"""True if the dataframe has a range index."""
|
|
533
|
+
from pandas import RangeIndex
|
|
534
|
+
|
|
535
|
+
return isinstance(df.index, RangeIndex)
|
|
536
|
+
|
|
537
|
+
|
|
531
538
|
def convert_anything_to_pandas_df(
|
|
532
539
|
data: Any,
|
|
533
540
|
max_unevaluated_rows: int = _MAX_UNEVALUATED_DF_ROWS,
|
streamlit/delta_generator.py
CHANGED
|
@@ -17,21 +17,19 @@
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
19
|
import sys
|
|
20
|
-
from collections.abc import Iterable
|
|
20
|
+
from collections.abc import Callable, Iterable
|
|
21
21
|
from copy import deepcopy
|
|
22
22
|
from typing import (
|
|
23
23
|
TYPE_CHECKING,
|
|
24
24
|
Any,
|
|
25
|
-
Callable,
|
|
26
25
|
Final,
|
|
27
26
|
Literal,
|
|
28
27
|
NoReturn,
|
|
28
|
+
TypeAlias,
|
|
29
29
|
TypeVar,
|
|
30
30
|
cast,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
from typing_extensions import TypeAlias
|
|
34
|
-
|
|
35
33
|
from streamlit import (
|
|
36
34
|
cli_util,
|
|
37
35
|
config,
|
|
@@ -41,6 +39,7 @@ from streamlit import (
|
|
|
41
39
|
runtime,
|
|
42
40
|
util,
|
|
43
41
|
)
|
|
42
|
+
from streamlit.components.v2.bidi_component import BidiComponentMixin
|
|
44
43
|
from streamlit.delta_generator_singletons import (
|
|
45
44
|
context_dg_stack,
|
|
46
45
|
get_last_dg_added_to_context_stack,
|
|
@@ -76,6 +75,7 @@ from streamlit.elements.plotly_chart import PlotlyMixin
|
|
|
76
75
|
from streamlit.elements.progress import ProgressMixin
|
|
77
76
|
from streamlit.elements.pyplot import PyplotMixin
|
|
78
77
|
from streamlit.elements.snow import SnowMixin
|
|
78
|
+
from streamlit.elements.space import SpaceMixin
|
|
79
79
|
from streamlit.elements.text import TextMixin
|
|
80
80
|
from streamlit.elements.toast import ToastMixin
|
|
81
81
|
from streamlit.elements.vega_charts import VegaChartsMixin
|
|
@@ -207,6 +207,7 @@ class DeltaGenerator(
|
|
|
207
207
|
SelectSliderMixin,
|
|
208
208
|
SliderMixin,
|
|
209
209
|
SnowMixin,
|
|
210
|
+
SpaceMixin,
|
|
210
211
|
JsonMixin,
|
|
211
212
|
TextMixin,
|
|
212
213
|
TextWidgetsMixin,
|
|
@@ -216,6 +217,7 @@ class DeltaGenerator(
|
|
|
216
217
|
ArrowMixin,
|
|
217
218
|
VegaChartsMixin,
|
|
218
219
|
DataEditorMixin,
|
|
220
|
+
BidiComponentMixin,
|
|
219
221
|
):
|
|
220
222
|
"""Creator of Delta protobuf messages.
|
|
221
223
|
|
|
@@ -20,11 +20,13 @@ cycle between streamlit.delta_generator and some elements.
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
22
|
from contextvars import ContextVar, Token
|
|
23
|
-
from typing import TYPE_CHECKING,
|
|
23
|
+
from typing import TYPE_CHECKING, Generic, TypeVar
|
|
24
24
|
|
|
25
25
|
from streamlit.proto.RootContainer_pb2 import RootContainer as _RootContainer
|
|
26
26
|
|
|
27
27
|
if TYPE_CHECKING:
|
|
28
|
+
from collections.abc import Callable
|
|
29
|
+
|
|
28
30
|
from streamlit.delta_generator import DeltaGenerator
|
|
29
31
|
from streamlit.elements.lib.dialog import Dialog
|
|
30
32
|
from streamlit.elements.lib.mutable_status_container import StatusContainer
|
streamlit/deprecation_util.py
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import functools
|
|
18
|
-
from
|
|
18
|
+
from collections.abc import Callable
|
|
19
|
+
from typing import Any, Final, TypeVar, cast
|
|
19
20
|
|
|
20
21
|
import streamlit
|
|
21
22
|
from streamlit import config
|
|
@@ -28,8 +29,17 @@ TObj = TypeVar("TObj", bound=object)
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
def _error_details_in_browser_enabled() -> bool:
|
|
31
|
-
"""True if we should print deprecation warnings to the browser.
|
|
32
|
-
|
|
32
|
+
"""True if we should print deprecation warnings to the browser.
|
|
33
|
+
|
|
34
|
+
Deprecation warnings are only shown when showErrorDetails is set to "full"
|
|
35
|
+
or the legacy True value. All other values ("stacktrace", "type", "none",
|
|
36
|
+
False) hide deprecation warnings in the browser.
|
|
37
|
+
"""
|
|
38
|
+
show_error_details = config.get_option("client.showErrorDetails")
|
|
39
|
+
return (
|
|
40
|
+
show_error_details == config.ShowErrorDetailsConfigOptions.FULL
|
|
41
|
+
or config.ShowErrorDetailsConfigOptions.is_true_variation(show_error_details)
|
|
42
|
+
)
|
|
33
43
|
|
|
34
44
|
|
|
35
45
|
def show_deprecation_warning(message: str, show_in_browser: bool = True) -> None:
|
|
@@ -41,9 +51,10 @@ def show_deprecation_warning(message: str, show_in_browser: bool = True) -> None
|
|
|
41
51
|
The deprecation warning message.
|
|
42
52
|
show_in_browser : bool, default=True
|
|
43
53
|
Whether to show the deprecation warning in the browser. When this is True,
|
|
44
|
-
we will show the deprecation warning in the browser
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
we will show the deprecation warning in the browser only if the user has
|
|
55
|
+
set `client.showErrorDetails` to "full" or the legacy True value. All
|
|
56
|
+
other values ("stacktrace", "type", "none", False) will hide deprecation
|
|
57
|
+
warnings in the browser (but still log them to the console).
|
|
47
58
|
"""
|
|
48
59
|
if _error_details_in_browser_enabled() and show_in_browser:
|
|
49
60
|
streamlit.warning(message)
|
streamlit/elements/arrow.py
CHANGED
|
@@ -16,9 +16,16 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
import json
|
|
18
18
|
from dataclasses import dataclass
|
|
19
|
-
from typing import
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
from typing import (
|
|
20
|
+
TYPE_CHECKING,
|
|
21
|
+
Any,
|
|
22
|
+
Final,
|
|
23
|
+
Literal,
|
|
24
|
+
TypeAlias,
|
|
25
|
+
TypedDict,
|
|
26
|
+
cast,
|
|
27
|
+
overload,
|
|
28
|
+
)
|
|
22
29
|
|
|
23
30
|
from streamlit import dataframe_util
|
|
24
31
|
from streamlit.deprecation_util import (
|
|
@@ -35,6 +42,7 @@ from streamlit.elements.lib.column_config_utils import (
|
|
|
35
42
|
)
|
|
36
43
|
from streamlit.elements.lib.form_utils import current_form_id
|
|
37
44
|
from streamlit.elements.lib.layout_utils import (
|
|
45
|
+
HeightWithoutContent,
|
|
38
46
|
LayoutConfig,
|
|
39
47
|
Width,
|
|
40
48
|
validate_height,
|
|
@@ -279,7 +287,7 @@ class ArrowMixin:
|
|
|
279
287
|
self,
|
|
280
288
|
data: Data = None,
|
|
281
289
|
width: Width = "stretch",
|
|
282
|
-
height:
|
|
290
|
+
height: HeightWithoutContent | Literal["auto"] = "auto",
|
|
283
291
|
*,
|
|
284
292
|
use_container_width: bool | None = None,
|
|
285
293
|
hide_index: bool | None = None,
|
|
@@ -296,7 +304,7 @@ class ArrowMixin:
|
|
|
296
304
|
self,
|
|
297
305
|
data: Data = None,
|
|
298
306
|
width: Width = "stretch",
|
|
299
|
-
height:
|
|
307
|
+
height: HeightWithoutContent | Literal["auto"] = "auto",
|
|
300
308
|
*,
|
|
301
309
|
use_container_width: bool | None = None,
|
|
302
310
|
hide_index: bool | None = None,
|
|
@@ -313,7 +321,7 @@ class ArrowMixin:
|
|
|
313
321
|
self,
|
|
314
322
|
data: Data = None,
|
|
315
323
|
width: Width = "stretch",
|
|
316
|
-
height:
|
|
324
|
+
height: HeightWithoutContent | Literal["auto"] = "auto",
|
|
317
325
|
*,
|
|
318
326
|
use_container_width: bool | None = None,
|
|
319
327
|
hide_index: bool | None = None,
|
|
@@ -381,11 +389,18 @@ class ArrowMixin:
|
|
|
381
389
|
the parent container, the width of the element matches the width
|
|
382
390
|
of the parent container.
|
|
383
391
|
|
|
384
|
-
height :
|
|
392
|
+
height : "auto", "stretch", or int
|
|
385
393
|
The height of the dataframe element. This can be one of the following:
|
|
386
394
|
|
|
387
395
|
- ``"auto"`` (default): Streamlit sets the height to show at most
|
|
388
396
|
ten rows.
|
|
397
|
+
- ``"stretch"``: The height of the element expands to fill the
|
|
398
|
+
available vertical space in its parent container. When multiple
|
|
399
|
+
elements with stretch height are in the same container, they
|
|
400
|
+
share the available vertical space evenly. The dataframe will
|
|
401
|
+
maintain a minimum height to display up to three rows, but
|
|
402
|
+
otherwise won't exceed the available height in its parent
|
|
403
|
+
container.
|
|
389
404
|
- An integer specifying the height in pixels: The element has a
|
|
390
405
|
fixed height.
|
|
391
406
|
|
|
@@ -407,7 +422,7 @@ class ArrowMixin:
|
|
|
407
422
|
hide_index : bool or None
|
|
408
423
|
Whether to hide the index column(s). If ``hide_index`` is ``None``
|
|
409
424
|
(default), the visibility of index columns is automatically
|
|
410
|
-
determined based on the data.
|
|
425
|
+
determined based on the data and other configurations.
|
|
411
426
|
|
|
412
427
|
column_order : Iterable[str] or None
|
|
413
428
|
The ordered list of columns to display. If this is ``None``
|
|
@@ -662,7 +677,6 @@ class ArrowMixin:
|
|
|
662
677
|
validate_height(
|
|
663
678
|
height,
|
|
664
679
|
allow_content=False,
|
|
665
|
-
allow_stretch=False,
|
|
666
680
|
additional_allowed=["auto"],
|
|
667
681
|
)
|
|
668
682
|
|
|
@@ -679,6 +693,7 @@ class ArrowMixin:
|
|
|
679
693
|
|
|
680
694
|
proto.editing_mode = ArrowProto.EditingMode.READ_ONLY
|
|
681
695
|
|
|
696
|
+
has_range_index: bool = False
|
|
682
697
|
if isinstance(data, pa.Table):
|
|
683
698
|
# For pyarrow tables, we can just serialize the table directly
|
|
684
699
|
proto.data = dataframe_util.convert_arrow_table_to_arrow_bytes(data)
|
|
@@ -701,6 +716,7 @@ class ArrowMixin:
|
|
|
701
716
|
data_df = dataframe_util.convert_anything_to_pandas_df(
|
|
702
717
|
data, ensure_copy=False
|
|
703
718
|
)
|
|
719
|
+
has_range_index = dataframe_util.has_range_index(data_df)
|
|
704
720
|
apply_data_specific_configs(column_config_mapping, data_format)
|
|
705
721
|
# Serialize the data to bytes:
|
|
706
722
|
proto.data = dataframe_util.convert_pandas_df_to_arrow_bytes(data_df)
|
|
@@ -709,6 +725,18 @@ class ArrowMixin:
|
|
|
709
725
|
update_column_config(
|
|
710
726
|
column_config_mapping, INDEX_IDENTIFIER, {"hidden": hide_index}
|
|
711
727
|
)
|
|
728
|
+
|
|
729
|
+
elif (
|
|
730
|
+
# Hide index column if row selections are activated and the dataframe has a range index.
|
|
731
|
+
# The range index usually does not add a lot of value.
|
|
732
|
+
is_selection_activated
|
|
733
|
+
and selection_mode in ["multi-row", "single-row"]
|
|
734
|
+
and has_range_index
|
|
735
|
+
):
|
|
736
|
+
update_column_config(
|
|
737
|
+
column_config_mapping, INDEX_IDENTIFIER, {"hidden": True}
|
|
738
|
+
)
|
|
739
|
+
|
|
712
740
|
marshall_column_config(proto, column_config_mapping)
|
|
713
741
|
|
|
714
742
|
# Create layout configuration
|
|
@@ -21,15 +21,25 @@ from typing import (
|
|
|
21
21
|
Any,
|
|
22
22
|
Final,
|
|
23
23
|
Literal,
|
|
24
|
+
TypeAlias,
|
|
24
25
|
TypedDict,
|
|
25
26
|
cast,
|
|
26
27
|
overload,
|
|
27
28
|
)
|
|
28
29
|
|
|
29
|
-
from typing_extensions import TypeAlias
|
|
30
|
-
|
|
31
30
|
from streamlit import config
|
|
31
|
+
from streamlit.deprecation_util import (
|
|
32
|
+
make_deprecated_name_warning,
|
|
33
|
+
show_deprecation_warning,
|
|
34
|
+
)
|
|
32
35
|
from streamlit.elements.lib.form_utils import current_form_id
|
|
36
|
+
from streamlit.elements.lib.layout_utils import (
|
|
37
|
+
HeightWithoutContent,
|
|
38
|
+
LayoutConfig,
|
|
39
|
+
WidthWithoutContent,
|
|
40
|
+
validate_height,
|
|
41
|
+
validate_width,
|
|
42
|
+
)
|
|
33
43
|
from streamlit.elements.lib.policies import check_widget_policies
|
|
34
44
|
from streamlit.elements.lib.utils import Key, compute_and_register_element_id, to_key
|
|
35
45
|
from streamlit.errors import StreamlitAPIException
|
|
@@ -263,9 +273,9 @@ class PydeckMixin:
|
|
|
263
273
|
self,
|
|
264
274
|
pydeck_obj: Deck | None = None,
|
|
265
275
|
*,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
height:
|
|
276
|
+
width: WidthWithoutContent = "stretch",
|
|
277
|
+
use_container_width: bool | None = None,
|
|
278
|
+
height: HeightWithoutContent = 500,
|
|
269
279
|
selection_mode: Literal[
|
|
270
280
|
"single-object"
|
|
271
281
|
], # Selection mode will only be activated by on_select param; default value here to make it work with mypy
|
|
@@ -279,9 +289,9 @@ class PydeckMixin:
|
|
|
279
289
|
self,
|
|
280
290
|
pydeck_obj: Deck | None = None,
|
|
281
291
|
*,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
height:
|
|
292
|
+
width: WidthWithoutContent = "stretch",
|
|
293
|
+
use_container_width: bool | None = None,
|
|
294
|
+
height: HeightWithoutContent = 500,
|
|
285
295
|
selection_mode: SelectionMode = "single-object",
|
|
286
296
|
on_select: Literal["rerun"] | WidgetCallback = "rerun",
|
|
287
297
|
key: Key | None = None,
|
|
@@ -292,9 +302,9 @@ class PydeckMixin:
|
|
|
292
302
|
self,
|
|
293
303
|
pydeck_obj: Deck | None = None,
|
|
294
304
|
*,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
height:
|
|
305
|
+
width: WidthWithoutContent = "stretch",
|
|
306
|
+
use_container_width: bool | None = None,
|
|
307
|
+
height: HeightWithoutContent = 500,
|
|
298
308
|
selection_mode: SelectionMode = "single-object",
|
|
299
309
|
on_select: Literal["rerun", "ignore"] | WidgetCallback = "ignore",
|
|
300
310
|
key: Key | None = None,
|
|
@@ -342,26 +352,43 @@ class PydeckMixin:
|
|
|
342
352
|
----------
|
|
343
353
|
pydeck_obj : pydeck.Deck or None
|
|
344
354
|
Object specifying the PyDeck chart to draw.
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
parent container
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
355
|
+
width : "stretch" or int
|
|
356
|
+
The width of the chart element. This can be one of the following:
|
|
357
|
+
|
|
358
|
+
- ``"stretch"`` (default): The width of the element matches the
|
|
359
|
+
width of the parent container.
|
|
360
|
+
- An integer specifying the width in pixels: The element has a
|
|
361
|
+
fixed width. If the specified width is greater than the width of
|
|
362
|
+
the parent container, the width of the element matches the width
|
|
363
|
+
of the parent container.
|
|
364
|
+
|
|
365
|
+
use_container_width : bool or None
|
|
366
|
+
Whether to override the chart's native width with the width of
|
|
367
|
+
the parent container. This can be one of the following:
|
|
368
|
+
|
|
369
|
+
- ``None`` (default): Streamlit will use the chart's default behavior.
|
|
370
|
+
- ``True``: Streamlit sets the width of the chart to match the
|
|
371
|
+
width of the parent container.
|
|
372
|
+
- ``False``: Streamlit sets the width of the chart to fit its
|
|
373
|
+
contents according to the plotting library, up to the width of
|
|
374
|
+
the parent container.
|
|
375
|
+
|
|
376
|
+
.. deprecated::
|
|
377
|
+
``use_container_width`` is deprecated and will be removed in a
|
|
378
|
+
future release. For ``use_container_width=True``, use
|
|
379
|
+
``width="stretch"``.
|
|
380
|
+
|
|
381
|
+
height : "stretch" or int
|
|
382
|
+
The height of the chart element. This can be one of the following:
|
|
383
|
+
|
|
384
|
+
- An integer specifying the height in pixels: The element has a
|
|
385
|
+
fixed height. If the content is larger than the specified
|
|
386
|
+
height, scrolling is enabled. This is ``500`` by default.
|
|
387
|
+
- ``"stretch"``: The height of the element matches the height of
|
|
388
|
+
its content or the height of the parent container, whichever is
|
|
389
|
+
larger. If the element is not in a parent container, the height
|
|
390
|
+
of the element matches the height of its content.
|
|
391
|
+
|
|
365
392
|
on_select : "ignore" or "rerun" or callable
|
|
366
393
|
How the figure should respond to user selection events. This controls
|
|
367
394
|
whether or not the chart behaves like an input widget.
|
|
@@ -460,6 +487,25 @@ class PydeckMixin:
|
|
|
460
487
|
you can set ``map_style=None`` in the ``pydeck.Deck`` object.
|
|
461
488
|
|
|
462
489
|
"""
|
|
490
|
+
if use_container_width is not None:
|
|
491
|
+
show_deprecation_warning(
|
|
492
|
+
make_deprecated_name_warning(
|
|
493
|
+
"use_container_width",
|
|
494
|
+
"width",
|
|
495
|
+
"2025-12-31",
|
|
496
|
+
"For `use_container_width=True`, use `width='stretch'`. "
|
|
497
|
+
"For `use_container_width=False`, specify an integer width.",
|
|
498
|
+
include_st_prefix=False,
|
|
499
|
+
),
|
|
500
|
+
show_in_browser=False,
|
|
501
|
+
)
|
|
502
|
+
if use_container_width:
|
|
503
|
+
width = "stretch"
|
|
504
|
+
# Otherwise keep the provided width.
|
|
505
|
+
|
|
506
|
+
validate_width(width, allow_content=False)
|
|
507
|
+
validate_height(height, allow_content=False)
|
|
508
|
+
|
|
463
509
|
pydeck_proto = PydeckProto()
|
|
464
510
|
|
|
465
511
|
ctx = get_script_run_ctx()
|
|
@@ -467,12 +513,6 @@ class PydeckMixin:
|
|
|
467
513
|
spec = json.dumps(EMPTY_MAP) if pydeck_obj is None else pydeck_obj.to_json()
|
|
468
514
|
|
|
469
515
|
pydeck_proto.json = spec
|
|
470
|
-
pydeck_proto.use_container_width = use_container_width
|
|
471
|
-
|
|
472
|
-
if width:
|
|
473
|
-
pydeck_proto.width = width
|
|
474
|
-
if height:
|
|
475
|
-
pydeck_proto.height = height
|
|
476
516
|
|
|
477
517
|
tooltip = _get_pydeck_tooltip(pydeck_obj)
|
|
478
518
|
if tooltip:
|
|
@@ -535,11 +575,17 @@ class PydeckMixin:
|
|
|
535
575
|
value_type="string_value",
|
|
536
576
|
)
|
|
537
577
|
|
|
538
|
-
|
|
578
|
+
layout_config = LayoutConfig(width=width, height=height)
|
|
579
|
+
self.dg._enqueue(
|
|
580
|
+
"deck_gl_json_chart", pydeck_proto, layout_config=layout_config
|
|
581
|
+
)
|
|
539
582
|
|
|
540
583
|
return widget_state.value
|
|
541
584
|
|
|
542
|
-
|
|
585
|
+
layout_config = LayoutConfig(width=width, height=height)
|
|
586
|
+
return self.dg._enqueue(
|
|
587
|
+
"deck_gl_json_chart", pydeck_proto, layout_config=layout_config
|
|
588
|
+
)
|
|
543
589
|
|
|
544
590
|
@property
|
|
545
591
|
def dg(self) -> DeltaGenerator:
|
|
@@ -547,6 +593,18 @@ class PydeckMixin:
|
|
|
547
593
|
return cast("DeltaGenerator", self)
|
|
548
594
|
|
|
549
595
|
|
|
596
|
+
def _get_pydeck_width(pydeck_obj: Deck | None) -> int | None:
|
|
597
|
+
"""Extract the width from a pydeck Deck object, if specified."""
|
|
598
|
+
if pydeck_obj is None:
|
|
599
|
+
return None
|
|
600
|
+
|
|
601
|
+
width = getattr(pydeck_obj, "width", None)
|
|
602
|
+
if width is not None and isinstance(width, (int, float)):
|
|
603
|
+
return int(width)
|
|
604
|
+
|
|
605
|
+
return None
|
|
606
|
+
|
|
607
|
+
|
|
550
608
|
def _get_pydeck_tooltip(pydeck_obj: Deck | None) -> dict[str, str] | None:
|
|
551
609
|
if pydeck_obj is None:
|
|
552
610
|
return None
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
+
from collections.abc import Callable
|
|
17
18
|
from functools import wraps
|
|
18
|
-
from typing import TYPE_CHECKING, Any,
|
|
19
|
+
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast, overload
|
|
19
20
|
|
|
20
21
|
from streamlit.delta_generator_singletons import (
|
|
21
22
|
get_dg_singleton_instance,
|
streamlit/elements/exception.py
CHANGED
|
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
import os
|
|
18
18
|
import traceback
|
|
19
|
-
from typing import TYPE_CHECKING,
|
|
19
|
+
from typing import TYPE_CHECKING, Final, TypeVar, cast
|
|
20
20
|
|
|
21
21
|
from streamlit import config
|
|
22
22
|
from streamlit.elements.lib.layout_utils import validate_width
|
|
@@ -31,6 +31,8 @@ from streamlit.runtime.metrics_util import gather_metrics
|
|
|
31
31
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
|
32
32
|
|
|
33
33
|
if TYPE_CHECKING:
|
|
34
|
+
from collections.abc import Callable
|
|
35
|
+
|
|
34
36
|
from streamlit.delta_generator import DeltaGenerator
|
|
35
37
|
from streamlit.elements.lib.layout_utils import WidthWithoutContent
|
|
36
38
|
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
|
-
from typing import TYPE_CHECKING, Union, cast
|
|
20
|
-
|
|
21
|
-
from typing_extensions import TypeAlias
|
|
19
|
+
from typing import TYPE_CHECKING, TypeAlias, Union, cast
|
|
22
20
|
|
|
23
21
|
from streamlit import type_util
|
|
24
22
|
from streamlit.deprecation_util import (
|
streamlit/elements/heading.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
from enum import Enum
|
|
18
|
-
from typing import TYPE_CHECKING, Literal,
|
|
19
|
-
|
|
20
|
-
from typing_extensions import TypeAlias
|
|
18
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, cast
|
|
21
19
|
|
|
22
20
|
from streamlit.elements.lib.layout_utils import LayoutConfig, validate_width
|
|
23
21
|
from streamlit.errors import StreamlitAPIException
|
|
@@ -37,8 +35,8 @@ class HeadingProtoTag(Enum):
|
|
|
37
35
|
SUBHEADER_TAG = "h3"
|
|
38
36
|
|
|
39
37
|
|
|
40
|
-
Anchor: TypeAlias =
|
|
41
|
-
Divider: TypeAlias =
|
|
38
|
+
Anchor: TypeAlias = str | Literal[False] | None
|
|
39
|
+
Divider: TypeAlias = bool | str | None
|
|
42
40
|
|
|
43
41
|
|
|
44
42
|
class HeadingMixin:
|
streamlit/elements/image.py
CHANGED
|
@@ -21,9 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
|
-
from typing import TYPE_CHECKING, Literal,
|
|
25
|
-
|
|
26
|
-
from typing_extensions import TypeAlias
|
|
24
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, cast
|
|
27
25
|
|
|
28
26
|
from streamlit.deprecation_util import (
|
|
29
27
|
make_deprecated_name_warning,
|
|
@@ -43,7 +41,7 @@ from streamlit.runtime.metrics_util import gather_metrics
|
|
|
43
41
|
if TYPE_CHECKING:
|
|
44
42
|
from streamlit.delta_generator import DeltaGenerator
|
|
45
43
|
|
|
46
|
-
UseColumnWith: TypeAlias =
|
|
44
|
+
UseColumnWith: TypeAlias = Literal["auto", "always", "never"] | bool | None
|
|
47
45
|
|
|
48
46
|
|
|
49
47
|
class ImageMixin:
|
streamlit/elements/layouts.py
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
from collections.abc import Sequence
|
|
18
|
-
from typing import TYPE_CHECKING, Literal,
|
|
19
|
-
|
|
20
|
-
from typing_extensions import TypeAlias
|
|
18
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, cast
|
|
21
19
|
|
|
22
20
|
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
|
23
21
|
from streamlit.elements.lib.layout_utils import (
|
|
@@ -54,7 +52,7 @@ if TYPE_CHECKING:
|
|
|
54
52
|
from streamlit.elements.lib.mutable_status_container import StatusContainer
|
|
55
53
|
from streamlit.runtime.state import WidgetCallback
|
|
56
54
|
|
|
57
|
-
SpecType: TypeAlias =
|
|
55
|
+
SpecType: TypeAlias = int | Sequence[int | float]
|
|
58
56
|
|
|
59
57
|
|
|
60
58
|
class LayoutsMixin:
|
|
@@ -385,13 +383,15 @@ class LayoutsMixin:
|
|
|
385
383
|
``False`` (default), no border is shown. If this is ``True``, a
|
|
386
384
|
border is shown around each column.
|
|
387
385
|
|
|
388
|
-
width :
|
|
389
|
-
The
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
386
|
+
width : "stretch" or int
|
|
387
|
+
The width of the column group. This can be one of the following:
|
|
388
|
+
|
|
389
|
+
- ``"stretch"`` (default): The width of the column group matches the
|
|
390
|
+
width of the parent container.
|
|
391
|
+
- An integer specifying the width in pixels: The column group has a
|
|
392
|
+
fixed width. If the specified width is greater than the width of
|
|
393
|
+
the parent container, the width of the column group matches the
|
|
394
|
+
width of the parent container.
|
|
395
395
|
|
|
396
396
|
Returns
|
|
397
397
|
-------
|
|
@@ -862,6 +862,7 @@ class LayoutsMixin:
|
|
|
862
862
|
self,
|
|
863
863
|
label: str,
|
|
864
864
|
*,
|
|
865
|
+
type: Literal["primary", "secondary", "tertiary"] = "secondary",
|
|
865
866
|
help: str | None = None,
|
|
866
867
|
icon: str | None = None,
|
|
867
868
|
disabled: bool = False,
|
|
@@ -912,6 +913,17 @@ class LayoutsMixin:
|
|
|
912
913
|
including the Markdown directives described in the ``body``
|
|
913
914
|
parameter of ``st.markdown``.
|
|
914
915
|
|
|
916
|
+
type : "primary", "secondary", or "tertiary"
|
|
917
|
+
An optional string that specifies the button type. This can be one
|
|
918
|
+
of the following:
|
|
919
|
+
|
|
920
|
+
- ``"primary"``: The button's background is the app's primary color
|
|
921
|
+
for additional emphasis.
|
|
922
|
+
- ``"secondary"`` (default): The button's background coordinates
|
|
923
|
+
with the app's background color for normal emphasis.
|
|
924
|
+
- ``"tertiary"``: The button is plain text without a border or
|
|
925
|
+
background for subtlety.
|
|
926
|
+
|
|
915
927
|
icon : str
|
|
916
928
|
An optional emoji or icon to display next to the button label. If ``icon``
|
|
917
929
|
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
|
@@ -1009,9 +1021,17 @@ class LayoutsMixin:
|
|
|
1009
1021
|
if use_container_width is not None:
|
|
1010
1022
|
width = "stretch" if use_container_width else "content"
|
|
1011
1023
|
|
|
1024
|
+
# Checks whether the entered button type is one of the allowed options
|
|
1025
|
+
if type not in ["primary", "secondary", "tertiary"]:
|
|
1026
|
+
raise StreamlitAPIException(
|
|
1027
|
+
'The type argument to st.popover must be "primary", "secondary", or "tertiary". '
|
|
1028
|
+
f'\nThe argument passed was "{type}".'
|
|
1029
|
+
)
|
|
1030
|
+
|
|
1012
1031
|
popover_proto = BlockProto.Popover()
|
|
1013
1032
|
popover_proto.label = label
|
|
1014
1033
|
popover_proto.disabled = disabled
|
|
1034
|
+
popover_proto.type = type
|
|
1015
1035
|
if help:
|
|
1016
1036
|
popover_proto.help = str(help)
|
|
1017
1037
|
if icon is not None:
|