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
|
@@ -19,9 +19,7 @@ from __future__ import annotations
|
|
|
19
19
|
from dataclasses import dataclass
|
|
20
20
|
from datetime import date
|
|
21
21
|
from enum import Enum
|
|
22
|
-
from typing import TYPE_CHECKING, Any, Final, Literal, TypedDict, cast
|
|
23
|
-
|
|
24
|
-
from typing_extensions import TypeAlias
|
|
22
|
+
from typing import TYPE_CHECKING, Any, Final, Literal, TypeAlias, TypedDict, cast
|
|
25
23
|
|
|
26
24
|
from streamlit import dataframe_util, type_util
|
|
27
25
|
from streamlit.elements.lib.color_util import (
|
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
-
from collections.abc import Collection
|
|
18
|
-
from typing import Any,
|
|
19
|
-
|
|
20
|
-
from typing_extensions import TypeAlias
|
|
17
|
+
from collections.abc import Callable, Collection
|
|
18
|
+
from typing import Any, TypeAlias, cast
|
|
21
19
|
|
|
22
20
|
from streamlit.errors import StreamlitInvalidColorError
|
|
23
21
|
|
|
@@ -35,26 +33,18 @@ IntRGBAColorTuple: TypeAlias = tuple[int, int, int, int]
|
|
|
35
33
|
# CSS uses these.
|
|
36
34
|
MixedRGBAColorTuple: TypeAlias = tuple[int, int, int, float]
|
|
37
35
|
|
|
38
|
-
Color4Tuple: TypeAlias =
|
|
39
|
-
FloatRGBAColorTuple,
|
|
40
|
-
IntRGBAColorTuple,
|
|
41
|
-
MixedRGBAColorTuple,
|
|
42
|
-
]
|
|
36
|
+
Color4Tuple: TypeAlias = FloatRGBAColorTuple | IntRGBAColorTuple | MixedRGBAColorTuple
|
|
43
37
|
|
|
44
|
-
Color3Tuple: TypeAlias =
|
|
45
|
-
FloatRGBColorTuple,
|
|
46
|
-
IntRGBColorTuple,
|
|
47
|
-
]
|
|
38
|
+
Color3Tuple: TypeAlias = FloatRGBColorTuple | IntRGBColorTuple
|
|
48
39
|
|
|
49
|
-
ColorTuple: TypeAlias =
|
|
40
|
+
ColorTuple: TypeAlias = Color4Tuple | Color3Tuple
|
|
50
41
|
|
|
51
|
-
IntColorTuple =
|
|
52
|
-
CSSColorStr = Union[IntRGBAColorTuple, MixedRGBAColorTuple]
|
|
42
|
+
IntColorTuple: TypeAlias = IntRGBColorTuple | IntRGBAColorTuple
|
|
53
43
|
|
|
54
44
|
ColorStr: TypeAlias = str
|
|
55
45
|
|
|
56
|
-
Color: TypeAlias =
|
|
57
|
-
MaybeColor: TypeAlias =
|
|
46
|
+
Color: TypeAlias = ColorTuple | ColorStr
|
|
47
|
+
MaybeColor: TypeAlias = str | Collection[Any]
|
|
58
48
|
|
|
59
49
|
|
|
60
50
|
def to_int_color_tuple(color: MaybeColor) -> IntColorTuple:
|
|
@@ -18,9 +18,7 @@ import copy
|
|
|
18
18
|
import json
|
|
19
19
|
from collections.abc import Mapping
|
|
20
20
|
from enum import Enum
|
|
21
|
-
from typing import TYPE_CHECKING, Final, Literal,
|
|
22
|
-
|
|
23
|
-
from typing_extensions import TypeAlias
|
|
21
|
+
from typing import TYPE_CHECKING, Final, Literal, TypeAlias
|
|
24
22
|
|
|
25
23
|
from streamlit.dataframe_util import DataFormat
|
|
26
24
|
from streamlit.elements.lib.column_types import ColumnConfig, ColumnType
|
|
@@ -405,16 +403,14 @@ def determine_dataframe_schema(
|
|
|
405
403
|
|
|
406
404
|
|
|
407
405
|
# A mapping of column names/IDs to column configs.
|
|
408
|
-
ColumnConfigMapping: TypeAlias = dict[
|
|
409
|
-
Union[IndexIdentifierType, str, int], ColumnConfig
|
|
410
|
-
]
|
|
406
|
+
ColumnConfigMapping: TypeAlias = dict[IndexIdentifierType | str | int, ColumnConfig]
|
|
411
407
|
ColumnConfigMappingInput: TypeAlias = Mapping[
|
|
412
408
|
# TODO(lukasmasuch): This should also use int here to
|
|
413
409
|
# correctly type the support for positional index. However,
|
|
414
410
|
# allowing int here leads mypy to complain about simple dict[str, ...]
|
|
415
411
|
# as input -> which seems like a mypy bug.
|
|
416
|
-
|
|
417
|
-
|
|
412
|
+
IndexIdentifierType | str,
|
|
413
|
+
ColumnConfig | None | str,
|
|
418
414
|
]
|
|
419
415
|
|
|
420
416
|
|
|
@@ -19,9 +19,9 @@ from __future__ import annotations
|
|
|
19
19
|
|
|
20
20
|
import datetime
|
|
21
21
|
import itertools
|
|
22
|
-
from typing import TYPE_CHECKING,
|
|
22
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, TypedDict
|
|
23
23
|
|
|
24
|
-
from typing_extensions import NotRequired
|
|
24
|
+
from typing_extensions import NotRequired
|
|
25
25
|
|
|
26
26
|
from streamlit.elements.lib.color_util import is_css_color_like
|
|
27
27
|
from streamlit.errors import StreamlitValueError
|
|
@@ -29,7 +29,7 @@ from streamlit.runtime.metrics_util import gather_metrics
|
|
|
29
29
|
from streamlit.string_util import validate_material_icon
|
|
30
30
|
|
|
31
31
|
if TYPE_CHECKING:
|
|
32
|
-
from collections.abc import Iterable, Iterator
|
|
32
|
+
from collections.abc import Callable, Iterable, Iterator
|
|
33
33
|
|
|
34
34
|
NumberFormat: TypeAlias = Literal[
|
|
35
35
|
"plain",
|
|
@@ -45,7 +45,7 @@ NumberFormat: TypeAlias = Literal[
|
|
|
45
45
|
"bytes",
|
|
46
46
|
]
|
|
47
47
|
|
|
48
|
-
ColumnWidth: TypeAlias =
|
|
48
|
+
ColumnWidth: TypeAlias = Literal["small", "medium", "large"] | int
|
|
49
49
|
|
|
50
50
|
# Type alias that represents all available column types
|
|
51
51
|
# which are configurable by the user.
|
|
@@ -83,11 +83,7 @@ ThemeColor: TypeAlias = Literal[
|
|
|
83
83
|
]
|
|
84
84
|
|
|
85
85
|
# Color options for chart columns:
|
|
86
|
-
ChartColor: TypeAlias =
|
|
87
|
-
Literal["auto", "auto-inverse"],
|
|
88
|
-
ThemeColor,
|
|
89
|
-
str,
|
|
90
|
-
]
|
|
86
|
+
ChartColor: TypeAlias = Literal["auto", "auto-inverse"] | ThemeColor | str
|
|
91
87
|
|
|
92
88
|
|
|
93
89
|
def _validate_chart_color(maybe_color: str) -> None:
|
|
@@ -135,7 +131,7 @@ class CheckboxColumnConfig(TypedDict):
|
|
|
135
131
|
type: Literal["checkbox"]
|
|
136
132
|
|
|
137
133
|
|
|
138
|
-
SelectboxOptionValue: TypeAlias =
|
|
134
|
+
SelectboxOptionValue: TypeAlias = str | int | float | bool
|
|
139
135
|
|
|
140
136
|
|
|
141
137
|
class SelectboxOption(TypedDict):
|
|
@@ -187,7 +183,7 @@ class ListColumnConfig(TypedDict):
|
|
|
187
183
|
class MultiselectOption(TypedDict):
|
|
188
184
|
value: str
|
|
189
185
|
label: NotRequired[str | None]
|
|
190
|
-
color: NotRequired[str | ThemeColor | None]
|
|
186
|
+
color: NotRequired[str | Literal["auto"] | ThemeColor | None]
|
|
191
187
|
|
|
192
188
|
|
|
193
189
|
class MultiselectColumnConfig(TypedDict):
|
|
@@ -229,6 +225,7 @@ class ProgressColumnConfig(TypedDict):
|
|
|
229
225
|
min_value: NotRequired[int | float | None]
|
|
230
226
|
max_value: NotRequired[int | float | None]
|
|
231
227
|
step: NotRequired[int | float | None]
|
|
228
|
+
color: NotRequired[ChartColor | None]
|
|
232
229
|
|
|
233
230
|
|
|
234
231
|
class JsonColumnConfig(TypedDict):
|
|
@@ -1732,10 +1729,15 @@ def MultiselectColumn(
|
|
|
1732
1729
|
help: str | None = None,
|
|
1733
1730
|
disabled: bool | None = None,
|
|
1734
1731
|
required: bool | None = None,
|
|
1732
|
+
pinned: bool | None = None,
|
|
1735
1733
|
default: Iterable[str] | None = None,
|
|
1736
1734
|
options: Iterable[str] | None = None,
|
|
1737
1735
|
accept_new_options: bool | None = None,
|
|
1738
|
-
color: str
|
|
1736
|
+
color: str
|
|
1737
|
+
| Literal["auto"]
|
|
1738
|
+
| ThemeColor
|
|
1739
|
+
| Iterable[str | ThemeColor]
|
|
1740
|
+
| None = None,
|
|
1739
1741
|
format_func: Callable[[str], str] | None = None,
|
|
1740
1742
|
) -> ColumnConfig:
|
|
1741
1743
|
"""Configure a multiselect column in ``st.dataframe`` or ``st.data_editor``.
|
|
@@ -1788,6 +1790,12 @@ def MultiselectColumn(
|
|
|
1788
1790
|
Whether edited cells in the column need to have a value. If True, an edited cell
|
|
1789
1791
|
can only be submitted if it has a value other than None. Defaults to False.
|
|
1790
1792
|
|
|
1793
|
+
pinned : bool or None
|
|
1794
|
+
Whether the column is pinned. A pinned column will stay visible on the
|
|
1795
|
+
left side no matter where the user scrolls. If this is ``None``
|
|
1796
|
+
(default), Streamlit will decide: index columns are pinned, and data
|
|
1797
|
+
columns are not pinned.
|
|
1798
|
+
|
|
1791
1799
|
default : Iterable of str or None
|
|
1792
1800
|
Specifies the default value in this column when a new row is added by the user.
|
|
1793
1801
|
|
|
@@ -1808,6 +1816,7 @@ def MultiselectColumn(
|
|
|
1808
1816
|
The color to use for different options. This can be:
|
|
1809
1817
|
|
|
1810
1818
|
- None (default): The options are displayed without color.
|
|
1819
|
+
- ``"auto"``: The options are colored based on the configured categorical chart colors.
|
|
1811
1820
|
- A single color value that is used for all options. This can be one of
|
|
1812
1821
|
the following strings:
|
|
1813
1822
|
|
|
@@ -1943,6 +1952,7 @@ def MultiselectColumn(
|
|
|
1943
1952
|
help=help,
|
|
1944
1953
|
disabled=disabled,
|
|
1945
1954
|
required=required,
|
|
1955
|
+
pinned=pinned,
|
|
1946
1956
|
default=None if default is None else list(default),
|
|
1947
1957
|
type_config=MultiselectColumnConfig(
|
|
1948
1958
|
type="multiselect",
|
|
@@ -2446,6 +2456,7 @@ def ProgressColumn(
|
|
|
2446
2456
|
min_value: int | float | None = None,
|
|
2447
2457
|
max_value: int | float | None = None,
|
|
2448
2458
|
step: int | float | None = None,
|
|
2459
|
+
color: ChartColor | None = None,
|
|
2449
2460
|
) -> ColumnConfig:
|
|
2450
2461
|
"""Configure a progress column in ``st.dataframe`` or ``st.data_editor``.
|
|
2451
2462
|
|
|
@@ -2528,6 +2539,19 @@ def ProgressColumn(
|
|
|
2528
2539
|
Setting ``step`` for float columns will ensure a consistent number of
|
|
2529
2540
|
digits after the decimal are displayed.
|
|
2530
2541
|
|
|
2542
|
+
color : "auto", "auto-inverse", str, or None
|
|
2543
|
+
The color to use for the chart. This can be one of the following:
|
|
2544
|
+
|
|
2545
|
+
- ``None`` (default): The primary color is used.
|
|
2546
|
+
- ``"auto"``: If the value is more than half, the bar is green; if the
|
|
2547
|
+
value is less than half, the bar is red.
|
|
2548
|
+
- ``"auto-inverse"``: If the value is more than half, the bar is red;
|
|
2549
|
+
if the value is less than half, the bar is green.
|
|
2550
|
+
- A single color value that is applied to all charts in the column.
|
|
2551
|
+
In addition to the basic color palette (red, orange, yellow, green,
|
|
2552
|
+
blue, violet, gray/grey, and primary), this supports hex codes like
|
|
2553
|
+
``"#483d8b"``.
|
|
2554
|
+
|
|
2531
2555
|
Examples
|
|
2532
2556
|
--------
|
|
2533
2557
|
>>> import pandas as pd
|
|
@@ -2558,6 +2582,9 @@ def ProgressColumn(
|
|
|
2558
2582
|
height: 300px
|
|
2559
2583
|
""" # noqa: E501
|
|
2560
2584
|
|
|
2585
|
+
if color is not None:
|
|
2586
|
+
_validate_chart_color(color)
|
|
2587
|
+
|
|
2561
2588
|
return ColumnConfig(
|
|
2562
2589
|
label=label,
|
|
2563
2590
|
width=width,
|
|
@@ -2569,6 +2596,7 @@ def ProgressColumn(
|
|
|
2569
2596
|
min_value=min_value,
|
|
2570
2597
|
max_value=max_value,
|
|
2571
2598
|
step=step,
|
|
2599
|
+
color=color,
|
|
2572
2600
|
),
|
|
2573
2601
|
)
|
|
2574
2602
|
|
streamlit/elements/lib/dialog.py
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
-
from typing import TYPE_CHECKING, Literal, cast
|
|
17
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, cast
|
|
18
18
|
|
|
19
|
-
from typing_extensions import Self
|
|
19
|
+
from typing_extensions import Self
|
|
20
20
|
|
|
21
21
|
from streamlit.delta_generator import DeltaGenerator
|
|
22
22
|
from streamlit.elements.lib.utils import compute_and_register_element_id
|
|
@@ -20,9 +20,7 @@ import re
|
|
|
20
20
|
from collections.abc import Sequence
|
|
21
21
|
from enum import IntEnum
|
|
22
22
|
from pathlib import Path
|
|
23
|
-
from typing import TYPE_CHECKING, Final, Literal, Union, cast
|
|
24
|
-
|
|
25
|
-
from typing_extensions import TypeAlias
|
|
23
|
+
from typing import TYPE_CHECKING, Final, Literal, TypeAlias, Union, cast
|
|
26
24
|
|
|
27
25
|
from streamlit import runtime, url_util
|
|
28
26
|
from streamlit.errors import StreamlitAPIException
|
|
@@ -48,7 +46,7 @@ AtomicImage: TypeAlias = Union[
|
|
|
48
46
|
Channels: TypeAlias = Literal["RGB", "BGR"]
|
|
49
47
|
ImageFormat: TypeAlias = Literal["JPEG", "PNG", "GIF"]
|
|
50
48
|
ImageFormatOrAuto: TypeAlias = Literal[ImageFormat, "auto"]
|
|
51
|
-
ImageOrImageList: TypeAlias =
|
|
49
|
+
ImageOrImageList: TypeAlias = AtomicImage | Sequence[AtomicImage]
|
|
52
50
|
|
|
53
51
|
# This constant is related to the frontend maximum content width specified
|
|
54
52
|
# in App.jsx main container
|
|
@@ -434,7 +432,7 @@ def marshall_images(
|
|
|
434
432
|
|
|
435
433
|
# Each image in an image list needs to be kept track of at its own coordinates.
|
|
436
434
|
for coord_suffix, (single_image, single_caption) in enumerate(
|
|
437
|
-
zip(images, captions)
|
|
435
|
+
zip(images, captions, strict=False)
|
|
438
436
|
):
|
|
439
437
|
proto_img = proto_imgs.imgs.add()
|
|
440
438
|
if single_caption is not None:
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
16
|
from dataclasses import dataclass
|
|
17
|
-
from typing import Literal,
|
|
18
|
-
|
|
19
|
-
from typing_extensions import TypeAlias
|
|
17
|
+
from typing import Literal, TypeAlias, cast
|
|
20
18
|
|
|
21
19
|
from streamlit.errors import (
|
|
22
20
|
StreamlitInvalidColumnGapError,
|
|
23
21
|
StreamlitInvalidHeightError,
|
|
24
22
|
StreamlitInvalidHorizontalAlignmentError,
|
|
23
|
+
StreamlitInvalidSizeError,
|
|
25
24
|
StreamlitInvalidVerticalAlignmentError,
|
|
26
25
|
StreamlitInvalidWidthError,
|
|
27
26
|
)
|
|
@@ -30,19 +29,29 @@ from streamlit.proto.GapSize_pb2 import GapSize
|
|
|
30
29
|
from streamlit.proto.HeightConfig_pb2 import HeightConfig
|
|
31
30
|
from streamlit.proto.WidthConfig_pb2 import WidthConfig
|
|
32
31
|
|
|
33
|
-
WidthWithoutContent: TypeAlias =
|
|
34
|
-
Width: TypeAlias =
|
|
35
|
-
HeightWithoutContent: TypeAlias =
|
|
36
|
-
Height: TypeAlias =
|
|
32
|
+
WidthWithoutContent: TypeAlias = int | Literal["stretch"]
|
|
33
|
+
Width: TypeAlias = int | Literal["stretch", "content"]
|
|
34
|
+
HeightWithoutContent: TypeAlias = int | Literal["stretch"]
|
|
35
|
+
Height: TypeAlias = int | Literal["stretch", "content"]
|
|
36
|
+
SpaceSize: TypeAlias = int | Literal["stretch", "small", "medium", "large"]
|
|
37
37
|
Gap: TypeAlias = Literal["small", "medium", "large"]
|
|
38
38
|
HorizontalAlignment: TypeAlias = Literal["left", "center", "right", "distribute"]
|
|
39
39
|
VerticalAlignment: TypeAlias = Literal["top", "center", "bottom", "distribute"]
|
|
40
40
|
|
|
41
|
+
# Mapping of size literals to rem values for st.space
|
|
42
|
+
# If changing these, also check streamlit/frontend/lib/src/theme/primitives/sizes.ts
|
|
43
|
+
# to ensure sizes are kept in sync.
|
|
44
|
+
SIZE_TO_REM_MAPPING = {
|
|
45
|
+
"small": 0.75, # Height of widget label minus gap
|
|
46
|
+
"medium": 2.5, # Height of button/input field
|
|
47
|
+
"large": 4.25, # Height of large widget without label
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
|
|
42
51
|
@dataclass
|
|
43
52
|
class LayoutConfig:
|
|
44
|
-
width: Width | None = None
|
|
45
|
-
height: Height | None = None
|
|
53
|
+
width: Width | SpaceSize | None = None
|
|
54
|
+
height: Height | SpaceSize | None = None
|
|
46
55
|
|
|
47
56
|
|
|
48
57
|
def validate_width(width: Width, allow_content: bool = False) -> None:
|
|
@@ -117,9 +126,35 @@ def validate_height(
|
|
|
117
126
|
raise StreamlitInvalidHeightError(height, allow_content)
|
|
118
127
|
|
|
119
128
|
|
|
120
|
-
def
|
|
129
|
+
def validate_space_size(size: SpaceSize) -> None:
|
|
130
|
+
"""Validate the size parameter for st.space.
|
|
131
|
+
|
|
132
|
+
Parameters
|
|
133
|
+
----------
|
|
134
|
+
size : Any
|
|
135
|
+
The size value to validate.
|
|
136
|
+
|
|
137
|
+
Raises
|
|
138
|
+
------
|
|
139
|
+
StreamlitInvalidSizeError
|
|
140
|
+
If the size value is invalid.
|
|
141
|
+
"""
|
|
142
|
+
if not isinstance(size, (int, str)):
|
|
143
|
+
raise StreamlitInvalidSizeError(size)
|
|
144
|
+
|
|
145
|
+
if isinstance(size, str):
|
|
146
|
+
valid_strings = ["stretch", "small", "medium", "large"]
|
|
147
|
+
if size not in valid_strings:
|
|
148
|
+
raise StreamlitInvalidSizeError(size)
|
|
149
|
+
elif isinstance(size, int) and size <= 0:
|
|
150
|
+
raise StreamlitInvalidSizeError(size)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def get_width_config(width: Width | SpaceSize) -> WidthConfig:
|
|
121
154
|
width_config = WidthConfig()
|
|
122
|
-
if isinstance(width,
|
|
155
|
+
if isinstance(width, str) and width in SIZE_TO_REM_MAPPING:
|
|
156
|
+
width_config.rem_width = SIZE_TO_REM_MAPPING[width]
|
|
157
|
+
elif isinstance(width, (int, float)):
|
|
123
158
|
width_config.pixel_width = int(width)
|
|
124
159
|
elif width == "content":
|
|
125
160
|
width_config.use_content = True
|
|
@@ -128,9 +163,11 @@ def get_width_config(width: Width) -> WidthConfig:
|
|
|
128
163
|
return width_config
|
|
129
164
|
|
|
130
165
|
|
|
131
|
-
def get_height_config(height: Height) -> HeightConfig:
|
|
166
|
+
def get_height_config(height: Height | SpaceSize) -> HeightConfig:
|
|
132
167
|
height_config = HeightConfig()
|
|
133
|
-
if isinstance(height,
|
|
168
|
+
if isinstance(height, str) and height in SIZE_TO_REM_MAPPING:
|
|
169
|
+
height_config.rem_height = SIZE_TO_REM_MAPPING[height]
|
|
170
|
+
elif isinstance(height, (int, float)):
|
|
134
171
|
height_config.pixel_height = int(height)
|
|
135
172
|
elif height == "content":
|
|
136
173
|
height_config.use_content = True
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import time
|
|
18
|
-
from typing import TYPE_CHECKING, Literal, cast
|
|
18
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, cast
|
|
19
19
|
|
|
20
|
-
from typing_extensions import Self
|
|
20
|
+
from typing_extensions import Self
|
|
21
21
|
|
|
22
22
|
from streamlit.delta_generator import DeltaGenerator
|
|
23
23
|
from streamlit.elements.lib.layout_utils import (
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
from enum import Enum, EnumMeta
|
|
18
|
-
from typing import TYPE_CHECKING, Any,
|
|
18
|
+
from typing import TYPE_CHECKING, Any, Final, TypeVar, overload
|
|
19
19
|
|
|
20
20
|
from streamlit import config, logger
|
|
21
21
|
from streamlit.dataframe_util import OptionSequence, convert_anything_to_list
|
|
@@ -26,7 +26,7 @@ from streamlit.type_util import (
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
if TYPE_CHECKING:
|
|
29
|
-
from collections.abc import Iterable, Sequence
|
|
29
|
+
from collections.abc import Callable, Iterable, Sequence
|
|
30
30
|
|
|
31
31
|
_LOGGER: Final = logger.get_logger(__name__)
|
|
32
32
|
|
streamlit/elements/lib/utils.py
CHANGED
|
@@ -20,12 +20,12 @@ from typing import (
|
|
|
20
20
|
TYPE_CHECKING,
|
|
21
21
|
Any,
|
|
22
22
|
Literal,
|
|
23
|
+
TypeAlias,
|
|
23
24
|
Union,
|
|
24
25
|
overload,
|
|
25
26
|
)
|
|
26
27
|
|
|
27
28
|
from google.protobuf.message import Message
|
|
28
|
-
from typing_extensions import TypeAlias
|
|
29
29
|
|
|
30
30
|
from streamlit import config
|
|
31
31
|
from streamlit.elements.lib.form_utils import current_form_id
|
|
@@ -49,12 +49,12 @@ if TYPE_CHECKING:
|
|
|
49
49
|
from streamlit.delta_generator import DeltaGenerator
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
Key: TypeAlias =
|
|
52
|
+
Key: TypeAlias = str | int
|
|
53
53
|
|
|
54
54
|
LabelVisibility: TypeAlias = Literal["visible", "hidden", "collapsed"]
|
|
55
55
|
|
|
56
|
-
PROTO_SCALAR_VALUE =
|
|
57
|
-
SAFE_VALUES = Union[
|
|
56
|
+
PROTO_SCALAR_VALUE: TypeAlias = float | int | bool | str | bytes
|
|
57
|
+
SAFE_VALUES: TypeAlias = Union[
|
|
58
58
|
date,
|
|
59
59
|
time,
|
|
60
60
|
datetime,
|
streamlit/elements/map.py
CHANGED
|
@@ -21,6 +21,10 @@ import json
|
|
|
21
21
|
from typing import TYPE_CHECKING, Any, Final, cast
|
|
22
22
|
|
|
23
23
|
from streamlit import config, dataframe_util
|
|
24
|
+
from streamlit.deprecation_util import (
|
|
25
|
+
make_deprecated_name_warning,
|
|
26
|
+
show_deprecation_warning,
|
|
27
|
+
)
|
|
24
28
|
from streamlit.elements import deck_gl_json_chart
|
|
25
29
|
from streamlit.elements.lib.color_util import (
|
|
26
30
|
Color,
|
|
@@ -28,6 +32,13 @@ from streamlit.elements.lib.color_util import (
|
|
|
28
32
|
is_color_like,
|
|
29
33
|
to_int_color_tuple,
|
|
30
34
|
)
|
|
35
|
+
from streamlit.elements.lib.layout_utils import (
|
|
36
|
+
HeightWithoutContent,
|
|
37
|
+
LayoutConfig,
|
|
38
|
+
WidthWithoutContent,
|
|
39
|
+
validate_height,
|
|
40
|
+
validate_width,
|
|
41
|
+
)
|
|
31
42
|
from streamlit.errors import StreamlitAPIException
|
|
32
43
|
from streamlit.proto.DeckGlJsonChart_pb2 import DeckGlJsonChart as DeckGlJsonChartProto
|
|
33
44
|
from streamlit.runtime.metrics_util import gather_metrics
|
|
@@ -85,9 +96,9 @@ class MapMixin:
|
|
|
85
96
|
color: None | str | Color = None,
|
|
86
97
|
size: None | str | float = None,
|
|
87
98
|
zoom: int | None = None,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
width: WidthWithoutContent = "stretch",
|
|
100
|
+
height: HeightWithoutContent = 500,
|
|
101
|
+
use_container_width: bool | None = None,
|
|
91
102
|
) -> DeltaGenerator:
|
|
92
103
|
"""Display a map with a scatterplot overlaid onto it.
|
|
93
104
|
|
|
@@ -163,28 +174,42 @@ class MapMixin:
|
|
|
163
174
|
Zoom level as specified in
|
|
164
175
|
https://wiki.openstreetmap.org/wiki/Zoom_levels.
|
|
165
176
|
|
|
166
|
-
|
|
177
|
+
width : "stretch" or int
|
|
178
|
+
The width of the chart element. This can be one of the following:
|
|
179
|
+
|
|
180
|
+
- ``"stretch"`` (default): The width of the element matches the
|
|
181
|
+
width of the parent container.
|
|
182
|
+
- An integer specifying the width in pixels: The element has a
|
|
183
|
+
fixed width. If the specified width is greater than the width of
|
|
184
|
+
the parent container, the width of the element matches the width
|
|
185
|
+
of the parent container.
|
|
186
|
+
|
|
187
|
+
height : "stretch" or int
|
|
188
|
+
The height of the chart element. This can be one of the following:
|
|
189
|
+
|
|
190
|
+
- An integer specifying the height in pixels: The element has a
|
|
191
|
+
fixed height. If the content is larger than the specified
|
|
192
|
+
height, scrolling is enabled. This is ``500`` by default.
|
|
193
|
+
- ``"stretch"``: The height of the element matches the height of
|
|
194
|
+
its content or the height of the parent container, whichever is
|
|
195
|
+
larger. If the element is not in a parent container, the height
|
|
196
|
+
of the element matches the height of its content.
|
|
197
|
+
|
|
198
|
+
use_container_width : bool or None
|
|
167
199
|
Whether to override the map's native width with the width of
|
|
168
|
-
the parent container.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
Streamlit sets the width of the
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
To use ``width``, you must set ``use_container_width=False``.
|
|
183
|
-
|
|
184
|
-
height : int or None
|
|
185
|
-
Desired height of the chart expressed in pixels. If ``height`` is
|
|
186
|
-
``None`` (default), Streamlit sets the height of the chart to fit
|
|
187
|
-
its contents according to the plotting library.
|
|
200
|
+
the parent container. This can be one of the following:
|
|
201
|
+
|
|
202
|
+
- ``None`` (default): Streamlit will use the map's default behavior.
|
|
203
|
+
- ``True``: Streamlit sets the width of the map to match the
|
|
204
|
+
width of the parent container.
|
|
205
|
+
- ``False``: Streamlit sets the width of the map to fit its
|
|
206
|
+
contents according to the plotting library, up to the width of
|
|
207
|
+
the parent container.
|
|
208
|
+
|
|
209
|
+
.. deprecated::
|
|
210
|
+
``use_container_width`` is deprecated and will be removed in a
|
|
211
|
+
future release. For ``use_container_width=True``, use
|
|
212
|
+
``width="stretch"``.
|
|
188
213
|
|
|
189
214
|
Examples
|
|
190
215
|
--------
|
|
@@ -231,12 +256,35 @@ class MapMixin:
|
|
|
231
256
|
height: 600px
|
|
232
257
|
|
|
233
258
|
"""
|
|
259
|
+
# Handle use_container_width deprecation (for elements that already had width parameter)
|
|
260
|
+
if use_container_width is not None:
|
|
261
|
+
show_deprecation_warning(
|
|
262
|
+
make_deprecated_name_warning(
|
|
263
|
+
"use_container_width",
|
|
264
|
+
"width",
|
|
265
|
+
"2025-12-31",
|
|
266
|
+
"For `use_container_width=True`, use `width='stretch'`. "
|
|
267
|
+
"For `use_container_width=False`, specify an integer width.",
|
|
268
|
+
include_st_prefix=False,
|
|
269
|
+
),
|
|
270
|
+
show_in_browser=False,
|
|
271
|
+
)
|
|
272
|
+
if use_container_width:
|
|
273
|
+
width = "stretch"
|
|
274
|
+
# For use_container_width=False, preserve any integer width that was set.
|
|
275
|
+
|
|
276
|
+
validate_width(width, allow_content=False)
|
|
277
|
+
validate_height(height, allow_content=False)
|
|
278
|
+
|
|
234
279
|
map_proto = DeckGlJsonChartProto()
|
|
235
280
|
deck_gl_json = to_deckgl_json(data, latitude, longitude, size, color, zoom)
|
|
236
|
-
|
|
237
|
-
|
|
281
|
+
|
|
282
|
+
marshall(map_proto, deck_gl_json)
|
|
283
|
+
|
|
284
|
+
layout_config = LayoutConfig(width=width, height=height)
|
|
285
|
+
return self.dg._enqueue(
|
|
286
|
+
"deck_gl_json_chart", map_proto, layout_config=layout_config
|
|
238
287
|
)
|
|
239
|
-
return self.dg._enqueue("deck_gl_json_chart", map_proto)
|
|
240
288
|
|
|
241
289
|
@property
|
|
242
290
|
def dg(self) -> DeltaGenerator:
|
|
@@ -464,18 +512,13 @@ def _get_zoom_level(distance: float) -> int:
|
|
|
464
512
|
def marshall(
|
|
465
513
|
pydeck_proto: DeckGlJsonChartProto,
|
|
466
514
|
pydeck_json: str,
|
|
467
|
-
use_container_width: bool,
|
|
468
|
-
height: int | None = None,
|
|
469
|
-
width: int | None = None,
|
|
470
515
|
) -> None:
|
|
471
|
-
|
|
472
|
-
pydeck_proto.use_container_width = use_container_width
|
|
473
|
-
|
|
474
|
-
if width:
|
|
475
|
-
pydeck_proto.width = width
|
|
476
|
-
if height:
|
|
477
|
-
pydeck_proto.height = height
|
|
516
|
+
"""Marshall a map proto with the given pydeck JSON specification.
|
|
478
517
|
|
|
518
|
+
Layout configuration (width, height, etc.) is handled by the LayoutConfig
|
|
519
|
+
system and not through proto fields.
|
|
520
|
+
"""
|
|
521
|
+
pydeck_proto.json = pydeck_json
|
|
479
522
|
pydeck_proto.id = ""
|
|
480
523
|
|
|
481
524
|
mapbox_token = config.get_option("mapbox.token")
|
streamlit/elements/media.py
CHANGED
|
@@ -18,9 +18,7 @@ import io
|
|
|
18
18
|
import re
|
|
19
19
|
from datetime import timedelta
|
|
20
20
|
from pathlib import Path
|
|
21
|
-
from typing import TYPE_CHECKING, Final, Union, cast
|
|
22
|
-
|
|
23
|
-
from typing_extensions import TypeAlias
|
|
21
|
+
from typing import TYPE_CHECKING, Final, TypeAlias, Union, cast
|
|
24
22
|
|
|
25
23
|
from streamlit import runtime, type_util, url_util
|
|
26
24
|
from streamlit.elements.lib.layout_utils import WidthWithoutContent, validate_width
|
|
@@ -53,11 +51,11 @@ MediaData: TypeAlias = Union[
|
|
|
53
51
|
None,
|
|
54
52
|
]
|
|
55
53
|
|
|
56
|
-
SubtitleData: TypeAlias =
|
|
57
|
-
str
|
|
58
|
-
|
|
54
|
+
SubtitleData: TypeAlias = (
|
|
55
|
+
str | Path | bytes | io.BytesIO | dict[str, str | Path | bytes | io.BytesIO] | None
|
|
56
|
+
)
|
|
59
57
|
|
|
60
|
-
MediaTime: TypeAlias =
|
|
58
|
+
MediaTime: TypeAlias = int | float | timedelta | str
|
|
61
59
|
|
|
62
60
|
TIMEDELTA_PARSE_ERROR_MESSAGE: Final = (
|
|
63
61
|
"Failed to convert '{param_name}' to a timedelta. "
|
streamlit/elements/metric.py
CHANGED
|
@@ -16,9 +16,7 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
from dataclasses import dataclass
|
|
18
18
|
from textwrap import dedent
|
|
19
|
-
from typing import TYPE_CHECKING, Any, Literal,
|
|
20
|
-
|
|
21
|
-
from typing_extensions import TypeAlias
|
|
19
|
+
from typing import TYPE_CHECKING, Any, Literal, TypeAlias, cast
|
|
22
20
|
|
|
23
21
|
from streamlit.dataframe_util import OptionSequence, convert_anything_to_list
|
|
24
22
|
from streamlit.elements.lib.layout_utils import (
|
|
@@ -42,8 +40,8 @@ if TYPE_CHECKING:
|
|
|
42
40
|
from streamlit.delta_generator import DeltaGenerator
|
|
43
41
|
|
|
44
42
|
|
|
45
|
-
Value: TypeAlias =
|
|
46
|
-
Delta: TypeAlias =
|
|
43
|
+
Value: TypeAlias = AnyNumber | str | None
|
|
44
|
+
Delta: TypeAlias = AnyNumber | str | None
|
|
47
45
|
DeltaColor: TypeAlias = Literal["normal", "inverse", "off"]
|
|
48
46
|
|
|
49
47
|
|