streamlit-nightly 1.45.1.dev20250507__py3-none-any.whl → 1.45.1.dev20250509__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 (203) hide show
  1. streamlit/auth_util.py +3 -3
  2. streamlit/cli_util.py +3 -2
  3. streamlit/commands/logo.py +2 -2
  4. streamlit/commands/navigation.py +5 -4
  5. streamlit/commands/page_config.py +3 -1
  6. streamlit/components/types/base_custom_component.py +7 -7
  7. streamlit/components/v1/custom_component.py +6 -6
  8. streamlit/config.py +84 -48
  9. streamlit/config_option.py +2 -2
  10. streamlit/config_util.py +20 -12
  11. streamlit/connections/base_connection.py +3 -3
  12. streamlit/connections/snowflake_connection.py +5 -5
  13. streamlit/connections/snowpark_connection.py +3 -3
  14. streamlit/connections/sql_connection.py +9 -10
  15. streamlit/cursor.py +6 -6
  16. streamlit/delta_generator.py +7 -6
  17. streamlit/delta_generator_singletons.py +2 -2
  18. streamlit/deprecation_util.py +1 -1
  19. streamlit/elements/arrow.py +2 -3
  20. streamlit/elements/deck_gl_json_chart.py +30 -17
  21. streamlit/elements/dialog_decorator.py +3 -3
  22. streamlit/elements/doc_string.py +20 -20
  23. streamlit/elements/layouts.py +26 -7
  24. streamlit/elements/lib/built_in_chart_utils.py +37 -39
  25. streamlit/elements/lib/color_util.py +3 -3
  26. streamlit/elements/lib/column_types.py +2 -2
  27. streamlit/elements/lib/dialog.py +2 -2
  28. streamlit/elements/lib/event_utils.py +1 -1
  29. streamlit/elements/lib/mutable_status_container.py +1 -1
  30. streamlit/elements/lib/policies.py +3 -3
  31. streamlit/elements/lib/utils.py +5 -5
  32. streamlit/elements/map.py +20 -15
  33. streamlit/elements/progress.py +9 -12
  34. streamlit/elements/vega_charts.py +2 -2
  35. streamlit/elements/widgets/button_group.py +2 -2
  36. streamlit/elements/widgets/data_editor.py +2 -2
  37. streamlit/elements/widgets/multiselect.py +2 -2
  38. streamlit/elements/widgets/selectbox.py +1 -1
  39. streamlit/elements/widgets/slider.py +16 -14
  40. streamlit/elements/write.py +3 -6
  41. streamlit/errors.py +34 -21
  42. streamlit/external/langchain/streamlit_callback_handler.py +2 -2
  43. streamlit/file_util.py +8 -8
  44. streamlit/git_util.py +1 -1
  45. streamlit/hello/dataframe_demo.py +1 -1
  46. streamlit/hello/mapping_demo.py +1 -1
  47. streamlit/navigation/page.py +1 -1
  48. streamlit/proto/Block_pb2.py +38 -29
  49. streamlit/proto/Block_pb2.pyi +68 -4
  50. streamlit/proto/DeckGlJsonChart_pb2.pyi +1 -1
  51. streamlit/proto/GapSize_pb2.py +29 -0
  52. streamlit/proto/GapSize_pb2.pyi +70 -0
  53. streamlit/proto/HeightConfig_pb2.py +27 -0
  54. streamlit/proto/HeightConfig_pb2.pyi +48 -0
  55. streamlit/proto/WidthConfig_pb2.py +2 -2
  56. streamlit/proto/WidthConfig_pb2.pyi +15 -1
  57. streamlit/runtime/app_session.py +2 -2
  58. streamlit/runtime/caching/cache_data_api.py +9 -5
  59. streamlit/runtime/caching/cache_errors.py +3 -3
  60. streamlit/runtime/caching/cache_resource_api.py +7 -7
  61. streamlit/runtime/caching/cache_utils.py +9 -9
  62. streamlit/runtime/caching/cached_message_replay.py +1 -1
  63. streamlit/runtime/caching/hashing.py +70 -74
  64. streamlit/runtime/caching/legacy_cache_api.py +1 -1
  65. streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +3 -1
  66. streamlit/runtime/caching/storage/local_disk_cache_storage.py +1 -1
  67. streamlit/runtime/connection_factory.py +12 -12
  68. streamlit/runtime/context.py +2 -2
  69. streamlit/runtime/credentials.py +3 -3
  70. streamlit/runtime/fragment.py +3 -4
  71. streamlit/runtime/media_file_manager.py +2 -2
  72. streamlit/runtime/memory_media_file_storage.py +1 -1
  73. streamlit/runtime/memory_uploaded_file_manager.py +1 -1
  74. streamlit/runtime/metrics_util.py +5 -6
  75. streamlit/runtime/pages_manager.py +3 -3
  76. streamlit/runtime/runtime.py +1 -1
  77. streamlit/runtime/runtime_util.py +2 -2
  78. streamlit/runtime/scriptrunner/exec_code.py +10 -3
  79. streamlit/runtime/scriptrunner/magic.py +13 -8
  80. streamlit/runtime/scriptrunner/script_runner.py +2 -2
  81. streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
  82. streamlit/runtime/scriptrunner_utils/script_run_context.py +6 -5
  83. streamlit/runtime/secrets.py +8 -11
  84. streamlit/runtime/state/query_params.py +2 -2
  85. streamlit/runtime/state/safe_session_state.py +2 -2
  86. streamlit/runtime/state/session_state.py +17 -15
  87. streamlit/runtime/stats.py +1 -1
  88. streamlit/runtime/uploaded_file_manager.py +1 -1
  89. streamlit/source_util.py +3 -4
  90. streamlit/static/index.html +1 -1
  91. streamlit/static/static/js/{ErrorOutline.esm.BgsGCsV4.js → ErrorOutline.esm.C-0hf1-k.js} +1 -1
  92. streamlit/static/static/js/{FileDownload.esm.CCKezPn5.js → FileDownload.esm.B-fFGI-X.js} +1 -1
  93. streamlit/static/static/js/{FileHelper.CprSF_kT.js → FileHelper.ACYo0OZo.js} +1 -1
  94. streamlit/static/static/js/{FormClearHelper.DiwQ0EtT.js → FormClearHelper.CVNTT-bJ.js} +1 -1
  95. streamlit/static/static/js/{Hooks.DDqhyZ1_.js → Hooks.C3thlpd2.js} +1 -1
  96. streamlit/static/static/js/{InputInstructions.BCEZxme4.js → InputInstructions.CwAxousX.js} +1 -1
  97. streamlit/static/static/js/{ProgressBar.CGdY94g_.js → ProgressBar.xh599Rum.js} +2 -2
  98. streamlit/static/static/js/{RenderInPortalIfExists.uGJp_Q0v.js → RenderInPortalIfExists.CQLIsNPE.js} +1 -1
  99. streamlit/static/static/js/{Toolbar.hTlw0-K1.js → Toolbar.LKdyvP0u.js} +1 -1
  100. streamlit/static/static/js/{index.xsH4HHeE.js → UploadFileInfo.0DCkpDDf.js} +5 -5
  101. streamlit/static/static/js/{base-input.mGTY3-qU.js → base-input.D8OdS4WW.js} +4 -4
  102. streamlit/static/static/js/{checkbox.Cg-5cKAh.js → checkbox.DSdYKlOI.js} +2 -2
  103. streamlit/static/static/js/{createSuper.-HPb1oYT.js → createSuper.B2pyCfWw.js} +1 -1
  104. streamlit/static/static/js/{data-grid-overlay-editor.BpNYxiTp.js → data-grid-overlay-editor.DhO2r0ne.js} +1 -1
  105. streamlit/static/static/js/{downloader.DS9891pS.js → downloader.C24skoDM.js} +1 -1
  106. streamlit/static/static/js/{es6.CU1PEL2w.js → es6.DHkvCKPh.js} +2 -2
  107. streamlit/static/static/js/{iframeResizer.contentWindow.CgJE2bJN.js → iframeResizer.contentWindow.2ckQaC2c.js} +1 -1
  108. streamlit/static/static/js/index.0dGwl8CJ.js +1 -0
  109. streamlit/static/static/js/index.B5A28NpR.js +1 -0
  110. streamlit/static/static/js/{index.BC0ueJ8H.js → index.B5EFweZ4.js} +1 -1
  111. streamlit/static/static/js/{index.CyGuL4If.js → index.BAafqHfB.js} +2 -2
  112. streamlit/static/static/js/{index.DWV80Vyw.js → index.BHTbGZPQ.js} +1 -1
  113. streamlit/static/static/js/index.BNXtQAj4.js +1 -0
  114. streamlit/static/static/js/index.BRhKaVdO.js +1 -0
  115. streamlit/static/static/js/index.BSOiJVQd.js +2 -0
  116. streamlit/static/static/js/{index.GSYBrzVp.js → index.BVgTQbOJ.js} +1 -1
  117. streamlit/static/static/js/{index.BTTj6ld4.js → index.BflIniLm.js} +1 -1
  118. streamlit/static/static/js/{index.DLTqo4pp.js → index.BjeNtZIz.js} +3 -3
  119. streamlit/static/static/js/{index.DZ6oX-v9.js → index.By-NmdnB.js} +161 -161
  120. streamlit/static/static/js/{index.DVpzZJNg.js → index.CIoOEhZ2.js} +1 -1
  121. streamlit/static/static/js/{index.CN91oQMB.js → index.CRCdonis.js} +36 -36
  122. streamlit/static/static/js/index.CRxaBCJ7.js +1 -0
  123. streamlit/static/static/js/index.CU-pbYVN.js +1 -0
  124. streamlit/static/static/js/{index.CzGUd4IN.js → index.CUsk52t2.js} +1 -1
  125. streamlit/static/static/js/{index.BHVQ94t4.js → index.CVO14oQG.js} +2 -2
  126. streamlit/static/static/js/index.CXFuA6J-.js +1 -0
  127. streamlit/static/static/js/{index.DJHUlWgy.js → index.C_dd5q7u.js} +1 -1
  128. streamlit/static/static/js/{index.Bph6ZoI5.js → index.CjWUnKIN.js} +1 -1
  129. streamlit/static/static/js/{index.B209tswL.js → index.CkTL9bAR.js} +256 -256
  130. streamlit/static/static/js/{index.ErkF0SoX.js → index.CsbhsAPy.js} +2 -2
  131. streamlit/static/static/js/{index.hPjr68pz.js → index.CtCnBUtk.js} +1 -1
  132. streamlit/static/static/js/{index.BT0p7gAu.js → index.CwuKadAX.js} +1 -1
  133. streamlit/static/static/js/{index.CtoDsUtq.js → index.D0R7Xh4Z.js} +1 -1
  134. streamlit/static/static/js/index.D2D75EDw.js +73 -0
  135. streamlit/static/static/js/index.D4eMiZ1F.js +1 -0
  136. streamlit/static/static/js/{index.Dh4RKl-F.js → index.D7SCC3z9.js} +1 -1
  137. streamlit/static/static/js/index.DZiilxEt.js +1 -0
  138. streamlit/static/static/js/{index.DtqvdV-p.js → index.Dvr1cEJS.js} +1 -1
  139. streamlit/static/static/js/index.JtIlC6Uq.js +1 -0
  140. streamlit/static/static/js/index.fz_c3Xh_.js +1 -0
  141. streamlit/static/static/js/{index.CvFsF3FD.js → index.gFjPlsMT.js} +1 -1
  142. streamlit/static/static/js/{index.DPJBu2uZ.js → index.jCJYMVED.js} +1 -1
  143. streamlit/static/static/js/index.xldt56AE.js +1 -0
  144. streamlit/static/static/js/{index.Bb-Ukg41.js → index.yzoj_DuM.js} +1 -1
  145. streamlit/static/static/js/{input.DY17i94N.js → input.BP6LX_Bg.js} +2 -2
  146. streamlit/static/static/js/{memory.DsIIcbSd.js → memory.E9x2ZYJv.js} +1 -1
  147. streamlit/static/static/js/{mergeWith.cRgGdgvI.js → mergeWith.CZP2AaVS.js} +1 -1
  148. streamlit/static/static/js/{number-overlay-editor.B8Xi2dYq.js → number-overlay-editor.D-Kl79U_.js} +1 -1
  149. streamlit/static/static/js/{possibleConstructorReturn.BgDi5nUm.js → possibleConstructorReturn.P2ILVC_6.js} +1 -1
  150. streamlit/static/static/js/{sandbox.BH9emp13.js → sandbox.DfzJIGMV.js} +1 -1
  151. streamlit/static/static/js/{textarea.DAyShsGG.js → textarea.4PjzfDWF.js} +2 -2
  152. streamlit/static/static/js/{timepicker.CCH2R2Y0.js → timepicker.DMQdaNzO.js} +1 -1
  153. streamlit/static/static/js/{toConsumableArray.CNffSDCu.js → toConsumableArray.BEdkbHYx.js} +1 -1
  154. streamlit/static/static/js/{uniqueId.B49CstkV.js → uniqueId.CAs7ftHC.js} +1 -1
  155. streamlit/static/static/js/{useBasicWidgetState.CkThOkF9.js → useBasicWidgetState.Cedp0V76.js} +1 -1
  156. streamlit/static/static/js/useOnInputChange.CvRKHHKx.js +1 -0
  157. streamlit/static/static/js/{withFullScreenWrapper.UsvF_Jwr.js → withFullScreenWrapper.BbmjZAzW.js} +1 -1
  158. streamlit/string_util.py +6 -7
  159. streamlit/temporary_directory.py +12 -3
  160. streamlit/testing/v1/app_test.py +11 -6
  161. streamlit/testing/v1/element_tree.py +134 -158
  162. streamlit/testing/v1/local_script_runner.py +5 -5
  163. streamlit/testing/v1/util.py +11 -4
  164. streamlit/type_util.py +3 -4
  165. streamlit/user_info.py +3 -2
  166. streamlit/util.py +1 -1
  167. streamlit/watcher/event_based_path_watcher.py +1 -1
  168. streamlit/watcher/folder_black_list.py +1 -1
  169. streamlit/watcher/local_sources_watcher.py +5 -5
  170. streamlit/watcher/path_watcher.py +1 -1
  171. streamlit/web/bootstrap.py +2 -1
  172. streamlit/web/cli.py +12 -11
  173. streamlit/web/server/browser_websocket_handler.py +1 -1
  174. streamlit/web/server/component_request_handler.py +1 -1
  175. streamlit/web/server/media_file_handler.py +2 -1
  176. streamlit/web/server/oauth_authlib_routes.py +9 -2
  177. streamlit/web/server/oidc_mixin.py +13 -6
  178. streamlit/web/server/routes.py +3 -3
  179. streamlit/web/server/server.py +1 -1
  180. streamlit/web/server/server_util.py +7 -6
  181. streamlit/web/server/upload_file_request_handler.py +5 -5
  182. {streamlit_nightly-1.45.1.dev20250507.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/METADATA +1 -1
  183. {streamlit_nightly-1.45.1.dev20250507.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/RECORD +187 -184
  184. {streamlit_nightly-1.45.1.dev20250507.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/WHEEL +1 -1
  185. streamlit/static/static/js/UploadFileInfo.C-jY39rj.js +0 -1
  186. streamlit/static/static/js/index.BVjgrQ4R.js +0 -1
  187. streamlit/static/static/js/index.BXYstdPh.js +0 -2
  188. streamlit/static/static/js/index.BZ9mqzEJ.js +0 -1
  189. streamlit/static/static/js/index.BhTok8vt.js +0 -1
  190. streamlit/static/static/js/index.CJPcdxPe.js +0 -1
  191. streamlit/static/static/js/index.CMOA-8Q2.js +0 -1
  192. streamlit/static/static/js/index.DAxf3_iz.js +0 -1
  193. streamlit/static/static/js/index.Dn76KVNf.js +0 -1
  194. streamlit/static/static/js/index.OngWTN39.js +0 -1
  195. streamlit/static/static/js/index.PSwG8ayC.js +0 -1
  196. streamlit/static/static/js/index.UTlCdasa.js +0 -73
  197. streamlit/static/static/js/index.eR_vQpeg.js +0 -1
  198. streamlit/static/static/js/index.fLsU9uCJ.js +0 -1
  199. streamlit/static/static/js/index.kXOZCC_6.js +0 -1
  200. streamlit/static/static/js/useOnInputChange.BqEq0xFZ.js +0 -1
  201. {streamlit_nightly-1.45.1.dev20250507.data → streamlit_nightly-1.45.1.dev20250509.data}/scripts/streamlit.cmd +0 -0
  202. {streamlit_nightly-1.45.1.dev20250507.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/entry_points.txt +0 -0
  203. {streamlit_nightly-1.45.1.dev20250507.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/top_level.txt +0 -0
@@ -21,7 +21,7 @@ from __future__ import annotations
21
21
 
22
22
  from collections import ChainMap
23
23
  from copy import deepcopy
24
- from typing import TYPE_CHECKING, cast
24
+ from typing import TYPE_CHECKING, Any, cast
25
25
 
26
26
  from streamlit.connections import BaseConnection
27
27
  from streamlit.connections.util import extract_from_dict
@@ -176,7 +176,7 @@ class SQLConnection(BaseConnection["Engine"]):
176
176
 
177
177
  """
178
178
 
179
- def _connect(self, autocommit: bool = False, **kwargs) -> Engine:
179
+ def _connect(self, autocommit: bool = False, **kwargs: Any) -> Engine:
180
180
  import sqlalchemy
181
181
 
182
182
  kwargs = deepcopy(kwargs)
@@ -217,8 +217,7 @@ class SQLConnection(BaseConnection["Engine"]):
217
217
 
218
218
  if autocommit:
219
219
  return cast("Engine", eng.execution_options(isolation_level="AUTOCOMMIT"))
220
- else:
221
- return cast("Engine", eng)
220
+ return cast("Engine", eng)
222
221
 
223
222
  def query(
224
223
  self,
@@ -228,8 +227,8 @@ class SQLConnection(BaseConnection["Engine"]):
228
227
  ttl: float | int | timedelta | None = None,
229
228
  index_col: str | list[str] | None = None,
230
229
  chunksize: int | None = None,
231
- params=None,
232
- **kwargs,
230
+ params: Any | None = None,
231
+ **kwargs: Any,
233
232
  ) -> DataFrame:
234
233
  """Run a read-only query.
235
234
 
@@ -312,10 +311,10 @@ class SQLConnection(BaseConnection["Engine"]):
312
311
  )
313
312
  def _query(
314
313
  sql: str,
315
- index_col=None,
316
- chunksize=None,
317
- params=None,
318
- **kwargs,
314
+ index_col: str | list[str] | None = None,
315
+ chunksize: int | None = None,
316
+ params: Any | None = None,
317
+ **kwargs: Any,
319
318
  ) -> DataFrame:
320
319
  import pandas as pd
321
320
 
streamlit/cursor.py CHANGED
@@ -91,7 +91,7 @@ class Cursor:
91
91
  def is_locked(self) -> bool:
92
92
  raise NotImplementedError()
93
93
 
94
- def get_locked_cursor(self, **props) -> LockedCursor:
94
+ def get_locked_cursor(self, **props: Any) -> LockedCursor:
95
95
  raise NotImplementedError()
96
96
 
97
97
  @property
@@ -105,7 +105,7 @@ class Cursor:
105
105
 
106
106
 
107
107
  class RunningCursor(Cursor):
108
- def __init__(self, root_container: int, parent_path: tuple[int, ...] = ()):
108
+ def __init__(self, root_container: int, parent_path: tuple[int, ...] = ()) -> None:
109
109
  """A moving pointer to a delta location in the app.
110
110
 
111
111
  RunningCursors auto-increment to the next available location when you
@@ -140,7 +140,7 @@ class RunningCursor(Cursor):
140
140
  def is_locked(self) -> bool:
141
141
  return False
142
142
 
143
- def get_locked_cursor(self, **props) -> LockedCursor:
143
+ def get_locked_cursor(self, **props: Any) -> LockedCursor:
144
144
  locked_cursor = LockedCursor(
145
145
  root_container=self._root_container,
146
146
  parent_path=self._parent_path,
@@ -159,8 +159,8 @@ class LockedCursor(Cursor):
159
159
  root_container: int,
160
160
  parent_path: tuple[int, ...] = (),
161
161
  index: int = 0,
162
- **props,
163
- ):
162
+ **props: Any,
163
+ ) -> None:
164
164
  """A locked pointer to a location in the app.
165
165
 
166
166
  LockedCursors always point to the same location, even when you call
@@ -201,7 +201,7 @@ class LockedCursor(Cursor):
201
201
  def is_locked(self) -> bool:
202
202
  return True
203
203
 
204
- def get_locked_cursor(self, **props) -> LockedCursor:
204
+ def get_locked_cursor(self, **props: Any) -> LockedCursor:
205
205
  self._props = props
206
206
  return self
207
207
 
@@ -100,6 +100,8 @@ from streamlit.runtime.scriptrunner import enqueue_message as _enqueue_message
100
100
  from streamlit.runtime.scriptrunner import get_script_run_ctx
101
101
 
102
102
  if TYPE_CHECKING:
103
+ from types import TracebackType
104
+
103
105
  from google.protobuf.message import Message
104
106
 
105
107
  from streamlit.cursor import Cursor
@@ -301,9 +303,9 @@ class DeltaGenerator(
301
303
 
302
304
  def __exit__(
303
305
  self,
304
- type: Any,
305
- value: Any,
306
- traceback: Any,
306
+ typ: type[BaseException] | None,
307
+ exc: BaseException | None,
308
+ tb: TracebackType | None,
307
309
  ) -> Literal[False]:
308
310
  # with block ended
309
311
 
@@ -365,7 +367,7 @@ class DeltaGenerator(
365
367
 
366
368
  return wrapper
367
369
 
368
- def __deepcopy__(self, _memo):
370
+ def __deepcopy__(self, _memo: Any) -> DeltaGenerator:
369
371
  dg = DeltaGenerator(
370
372
  root_container=self._root_container,
371
373
  cursor=deepcopy(self._cursor),
@@ -406,8 +408,7 @@ class DeltaGenerator(
406
408
  """
407
409
  if self._provided_cursor is None:
408
410
  return cursor.get_container_cursor(self._root_container)
409
- else:
410
- return self._provided_cursor
411
+ return self._provided_cursor
411
412
 
412
413
  @property
413
414
  def _is_top_level(self) -> bool:
@@ -52,7 +52,7 @@ class DeltaGeneratorSingleton:
52
52
  delta_generator_cls: type[DeltaGenerator],
53
53
  status_container_cls: type[StatusContainer],
54
54
  dialog_container_cls: type[Dialog],
55
- ):
55
+ ) -> None:
56
56
  """Registers and initializes all delta-generator classes.
57
57
 
58
58
  Parameters
@@ -138,7 +138,7 @@ class ContextVarWithLazyDefault(Generic[_T]):
138
138
  the default dg (main_dg) might not exist yet when this module is imported.
139
139
  """
140
140
 
141
- def __init__(self, name: str, *, default: Callable[[], _T]):
141
+ def __init__(self, name: str, *, default: Callable[[], _T]) -> None:
142
142
  self._name = name
143
143
  self._default = default
144
144
  self._context_var: ContextVar[_T] | None = None
@@ -188,7 +188,7 @@ def _create_deprecated_obj_wrapper(obj: TObj, show_warning: Callable[[], Any]) -
188
188
  return getattr(obj, attr)
189
189
 
190
190
  @staticmethod
191
- def _get_magic_functions(self_cls) -> list[str]:
191
+ def _get_magic_functions(self_cls: type[object]) -> list[str]:
192
192
  # ignore the handful of magic functions we cannot override without
193
193
  # breaking the Wrapper.
194
194
  ignore = ("__class__", "__dict__", "__getattribute__", "__getattr__")
@@ -645,8 +645,7 @@ class ArrowMixin:
645
645
  )
646
646
  self.dg._enqueue("arrow_data_frame", proto)
647
647
  return cast("DataframeState", widget_state.value)
648
- else:
649
- return self.dg._enqueue("arrow_data_frame", proto)
648
+ return self.dg._enqueue("arrow_data_frame", proto)
650
649
 
651
650
  @gather_metrics("table")
652
651
  def table(self, data: Data = None) -> DeltaGenerator:
@@ -733,7 +732,7 @@ class ArrowMixin:
733
732
  return self.dg._enqueue("arrow_table", proto)
734
733
 
735
734
  @gather_metrics("add_rows")
736
- def add_rows(self, data: Data = None, **kwargs) -> DeltaGenerator | None:
735
+ def add_rows(self, data: Data = None, **kwargs: Any) -> DeltaGenerator | None:
737
736
  """Concatenate a dataframe to the bottom of the current one.
738
737
 
739
738
  Parameters
@@ -269,7 +269,8 @@ class PydeckMixin:
269
269
  selection_mode: Literal[
270
270
  "single-object"
271
271
  ], # Selection mode will only be activated by on_select param; default value here to make it work with mypy
272
- on_select: Literal["ignore"], # No default value here to make it work with mypy
272
+ # No default value here to make it work with mypy
273
+ on_select: Literal["ignore"],
273
274
  key: Key | None = None,
274
275
  ) -> DeltaGenerator: ...
275
276
 
@@ -308,21 +309,26 @@ class PydeckMixin:
308
309
  - DeckGL docs: https://github.com/uber/deck.gl/tree/master/docs
309
310
  - DeckGL JSON docs: https://github.com/uber/deck.gl/tree/master/modules/json
310
311
 
311
- When using this command, Mapbox provides the map tiles to render map
312
- content. Note that Mapbox is a third-party product and Streamlit accepts
313
- no responsibility or liability of any kind for Mapbox or for any content
314
- or information made available by Mapbox.
312
+ When using this command, a service called Carto_ provides the map tiles to render
313
+ map content. If you're using advanced PyDeck features you may need to obtain
314
+ an API key from Carto first. You can do that as
315
+ ``pydeck.Deck(api_keys={"carto": YOUR_KEY})`` or by setting the CARTO_API_KEY
316
+ environment variable. See `PyDeck's documentation`_ for more information.
315
317
 
316
- Mapbox requires users to register and provide a token before users can
317
- request map tiles. Currently, Streamlit provides this token for you, but
318
- this could change at any time. We strongly recommend all users create and
319
- use their own personal Mapbox token to avoid any disruptions to their
320
- experience. You can do this with the ``mapbox.token`` config option. The
321
- use of Mapbox is governed by Mapbox's Terms of Use.
318
+ Another common provider for map tiles is Mapbox_. If you prefer to use that,
319
+ you'll need to create an account at https://mapbox.com and specify your Mapbox
320
+ key when creating the ``pydeck.Deck`` object. You can do that as
321
+ ``pydeck.Deck(api_keys={"mapbox": YOUR_KEY})`` or by setting the MAPBOX_API_KEY
322
+ environment variable.
322
323
 
323
- To get a token for yourself, create an account at https://mapbox.com.
324
- For more info on how to set config options, see
325
- https://docs.streamlit.io/develop/api-reference/configuration/config.toml.
324
+ .. _Carto: https://carto.com
325
+ .. _Mapbox: https://mapbox.com
326
+ .. _PyDeck's documentation: https://deckgl.readthedocs.io/en/latest/deck.html
327
+
328
+ Carto and Mapbox are third-party products and Streamlit accepts no responsibility
329
+ or liability of any kind for Carto or Mapbox, or for any content or information
330
+ made available by Carto or Mapbox. The use of Carto or Mapbox is governed by
331
+ their respective Terms of Use.
326
332
 
327
333
  Parameters
328
334
  ----------
@@ -408,7 +414,7 @@ class PydeckMixin:
408
414
  >>>
409
415
  >>> st.pydeck_chart(
410
416
  ... pdk.Deck(
411
- ... map_style=None,
417
+ ... map_style=None, # Use Streamlit theme to pick map style
412
418
  ... initial_view_state=pdk.ViewState(
413
419
  ... latitude=37.76,
414
420
  ... longitude=-122.4,
@@ -467,7 +473,13 @@ class PydeckMixin:
467
473
  if tooltip:
468
474
  pydeck_proto.tooltip = json.dumps(tooltip)
469
475
 
470
- mapbox_token = config.get_option("mapbox.token")
476
+ # Get the Mapbox key from the PyDeck object first, and then fallback to the
477
+ # old mapbox.token config option.
478
+
479
+ mapbox_token = getattr(pydeck_obj, "mapbox_key", None)
480
+ if mapbox_token is None or mapbox_token == "":
481
+ mapbox_token = config.get_option("mapbox.token")
482
+
471
483
  if mapbox_token:
472
484
  pydeck_proto.mapbox_token = mapbox_token
473
485
 
@@ -476,7 +488,8 @@ class PydeckMixin:
476
488
 
477
489
  if on_select not in ["ignore", "rerun"] and not callable(on_select):
478
490
  raise StreamlitAPIException(
479
- f"You have passed {on_select} to `on_select`. But only 'ignore', 'rerun', or a callable is supported."
491
+ f"You have passed {on_select} to `on_select`. "
492
+ "But only 'ignore', 'rerun', or a callable is supported."
480
493
  )
481
494
 
482
495
  if is_selection_activated:
@@ -15,7 +15,7 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  from functools import wraps
18
- from typing import TYPE_CHECKING, Callable, TypeVar, cast, overload
18
+ from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast, overload
19
19
 
20
20
  from streamlit.delta_generator_singletons import (
21
21
  get_dg_singleton_instance,
@@ -74,7 +74,7 @@ def _dialog_decorator(
74
74
  )
75
75
 
76
76
  @wraps(non_optional_func)
77
- def wrap(*args, **kwargs) -> None:
77
+ def wrap(*args: Any, **kwargs: Any) -> None:
78
78
  _assert_no_nested_dialogs()
79
79
  # Call the Dialog on the event_dg because it lives outside of the normal
80
80
  # Streamlit UI flow. For example, if it is called from the sidebar, it should
@@ -109,7 +109,7 @@ def _dialog_decorator(
109
109
 
110
110
  with dialog:
111
111
  fragmented_dialog_content()
112
- return None
112
+ return
113
113
 
114
114
  return cast("F", wrap)
115
115
 
@@ -168,25 +168,25 @@ def _marshall(
168
168
  doc_string_proto.width_config.CopyFrom(width_config)
169
169
 
170
170
 
171
- def _get_name(obj):
171
+ def _get_name(obj: object) -> str | None:
172
172
  # Try to get the fully-qualified name of the object.
173
173
  # For example: st.help(bar.Baz(123))
174
174
  # The name is bar.Baz
175
175
  name = getattr(obj, "__qualname__", None)
176
176
  if name:
177
- return name
177
+ return cast("str", name)
178
178
 
179
179
  # Try to get the name of the object.
180
180
  # For example: st.help(bar.Baz(123))
181
181
  # The name is Baz
182
- return getattr(obj, "__name__", None)
182
+ return cast("str | None", getattr(obj, "__name__", None))
183
183
 
184
184
 
185
- def _get_module(obj):
185
+ def _get_module(obj: object) -> str | None:
186
186
  return getattr(obj, "__module__", None)
187
187
 
188
188
 
189
- def _get_signature(obj):
189
+ def _get_signature(obj: object) -> str | None:
190
190
  if not inspect.isclass(obj) and not callable(obj):
191
191
  return None
192
192
 
@@ -215,7 +215,7 @@ def _get_signature(obj):
215
215
  return sig
216
216
 
217
217
 
218
- def _get_docstring(obj):
218
+ def _get_docstring(obj: object) -> str | None:
219
219
  doc_string = inspect.getdoc(obj)
220
220
 
221
221
  # Sometimes an object has no docstring, but the object's type does.
@@ -239,7 +239,7 @@ def _get_docstring(obj):
239
239
  return None
240
240
 
241
241
 
242
- def _get_variable_name():
242
+ def _get_variable_name() -> str | None:
243
243
  """Try to get the name of the variable in the current line, as set by the user.
244
244
 
245
245
  For example:
@@ -256,7 +256,7 @@ def _get_variable_name():
256
256
  return _get_variable_name_from_code_str(code)
257
257
 
258
258
 
259
- def _get_variable_name_from_code_str(code):
259
+ def _get_variable_name_from_code_str(code: str) -> str | None:
260
260
  tree = ast.parse(code)
261
261
 
262
262
  # Example:
@@ -295,7 +295,7 @@ def _get_variable_name_from_code_str(code):
295
295
 
296
296
  # If walrus, get name.
297
297
  # E.g. st.help(foo := 123) should give you "foo".
298
- elif type(arg_node) is ast.NamedExpr:
298
+ if type(arg_node) is ast.NamedExpr:
299
299
  # This next "if" will always be true, but need to add this for the type-checking test to
300
300
  # pass.
301
301
  if type(arg_node.target) is ast.Name:
@@ -329,7 +329,7 @@ def _get_variable_name_from_code_str(code):
329
329
  _NEWLINES = re.compile(r"[\n\r]+")
330
330
 
331
331
 
332
- def _get_current_line_of_code_as_str():
332
+ def _get_current_line_of_code_as_str() -> str | None:
333
333
  scriptrunner_frame = _get_scriptrunner_frame()
334
334
 
335
335
  if scriptrunner_frame is None:
@@ -352,7 +352,7 @@ def _get_current_line_of_code_as_str():
352
352
  return re.sub(_NEWLINES, "", code_as_string.strip())
353
353
 
354
354
 
355
- def _get_scriptrunner_frame():
355
+ def _get_scriptrunner_frame() -> inspect.FrameInfo | None:
356
356
  prev_frame = None
357
357
  scriptrunner_frame = None
358
358
 
@@ -375,7 +375,7 @@ def _get_scriptrunner_frame():
375
375
  return scriptrunner_frame
376
376
 
377
377
 
378
- def _is_stcommand(tree, command_name):
378
+ def _is_stcommand(tree: Any, command_name: str) -> bool:
379
379
  """Checks whether the AST in tree is a call for command_name."""
380
380
  root_node = tree.body[0].value
381
381
 
@@ -391,25 +391,25 @@ def _is_stcommand(tree, command_name):
391
391
  )
392
392
 
393
393
 
394
- def _get_stcommand_arg(tree):
394
+ def _get_stcommand_arg(tree: ast.Module) -> ast.expr | None:
395
395
  """Gets the argument node for the st command in tree (AST)."""
396
396
 
397
- root_node = tree.body[0].value
397
+ root_node = tree.body[0].value # type: ignore
398
398
 
399
399
  if root_node.args:
400
- return root_node.args[0]
400
+ return cast("ast.expr", root_node.args[0])
401
401
 
402
402
  return None
403
403
 
404
404
 
405
- def _get_type_as_str(obj):
405
+ def _get_type_as_str(obj: object) -> str:
406
406
  if inspect.isclass(obj):
407
407
  return "class"
408
408
 
409
409
  return str(type(obj).__name__)
410
410
 
411
411
 
412
- def _get_first_line(text):
412
+ def _get_first_line(text: str) -> str:
413
413
  if not text:
414
414
  return ""
415
415
 
@@ -417,7 +417,7 @@ def _get_first_line(text):
417
417
  return left
418
418
 
419
419
 
420
- def _get_weight(value):
420
+ def _get_weight(value: Any) -> int:
421
421
  if inspect.ismodule(value):
422
422
  return 3
423
423
  if inspect.isclass(value):
@@ -485,12 +485,12 @@ def _get_human_readable_value(value):
485
485
  return _shorten(value_str)
486
486
 
487
487
 
488
- def _shorten(s, length=300):
488
+ def _shorten(s: str, length: int = 300) -> str:
489
489
  s = s.strip()
490
490
  return s[:length] + "..." if len(s) > length else s
491
491
 
492
492
 
493
- def _is_computed_property(obj, attr_name):
493
+ def _is_computed_property(obj: object, attr_name: str) -> bool:
494
494
  obj_class = getattr(obj, "__class__", None)
495
495
 
496
496
  if not obj_class:
@@ -28,6 +28,8 @@ from streamlit.errors import (
28
28
  StreamlitInvalidVerticalAlignmentError,
29
29
  )
30
30
  from streamlit.proto.Block_pb2 import Block as BlockProto
31
+ from streamlit.proto.GapSize_pb2 import GapConfig, GapSize
32
+ from streamlit.proto.HeightConfig_pb2 import HeightConfig
31
33
  from streamlit.runtime.metrics_util import gather_metrics
32
34
  from streamlit.string_util import validate_icon_or_emoji
33
35
 
@@ -149,17 +151,21 @@ class LayoutsMixin:
149
151
  key = to_key(key)
150
152
  block_proto = BlockProto()
151
153
  block_proto.allow_empty = False
152
- block_proto.vertical.border = border or False
154
+ block_proto.flex_container.border = border or False
155
+ block_proto.flex_container.wrap = False
153
156
 
154
157
  if height:
155
158
  # Activate scrolling container behavior:
156
159
  block_proto.allow_empty = True
157
- block_proto.vertical.height = height
160
+
161
+ height_config = HeightConfig()
162
+ height_config.pixel_height = height
163
+ block_proto.flex_container.height_config.CopyFrom(height_config)
158
164
  if border is None:
159
165
  # If border is None, we activated the
160
166
  # border as default setting for scrolling
161
167
  # containers.
162
- block_proto.vertical.border = True
168
+ block_proto.flex_container.border = True
163
169
 
164
170
  if key:
165
171
  # At the moment, the ID is only used for extracting the
@@ -348,22 +354,30 @@ class LayoutsMixin:
348
354
  vertical_alignment=vertical_alignment
349
355
  )
350
356
 
351
- def column_gap(gap):
357
+ def column_gap(gap: str) -> GapSize.ValueType:
358
+ gap_mapping = {
359
+ "small": GapSize.SMALL,
360
+ "medium": GapSize.MEDIUM,
361
+ "large": GapSize.LARGE,
362
+ }
363
+
352
364
  if isinstance(gap, str):
353
365
  gap_size = gap.lower()
354
366
  valid_sizes = ["small", "medium", "large"]
355
367
 
356
368
  if gap_size in valid_sizes:
357
- return gap_size
369
+ return gap_mapping[gap_size]
358
370
 
359
371
  raise StreamlitInvalidColumnGapError(gap=gap)
360
372
 
361
373
  gap_size = column_gap(gap)
374
+ gap_config = GapConfig()
375
+ gap_config.gap_size = gap_size
362
376
 
363
377
  def column_proto(normalized_weight: float) -> BlockProto:
364
378
  col_proto = BlockProto()
365
379
  col_proto.column.weight = normalized_weight
366
- col_proto.column.gap = gap_size
380
+ col_proto.column.gap_config.CopyFrom(gap_config)
367
381
  col_proto.column.vertical_alignment = vertical_alignment_mapping[
368
382
  vertical_alignment
369
383
  ]
@@ -372,7 +386,12 @@ class LayoutsMixin:
372
386
  return col_proto
373
387
 
374
388
  block_proto = BlockProto()
375
- block_proto.horizontal.gap = gap_size
389
+ block_proto.flex_container.direction = (
390
+ BlockProto.FlexContainer.Direction.HORIZONTAL
391
+ )
392
+ block_proto.flex_container.wrap = True
393
+ block_proto.flex_container.gap_config.CopyFrom(gap_config)
394
+ block_proto.flex_container.scale = 1
376
395
  row = self.dg._block(block_proto)
377
396
  total_weight = sum(weights)
378
397
  return [row._block(column_proto(w / total_weight)) for w in weights]