streamlit-nightly 1.41.2.dev20250201__py2.py3-none-any.whl → 1.42.1.dev20250204__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. streamlit/auth_util.py +2 -1
  2. streamlit/commands/echo.py +4 -1
  3. streamlit/commands/execution_control.py +3 -1
  4. streamlit/commands/page_config.py +2 -1
  5. streamlit/config.py +56 -25
  6. streamlit/config_option.py +3 -3
  7. streamlit/connections/snowflake_connection.py +22 -10
  8. streamlit/connections/snowpark_connection.py +2 -1
  9. streamlit/connections/util.py +4 -1
  10. streamlit/dataframe_util.py +3 -8
  11. streamlit/delta_generator.py +1 -1
  12. streamlit/elements/alert.py +32 -4
  13. streamlit/elements/arrow.py +28 -15
  14. streamlit/elements/code.py +4 -3
  15. streamlit/elements/deck_gl_json_chart.py +3 -4
  16. streamlit/elements/form.py +22 -4
  17. streamlit/elements/heading.py +21 -6
  18. streamlit/elements/image.py +12 -3
  19. streamlit/elements/layouts.py +9 -4
  20. streamlit/elements/lib/built_in_chart_utils.py +1 -3
  21. streamlit/elements/lib/color_util.py +7 -6
  22. streamlit/elements/lib/column_config_utils.py +4 -3
  23. streamlit/elements/lib/column_types.py +100 -33
  24. streamlit/elements/lib/dicttools.py +4 -1
  25. streamlit/elements/lib/event_utils.py +2 -2
  26. streamlit/elements/lib/file_uploader_utils.py +4 -1
  27. streamlit/elements/lib/image_utils.py +5 -4
  28. streamlit/elements/lib/options_selector_utils.py +4 -1
  29. streamlit/elements/lib/pandas_styler_utils.py +2 -1
  30. streamlit/elements/lib/policies.py +3 -1
  31. streamlit/elements/lib/utils.py +1 -1
  32. streamlit/elements/map.py +3 -1
  33. streamlit/elements/markdown.py +21 -7
  34. streamlit/elements/media.py +2 -2
  35. streamlit/elements/metric.py +8 -4
  36. streamlit/elements/plotly_chart.py +4 -5
  37. streamlit/elements/spinner.py +25 -3
  38. streamlit/elements/text.py +7 -2
  39. streamlit/elements/vega_charts.py +26 -22
  40. streamlit/elements/widgets/audio_input.py +8 -4
  41. streamlit/elements/widgets/button.py +29 -12
  42. streamlit/elements/widgets/button_group.py +29 -13
  43. streamlit/elements/widgets/camera_input.py +8 -4
  44. streamlit/elements/widgets/chat.py +1 -3
  45. streamlit/elements/widgets/checkbox.py +16 -8
  46. streamlit/elements/widgets/color_picker.py +8 -4
  47. streamlit/elements/widgets/data_editor.py +10 -14
  48. streamlit/elements/widgets/file_uploader.py +12 -6
  49. streamlit/elements/widgets/multiselect.py +10 -5
  50. streamlit/elements/widgets/number_input.py +8 -4
  51. streamlit/elements/widgets/radio.py +11 -5
  52. streamlit/elements/widgets/select_slider.py +12 -8
  53. streamlit/elements/widgets/selectbox.py +11 -5
  54. streamlit/elements/widgets/slider.py +19 -17
  55. streamlit/elements/widgets/text_widgets.py +16 -8
  56. streamlit/elements/widgets/time_widgets.py +21 -15
  57. streamlit/elements/write.py +60 -43
  58. streamlit/errors.py +1 -2
  59. streamlit/external/langchain/streamlit_callback_handler.py +3 -3
  60. streamlit/hello/animation_demo.py +1 -1
  61. streamlit/material_icon_names.py +1 -1
  62. streamlit/proto/NewSession_pb2.py +16 -16
  63. streamlit/proto/NewSession_pb2.pyi +30 -3
  64. streamlit/runtime/app_session.py +15 -15
  65. streamlit/runtime/caching/cached_message_replay.py +2 -1
  66. streamlit/runtime/caching/hashing.py +3 -2
  67. streamlit/runtime/context.py +2 -1
  68. streamlit/runtime/forward_msg_cache.py +3 -1
  69. streamlit/runtime/memory_session_storage.py +4 -1
  70. streamlit/runtime/memory_uploaded_file_manager.py +4 -1
  71. streamlit/runtime/runtime.py +6 -4
  72. streamlit/runtime/scriptrunner/script_runner.py +4 -3
  73. streamlit/runtime/scriptrunner_utils/script_run_context.py +2 -3
  74. streamlit/runtime/secrets.py +1 -5
  75. streamlit/runtime/state/common.py +2 -4
  76. streamlit/runtime/state/query_params.py +2 -1
  77. streamlit/runtime/state/query_params_proxy.py +2 -1
  78. streamlit/runtime/state/safe_session_state.py +3 -1
  79. streamlit/runtime/state/session_state.py +2 -5
  80. streamlit/runtime/state/session_state_proxy.py +2 -1
  81. streamlit/runtime/uploaded_file_manager.py +3 -1
  82. streamlit/runtime/websocket_session_manager.py +8 -8
  83. streamlit/static/index.html +2 -2
  84. streamlit/static/static/css/{index.mUTQuMqR.css → index.DpJG_94W.css} +1 -1
  85. streamlit/static/static/js/{FileDownload.esm.Cf3bITtP.js → FileDownload.esm.CuayiK6T.js} +1 -1
  86. streamlit/static/static/js/FileDropzone.CvXoxIUm.js +5 -0
  87. streamlit/static/static/js/{FormClearHelper.BgwPD1tD.js → FormClearHelper.DpwWkrvV.js} +1 -1
  88. streamlit/static/static/js/{Hooks.BMaXaj11.js → Hooks.BQiFiHd5.js} +1 -1
  89. streamlit/static/static/js/{InputInstructions.qlsk9gvt.js → InputInstructions.CypmdrYz.js} +1 -1
  90. streamlit/static/static/js/ProgressBar.DfR4HyQR.js +2 -0
  91. streamlit/static/static/js/{RenderInPortalIfExists.Blpdplqk.js → RenderInPortalIfExists.D6u3szcn.js} +1 -1
  92. streamlit/static/static/js/{Toolbar.DMhyNpv2.js → Toolbar.D6p42Hno.js} +1 -1
  93. streamlit/static/static/js/axios.upsvKRUO.js +6 -0
  94. streamlit/static/static/js/{base-input.DyTEaESI.js → base-input.B5AcLp6p.js} +4 -4
  95. streamlit/static/static/js/{createSuper.B3rIhdpQ.js → createSuper.DNzaJgi-.js} +1 -1
  96. streamlit/static/static/js/{data-grid-overlay-editor.C9Q9Gy4e.js → data-grid-overlay-editor.CKACfVZL.js} +1 -1
  97. streamlit/static/static/js/{downloader.BAMiKd1n.js → downloader.D6HV3a60.js} +1 -1
  98. streamlit/static/static/js/{es6.D82pr6dy.js → es6.UQDWlCyE.js} +2 -2
  99. streamlit/static/static/js/{iframeResizer.contentWindow.CJwxqR7x.js → iframeResizer.contentWindow.DQ-TFrBp.js} +1 -1
  100. streamlit/static/static/js/{index.B7J6suR-.js → index.2EE80u0h.js} +200 -200
  101. streamlit/static/static/js/{index.CoE1gpPQ.js → index.B96fHK2A.js} +1 -1
  102. streamlit/static/static/js/index.BAFGiIHm.js +1 -0
  103. streamlit/static/static/js/index.BPNlEjgz.js +1 -0
  104. streamlit/static/static/js/{index.C4kPuKr4.js → index.BPmrb-47.js} +1 -1
  105. streamlit/static/static/js/{index.BM_J1KkD.js → index.BQEIBi4n.js} +1 -1
  106. streamlit/static/static/js/index.BUGQmWUV.js +3 -0
  107. streamlit/static/static/js/index.BXmBj7MJ.js +1 -0
  108. streamlit/static/static/js/{index.5JFTbX2J.js → index.BY8YeKF1.js} +1 -1
  109. streamlit/static/static/js/{index.CF4stbIZ.js → index.BdVr8Tta.js} +1 -1
  110. streamlit/static/static/js/{index.CjFbbEE0.js → index.BghvoEVe.js} +1 -1
  111. streamlit/static/static/js/{index.8Q56Jjmk.js → index.BiMrOUpK.js} +1 -1
  112. streamlit/static/static/js/{index.yp4f0OMe.js → index.BiybRa0I.js} +2 -2
  113. streamlit/static/static/js/index.Bm7Vkuba.js +73 -0
  114. streamlit/static/static/js/{index.BZvQkTCS.js → index.BuyK2IsW.js} +1 -1
  115. streamlit/static/static/js/index.ByH1pn5_.js +1 -0
  116. streamlit/static/static/js/{index.zlHOKWDA.js → index.C8zZSMvD.js} +1 -1
  117. streamlit/static/static/js/index.CAuJtYES.js +1 -0
  118. streamlit/static/static/js/{index.Y84nTPW2.js → index.CEdHQ1ob.js} +1 -1
  119. streamlit/static/static/js/{index.CqGcWpm5.js → index.CJ-t5S6T.js} +2 -2
  120. streamlit/static/static/js/{index.BdlaxG49.js → index.CKOdbWxq.js} +1 -1
  121. streamlit/static/static/js/index.CSgG8OVN.js +1 -0
  122. streamlit/static/static/js/index.CX9gqq2L.js +1 -0
  123. streamlit/static/static/js/{index.TPHsScPF.js → index.CgVoYKAP.js} +1 -1
  124. streamlit/static/static/js/{index.D9yF6cxC.js → index.ChrjN8GY.js} +1 -1
  125. streamlit/static/static/js/{index.NbimJbgq.js → index.CrMtUJsu.js} +6 -6
  126. streamlit/static/static/js/index.D4SMJhY1.js +1 -0
  127. streamlit/static/static/js/index.D7BxtE4u.js +1 -0
  128. streamlit/static/static/js/{index.P5kx9um8.js → index.DB_dBVfZ.js} +5 -5
  129. streamlit/static/static/js/{index.BLCqXxIG.js → index.DMKXUbO6.js} +1 -1
  130. streamlit/static/static/js/index.DaoBv396.js +1 -0
  131. streamlit/static/static/js/{index.B3Wxz7wG.js → index.DkV6k6Ng.js} +1 -1
  132. streamlit/static/static/js/{index.BcAjRRAZ.js → index.DqZZoWyt.js} +1 -1
  133. streamlit/static/static/js/index.Dr6DSYcq.js +1 -0
  134. streamlit/static/static/js/{index.BdEYCAFh.js → index.Epl2r08f.js} +1 -1
  135. streamlit/static/static/js/{index.CC5oiyoV.js → index.ndVWhafL.js} +2 -2
  136. streamlit/static/static/js/{index.DiZyaYeV.js → index.wW-pPvtW.js} +3 -3
  137. streamlit/static/static/js/{input.DRyjjTTH.js → input.CxqdG-sh.js} +2 -2
  138. streamlit/static/static/js/{memory.C98yjNkk.js → memory.DuSk7Eex.js} +1 -1
  139. streamlit/static/static/js/{mergeWith.CLihEflw.js → mergeWith.DrxB1Sj4.js} +1 -1
  140. streamlit/static/static/js/{number-overlay-editor.DozQhDJj.js → number-overlay-editor.DBc0yndt.js} +1 -1
  141. streamlit/static/static/js/{possibleConstructorReturn.DJ7-JsJc.js → possibleConstructorReturn.ZdYWHeG3.js} +1 -1
  142. streamlit/static/static/js/{sandbox.0Tj4C46D.js → sandbox.D3L4CYjG.js} +1 -1
  143. streamlit/static/static/js/{textarea.CUrV8-V3.js → textarea.CSafh28v.js} +2 -2
  144. streamlit/static/static/js/{timepicker.DEu3fwJe.js → timepicker.C-pwkiaT.js} +4 -4
  145. streamlit/static/static/js/{toConsumableArray.C71OtXzK.js → toConsumableArray.DyCVskz5.js} +1 -1
  146. streamlit/static/static/js/{uniqueId.CndDhnid.js → uniqueId.BODM2vTk.js} +1 -1
  147. streamlit/static/static/js/useBasicWidgetState.DQUiM2dz.js +1 -0
  148. streamlit/static/static/js/{useOnInputChange.CvHbHWmy.js → useOnInputChange.Ccjd55xn.js} +1 -1
  149. streamlit/static/static/js/{withFullScreenWrapper.BLLyDFUF.js → withFullScreenWrapper.CneUoXNE.js} +1 -1
  150. streamlit/static/static/media/MaterialSymbols-Rounded.DcZbplWk.woff2 +0 -0
  151. streamlit/testing/v1/app_test.py +3 -1
  152. streamlit/testing/v1/element_tree.py +3 -4
  153. streamlit/testing/v1/local_script_runner.py +3 -3
  154. streamlit/type_util.py +11 -8
  155. streamlit/user_info.py +2 -3
  156. streamlit/watcher/path_watcher.py +4 -4
  157. streamlit/web/server/authlib_tornado_integration.py +3 -1
  158. streamlit/web/server/browser_websocket_handler.py +3 -1
  159. streamlit/web/server/routes.py +4 -1
  160. streamlit/web/server/server.py +2 -1
  161. {streamlit_nightly-1.41.2.dev20250201.dist-info → streamlit_nightly-1.42.1.dev20250204.dist-info}/METADATA +1 -2
  162. {streamlit_nightly-1.41.2.dev20250201.dist-info → streamlit_nightly-1.42.1.dev20250204.dist-info}/RECORD +166 -165
  163. streamlit/static/static/js/FileDropzone.B8wCqKiM.js +0 -5
  164. streamlit/static/static/js/ProgressBar.Di2oT-20.js +0 -2
  165. streamlit/static/static/js/index.B79cf7gS.js +0 -1
  166. streamlit/static/static/js/index.BBPZ3wsr.js +0 -1
  167. streamlit/static/static/js/index.BKahTKEx.js +0 -3
  168. streamlit/static/static/js/index.CSGfgCnQ.js +0 -1
  169. streamlit/static/static/js/index.CYMgsYSm.js +0 -1
  170. streamlit/static/static/js/index.CZjnqbcd.js +0 -73
  171. streamlit/static/static/js/index.C_4BuzGH.js +0 -1
  172. streamlit/static/static/js/index.CjiPq39N.js +0 -1
  173. streamlit/static/static/js/index.CjuTYYFG.js +0 -1
  174. streamlit/static/static/js/index.CuH7mftz.js +0 -1
  175. streamlit/static/static/js/index.DFJg1zHB.js +0 -1
  176. streamlit/static/static/js/index.Dm3nmdhh.js +0 -1
  177. streamlit/static/static/js/index.rrDohWOh.js +0 -1
  178. streamlit/static/static/js/useBasicWidgetState.DXLMTaiS.js +0 -1
  179. streamlit/static/static/media/MaterialSymbols-Rounded.DzyB5T7Y.woff2 +0 -0
  180. {streamlit_nightly-1.41.2.dev20250201.data → streamlit_nightly-1.42.1.dev20250204.data}/scripts/streamlit.cmd +0 -0
  181. {streamlit_nightly-1.41.2.dev20250201.dist-info → streamlit_nightly-1.42.1.dev20250204.dist-info}/WHEEL +0 -0
  182. {streamlit_nightly-1.41.2.dev20250201.dist-info → streamlit_nightly-1.42.1.dev20250204.dist-info}/entry_points.txt +0 -0
  183. {streamlit_nightly-1.41.2.dev20250201.dist-info → streamlit_nightly-1.42.1.dev20250204.dist-info}/top_level.txt +0 -0
@@ -21,8 +21,6 @@ from typing import (
21
21
  Any,
22
22
  Callable,
23
23
  Generic,
24
- Sequence,
25
- Tuple,
26
24
  cast,
27
25
  overload,
28
26
  )
@@ -64,6 +62,8 @@ from streamlit.runtime.state.common import (
64
62
  from streamlit.type_util import T, check_python_comparable
65
63
 
66
64
  if TYPE_CHECKING:
65
+ from collections.abc import Sequence
66
+
67
67
  from streamlit.delta_generator import DeltaGenerator
68
68
 
69
69
 
@@ -91,7 +91,7 @@ class SelectSliderSerde(Generic[T]):
91
91
 
92
92
  # The widget always returns floats, so convert to ints before indexing
93
93
  return_value: tuple[T, T] = cast(
94
- Tuple[T, T],
94
+ tuple[T, T],
95
95
  tuple(self.options[int(x)] for x in ui_value),
96
96
  )
97
97
 
@@ -230,10 +230,14 @@ class SelectSliderMixin:
230
230
  If this is omitted, a key will be generated for the widget
231
231
  based on its content. No two widgets may have the same key.
232
232
 
233
- help : str
234
- An optional tooltip that gets displayed next to the widget label.
235
- Streamlit only displays the tooltip when
236
- ``label_visibility="visible"``.
233
+ help : str or None
234
+ A tooltip that gets displayed next to the widget label. Streamlit
235
+ only displays the tooltip when ``label_visibility="visible"``. If
236
+ this is ``None`` (default), no tooltip is displayed.
237
+
238
+ The tooltip can optionally contain GitHub-flavored Markdown,
239
+ including the Markdown directives described in the ``body``
240
+ parameter of ``st.markdown``.
237
241
 
238
242
  on_change : callable
239
243
  An optional callback invoked when this select_slider's value changes.
@@ -412,7 +416,7 @@ class SelectSliderMixin:
412
416
  )
413
417
  if isinstance(widget_state.value, tuple):
414
418
  widget_state = maybe_coerce_enum_sequence(
415
- cast(RegisterWidgetResult[Tuple[T, T]], widget_state), options, opt
419
+ cast(RegisterWidgetResult[tuple[T, T]], widget_state), options, opt
416
420
  )
417
421
  else:
418
422
  widget_state = maybe_coerce_enum(widget_state, options, opt)
@@ -15,7 +15,7 @@ from __future__ import annotations
15
15
 
16
16
  from dataclasses import dataclass
17
17
  from textwrap import dedent
18
- from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, cast, overload
18
+ from typing import TYPE_CHECKING, Any, Callable, Generic, cast, overload
19
19
 
20
20
  from streamlit.dataframe_util import OptionSequence, convert_anything_to_list
21
21
  from streamlit.elements.lib.form_utils import current_form_id
@@ -49,6 +49,8 @@ from streamlit.type_util import (
49
49
  )
50
50
 
51
51
  if TYPE_CHECKING:
52
+ from collections.abc import Sequence
53
+
52
54
  from streamlit.delta_generator import DeltaGenerator
53
55
 
54
56
 
@@ -175,10 +177,14 @@ class SelectboxMixin:
175
177
  If this is omitted, a key will be generated for the widget
176
178
  based on its content. No two widgets may have the same key.
177
179
 
178
- help : str
179
- An optional tooltip that gets displayed next to the widget label.
180
- Streamlit only displays the tooltip when
181
- ``label_visibility="visible"``.
180
+ help : str or None
181
+ A tooltip that gets displayed next to the widget label. Streamlit
182
+ only displays the tooltip when ``label_visibility="visible"``. If
183
+ this is ``None`` (default), no tooltip is displayed.
184
+
185
+ The tooltip can optionally contain GitHub-flavored Markdown,
186
+ including the Markdown directives described in the ``body``
187
+ parameter of ``st.markdown``.
182
188
 
183
189
  on_change : callable
184
190
  An optional callback invoked when this selectbox's value changes.
@@ -14,6 +14,7 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
+ from collections.abc import Sequence
17
18
  from dataclasses import dataclass
18
19
  from datetime import date, datetime, time, timedelta, timezone, tzinfo
19
20
  from numbers import Integral, Real
@@ -22,9 +23,6 @@ from typing import (
22
23
  TYPE_CHECKING,
23
24
  Any,
24
25
  Final,
25
- List,
26
- Sequence,
27
- Tuple,
28
26
  TypeVar,
29
27
  Union,
30
28
  cast,
@@ -65,16 +63,16 @@ SliderNumericT = TypeVar("SliderNumericT", int, float)
65
63
  SliderDatelikeT = TypeVar("SliderDatelikeT", date, time, datetime)
66
64
 
67
65
  SliderNumericSpanT: TypeAlias = Union[
68
- List[SliderNumericT],
69
- Tuple[()],
70
- Tuple[SliderNumericT],
71
- Tuple[SliderNumericT, SliderNumericT],
66
+ list[SliderNumericT],
67
+ tuple[()],
68
+ tuple[SliderNumericT],
69
+ tuple[SliderNumericT, SliderNumericT],
72
70
  ]
73
71
  SliderDatelikeSpanT: TypeAlias = Union[
74
- List[SliderDatelikeT],
75
- Tuple[()],
76
- Tuple[SliderDatelikeT],
77
- Tuple[SliderDatelikeT, SliderDatelikeT],
72
+ list[SliderDatelikeT],
73
+ tuple[()],
74
+ tuple[SliderDatelikeT],
75
+ tuple[SliderDatelikeT, SliderDatelikeT],
78
76
  ]
79
77
 
80
78
  StepNumericT: TypeAlias = SliderNumericT
@@ -96,8 +94,8 @@ SliderValue: TypeAlias = Union[
96
94
  ]
97
95
  SliderReturnGeneric: TypeAlias = Union[
98
96
  SliderValueT,
99
- Tuple[SliderValueT],
100
- Tuple[SliderValueT, SliderValueT],
97
+ tuple[SliderValueT],
98
+ tuple[SliderValueT, SliderValueT],
101
99
  ]
102
100
  SliderReturn: TypeAlias = Union[
103
101
  SliderReturnGeneric[int],
@@ -426,10 +424,14 @@ class SliderMixin:
426
424
  If this is omitted, a key will be generated for the widget
427
425
  based on its content. No two widgets may have the same key.
428
426
 
429
- help : str
430
- An optional tooltip that gets displayed next to the widget label.
431
- Streamlit only displays the tooltip when
432
- ``label_visibility="visible"``.
427
+ help : str or None
428
+ A tooltip that gets displayed next to the widget label. Streamlit
429
+ only displays the tooltip when ``label_visibility="visible"``. If
430
+ this is ``None`` (default), no tooltip is displayed.
431
+
432
+ The tooltip can optionally contain GitHub-flavored Markdown,
433
+ including the Markdown directives described in the ``body``
434
+ parameter of ``st.markdown``.
433
435
 
434
436
  on_change : callable
435
437
  An optional callback invoked when this slider's value changes.
@@ -176,10 +176,14 @@ class TextWidgetsMixin:
176
176
  a regular text input), or "password" (for a text input that
177
177
  masks the user's typed value). Defaults to "default".
178
178
 
179
- help : str
180
- An optional tooltip that gets displayed next to the widget label.
181
- Streamlit only displays the tooltip when
182
- ``label_visibility="visible"``.
179
+ help : str or None
180
+ A tooltip that gets displayed next to the widget label. Streamlit
181
+ only displays the tooltip when ``label_visibility="visible"``. If
182
+ this is ``None`` (default), no tooltip is displayed.
183
+
184
+ The tooltip can optionally contain GitHub-flavored Markdown,
185
+ including the Markdown directives described in the ``body``
186
+ parameter of ``st.markdown``.
183
187
 
184
188
  autocomplete : str
185
189
  An optional value that will be passed to the <input> element's
@@ -450,10 +454,14 @@ class TextWidgetsMixin:
450
454
  If this is omitted, a key will be generated for the widget
451
455
  based on its content. No two widgets may have the same key.
452
456
 
453
- help : str
454
- An optional tooltip that gets displayed next to the widget label.
455
- Streamlit only displays the tooltip when
456
- ``label_visibility="visible"``.
457
+ help : str or None
458
+ A tooltip that gets displayed next to the widget label. Streamlit
459
+ only displays the tooltip when ``label_visibility="visible"``. If
460
+ this is ``None`` (default), no tooltip is displayed.
461
+
462
+ The tooltip can optionally contain GitHub-flavored Markdown,
463
+ including the Markdown directives described in the ``body``
464
+ parameter of ``st.markdown``.
457
465
 
458
466
  on_change : callable
459
467
  An optional callback invoked when this text_area's value changes.
@@ -14,6 +14,7 @@
14
14
  from __future__ import annotations
15
15
 
16
16
  import re
17
+ from collections.abc import Sequence
17
18
  from dataclasses import dataclass
18
19
  from datetime import date, datetime, time, timedelta
19
20
  from textwrap import dedent
@@ -21,10 +22,7 @@ from typing import (
21
22
  TYPE_CHECKING,
22
23
  Any,
23
24
  Final,
24
- List,
25
25
  Literal,
26
- Sequence,
27
- Tuple,
28
26
  Union,
29
27
  cast,
30
28
  overload,
@@ -72,9 +70,9 @@ DateValue: TypeAlias = Union[NullableScalarDateValue, Sequence[NullableScalarDat
72
70
 
73
71
  # The return value of st.date_input.
74
72
  DateWidgetRangeReturn: TypeAlias = Union[
75
- Tuple[()],
76
- Tuple[date],
77
- Tuple[date, date],
73
+ tuple[()],
74
+ tuple[date],
75
+ tuple[date, date],
78
76
  ]
79
77
  DateWidgetReturn: TypeAlias = Union[date, DateWidgetRangeReturn, None]
80
78
 
@@ -229,7 +227,7 @@ class _DateInputValues:
229
227
  )
230
228
 
231
229
  if value == "today":
232
- v = cast(List[date], parsed_value)[0]
230
+ v = cast(list[date], parsed_value)[0]
233
231
  if v < parsed_min:
234
232
  parsed_value = [parsed_min]
235
233
  if v > parsed_max:
@@ -406,10 +404,14 @@ class TimeWidgetsMixin:
406
404
  If this is omitted, a key will be generated for the widget
407
405
  based on its content. No two widgets may have the same key.
408
406
 
409
- help : str
410
- An optional tooltip that gets displayed next to the widget label.
411
- Streamlit only displays the tooltip when
412
- ``label_visibility="visible"``.
407
+ help : str or None
408
+ A tooltip that gets displayed next to the widget label. Streamlit
409
+ only displays the tooltip when ``label_visibility="visible"``. If
410
+ this is ``None`` (default), no tooltip is displayed.
411
+
412
+ The tooltip can optionally contain GitHub-flavored Markdown,
413
+ including the Markdown directives described in the ``body``
414
+ parameter of ``st.markdown``.
413
415
 
414
416
  on_change : callable
415
417
  An optional callback invoked when this time_input's value changes.
@@ -716,10 +718,14 @@ class TimeWidgetsMixin:
716
718
  If this is omitted, a key will be generated for the widget
717
719
  based on its content. No two widgets may have the same key.
718
720
 
719
- help : str
720
- An optional tooltip that gets displayed next to the widget label.
721
- Streamlit only displays the tooltip when
722
- ``label_visibility="visible"``.
721
+ help : str or None
722
+ A tooltip that gets displayed next to the widget label. Streamlit
723
+ only displays the tooltip when ``label_visibility="visible"``. If
724
+ this is ``None`` (default), no tooltip is displayed.
725
+
726
+ The tooltip can optionally contain GitHub-flavored Markdown,
727
+ including the Markdown directives described in the ``body``
728
+ parameter of ``st.markdown``.
723
729
 
724
730
  on_change : callable
725
731
  An optional callback invoked when this date_input's value changes.
@@ -18,17 +18,20 @@ import dataclasses
18
18
  import inspect
19
19
  import types
20
20
  from collections import ChainMap, UserDict, UserList
21
- from collections.abc import ItemsView, KeysView, ValuesView
21
+ from collections.abc import (
22
+ AsyncGenerator,
23
+ Generator,
24
+ ItemsView,
25
+ Iterable,
26
+ KeysView,
27
+ ValuesView,
28
+ )
22
29
  from io import StringIO
23
30
  from typing import (
24
31
  TYPE_CHECKING,
25
32
  Any,
26
- AsyncGenerator,
27
33
  Callable,
28
34
  Final,
29
- Generator,
30
- Iterable,
31
- List,
32
35
  cast,
33
36
  )
34
37
 
@@ -58,7 +61,7 @@ _LOGGER: Final = get_logger(__name__)
58
61
  _TEXT_CURSOR: Final = " ▏"
59
62
 
60
63
 
61
- class StreamingOutput(List[Any]):
64
+ class StreamingOutput(list[Any]):
62
65
  pass
63
66
 
64
67
 
@@ -251,48 +254,59 @@ class WriteMixin:
251
254
 
252
255
  @gather_metrics("write")
253
256
  def write(self, *args: Any, unsafe_allow_html: bool = False, **kwargs) -> None:
254
- """Write arguments to the app.
257
+ """Displays arguments in the app.
255
258
 
256
259
  This is the Swiss Army knife of Streamlit commands: it does different
257
- things depending on what you throw at it. Unlike other Streamlit commands,
258
- write() has some unique properties:
260
+ things depending on what you throw at it. Unlike other Streamlit
261
+ commands, ``st.write()`` has some unique properties:
259
262
 
260
- 1. You can pass in multiple arguments, all of which will be written.
261
- 2. Its behavior depends on the input types as follows.
262
- 3. It returns None, so its "slot" in the App cannot be reused.
263
+ - You can pass in multiple arguments, all of which will be displayed.
264
+ - Its behavior depends on the input type(s).
263
265
 
264
266
  Parameters
265
267
  ----------
266
268
  *args : any
267
- One or many objects to print to the App.
268
-
269
- Arguments are handled as follows:
270
-
271
- - write(string) : Prints the formatted Markdown string, with
272
- support for LaTeX expression, emoji shortcodes, and colored text.
273
- See docs for st.markdown for more.
274
- - write(dataframe) : Displays any dataframe-like object in an interactive table.
275
- - write(dict) : Displays dict-like in an interactive viewer.
276
- - write(list) : Displays list-like in an interactive viewer.
277
- - write(error) : Prints an exception specially.
278
- - write(func) : Displays information about a function.
279
- - write(module) : Displays information about a module.
280
- - write(class) : Displays information about a class.
281
- - write(DeltaGenerator) : Displays information about a DeltaGenerator.
282
- - write(mpl_fig) : Displays a Matplotlib figure.
283
- - write(generator) : Streams the output of a generator.
284
- - write(openai.Stream) : Streams the output of an OpenAI stream.
285
- - write(altair) : Displays an Altair chart.
286
- - write(PIL.Image) : Displays an image.
287
- - write(keras) : Displays a Keras model.
288
- - write(graphviz) : Displays a Graphviz graph.
289
- - write(plotly_fig) : Displays a Plotly figure.
290
- - write(bokeh_fig) : Displays a Bokeh figure.
291
- - write(sympy_expr) : Prints SymPy expression using LaTeX.
292
- - write(htmlable) : Prints _repr_html_() for the object if available.
293
- - write(db_cursor) : Displays DB API 2.0 cursor results in a table.
294
- - write(obj) : Prints str(obj) if otherwise unknown.
295
-
269
+ One or many objects to display in the app.
270
+
271
+ .. list-table:: Each type of argument is handled as follows:
272
+ :header-rows: 1
273
+
274
+ * - Type
275
+ - Handling
276
+ * - ``str``
277
+ - Uses ``st.markdown()``.
278
+ * - dataframe-like, ``dict``, or ``list``
279
+ - Uses ``st.dataframe()``.
280
+ * - ``Exception``
281
+ - Uses ``st.exception()``.
282
+ * - function, module, or class
283
+ - Uses ``st.help()``.
284
+ * - ``DeltaGenerator``
285
+ - Uses ``st.help()``.
286
+ * - Altair chart
287
+ - Uses ``st.altair_chart()``.
288
+ * - Bokeh figure
289
+ - Uses ``st.bokeh_chart()``.
290
+ * - Graphviz graph
291
+ - Uses ``st.graphviz_chart()``.
292
+ * - Keras model
293
+ - Converts model and uses ``st.graphviz_chart()``.
294
+ * - Matplotlib figure
295
+ - Uses ``st.pyplot()``.
296
+ * - Plotly figure
297
+ - Uses ``st.plotly_chart()``.
298
+ * - ``PIL.Image``
299
+ - Uses ``st.image()``.
300
+ * - generator or stream (like ``openai.Stream``)
301
+ - Uses ``st.write_stream()``.
302
+ * - SymPy expression
303
+ - Uses ``st.latex()``.
304
+ * - An object with ``._repr_html()``
305
+ - Uses ``st.html()``.
306
+ * - Database cursor
307
+ - Displays DB API 2.0 cursor results in a table.
308
+ * - Any
309
+ - Displays ``str(arg)`` as inline code.
296
310
 
297
311
  unsafe_allow_html : bool
298
312
  Whether to render HTML within ``*args``. This only applies to
@@ -316,9 +330,12 @@ class WriteMixin:
316
330
  Use other, more specific Streamlit commands to pass additional
317
331
  keyword arguments.
318
332
 
319
-
320
- Example
333
+ Returns
321
334
  -------
335
+ None
336
+
337
+ Examples
338
+ --------
322
339
 
323
340
  Its basic use case is to draw Markdown-formatted text, whenever the
324
341
  input is a string:
streamlit/errors.py CHANGED
@@ -154,8 +154,7 @@ class StreamlitModuleNotFoundError(StreamlitAPIWarning):
154
154
 
155
155
  def __init__(self, module_name, *args):
156
156
  message = (
157
- f'This Streamlit command requires module "{module_name}" '
158
- "to be installed."
157
+ f'This Streamlit command requires module "{module_name}" to be installed.'
159
158
  )
160
159
  super().__init__(message, *args)
161
160
 
@@ -246,9 +246,9 @@ class LLMThought:
246
246
  def complete(self, final_label: str | None = None) -> None:
247
247
  """Finish the thought."""
248
248
  if final_label is None and self._state == LLMThoughtState.RUNNING_TOOL:
249
- assert (
250
- self._last_tool is not None
251
- ), "_last_tool should never be null when _state == RUNNING_TOOL"
249
+ assert self._last_tool is not None, (
250
+ "_last_tool should never be null when _state == RUNNING_TOOL"
251
+ )
252
252
  final_label = self._labeler.get_tool_label(
253
253
  self._last_tool, is_complete=True
254
254
  )
@@ -74,7 +74,7 @@ st.title("Animation demo")
74
74
  st.write(
75
75
  """
76
76
  This app shows how you can use Streamlit to build cool animations.
77
- It displays an animated fractal based on the the Julia Set. Use the slider
77
+ It displays an animated fractal based on the Julia Set. Use the slider
78
78
  to tune different parameters.
79
79
  """
80
80
  )