streamlit-nightly 1.43.3.dev20250311__py3-none-any.whl → 1.43.3.dev20250313__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 +1 -0
- streamlit/auth_util.py +2 -1
- streamlit/commands/experimental_query_params.py +1 -1
- streamlit/commands/logo.py +3 -3
- streamlit/components/v1/__init__.py +1 -3
- streamlit/config.py +3 -2
- streamlit/config_option.py +1 -3
- streamlit/connections/snowflake_connection.py +0 -1
- streamlit/connections/sql_connection.py +0 -1
- streamlit/dataframe_util.py +7 -6
- streamlit/delta_generator_singletons.py +2 -2
- streamlit/elements/arrow.py +0 -1
- streamlit/elements/exception.py +3 -1
- streamlit/elements/form.py +3 -3
- streamlit/elements/json.py +2 -2
- streamlit/elements/layouts.py +0 -5
- streamlit/elements/lib/built_in_chart_utils.py +1 -2
- streamlit/elements/lib/column_config_utils.py +0 -3
- streamlit/elements/lib/column_types.py +6 -39
- streamlit/elements/lib/image_utils.py +2 -1
- streamlit/elements/lib/options_selector_utils.py +6 -3
- streamlit/elements/lib/subtitle_utils.py +2 -0
- streamlit/elements/lib/utils.py +0 -2
- streamlit/elements/markdown.py +98 -2
- streamlit/elements/media.py +2 -1
- streamlit/elements/metric.py +0 -1
- streamlit/elements/progress.py +1 -1
- streamlit/elements/text.py +2 -2
- streamlit/elements/vega_charts.py +2 -1
- streamlit/elements/widgets/audio_input.py +2 -1
- streamlit/elements/widgets/button.py +0 -1
- streamlit/elements/widgets/button_group.py +2 -3
- streamlit/elements/widgets/data_editor.py +2 -3
- streamlit/elements/widgets/slider.py +1 -1
- streamlit/elements/widgets/text_widgets.py +1 -0
- streamlit/elements/write.py +0 -1
- streamlit/errors.py +11 -2
- streamlit/external/langchain/streamlit_callback_handler.py +1 -2
- streamlit/file_util.py +4 -2
- streamlit/navigation/page.py +0 -1
- streamlit/platform.py +1 -3
- streamlit/runtime/caching/cache_data_api.py +5 -5
- streamlit/runtime/caching/cache_errors.py +1 -1
- streamlit/runtime/caching/cache_resource_api.py +4 -4
- streamlit/runtime/caching/cache_utils.py +6 -4
- streamlit/runtime/caching/storage/cache_storage_protocol.py +6 -6
- streamlit/runtime/caching/storage/dummy_cache_storage.py +2 -2
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +6 -6
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +6 -6
- streamlit/runtime/connection_factory.py +0 -1
- streamlit/runtime/context.py +1 -1
- streamlit/runtime/credentials.py +1 -1
- streamlit/runtime/forward_msg_cache.py +1 -1
- streamlit/runtime/forward_msg_queue.py +2 -1
- streamlit/runtime/fragment.py +2 -1
- streamlit/runtime/memory_media_file_storage.py +2 -2
- streamlit/runtime/metrics_util.py +2 -2
- streamlit/runtime/runtime_util.py +1 -1
- streamlit/runtime/scriptrunner/script_runner.py +1 -1
- streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
- streamlit/runtime/scriptrunner_utils/script_run_context.py +1 -0
- streamlit/runtime/secrets.py +28 -31
- streamlit/runtime/state/common.py +1 -1
- streamlit/runtime/state/safe_session_state.py +1 -1
- streamlit/runtime/state/session_state.py +4 -3
- streamlit/runtime/stats.py +1 -1
- streamlit/runtime/uploaded_file_manager.py +4 -3
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.B-R2xJ_2.js → FileDownload.esm.imTamlxP.js} +1 -1
- streamlit/static/static/js/{FileHelper.Dpame4Yy.js → FileHelper.BwPSCUvG.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CJtgEcyv.js → FormClearHelper.DB5q2Avl.js} +1 -1
- streamlit/static/static/js/{Hooks.eMU4yP9C.js → Hooks.Cxijo2P7.js} +1 -1
- streamlit/static/static/js/{InputInstructions.Bt5nMAh-.js → InputInstructions.B3OvMrKL.js} +1 -1
- streamlit/static/static/js/{ProgressBar.CRfY498S.js → ProgressBar.DmTol130.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CjsBZs42.js → RenderInPortalIfExists.B8t62565.js} +1 -1
- streamlit/static/static/js/{Toolbar.CBmSHKas.js → Toolbar.CbG49UPG.js} +1 -1
- streamlit/static/static/js/{base-input.pwi2uHY4.js → base-input.D7sJ1S2g.js} +1 -1
- streamlit/static/static/js/{checkbox.BRMCIUrT.js → checkbox.0Qx7AQxA.js} +1 -1
- streamlit/static/static/js/{createSuper.BT2FfU2u.js → createSuper.DYiyAta_.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DR231PaH.js → data-grid-overlay-editor.DH61CZYo.js} +1 -1
- streamlit/static/static/js/{downloader.Cwh9Q8n3.js → downloader.ClUad3SK.js} +1 -1
- streamlit/static/static/js/{es6.DXFo1lzk.js → es6.oePMPTIo.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.BqHH3gN-.js → iframeResizer.contentWindow.DWkIX4K7.js} +1 -1
- streamlit/static/static/js/{index.SGdFItlP.js → index.1VrMb7Gq.js} +1 -1
- streamlit/static/static/js/index.62zz5frt.js +1 -0
- streamlit/static/static/js/index.BJRyQckV.js +1 -0
- streamlit/static/static/js/{index.C8ZQWk_P.js → index.BQVZQA1G.js} +1 -1
- streamlit/static/static/js/{index.-J5N3GRT.js → index.BSZRb65z.js} +1 -1
- streamlit/static/static/js/{index.oH2t20_d.js → index.BUJE3tb_.js} +1 -1
- streamlit/static/static/js/{index.DAIPHdqL.js → index.BWsaTYC-.js} +1 -1
- streamlit/static/static/js/{index.B9ftDzXT.js → index.BccrUqFL.js} +1 -1
- streamlit/static/static/js/index.BhzKPoO6.js +1 -0
- streamlit/static/static/js/{index._HJ2bgYb.js → index.BpNXx3zc.js} +6 -6
- streamlit/static/static/js/{index.DzJ-K9FH.js → index.BzEstIKX.js} +1 -1
- streamlit/static/static/js/{index.Cqy-AKUq.js → index.C-ilKj2l.js} +1 -1
- streamlit/static/static/js/{index.DBAW0l2y.js → index.CCAIkxXD.js} +2367 -1541
- streamlit/static/static/js/{index.DklFRDjI.js → index.CEXlj4h2.js} +1 -1
- streamlit/static/static/js/{index.E4BOW70b.js → index.CEtBn4Yo.js} +1 -1
- streamlit/static/static/js/{index.Y1Qnwm4b.js → index.CM7PC5PD.js} +1 -1
- streamlit/static/static/js/{index.BAQ_1jSz.js → index.CSLXWDcG.js} +1 -1
- streamlit/static/static/js/{index.7mbSZESp.js → index.CqywW5KK.js} +1 -1
- streamlit/static/static/js/{index.DGe1v1i2.js → index.CyRCgpSs.js} +1 -1
- streamlit/static/static/js/{index.BiPCWEUM.js → index.CzFs8nXc.js} +45 -45
- streamlit/static/static/js/{index.DTC2KQEB.js → index.Czxn5B2N.js} +1 -1
- streamlit/static/static/js/{index.BhhnIkTX.js → index.D0OLo5Dp.js} +1 -1
- streamlit/static/static/js/{index.DC7tm9ca.js → index.D2JlVfHE.js} +1 -1
- streamlit/static/static/js/{index.BtuGy7By.js → index.D8rVyQy1.js} +2 -2
- streamlit/static/static/js/{index.BN2fMHzp.js → index.DJRmF7dm.js} +1 -1
- streamlit/static/static/js/{index.eHde7unb.js → index.Dd9D963h.js} +1 -1
- streamlit/static/static/js/{index.CtDd3Kvg.js → index.DhcpqbOJ.js} +1 -1
- streamlit/static/static/js/{index.DJZrR-yh.js → index.DlEF0vUx.js} +1 -1
- streamlit/static/static/js/{index.pfdwKIIK.js → index.DnJimAdR.js} +1 -1
- streamlit/static/static/js/index.DoqMrowT.js +1 -0
- streamlit/static/static/js/{index.B71BDPil.js → index.DqsHy8ck.js} +1 -1
- streamlit/static/static/js/{index.DbtNEUBr.js → index.DtS10fdK.js} +1 -1
- streamlit/static/static/js/{index.BtaSeLy3.js → index.XZw2NTV4.js} +1 -1
- streamlit/static/static/js/index.YB9Oe71d.js +1 -0
- streamlit/static/static/js/{index.Bt4_I4Hr.js → index.axjxDsFs.js} +1 -1
- streamlit/static/static/js/{index.CKLHvpe_.js → index.kB2IGVOe.js} +1 -1
- streamlit/static/static/js/{index.ClCou1d2.js → index.tVO_vJdT.js} +1 -1
- streamlit/static/static/js/{index.DIxz2WrU.js → index.uPQFE7KD.js} +1 -1
- streamlit/static/static/js/{input.Rf6xGN5X.js → input.od7ufwko.js} +1 -1
- streamlit/static/static/js/{memory.D5NLCYdA.js → memory.B4tdC6o-.js} +1 -1
- streamlit/static/static/js/{mergeWith.Bcdwg8Ac.js → mergeWith.BIQlVIWW.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CCjfRIEO.js → number-overlay-editor.yJDCpy9b.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.B8bXiVQj.js → possibleConstructorReturn.CarGSmuW.js} +1 -1
- streamlit/static/static/js/{sandbox.lrrkbqxh.js → sandbox.DMCKOK6i.js} +1 -1
- streamlit/static/static/js/{textarea.DCEYRe9D.js → textarea.CKKbJt6B.js} +1 -1
- streamlit/static/static/js/{timepicker.DpQ3WAC_.js → timepicker.BgsARtBm.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.EduObuzm.js → toConsumableArray.DXHhbr1a.js} +1 -1
- streamlit/static/static/js/{uniqueId.qyd-2U_A.js → uniqueId.Cb5oTCCd.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.B0zc_tpZ.js → useBasicWidgetState.8rZ80dWq.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.tzktvOeD.js → useOnInputChange.Bc5KC47X.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.TezXOJ_z.js → withFullScreenWrapper.CSP3iCNz.js} +1 -1
- streamlit/string_util.py +3 -2
- streamlit/testing/v1/element_tree.py +30 -30
- streamlit/testing/v1/util.py +2 -1
- streamlit/time_util.py +1 -3
- streamlit/type_util.py +2 -1
- streamlit/user_info.py +0 -1
- streamlit/watcher/event_based_path_watcher.py +1 -1
- streamlit/web/bootstrap.py +3 -1
- streamlit/web/cache_storage_manager_config.py +1 -1
- streamlit/web/cli.py +44 -2
- streamlit/web/server/authlib_tornado_integration.py +1 -1
- streamlit/web/server/browser_websocket_handler.py +2 -1
- streamlit/web/server/routes.py +2 -2
- streamlit/web/server/server_util.py +2 -4
- {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/RECORD +154 -154
- streamlit/static/static/js/index.BMcgy3Eb.js +0 -1
- streamlit/static/static/js/index.COJ2HeaK.js +0 -1
- streamlit/static/static/js/index.D6iEZATu.js +0 -1
- streamlit/static/static/js/index.DuXQiNfC.js +0 -1
- streamlit/static/static/js/index.Fi_0UKZA.js +0 -1
- {streamlit_nightly-1.43.3.dev20250311.data → streamlit_nightly-1.43.3.dev20250313.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/top_level.txt +0 -0
@@ -86,7 +86,7 @@ T = TypeVar("T")
|
|
86
86
|
|
87
87
|
@dataclass
|
88
88
|
class InitialValue:
|
89
|
-
"""
|
89
|
+
"""Used to represent the initial value of a widget."""
|
90
90
|
|
91
91
|
pass
|
92
92
|
|
@@ -136,7 +136,7 @@ class Element(ABC):
|
|
136
136
|
...
|
137
137
|
|
138
138
|
def __getattr__(self, name: str) -> Any:
|
139
|
-
"""Fallback attempt to get an attribute from the proto"""
|
139
|
+
"""Fallback attempt to get an attribute from the proto."""
|
140
140
|
return getattr(self.proto, name)
|
141
141
|
|
142
142
|
def run(self, *, timeout: float | None = None) -> AppTest:
|
@@ -323,7 +323,7 @@ class Button(Widget):
|
|
323
323
|
|
324
324
|
@property
|
325
325
|
def value(self) -> bool:
|
326
|
-
"""The value of the button. (bool)"""
|
326
|
+
"""The value of the button. (bool)""" # noqa: D400
|
327
327
|
if self._value:
|
328
328
|
return self._value
|
329
329
|
else:
|
@@ -368,7 +368,7 @@ class ChatInput(Widget):
|
|
368
368
|
|
369
369
|
@property
|
370
370
|
def value(self) -> str | None:
|
371
|
-
"""The value of the widget. (str)"""
|
371
|
+
"""The value of the widget. (str)""" # noqa: D400
|
372
372
|
if self._value:
|
373
373
|
return self._value
|
374
374
|
else:
|
@@ -401,7 +401,7 @@ class Checkbox(Widget):
|
|
401
401
|
|
402
402
|
@property
|
403
403
|
def value(self) -> bool:
|
404
|
-
"""The value of the widget. (bool)"""
|
404
|
+
"""The value of the widget. (bool)""" # noqa: D400
|
405
405
|
if self._value is not None:
|
406
406
|
return self._value
|
407
407
|
else:
|
@@ -441,7 +441,7 @@ class Code(Element):
|
|
441
441
|
|
442
442
|
@property
|
443
443
|
def value(self) -> str:
|
444
|
-
"""The value of the element. (str)"""
|
444
|
+
"""The value of the element. (str)""" # noqa: D400
|
445
445
|
return self.proto.code_text
|
446
446
|
|
447
447
|
|
@@ -462,7 +462,7 @@ class ColorPicker(Widget):
|
|
462
462
|
|
463
463
|
@property
|
464
464
|
def value(self) -> str:
|
465
|
-
"""The currently selected value as a hex string. (str)"""
|
465
|
+
"""The currently selected value as a hex string. (str)""" # noqa: D400
|
466
466
|
if self._value is not None:
|
467
467
|
return self._value
|
468
468
|
else:
|
@@ -548,7 +548,7 @@ class DateInput(Widget):
|
|
548
548
|
|
549
549
|
@property
|
550
550
|
def value(self) -> DateWidgetReturn:
|
551
|
-
"""The value of the widget. (date or Tuple of date)"""
|
551
|
+
"""The value of the widget. (date or Tuple of date)""" # noqa: D400
|
552
552
|
if not isinstance(self._value, InitialValue):
|
553
553
|
parsed, _ = _parse_date_value(self._value)
|
554
554
|
return tuple(parsed) if parsed is not None else None # type: ignore
|
@@ -721,7 +721,7 @@ class ButtonGroup(Widget, Generic[T]):
|
|
721
721
|
|
722
722
|
@property
|
723
723
|
def value(self) -> list[T]:
|
724
|
-
"""The currently selected values from the options. (list)"""
|
724
|
+
"""The currently selected values from the options. (list)""" # noqa: D400
|
725
725
|
if self._value is not None:
|
726
726
|
return self._value
|
727
727
|
else:
|
@@ -731,17 +731,17 @@ class ButtonGroup(Widget, Generic[T]):
|
|
731
731
|
|
732
732
|
@property
|
733
733
|
def indices(self) -> Sequence[int]:
|
734
|
-
"""The indices of the currently selected values from the options. (list)"""
|
734
|
+
"""The indices of the currently selected values from the options. (list)""" # noqa: D400
|
735
735
|
return [self.options.index(self.format_func(v)) for v in self.value]
|
736
736
|
|
737
737
|
@property
|
738
738
|
def format_func(self) -> Callable[[Any], Any]:
|
739
|
-
"""The widget's formatting function for displaying options. (callable)"""
|
739
|
+
"""The widget's formatting function for displaying options. (callable)""" # noqa: D400
|
740
740
|
ss = self.root.session_state
|
741
741
|
return cast(Callable[[Any], Any], ss[TESTING_KEY][self.id])
|
742
742
|
|
743
743
|
def set_value(self, v: list[T]) -> ButtonGroup[T]:
|
744
|
-
"""Set the value of the multiselect widget. (list)"""
|
744
|
+
"""Set the value of the multiselect widget. (list)""" # noqa: D400
|
745
745
|
|
746
746
|
self._value = v
|
747
747
|
return self
|
@@ -809,7 +809,7 @@ class Multiselect(Widget, Generic[T]):
|
|
809
809
|
|
810
810
|
@property
|
811
811
|
def value(self) -> list[T]:
|
812
|
-
"""The currently selected values from the options. (list)"""
|
812
|
+
"""The currently selected values from the options. (list)""" # noqa: D400
|
813
813
|
if self._value is not None:
|
814
814
|
return self._value
|
815
815
|
else:
|
@@ -819,17 +819,17 @@ class Multiselect(Widget, Generic[T]):
|
|
819
819
|
|
820
820
|
@property
|
821
821
|
def indices(self) -> Sequence[int]:
|
822
|
-
"""The indices of the currently selected values from the options. (list)"""
|
822
|
+
"""The indices of the currently selected values from the options. (list)""" # noqa: D400
|
823
823
|
return [self.options.index(self.format_func(v)) for v in self.value]
|
824
824
|
|
825
825
|
@property
|
826
826
|
def format_func(self) -> Callable[[Any], Any]:
|
827
|
-
"""The widget's formatting function for displaying options. (callable)"""
|
827
|
+
"""The widget's formatting function for displaying options. (callable)""" # noqa: D400
|
828
828
|
ss = self.root.session_state
|
829
829
|
return cast(Callable[[Any], Any], ss[TESTING_KEY][self.id])
|
830
830
|
|
831
831
|
def set_value(self, v: list[T]) -> Multiselect[T]:
|
832
|
-
"""Set the value of the multiselect widget. (list)"""
|
832
|
+
"""Set the value of the multiselect widget. (list)""" # noqa: D400
|
833
833
|
|
834
834
|
self._value = v
|
835
835
|
return self
|
@@ -952,14 +952,14 @@ class Radio(Widget, Generic[T]):
|
|
952
952
|
|
953
953
|
@property
|
954
954
|
def index(self) -> int | None:
|
955
|
-
"""The index of the current selection. (int)"""
|
955
|
+
"""The index of the current selection. (int)""" # noqa: D400
|
956
956
|
if self.value is None:
|
957
957
|
return None
|
958
958
|
return self.options.index(self.format_func(self.value))
|
959
959
|
|
960
960
|
@property
|
961
961
|
def value(self) -> T | None:
|
962
|
-
"""The currently selected value from the options. (Any)"""
|
962
|
+
"""The currently selected value from the options. (Any)""" # noqa: D400
|
963
963
|
if not isinstance(self._value, InitialValue):
|
964
964
|
return self._value
|
965
965
|
else:
|
@@ -969,7 +969,7 @@ class Radio(Widget, Generic[T]):
|
|
969
969
|
|
970
970
|
@property
|
971
971
|
def format_func(self) -> Callable[[Any], Any]:
|
972
|
-
"""The widget's formatting function for displaying options. (callable)"""
|
972
|
+
"""The widget's formatting function for displaying options. (callable)""" # noqa: D400
|
973
973
|
ss = self.root.session_state
|
974
974
|
return cast(Callable[[Any], Any], ss[TESTING_KEY][self.id])
|
975
975
|
|
@@ -1011,7 +1011,7 @@ class Selectbox(Widget, Generic[T]):
|
|
1011
1011
|
|
1012
1012
|
@property
|
1013
1013
|
def index(self) -> int | None:
|
1014
|
-
"""The index of the current selection. (int)"""
|
1014
|
+
"""The index of the current selection. (int)""" # noqa: D400
|
1015
1015
|
if self.value is None:
|
1016
1016
|
return None
|
1017
1017
|
|
@@ -1021,7 +1021,7 @@ class Selectbox(Widget, Generic[T]):
|
|
1021
1021
|
|
1022
1022
|
@property
|
1023
1023
|
def value(self) -> T | None:
|
1024
|
-
"""The currently selected value from the options. (Any)"""
|
1024
|
+
"""The currently selected value from the options. (Any)""" # noqa: D400
|
1025
1025
|
if not isinstance(self._value, InitialValue):
|
1026
1026
|
return self._value
|
1027
1027
|
else:
|
@@ -1031,7 +1031,7 @@ class Selectbox(Widget, Generic[T]):
|
|
1031
1031
|
|
1032
1032
|
@property
|
1033
1033
|
def format_func(self) -> Callable[[Any], Any]:
|
1034
|
-
"""The widget's formatting function for displaying options. (callable)"""
|
1034
|
+
"""The widget's formatting function for displaying options. (callable)""" # noqa: D400
|
1035
1035
|
ss = self.root.session_state
|
1036
1036
|
return cast(Callable[[Any], Any], ss[TESTING_KEY][self.id])
|
1037
1037
|
|
@@ -1104,7 +1104,7 @@ class SelectSlider(Widget, Generic[T]):
|
|
1104
1104
|
|
1105
1105
|
@property
|
1106
1106
|
def value(self) -> T | Sequence[T]:
|
1107
|
-
"""The currently selected value or range. (Any or Sequence of Any)"""
|
1107
|
+
"""The currently selected value or range. (Any or Sequence of Any)""" # noqa: D400
|
1108
1108
|
if self._value is not None:
|
1109
1109
|
return self._value
|
1110
1110
|
else:
|
@@ -1115,7 +1115,7 @@ class SelectSlider(Widget, Generic[T]):
|
|
1115
1115
|
|
1116
1116
|
@property
|
1117
1117
|
def format_func(self) -> Callable[[Any], Any]:
|
1118
|
-
"""The widget's formatting function for displaying options. (callable)"""
|
1118
|
+
"""The widget's formatting function for displaying options. (callable)""" # noqa: D400
|
1119
1119
|
ss = self.root.session_state
|
1120
1120
|
return cast(Callable[[Any], Any], ss[TESTING_KEY][self.id])
|
1121
1121
|
|
@@ -1163,7 +1163,7 @@ class Slider(Widget, Generic[SliderValueT]):
|
|
1163
1163
|
|
1164
1164
|
@property
|
1165
1165
|
def value(self) -> SliderValueT | Sequence[SliderValueT]:
|
1166
|
-
"""The currently selected value or range. (Any or Sequence of Any)"""
|
1166
|
+
"""The currently selected value or range. (Any or Sequence of Any)""" # noqa: D400
|
1167
1167
|
if self._value is not None:
|
1168
1168
|
return self._value
|
1169
1169
|
else:
|
@@ -1207,7 +1207,7 @@ class Text(Element):
|
|
1207
1207
|
|
1208
1208
|
@property
|
1209
1209
|
def value(self) -> str:
|
1210
|
-
"""The value of the element. (str)"""
|
1210
|
+
"""The value of the element. (str)""" # noqa: D400
|
1211
1211
|
return self.proto.body
|
1212
1212
|
|
1213
1213
|
|
@@ -1244,7 +1244,7 @@ class TextArea(Widget):
|
|
1244
1244
|
|
1245
1245
|
@property
|
1246
1246
|
def value(self) -> str | None:
|
1247
|
-
"""The current value of the widget. (str)"""
|
1247
|
+
"""The current value of the widget. (str)""" # noqa: D400
|
1248
1248
|
if not isinstance(self._value, InitialValue):
|
1249
1249
|
return self._value
|
1250
1250
|
else:
|
@@ -1297,7 +1297,7 @@ class TextInput(Widget):
|
|
1297
1297
|
|
1298
1298
|
@property
|
1299
1299
|
def value(self) -> str | None:
|
1300
|
-
"""The current value of the widget. (str)"""
|
1300
|
+
"""The current value of the widget. (str)""" # noqa: D400
|
1301
1301
|
if not isinstance(self._value, InitialValue):
|
1302
1302
|
return self._value
|
1303
1303
|
else:
|
@@ -1354,7 +1354,7 @@ class TimeInput(Widget):
|
|
1354
1354
|
|
1355
1355
|
@property
|
1356
1356
|
def value(self) -> time | None:
|
1357
|
-
"""The current value of the widget. (time)"""
|
1357
|
+
"""The current value of the widget. (time)""" # noqa: D400
|
1358
1358
|
if not isinstance(self._value, InitialValue):
|
1359
1359
|
v = self._value
|
1360
1360
|
v = v.time() if isinstance(v, datetime) else v
|
@@ -1420,7 +1420,7 @@ class Toggle(Widget):
|
|
1420
1420
|
|
1421
1421
|
@property
|
1422
1422
|
def value(self) -> bool:
|
1423
|
-
"""The current value of the widget. (bool)"""
|
1423
|
+
"""The current value of the widget. (bool)""" # noqa: D400
|
1424
1424
|
if self._value is not None:
|
1425
1425
|
return self._value
|
1426
1426
|
else:
|
streamlit/testing/v1/util.py
CHANGED
@@ -25,7 +25,8 @@ def patch_config_options(config_overrides: dict[str, Any]):
|
|
25
25
|
"""A context manager that overrides config options. It can
|
26
26
|
also be used as a function decorator.
|
27
27
|
|
28
|
-
Examples
|
28
|
+
Examples
|
29
|
+
--------
|
29
30
|
>>> with patch_config_options({"server.headless": True}):
|
30
31
|
... assert config.get_option("server.headless") is True
|
31
32
|
... # Other test code that relies on these options
|
streamlit/time_util.py
CHANGED
@@ -51,9 +51,7 @@ def time_to_seconds(t: float | timedelta | str | None) -> float: ...
|
|
51
51
|
def time_to_seconds(
|
52
52
|
t: float | timedelta | str | None, *, coerce_none_to_inf: bool = True
|
53
53
|
) -> float | None:
|
54
|
-
"""
|
55
|
-
Convert a time string value to a float representing "number of seconds".
|
56
|
-
"""
|
54
|
+
"""Convert a time string value to a float representing "number of seconds"."""
|
57
55
|
if coerce_none_to_inf and t is None:
|
58
56
|
return math.inf
|
59
57
|
if isinstance(t, timedelta):
|
streamlit/type_util.py
CHANGED
@@ -386,7 +386,8 @@ def is_list_like(obj: object) -> TypeGuard[Sequence[Any]]:
|
|
386
386
|
def check_python_comparable(seq: Sequence[Any]) -> None:
|
387
387
|
"""Check if the sequence elements support "python comparison".
|
388
388
|
That means that the equality operator (==) returns a boolean value.
|
389
|
-
Which is not True for e.g. numpy arrays and pandas series.
|
389
|
+
Which is not True for e.g. numpy arrays and pandas series.
|
390
|
+
"""
|
390
391
|
try:
|
391
392
|
bool(seq[0] == seq[0])
|
392
393
|
except LookupError:
|
streamlit/user_info.py
CHANGED
streamlit/web/bootstrap.py
CHANGED
@@ -137,7 +137,9 @@ def _on_server_start(server: Server) -> None:
|
|
137
137
|
|
138
138
|
|
139
139
|
def _fix_pydeck_mapbox_api_warning() -> None:
|
140
|
-
"""Sets MAPBOX_API_KEY environment variable needed for PyDeck otherwise it
|
140
|
+
"""Sets MAPBOX_API_KEY environment variable needed for PyDeck otherwise it
|
141
|
+
will throw an exception.
|
142
|
+
"""
|
141
143
|
|
142
144
|
os.environ["MAPBOX_API_KEY"] = config.get_option("mapbox.token")
|
143
145
|
|
@@ -27,7 +27,7 @@ if TYPE_CHECKING:
|
|
27
27
|
def create_default_cache_storage_manager() -> CacheStorageManager:
|
28
28
|
"""
|
29
29
|
Get the cache storage manager.
|
30
|
-
It would be used both in server.py and in cli.py to have unified cache storage
|
30
|
+
It would be used both in server.py and in cli.py to have unified cache storage.
|
31
31
|
|
32
32
|
Returns
|
33
33
|
-------
|
streamlit/web/cli.py
CHANGED
@@ -110,7 +110,7 @@ def configurator_options(func: F) -> F:
|
|
110
110
|
|
111
111
|
|
112
112
|
def _download_remote(main_script_path: str, url_path: str) -> None:
|
113
|
-
"""Fetch remote file at url_path to main_script_path"""
|
113
|
+
"""Fetch remote file at url_path to main_script_path."""
|
114
114
|
import requests
|
115
115
|
|
116
116
|
with open(main_script_path, "wb") as fp:
|
@@ -133,7 +133,7 @@ def main(log_level="info"):
|
|
133
133
|
Or use the line below to run your own script:
|
134
134
|
|
135
135
|
$ streamlit run your_script.py
|
136
|
-
"""
|
136
|
+
""" # noqa: D400
|
137
137
|
|
138
138
|
if log_level:
|
139
139
|
from streamlit.logger import get_logger
|
@@ -365,5 +365,47 @@ def test_prog_name():
|
|
365
365
|
assert parent.command_path == "streamlit test"
|
366
366
|
|
367
367
|
|
368
|
+
@main.command("init")
|
369
|
+
@click.argument("directory", required=False)
|
370
|
+
def main_init(directory: str | None = None):
|
371
|
+
"""Initialize a new Streamlit project.
|
372
|
+
|
373
|
+
If DIRECTORY is specified, create it and initialize the project there.
|
374
|
+
Otherwise use the current directory.
|
375
|
+
"""
|
376
|
+
from pathlib import Path
|
377
|
+
|
378
|
+
project_dir = Path(directory) if directory else Path.cwd()
|
379
|
+
|
380
|
+
try:
|
381
|
+
project_dir.mkdir(exist_ok=True, parents=True)
|
382
|
+
except OSError as e:
|
383
|
+
raise click.ClickException(f"Failed to create directory: {e}")
|
384
|
+
|
385
|
+
# Create requirements.txt
|
386
|
+
(project_dir / "requirements.txt").write_text("streamlit\n")
|
387
|
+
|
388
|
+
# Create streamlit_app.py
|
389
|
+
(project_dir / "streamlit_app.py").write_text("""import streamlit as st
|
390
|
+
|
391
|
+
st.title("🎈 My new app")
|
392
|
+
st.write(
|
393
|
+
"Let's start building! For help and inspiration, head over to [docs.streamlit.io](https://docs.streamlit.io/)."
|
394
|
+
)
|
395
|
+
""")
|
396
|
+
|
397
|
+
rel_path_str = str(directory) if directory else "."
|
398
|
+
|
399
|
+
click.secho("✨ Created new Streamlit app in ", nl=False)
|
400
|
+
click.secho(f"{rel_path_str}", fg="blue")
|
401
|
+
click.echo("🚀 Run it with: ", nl=False)
|
402
|
+
click.secho(f"streamlit run {rel_path_str}/streamlit_app.py", fg="blue")
|
403
|
+
|
404
|
+
if click.confirm("❓ Run the app now?", default=True):
|
405
|
+
app_path = project_dir / "streamlit_app.py"
|
406
|
+
click.echo("\nStarting Streamlit...")
|
407
|
+
_main_run(str(app_path))
|
408
|
+
|
409
|
+
|
368
410
|
if __name__ == "__main__":
|
369
411
|
main()
|
@@ -40,7 +40,7 @@ class TornadoIntegration(FrameworkIntegration): # type: ignore[misc]
|
|
40
40
|
oauth: TornadoOAuth, name: str, params: Sequence[str]
|
41
41
|
) -> dict[str, Any]:
|
42
42
|
"""Configure Authlib integration with provider parameters
|
43
|
-
specified in secrets.toml
|
43
|
+
specified in secrets.toml.
|
44
44
|
"""
|
45
45
|
|
46
46
|
# oauth.config here is an auth section from secrets.toml
|
@@ -47,7 +47,7 @@ _LOGGER: Final = get_logger(__name__)
|
|
47
47
|
|
48
48
|
|
49
49
|
class BrowserWebSocketHandler(WebSocketHandler, SessionClient):
|
50
|
-
"""Handles a WebSocket connection from the browser"""
|
50
|
+
"""Handles a WebSocket connection from the browser."""
|
51
51
|
|
52
52
|
def initialize(self, runtime: Runtime) -> None:
|
53
53
|
self._runtime = runtime
|
@@ -69,6 +69,7 @@ class BrowserWebSocketHandler(WebSocketHandler, SessionClient):
|
|
69
69
|
) -> bytes | None:
|
70
70
|
"""Get a signed cookie from the request. Added for compatibility with
|
71
71
|
Tornado < 6.3.0.
|
72
|
+
|
72
73
|
See release notes: https://www.tornadoweb.org/en/stable/releases/v6.3.0.html#deprecation-notices
|
73
74
|
"""
|
74
75
|
try:
|
streamlit/web/server/routes.py
CHANGED
@@ -141,7 +141,7 @@ class _SpecialRequestHandler(tornado.web.RequestHandler):
|
|
141
141
|
|
142
142
|
class HealthHandler(_SpecialRequestHandler):
|
143
143
|
def initialize(self, callback):
|
144
|
-
"""Initialize the handler
|
144
|
+
"""Initialize the handler.
|
145
145
|
|
146
146
|
Parameters
|
147
147
|
----------
|
@@ -242,7 +242,7 @@ class HostConfigHandler(_SpecialRequestHandler):
|
|
242
242
|
|
243
243
|
|
244
244
|
class MessageCacheHandler(tornado.web.RequestHandler):
|
245
|
-
"""Returns ForwardMsgs from our MessageCache"""
|
245
|
+
"""Returns ForwardMsgs from our MessageCache."""
|
246
246
|
|
247
247
|
def initialize(self, cache):
|
248
248
|
"""Initializes the handler.
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
"""Server related utility functions"""
|
15
|
+
"""Server related utility functions."""
|
16
16
|
|
17
17
|
from __future__ import annotations
|
18
18
|
|
@@ -153,9 +153,7 @@ def _get_browser_address_bar_port() -> int:
|
|
153
153
|
|
154
154
|
|
155
155
|
def emit_endpoint_deprecation_notice(handler: RequestHandler, new_path: str) -> None:
|
156
|
-
"""
|
157
|
-
Emits the warning about deprecation of HTTP endpoint in the HTTP header.
|
158
|
-
"""
|
156
|
+
"""Emits the warning about deprecation of HTTP endpoint in the HTTP header."""
|
159
157
|
handler.set_header("Deprecation", True)
|
160
158
|
new_url = urljoin(f"{handler.request.protocol}://{handler.request.host}", new_path)
|
161
159
|
handler.set_header("Link", f'<{new_url}>; rel="alternate"')
|