streamlit 1.45.0__py3-none-any.whl → 1.46.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. streamlit/__init__.py +5 -1
  2. streamlit/auth_util.py +12 -12
  3. streamlit/cli_util.py +4 -3
  4. streamlit/column_config.py +11 -9
  5. streamlit/commands/echo.py +6 -4
  6. streamlit/commands/execution_control.py +33 -32
  7. streamlit/commands/experimental_query_params.py +2 -2
  8. streamlit/commands/logo.py +9 -4
  9. streamlit/commands/navigation.py +61 -18
  10. streamlit/commands/page_config.py +57 -47
  11. streamlit/components/types/base_custom_component.py +7 -7
  12. streamlit/components/v1/component_registry.py +7 -3
  13. streamlit/components/v1/components.py +1 -1
  14. streamlit/components/v1/custom_component.py +8 -8
  15. streamlit/config.py +289 -144
  16. streamlit/config_option.py +19 -15
  17. streamlit/config_util.py +29 -23
  18. streamlit/connections/__init__.py +2 -2
  19. streamlit/connections/base_connection.py +5 -5
  20. streamlit/connections/snowflake_connection.py +13 -11
  21. streamlit/connections/snowpark_connection.py +3 -3
  22. streamlit/connections/sql_connection.py +20 -18
  23. streamlit/connections/util.py +2 -2
  24. streamlit/cursor.py +6 -6
  25. streamlit/dataframe_util.py +52 -52
  26. streamlit/delta_generator.py +46 -48
  27. streamlit/delta_generator_singletons.py +3 -3
  28. streamlit/deprecation_util.py +6 -6
  29. streamlit/elements/alert.py +37 -29
  30. streamlit/elements/arrow.py +40 -22
  31. streamlit/elements/code.py +46 -13
  32. streamlit/elements/deck_gl_json_chart.py +38 -27
  33. streamlit/elements/dialog_decorator.py +3 -4
  34. streamlit/elements/doc_string.py +64 -58
  35. streamlit/elements/exception.py +23 -27
  36. streamlit/elements/form.py +41 -0
  37. streamlit/elements/graphviz_chart.py +1 -1
  38. streamlit/elements/heading.py +60 -9
  39. streamlit/elements/html.py +3 -4
  40. streamlit/elements/image.py +8 -9
  41. streamlit/elements/json.py +21 -2
  42. streamlit/elements/layouts.py +120 -31
  43. streamlit/elements/lib/built_in_chart_utils.py +96 -73
  44. streamlit/elements/lib/color_util.py +3 -3
  45. streamlit/elements/lib/column_config_utils.py +2 -4
  46. streamlit/elements/lib/column_types.py +14 -8
  47. streamlit/elements/lib/dialog.py +9 -5
  48. streamlit/elements/lib/file_uploader_utils.py +7 -2
  49. streamlit/elements/lib/image_utils.py +39 -40
  50. streamlit/elements/lib/js_number.py +4 -4
  51. streamlit/elements/lib/layout_utils.py +65 -1
  52. streamlit/elements/lib/mutable_status_container.py +14 -3
  53. streamlit/elements/lib/options_selector_utils.py +22 -12
  54. streamlit/elements/lib/pandas_styler_utils.py +25 -21
  55. streamlit/elements/lib/policies.py +6 -5
  56. streamlit/elements/lib/streamlit_plotly_theme.py +54 -53
  57. streamlit/elements/lib/subtitle_utils.py +6 -9
  58. streamlit/elements/lib/utils.py +20 -5
  59. streamlit/elements/map.py +32 -56
  60. streamlit/elements/markdown.py +101 -12
  61. streamlit/elements/media.py +78 -21
  62. streamlit/elements/metric.py +32 -16
  63. streamlit/elements/plotly_chart.py +15 -15
  64. streamlit/elements/progress.py +33 -15
  65. streamlit/elements/spinner.py +31 -6
  66. streamlit/elements/text.py +21 -1
  67. streamlit/elements/toast.py +1 -2
  68. streamlit/elements/vega_charts.py +54 -23
  69. streamlit/elements/widgets/audio_input.py +24 -7
  70. streamlit/elements/widgets/button.py +26 -19
  71. streamlit/elements/widgets/button_group.py +10 -15
  72. streamlit/elements/widgets/camera_input.py +27 -7
  73. streamlit/elements/widgets/chat.py +91 -38
  74. streamlit/elements/widgets/checkbox.py +45 -4
  75. streamlit/elements/widgets/color_picker.py +40 -17
  76. streamlit/elements/widgets/data_editor.py +76 -37
  77. streamlit/elements/widgets/file_uploader.py +42 -13
  78. streamlit/elements/widgets/multiselect.py +7 -10
  79. streamlit/elements/widgets/number_input.py +123 -47
  80. streamlit/elements/widgets/radio.py +59 -13
  81. streamlit/elements/widgets/select_slider.py +35 -30
  82. streamlit/elements/widgets/selectbox.py +56 -9
  83. streamlit/elements/widgets/slider.py +190 -99
  84. streamlit/elements/widgets/text_widgets.py +54 -8
  85. streamlit/elements/widgets/time_widgets.py +53 -14
  86. streamlit/elements/write.py +5 -8
  87. streamlit/env_util.py +2 -7
  88. streamlit/error_util.py +16 -9
  89. streamlit/errors.py +69 -48
  90. streamlit/external/langchain/streamlit_callback_handler.py +10 -5
  91. streamlit/file_util.py +27 -10
  92. streamlit/git_util.py +29 -24
  93. streamlit/hello/animation_demo.py +9 -9
  94. streamlit/hello/dataframe_demo.py +5 -5
  95. streamlit/hello/hello.py +1 -0
  96. streamlit/hello/mapping_demo.py +7 -8
  97. streamlit/hello/plotting_demo.py +3 -3
  98. streamlit/hello/streamlit_app.py +28 -26
  99. streamlit/hello/utils.py +2 -1
  100. streamlit/logger.py +10 -11
  101. streamlit/navigation/page.py +11 -8
  102. streamlit/proto/Audio_pb2.py +4 -3
  103. streamlit/proto/Audio_pb2.pyi +8 -1
  104. streamlit/proto/Block_pb2.py +38 -29
  105. streamlit/proto/Block_pb2.pyi +72 -4
  106. streamlit/proto/ClientState_pb2.py +4 -4
  107. streamlit/proto/ClientState_pb2.pyi +7 -2
  108. streamlit/proto/Code_pb2.py +4 -2
  109. streamlit/proto/Code_pb2.pyi +1 -0
  110. streamlit/proto/DataFrame_pb2.pyi +1 -1
  111. streamlit/proto/DeckGlJsonChart_pb2.pyi +1 -1
  112. streamlit/proto/Element_pb2.py +5 -3
  113. streamlit/proto/Element_pb2.pyi +20 -3
  114. streamlit/proto/GapSize_pb2.py +29 -0
  115. streamlit/proto/GapSize_pb2.pyi +70 -0
  116. streamlit/proto/HeightConfig_pb2.py +27 -0
  117. streamlit/proto/HeightConfig_pb2.pyi +48 -0
  118. streamlit/proto/NamedDataSet_pb2.pyi +1 -1
  119. streamlit/proto/Navigation_pb2.py +3 -3
  120. streamlit/proto/Navigation_pb2.pyi +4 -0
  121. streamlit/proto/NewSession_pb2.py +18 -16
  122. streamlit/proto/NewSession_pb2.pyi +29 -3
  123. streamlit/proto/PageConfig_pb2.py +7 -7
  124. streamlit/proto/PageConfig_pb2.pyi +21 -1
  125. streamlit/proto/Video_pb2.py +8 -7
  126. streamlit/proto/Video_pb2.pyi +8 -1
  127. streamlit/proto/WidthConfig_pb2.py +2 -2
  128. streamlit/proto/WidthConfig_pb2.pyi +15 -1
  129. streamlit/runtime/__init__.py +1 -1
  130. streamlit/runtime/app_session.py +53 -40
  131. streamlit/runtime/caching/__init__.py +9 -9
  132. streamlit/runtime/caching/cache_data_api.py +36 -30
  133. streamlit/runtime/caching/cache_errors.py +4 -4
  134. streamlit/runtime/caching/cache_resource_api.py +8 -8
  135. streamlit/runtime/caching/cache_utils.py +15 -14
  136. streamlit/runtime/caching/cached_message_replay.py +14 -8
  137. streamlit/runtime/caching/hashing.py +91 -97
  138. streamlit/runtime/caching/legacy_cache_api.py +2 -2
  139. streamlit/runtime/caching/storage/cache_storage_protocol.py +1 -1
  140. streamlit/runtime/caching/storage/dummy_cache_storage.py +1 -1
  141. streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +12 -14
  142. streamlit/runtime/caching/storage/local_disk_cache_storage.py +6 -6
  143. streamlit/runtime/connection_factory.py +36 -36
  144. streamlit/runtime/context.py +58 -9
  145. streamlit/runtime/credentials.py +29 -40
  146. streamlit/runtime/forward_msg_queue.py +11 -11
  147. streamlit/runtime/fragment.py +7 -7
  148. streamlit/runtime/media_file_manager.py +3 -4
  149. streamlit/runtime/memory_media_file_storage.py +6 -5
  150. streamlit/runtime/memory_uploaded_file_manager.py +2 -2
  151. streamlit/runtime/metrics_util.py +11 -12
  152. streamlit/runtime/pages_manager.py +4 -6
  153. streamlit/runtime/runtime.py +8 -6
  154. streamlit/runtime/runtime_util.py +7 -6
  155. streamlit/runtime/scriptrunner/__init__.py +4 -4
  156. streamlit/runtime/scriptrunner/exec_code.py +12 -5
  157. streamlit/runtime/scriptrunner/magic.py +16 -12
  158. streamlit/runtime/scriptrunner/script_cache.py +1 -1
  159. streamlit/runtime/scriptrunner/script_runner.py +55 -34
  160. streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
  161. streamlit/runtime/scriptrunner_utils/script_requests.py +7 -4
  162. streamlit/runtime/scriptrunner_utils/script_run_context.py +10 -23
  163. streamlit/runtime/secrets.py +40 -35
  164. streamlit/runtime/session_manager.py +2 -1
  165. streamlit/runtime/state/__init__.py +5 -5
  166. streamlit/runtime/state/common.py +2 -2
  167. streamlit/runtime/state/query_params.py +13 -15
  168. streamlit/runtime/state/query_params_proxy.py +17 -13
  169. streamlit/runtime/state/safe_session_state.py +2 -2
  170. streamlit/runtime/state/session_state.py +52 -34
  171. streamlit/runtime/stats.py +2 -2
  172. streamlit/runtime/uploaded_file_manager.py +1 -1
  173. streamlit/runtime/websocket_session_manager.py +10 -6
  174. streamlit/source_util.py +8 -6
  175. streamlit/static/index.html +3 -17
  176. streamlit/static/manifest.json +1180 -0
  177. streamlit/static/static/css/{index.DqDwtg6_.css → index.CJVRHjQZ.css} +1 -1
  178. streamlit/static/static/js/{ErrorOutline.esm.DyIfDYvY.js → ErrorOutline.esm.6PVAQvlT.js} +1 -1
  179. streamlit/static/static/js/{FileDownload.esm.kF1FCxeJ.js → FileDownload.esm.BZQHC61b.js} +1 -1
  180. streamlit/static/static/js/{FileHelper.DKt6tIeO.js → FileHelper.Bn1VShMJ.js} +5 -5
  181. streamlit/static/static/js/{FormClearHelper.DpJR9YCu.js → FormClearHelper.CsFEiTNN.js} +1 -1
  182. streamlit/static/static/js/{Hooks.BT6PF2Zi.js → Hooks.DguOHQL1.js} +1 -1
  183. streamlit/static/static/js/{InputInstructions.BmnD4oa3.js → InputInstructions.CTYn2BJQ.js} +1 -1
  184. streamlit/static/static/js/{ProgressBar.Ch7VNdkM.js → ProgressBar.CPOGBKCi.js} +2 -2
  185. streamlit/static/static/js/{RenderInPortalIfExists.43tDswzK.js → RenderInPortalIfExists.BYu_CZaF.js} +1 -1
  186. streamlit/static/static/js/Toolbar.gXKw7ANv.js +1 -0
  187. streamlit/static/static/js/UploadFileInfo.0DCkpDDf.js +6 -0
  188. streamlit/static/static/js/{base-input.BjeC3XFX.js → base-input.DBYPj91R.js} +4 -4
  189. streamlit/static/static/js/{checkbox.DIVN0GOS.js → checkbox.BUm2vnNv.js} +2 -2
  190. streamlit/static/static/js/{createSuper.CKyBiJe0.js → createSuper.KD4RuZ-W.js} +1 -1
  191. streamlit/static/static/js/{data-grid-overlay-editor.CXpaXRk5.js → data-grid-overlay-editor.CUwpDfvI.js} +1 -1
  192. streamlit/static/static/js/{downloader.B-uWAyLB.js → downloader.CkDtclup.js} +1 -1
  193. streamlit/static/static/js/{es6._eGNfJ2i.js → es6.Dlcvh_r0.js} +2 -2
  194. streamlit/static/static/js/{iframeResizer.contentWindow.CebQfV1Q.js → iframeResizer.contentWindow.DOXlFfve.js} +1 -1
  195. streamlit/static/static/js/{index.EbMzSayc.js → index.B0cuGMAB.js} +25 -25
  196. streamlit/static/static/js/index.BCWTclSV.js +73 -0
  197. streamlit/static/static/js/index.BJY_fap7.js +1 -0
  198. streamlit/static/static/js/index.BL3l6dnk.js +1 -0
  199. streamlit/static/static/js/{index.CpV1hnf8.js → index.BMZzRZjB.js} +1 -1
  200. streamlit/static/static/js/{index.l6QfBDTC.js → index.BOzUTGDe.js} +1 -1
  201. streamlit/static/static/js/index.BYI5iO-o.js +1 -0
  202. streamlit/static/static/js/index.BYo0ywlm.js +783 -0
  203. streamlit/static/static/js/{index.CuUJHsRK.js → index.BYz9btsY.js} +1 -1
  204. streamlit/static/static/js/{index.C_nMqHLH.js → index.CCVzQz0Z.js} +2 -2
  205. streamlit/static/static/js/index.CD6FydK9.js +1 -0
  206. streamlit/static/static/js/index.CDYEqgC8.js +2 -0
  207. streamlit/static/static/js/{index.BAdBHmJD.js → index.CMP9c4xA.js} +1 -1
  208. streamlit/static/static/js/index.CN30QAPD.js +1 -0
  209. streamlit/static/static/js/{index.CtTgot1Z.js → index.CNqWQkTe.js} +1 -1
  210. streamlit/static/static/js/index.CaxS67Xz.js +1 -0
  211. streamlit/static/static/js/{index.HsXxdgGd.js → index.CbsT4sGW.js} +1 -1
  212. streamlit/static/static/js/index.ChAVlxpQ.js +1 -0
  213. streamlit/static/static/js/{index.BaYSBSaz.js → index.ClLMMmDd.js} +1 -1
  214. streamlit/static/static/js/{index.CxxktCLw.js → index.D-O9rQmV.js} +1 -1
  215. streamlit/static/static/js/{index.Coc8OVG7.js → index.D4k7VZZL.js} +1 -1
  216. streamlit/static/static/js/index.DLBi0Ar1.js +1 -0
  217. streamlit/static/static/js/index.DVq5XmJo.js +197 -0
  218. streamlit/static/static/js/{index.ClX0ambk.js → index.DZKmKXWw.js} +1 -1
  219. streamlit/static/static/js/index.DkaVx80F.js +1 -0
  220. streamlit/static/static/js/index.Dr968Klx.js +1 -0
  221. streamlit/static/static/js/{index.BaozEIL-.js → index.DtUYLn9j.js} +20 -20
  222. streamlit/static/static/js/index.DwjYSyhs.js +1 -0
  223. streamlit/static/static/js/index.DzrImxu4.js +1 -0
  224. streamlit/static/static/js/index.HyGsn4VM.js +1 -0
  225. streamlit/static/static/js/index.OwxC65od.js +12 -0
  226. streamlit/static/static/js/index.PZs7VZkC.js +1 -0
  227. streamlit/static/static/js/index.Voiqpj4q.js +1 -0
  228. streamlit/static/static/js/index.bSROvR-J.js +3 -0
  229. streamlit/static/static/js/index.oT9GD3l4.js +1 -0
  230. streamlit/static/static/js/{index.schmj9D9.js → index.qb-yAPH6.js} +255 -255
  231. streamlit/static/static/js/index.rJFy_Ygy.js +2 -0
  232. streamlit/static/static/js/{input.VQEe_bZy.js → input.CwQtEnFN.js} +2 -2
  233. streamlit/static/static/js/{memory.DGVHab07.js → memory.C5XaFIjR.js} +1 -1
  234. streamlit/static/static/js/{mergeWith.-RIuUGoA.js → mergeWith.DzwwH6AG.js} +1 -1
  235. streamlit/static/static/js/{number-overlay-editor.wzFLIbEE.js → number-overlay-editor.Dx0XqCkD.js} +1 -1
  236. streamlit/static/static/js/{possibleConstructorReturn.GIObu6rf.js → possibleConstructorReturn.CVfSu9Ws.js} +1 -1
  237. streamlit/static/static/js/{sandbox.DpjSeqe2.js → sandbox.BT0gdMXk.js} +1 -1
  238. streamlit/static/static/js/{textarea.Dz0J9LZe.js → textarea.DNCbrtbM.js} +2 -2
  239. streamlit/static/static/js/{timepicker.BLgJZnzX.js → timepicker.4UYJD9Ts.js} +1 -1
  240. streamlit/static/static/js/{toConsumableArray.0OZlxz7U.js → toConsumableArray.DUmnaVWV.js} +1 -1
  241. streamlit/static/static/js/{uniqueId.DbzplC8D.js → uniqueId.DUvh-GL8.js} +1 -1
  242. streamlit/static/static/js/{useBasicWidgetState.COJZng1S.js → useBasicWidgetState.Cwd7-jJa.js} +1 -1
  243. streamlit/static/static/js/useOnInputChange.DvemQrOM.js +1 -0
  244. streamlit/static/static/js/{withFullScreenWrapper.CzWvNbvi.js → withFullScreenWrapper.CiQ10ByU.js} +1 -1
  245. streamlit/static/static/media/SourceCodeVF-Italic.ttf.Ba1oaZG1.woff2 +0 -0
  246. streamlit/static/static/media/SourceCodeVF-Upright.ttf.BjWn63N-.woff2 +0 -0
  247. streamlit/static/static/media/SourceSansVF-Italic.ttf.Bt9VkdQ3.woff2 +0 -0
  248. streamlit/static/static/media/SourceSansVF-Upright.ttf.BsWL4Kly.woff2 +0 -0
  249. streamlit/static/static/media/SourceSerifVariable-Italic.ttf.CVdzAtxO.woff2 +0 -0
  250. streamlit/static/static/media/SourceSerifVariable-Roman.ttf.mdpVL9bi.woff2 +0 -0
  251. streamlit/string_util.py +14 -19
  252. streamlit/temporary_directory.py +13 -4
  253. streamlit/testing/v1/app_test.py +15 -10
  254. streamlit/testing/v1/element_tree.py +157 -178
  255. streamlit/testing/v1/local_script_runner.py +11 -15
  256. streamlit/testing/v1/util.py +11 -4
  257. streamlit/type_util.py +8 -12
  258. streamlit/url_util.py +1 -1
  259. streamlit/user_info.py +6 -5
  260. streamlit/util.py +25 -1
  261. streamlit/vendor/pympler/asizeof.py +3 -2
  262. streamlit/watcher/event_based_path_watcher.py +15 -1
  263. streamlit/watcher/folder_black_list.py +2 -2
  264. streamlit/watcher/local_sources_watcher.py +64 -18
  265. streamlit/watcher/path_watcher.py +6 -10
  266. streamlit/watcher/polling_path_watcher.py +8 -7
  267. streamlit/watcher/util.py +7 -6
  268. streamlit/web/bootstrap.py +16 -14
  269. streamlit/web/cli.py +52 -45
  270. streamlit/web/server/__init__.py +7 -3
  271. streamlit/web/server/app_static_file_handler.py +1 -1
  272. streamlit/web/server/authlib_tornado_integration.py +9 -4
  273. streamlit/web/server/browser_websocket_handler.py +8 -2
  274. streamlit/web/server/component_request_handler.py +14 -10
  275. streamlit/web/server/media_file_handler.py +14 -7
  276. streamlit/web/server/oauth_authlib_routes.py +41 -9
  277. streamlit/web/server/oidc_mixin.py +35 -17
  278. streamlit/web/server/routes.py +32 -22
  279. streamlit/web/server/server.py +6 -18
  280. streamlit/web/server/server_util.py +19 -9
  281. streamlit/web/server/stats_request_handler.py +7 -5
  282. streamlit/web/server/upload_file_request_handler.py +22 -19
  283. streamlit/web/server/websocket_headers.py +1 -1
  284. {streamlit-1.45.0.dist-info → streamlit-1.46.0.dist-info}/METADATA +4 -4
  285. streamlit-1.46.0.dist-info/RECORD +559 -0
  286. {streamlit-1.45.0.dist-info → streamlit-1.46.0.dist-info}/WHEEL +1 -1
  287. streamlit/elements/lib/event_utils.py +0 -39
  288. streamlit/static/static/js/Toolbar.HTGsjfCP.js +0 -1
  289. streamlit/static/static/js/UploadFileInfo.C-jY39rj.js +0 -1
  290. streamlit/static/static/js/index.B5TWFN5r.js +0 -1
  291. streamlit/static/static/js/index.BI9-p_-s.js +0 -3
  292. streamlit/static/static/js/index.BYHnDZYn.js +0 -1
  293. streamlit/static/static/js/index.B_M97aPz.js +0 -1
  294. streamlit/static/static/js/index.BdN5swP0.js +0 -1
  295. streamlit/static/static/js/index.BfCAp_Sj.js +0 -1
  296. streamlit/static/static/js/index.BqDl3eRM.js +0 -779
  297. streamlit/static/static/js/index.C0VtYb3T.js +0 -2
  298. streamlit/static/static/js/index.C1qW_Owy.js +0 -1
  299. streamlit/static/static/js/index.C4AcBARa.js +0 -1
  300. streamlit/static/static/js/index.CCOiJRk1.js +0 -1
  301. streamlit/static/static/js/index.COvpza5W.js +0 -1
  302. streamlit/static/static/js/index.C_9qGjbK.js +0 -2
  303. streamlit/static/static/js/index.CqISBfsc.js +0 -197
  304. streamlit/static/static/js/index.D1WOs2Ce.js +0 -1
  305. streamlit/static/static/js/index.DQljs-9e.js +0 -1
  306. streamlit/static/static/js/index.DZqX4P_2.js +0 -1
  307. streamlit/static/static/js/index.DajIfBOb.js +0 -1
  308. streamlit/static/static/js/index.DuOXre0H.js +0 -1
  309. streamlit/static/static/js/index.EWD98YhP.js +0 -1
  310. streamlit/static/static/js/index.LaZloCTl.js +0 -73
  311. streamlit/static/static/js/index.S_1klBoy.js +0 -1
  312. streamlit/static/static/js/index.b0Gf958T.js +0 -12
  313. streamlit/static/static/js/index.t--hEgTQ.js +0 -6
  314. streamlit/static/static/js/useOnInputChange.CgOwAHyw.js +0 -1
  315. streamlit/static/static/media/SourceCodePro-Bold.CFEfr7-q.woff2 +0 -0
  316. streamlit/static/static/media/SourceCodePro-BoldItalic.C-LkFXxa.woff2 +0 -0
  317. streamlit/static/static/media/SourceCodePro-Italic.CxFOx7N-.woff2 +0 -0
  318. streamlit/static/static/media/SourceCodePro-Regular.CBOlD63d.woff2 +0 -0
  319. streamlit/static/static/media/SourceCodePro-SemiBold.CFHwW3Wd.woff2 +0 -0
  320. streamlit/static/static/media/SourceCodePro-SemiBoldItalic.Cg2yRu82.woff2 +0 -0
  321. streamlit/static/static/media/SourceSansPro-Bold.-6c9oR8J.woff2 +0 -0
  322. streamlit/static/static/media/SourceSansPro-BoldItalic.DmM_grLY.woff2 +0 -0
  323. streamlit/static/static/media/SourceSansPro-Italic.I1ipWe7Q.woff2 +0 -0
  324. streamlit/static/static/media/SourceSansPro-Regular.DZLUzqI4.woff2 +0 -0
  325. streamlit/static/static/media/SourceSansPro-SemiBold.sKQIyTMz.woff2 +0 -0
  326. streamlit/static/static/media/SourceSansPro-SemiBoldItalic.C0wP0icr.woff2 +0 -0
  327. streamlit/static/static/media/SourceSerifPro-Bold.8TUnKj4x.woff2 +0 -0
  328. streamlit/static/static/media/SourceSerifPro-BoldItalic.CBVO7Ve7.woff2 +0 -0
  329. streamlit/static/static/media/SourceSerifPro-Italic.DkFgL2HZ.woff2 +0 -0
  330. streamlit/static/static/media/SourceSerifPro-Regular.CNJNET2S.woff2 +0 -0
  331. streamlit/static/static/media/SourceSerifPro-SemiBold.CHyh9GC5.woff2 +0 -0
  332. streamlit/static/static/media/SourceSerifPro-SemiBoldItalic.CBtz8sWN.woff2 +0 -0
  333. streamlit-1.45.0.dist-info/RECORD +0 -568
  334. {streamlit-1.45.0.data → streamlit-1.46.0.data}/scripts/streamlit.cmd +0 -0
  335. {streamlit-1.45.0.dist-info → streamlit-1.46.0.dist-info}/entry_points.txt +0 -0
  336. {streamlit-1.45.0.dist-info → streamlit-1.46.0.dist-info}/top_level.txt +0 -0
@@ -104,9 +104,7 @@ def _srt_to_vtt(srt_data: str | bytes) -> bytes:
104
104
  # Add WebVTT file header
105
105
  vtt_content = "WEBVTT\n\n" + vtt_data
106
106
  # Convert the vtt content to bytes
107
- vtt_content = vtt_content.strip().encode("utf-8")
108
-
109
- return vtt_content
107
+ return vtt_content.strip().encode("utf-8")
110
108
 
111
109
 
112
110
  def _handle_string_or_path_data(data_or_path: str | Path) -> bytes:
@@ -123,14 +121,14 @@ def _handle_string_or_path_data(data_or_path: str | Path) -> bytes:
123
121
  with open(data_or_path, "rb") as file:
124
122
  content = file.read()
125
123
  return _srt_to_vtt(content) if file_extension == ".srt" else content
126
- elif isinstance(data_or_path, Path):
127
- raise ValueError(f"File {data_or_path} does not exist.")
124
+ if isinstance(data_or_path, Path):
125
+ raise ValueError(f"File {data_or_path} does not exist.") # noqa: TRY004
128
126
 
129
127
  content_string = data_or_path.strip()
130
128
 
131
129
  if content_string.startswith("WEBVTT") or content_string == "":
132
130
  return content_string.encode("utf-8")
133
- elif _is_srt(content_string):
131
+ if _is_srt(content_string):
134
132
  return _srt_to_vtt(content_string)
135
133
  raise ValueError("The provided string neither matches valid VTT nor SRT format.")
136
134
 
@@ -173,6 +171,5 @@ def process_subtitle_data(
173
171
  )
174
172
  caching.save_media_data(subtitle_data, "text/vtt", coordinates)
175
173
  return file_url
176
- else:
177
- # When running in "raw mode", we can't access the MediaFileManager.
178
- return ""
174
+ # When running in "raw mode", we can't access the MediaFileManager.
175
+ return ""
@@ -31,6 +31,7 @@ from streamlit import config
31
31
  from streamlit.errors import StreamlitDuplicateElementId, StreamlitDuplicateElementKey
32
32
  from streamlit.proto.ChatInput_pb2 import ChatInput
33
33
  from streamlit.proto.LabelVisibilityMessage_pb2 import LabelVisibilityMessage
34
+ from streamlit.proto.RootContainer_pb2 import RootContainer
34
35
  from streamlit.runtime.scriptrunner_utils.script_run_context import (
35
36
  ScriptRunContext,
36
37
  get_script_run_ctx,
@@ -45,6 +46,8 @@ if TYPE_CHECKING:
45
46
  from builtins import ellipsis
46
47
  from collections.abc import Iterable
47
48
 
49
+ from streamlit.delta_generator import DeltaGenerator
50
+
48
51
 
49
52
  Key: TypeAlias = Union[str, int]
50
53
 
@@ -70,9 +73,9 @@ def get_label_visibility_proto_value(
70
73
 
71
74
  if label_visibility_string == "visible":
72
75
  return LabelVisibilityMessage.LabelVisibilityOptions.VISIBLE
73
- elif label_visibility_string == "hidden":
76
+ if label_visibility_string == "hidden":
74
77
  return LabelVisibilityMessage.LabelVisibilityOptions.HIDDEN
75
- elif label_visibility_string == "collapsed":
78
+ if label_visibility_string == "collapsed":
76
79
  return LabelVisibilityMessage.LabelVisibilityOptions.COLLAPSED
77
80
 
78
81
  raise ValueError(f"Unknown label visibility value: {label_visibility_string}")
@@ -85,9 +88,9 @@ def get_chat_input_accept_file_proto_value(
85
88
 
86
89
  if accept_file_value is False:
87
90
  return ChatInput.AcceptFile.NONE
88
- elif accept_file_value is True:
91
+ if accept_file_value is True:
89
92
  return ChatInput.AcceptFile.SINGLE
90
- elif accept_file_value == "multiple":
93
+ if accept_file_value == "multiple":
91
94
  return ChatInput.AcceptFile.MULTIPLE
92
95
 
93
96
  raise ValueError(f"Unknown accept file value: {accept_file_value}")
@@ -182,6 +185,7 @@ def compute_and_register_element_id(
182
185
  *,
183
186
  user_key: str | None,
184
187
  form_id: str | None,
188
+ dg: DeltaGenerator | None = None,
185
189
  **kwargs: SAFE_VALUES | Iterable[SAFE_VALUES],
186
190
  ) -> str:
187
191
  """Compute and register the ID for the given element.
@@ -212,6 +216,9 @@ def compute_and_register_element_id(
212
216
  The ID of the form that the element belongs to. `None` or empty string
213
217
  if the element doesn't belong to a form or doesn't support forms.
214
218
 
219
+ dg : DeltaGenerator | None
220
+ The DeltaGenerator of each element. `None` if the element is not a widget.
221
+
215
222
  kwargs : SAFE_VALUES | Iterable[SAFE_VALUES]
216
223
  The arguments to use to compute the element ID.
217
224
  The arguments must be stable, deterministic values.
@@ -229,6 +236,14 @@ def compute_and_register_element_id(
229
236
  # pages unique IDs.
230
237
  kwargs_to_use["active_script_hash"] = ctx.active_script_hash
231
238
 
239
+ if dg:
240
+ # If no key is provided and the widget element is inside the sidebar area
241
+ # add it to the kwargs
242
+ # allowing the same widget to be both in main area and sidebar.
243
+ active_dg_root_container = dg._active_dg._root_container
244
+ if active_dg_root_container == RootContainer.SIDEBAR and user_key is None:
245
+ kwargs_to_use["active_dg_root_container"] = str(active_dg_root_container)
246
+
232
247
  element_id = _compute_element_id(
233
248
  element_type,
234
249
  user_key,
@@ -240,7 +255,7 @@ def compute_and_register_element_id(
240
255
  return element_id
241
256
 
242
257
 
243
- def save_for_app_testing(ctx: ScriptRunContext, k: str, v: Any):
258
+ def save_for_app_testing(ctx: ScriptRunContext, k: str, v: Any) -> None:
244
259
  if config.get_option("global.appTest"):
245
260
  try:
246
261
  ctx.session_state[TESTING_KEY][k] = v
streamlit/elements/map.py CHANGED
@@ -20,8 +20,8 @@ import copy
20
20
  import json
21
21
  from typing import TYPE_CHECKING, Any, Final, cast
22
22
 
23
- import streamlit.elements.deck_gl_json_chart as deck_gl_json_chart
24
23
  from streamlit import config, dataframe_util
24
+ from streamlit.elements import deck_gl_json_chart
25
25
  from streamlit.elements.lib.color_util import (
26
26
  Color,
27
27
  IntColorTuple,
@@ -94,21 +94,26 @@ class MapMixin:
94
94
  This is a wrapper around ``st.pydeck_chart`` to quickly create
95
95
  scatterplot charts on top of a map, with auto-centering and auto-zoom.
96
96
 
97
- When using this command, Mapbox provides the map tiles to render map
98
- content. Note that Mapbox is a third-party product and Streamlit accepts
99
- no responsibility or liability of any kind for Mapbox or for any content
100
- or information made available by Mapbox.
97
+ When using this command, a service called Carto_ provides the map tiles to render
98
+ map content. If you're using advanced PyDeck features you may need to obtain
99
+ an API key from Carto first. You can do that as
100
+ ``pydeck.Deck(api_keys={"carto": YOUR_KEY})`` or by setting the CARTO_API_KEY
101
+ environment variable. See `PyDeck's documentation`_ for more information.
101
102
 
102
- Mapbox requires users to register and provide a token before users can
103
- request map tiles. Currently, Streamlit provides this token for you, but
104
- this could change at any time. We strongly recommend all users create and
105
- use their own personal Mapbox token to avoid any disruptions to their
106
- experience. You can do this with the ``mapbox.token`` config option. The
107
- use of Mapbox is governed by Mapbox's Terms of Use.
103
+ Another common provider for map tiles is Mapbox_. If you prefer to use that,
104
+ you'll need to create an account at https://mapbox.com and specify your Mapbox
105
+ key when creating the ``pydeck.Deck`` object. You can do that as
106
+ ``pydeck.Deck(api_keys={"mapbox": YOUR_KEY})`` or by setting the MAPBOX_API_KEY
107
+ environment variable.
108
108
 
109
- To get a token for yourself, create an account at https://mapbox.com.
110
- For more info on how to set config options, see
111
- https://docs.streamlit.io/develop/api-reference/configuration/config.toml.
109
+ .. _Carto: https://carto.com
110
+ .. _Mapbox: https://mapbox.com
111
+ .. _PyDeck's documentation: https://deckgl.readthedocs.io/en/latest/deck.html
112
+
113
+ Carto and Mapbox are third-party products and Streamlit accepts no responsibility
114
+ or liability of any kind for Carto or Mapbox, or for any content or information
115
+ made available by Carto or Mapbox. The use of Carto or Mapbox is governed by
116
+ their respective Terms of Use.
112
117
 
113
118
  Parameters
114
119
  ----------
@@ -225,23 +230,8 @@ class MapMixin:
225
230
  height: 600px
226
231
 
227
232
  """
228
- # This feature was turned off while we investigate why different
229
- # map styles cause DeckGL to crash.
230
- #
231
- # For reference, this was the docstring for map_style:
232
- #
233
- # map_style : str or None
234
- # One of Mapbox's map style URLs. A full list can be found here:
235
- # https://docs.mapbox.com/api/maps/styles/#mapbox-styles
236
- #
237
- # This feature requires a Mapbox token. See the top of these docs
238
- # for information on how to get one and set it up in Streamlit.
239
- #
240
- map_style = None
241
233
  map_proto = DeckGlJsonChartProto()
242
- deck_gl_json = to_deckgl_json(
243
- data, latitude, longitude, size, color, map_style, zoom
244
- )
234
+ deck_gl_json = to_deckgl_json(data, latitude, longitude, size, color, zoom)
245
235
  marshall(
246
236
  map_proto, deck_gl_json, use_container_width, width=width, height=height
247
237
  )
@@ -259,7 +249,6 @@ def to_deckgl_json(
259
249
  lon: str | None,
260
250
  size: None | str | float,
261
251
  color: None | str | Collection[float],
262
- map_style: str | None,
263
252
  zoom: int | None,
264
253
  ) -> str:
265
254
  if data is None:
@@ -291,7 +280,7 @@ def to_deckgl_json(
291
280
  )
292
281
  df = df[used_columns]
293
282
 
294
- color_arg = _convert_color_arg_or_column(df, color_arg, color_col_name)
283
+ converted_color_arg = _convert_color_arg_or_column(df, color_arg, color_col_name)
295
284
 
296
285
  zoom, center_lat, center_lon = _get_viewport_details(
297
286
  df, lat_col_name, lon_col_name, zoom
@@ -308,19 +297,11 @@ def to_deckgl_json(
308
297
  "getRadius": size_arg,
309
298
  "radiusMinPixels": 3,
310
299
  "radiusUnits": "meters",
311
- "getFillColor": color_arg,
300
+ "getFillColor": converted_color_arg,
312
301
  "data": df.to_dict("records"),
313
302
  }
314
303
  ]
315
304
 
316
- if map_style:
317
- if not config.get_option("mapbox.token"):
318
- raise StreamlitAPIException(
319
- "You need a Mapbox token in order to select a map type. "
320
- "Refer to the docs for st.map for more information."
321
- )
322
- default["mapStyle"] = map_style
323
-
324
305
  return json.dumps(default)
325
306
 
326
307
 
@@ -352,8 +333,7 @@ def _get_lat_or_lon_col_name(
352
333
  f"Map data must contain a {human_readable_name} column named: "
353
334
  f"{formatted_allowed_col_name}. Existing columns: {formmated_col_names}"
354
335
  )
355
- else:
356
- col_name = candidate_col_name
336
+ col_name = candidate_col_name
357
337
 
358
338
  # Check that the column is well-formed.
359
339
  # IMPLEMENTATION NOTE: We can't use isnull().values.any() because .values can return
@@ -374,7 +354,7 @@ def _get_value_and_col_name(
374
354
  data: DataFrame,
375
355
  value_or_name: Any,
376
356
  default_value: Any,
377
- ) -> tuple[Any, str | None]:
357
+ ) -> tuple[str, str | None]:
378
358
  """Take a value_or_name passed in by the Streamlit developer and return a PyDeck
379
359
  argument and column name for that property.
380
360
 
@@ -386,7 +366,7 @@ def _get_value_and_col_name(
386
366
  - If the user passes size="my_col_123", this returns "@@=my_col_123" and "my_col_123".
387
367
  """
388
368
 
389
- pydeck_arg: str | float
369
+ pydeck_arg: str
390
370
 
391
371
  if isinstance(value_or_name, str) and value_or_name in data.columns:
392
372
  col_name = value_or_name
@@ -394,17 +374,14 @@ def _get_value_and_col_name(
394
374
  else:
395
375
  col_name = None
396
376
 
397
- if value_or_name is None:
398
- pydeck_arg = default_value
399
- else:
400
- pydeck_arg = value_or_name
377
+ pydeck_arg = default_value if value_or_name is None else value_or_name
401
378
 
402
379
  return pydeck_arg, col_name
403
380
 
404
381
 
405
382
  def _convert_color_arg_or_column(
406
383
  data: DataFrame,
407
- color_arg: str | Color,
384
+ color_arg: str,
408
385
  color_col_name: str | None,
409
386
  ) -> None | str | IntColorTuple:
410
387
  """Converts color to a format accepted by PyDeck.
@@ -433,8 +410,6 @@ def _convert_color_arg_or_column(
433
410
  f'Column "{color_col_name}" does not appear to contain valid colors.'
434
411
  )
435
412
 
436
- # This is guaranteed to be a str because of _get_value_and_col_name
437
- assert isinstance(color_arg, str)
438
413
  color_arg_out = color_arg
439
414
 
440
415
  elif color_arg is not None:
@@ -457,10 +432,7 @@ def _get_viewport_details(
457
432
  range_lat = abs(max_lat - min_lat)
458
433
 
459
434
  if zoom is None:
460
- if range_lon > range_lat:
461
- longitude_distance = range_lon
462
- else:
463
- longitude_distance = range_lat
435
+ longitude_distance = max(range_lat, range_lon)
464
436
  zoom = _get_zoom_level(longitude_distance)
465
437
 
466
438
  return zoom, center_lat, center_lon
@@ -506,3 +478,7 @@ def marshall(
506
478
  pydeck_proto.height = height
507
479
 
508
480
  pydeck_proto.id = ""
481
+
482
+ mapbox_token = config.get_option("mapbox.token")
483
+ if mapbox_token:
484
+ pydeck_proto.mapbox_token = mapbox_token
@@ -16,13 +16,19 @@ from __future__ import annotations
16
16
 
17
17
  from typing import TYPE_CHECKING, Final, Literal, cast
18
18
 
19
+ from streamlit.elements.lib.layout_utils import (
20
+ LayoutConfig,
21
+ Width,
22
+ WidthWithoutContent,
23
+ validate_width,
24
+ )
19
25
  from streamlit.proto.Markdown_pb2 import Markdown as MarkdownProto
20
26
  from streamlit.runtime.metrics_util import gather_metrics
21
27
  from streamlit.string_util import clean_text, validate_icon_or_emoji
22
28
  from streamlit.type_util import SupportsStr, is_sympy_expression
23
29
 
24
30
  if TYPE_CHECKING:
25
- import sympy # type: ignore
31
+ import sympy
26
32
 
27
33
  from streamlit.delta_generator import DeltaGenerator
28
34
 
@@ -37,6 +43,7 @@ class MarkdownMixin:
37
43
  unsafe_allow_html: bool = False,
38
44
  *, # keyword-only arguments:
39
45
  help: str | None = None,
46
+ width: Width = "stretch",
40
47
  ) -> DeltaGenerator:
41
48
  r"""Display string formatted as Markdown.
42
49
 
@@ -110,6 +117,18 @@ class MarkdownMixin:
110
117
  including the Markdown directives described in the ``body``
111
118
  parameter of ``st.markdown``.
112
119
 
120
+ width : "stretch", "content", or int
121
+ The width of the Markdown element. This can be one of the following:
122
+
123
+ - ``"stretch"`` (default): The width of the element matches the
124
+ width of the parent container.
125
+ - ``"content"``: The width of the element matches the width of its
126
+ content, but doesn't exceed the width of the parent container.
127
+ - An integer specifying the width in pixels: The element has a
128
+ fixed width. If the specified width is greater than the width of
129
+ the parent container, the width of the element matches the width
130
+ of the parent container.
131
+
113
132
  Examples
114
133
  --------
115
134
  >>> import streamlit as st
@@ -141,7 +160,10 @@ class MarkdownMixin:
141
160
  if help:
142
161
  markdown_proto.help = help
143
162
 
144
- return self.dg._enqueue("markdown", markdown_proto)
163
+ validate_width(width, allow_content=True)
164
+ layout_config = LayoutConfig(width=width)
165
+
166
+ return self.dg._enqueue("markdown", markdown_proto, layout_config=layout_config)
145
167
 
146
168
  @gather_metrics("caption")
147
169
  def caption(
@@ -150,6 +172,7 @@ class MarkdownMixin:
150
172
  unsafe_allow_html: bool = False,
151
173
  *, # keyword-only arguments:
152
174
  help: str | None = None,
175
+ width: Width = "stretch",
153
176
  ) -> DeltaGenerator:
154
177
  """Display text in small font.
155
178
 
@@ -189,6 +212,18 @@ class MarkdownMixin:
189
212
  including the Markdown directives described in the ``body``
190
213
  parameter of ``st.markdown``.
191
214
 
215
+ width : "stretch", "content", or int
216
+ The width of the caption element. This can be one of the following:
217
+
218
+ - ``"stretch"`` (default): The width of the element matches the
219
+ width of the parent container.
220
+ - ``"content"``: The width of the element matches the width of its
221
+ content, but doesn't exceed the width of the parent container.
222
+ - An integer specifying the width in pixels: The element has a
223
+ fixed width. If the specified width is greater than the width of
224
+ the parent container, the width of the element matches the width
225
+ of the parent container.
226
+
192
227
  Examples
193
228
  --------
194
229
  >>> import streamlit as st
@@ -204,7 +239,11 @@ class MarkdownMixin:
204
239
  caption_proto.element_type = MarkdownProto.Type.CAPTION
205
240
  if help:
206
241
  caption_proto.help = help
207
- return self.dg._enqueue("markdown", caption_proto)
242
+
243
+ validate_width(width, allow_content=True)
244
+ layout_config = LayoutConfig(width=width)
245
+
246
+ return self.dg._enqueue("markdown", caption_proto, layout_config=layout_config)
208
247
 
209
248
  @gather_metrics("latex")
210
249
  def latex(
@@ -212,6 +251,7 @@ class MarkdownMixin:
212
251
  body: SupportsStr | sympy.Expr,
213
252
  *, # keyword-only arguments:
214
253
  help: str | None = None,
254
+ width: Width = "stretch",
215
255
  ) -> DeltaGenerator:
216
256
  # This docstring needs to be "raw" because of the backslashes in the
217
257
  # example below.
@@ -235,6 +275,18 @@ class MarkdownMixin:
235
275
  including the Markdown directives described in the ``body``
236
276
  parameter of ``st.markdown``.
237
277
 
278
+ width : "stretch", "content", or int
279
+ The width of the LaTeX element. This can be one of the following:
280
+
281
+ - ``"stretch"`` (default): The width of the element matches the
282
+ width of the parent container.
283
+ - ``"content"``: The width of the element matches the width of its
284
+ content, but doesn't exceed the width of the parent container.
285
+ - An integer specifying the width in pixels: The element has a
286
+ fixed width. If the specified width is greater than the width of
287
+ the parent container, the width of the element matches the width
288
+ of the parent container.
289
+
238
290
  Example
239
291
  -------
240
292
  >>> import streamlit as st
@@ -246,26 +298,43 @@ class MarkdownMixin:
246
298
  ... ''')
247
299
 
248
300
  """
301
+
249
302
  if is_sympy_expression(body):
250
303
  import sympy
251
304
 
252
305
  body = sympy.latex(body)
253
306
 
254
307
  latex_proto = MarkdownProto()
255
- latex_proto.body = "$$\n%s\n$$" % clean_text(body)
308
+ latex_proto.body = f"$$\n{clean_text(body)}\n$$"
256
309
  latex_proto.element_type = MarkdownProto.Type.LATEX
257
310
  if help:
258
311
  latex_proto.help = help
259
- return self.dg._enqueue("markdown", latex_proto)
312
+
313
+ validate_width(width, allow_content=True)
314
+ layout_config = LayoutConfig(width=width)
315
+
316
+ return self.dg._enqueue("markdown", latex_proto, layout_config=layout_config)
260
317
 
261
318
  @gather_metrics("divider")
262
- def divider(self) -> DeltaGenerator:
319
+ def divider(self, *, width: WidthWithoutContent = "stretch") -> DeltaGenerator:
263
320
  """Display a horizontal rule.
264
321
 
265
322
  .. note::
266
323
  You can achieve the same effect with st.write("---") or
267
324
  even just "---" in your script (via magic).
268
325
 
326
+ Parameters
327
+ ----------
328
+ width : "stretch" or int
329
+ The width of the divider element. This can be one of the following:
330
+
331
+ - ``"stretch"`` (default): The width of the element matches the
332
+ width of the parent container.
333
+ - An integer specifying the width in pixels: The element has a
334
+ fixed width. If the specified width is greater than the width of
335
+ the parent container, the width of the element matches the width
336
+ of the parent container.
337
+
269
338
  Example
270
339
  -------
271
340
  >>> import streamlit as st
@@ -273,10 +342,15 @@ class MarkdownMixin:
273
342
  >>> st.divider()
274
343
 
275
344
  """
345
+
276
346
  divider_proto = MarkdownProto()
277
347
  divider_proto.body = MARKDOWN_HORIZONTAL_RULE_EXPRESSION
278
348
  divider_proto.element_type = MarkdownProto.Type.DIVIDER
279
- return self.dg._enqueue("markdown", divider_proto)
349
+
350
+ validate_width(width, allow_content=False)
351
+ layout_config = LayoutConfig(width=width)
352
+
353
+ return self.dg._enqueue("markdown", divider_proto, layout_config=layout_config)
280
354
 
281
355
  @gather_metrics("badge")
282
356
  def badge(
@@ -294,6 +368,7 @@ class MarkdownMixin:
294
368
  "grey",
295
369
  "primary",
296
370
  ] = "blue",
371
+ width: Width = "content",
297
372
  ) -> DeltaGenerator:
298
373
  """Display a colored badge with an icon and label.
299
374
 
@@ -348,6 +423,19 @@ class MarkdownMixin:
348
423
  ``"primary"``, Streamlit will use the default primary accent color
349
424
  unless you set the ``theme.primaryColor`` configuration option.
350
425
 
426
+ width : "content", "stretch", or int
427
+ The width of the badge element. This can be one of the following:
428
+
429
+ - ``"content"`` (default): The width of the element matches the
430
+ width of its content, but doesn't exceed the width of the parent
431
+ container.
432
+ - ``"stretch"``: The width of the element matches the width of the
433
+ parent container.
434
+ - An integer specifying the width in pixels: The element has a
435
+ fixed width. If the specified width is greater than the width of
436
+ the parent container, the width of the element matches the width
437
+ of the parent container.
438
+
351
439
  Examples
352
440
  --------
353
441
  Create standalone badges with ``st.badge`` (with or without icons). If
@@ -368,10 +456,7 @@ class MarkdownMixin:
368
456
  height: 220px
369
457
 
370
458
  """
371
- if icon is not None:
372
- icon_str = validate_icon_or_emoji(icon) + " "
373
- else:
374
- icon_str = ""
459
+ icon_str = validate_icon_or_emoji(icon) + " " if icon is not None else ""
375
460
 
376
461
  # Escape [ and ] characters in the label to prevent breaking the directive syntax
377
462
  escaped_label = label.replace("[", "\\[").replace("]", "\\]")
@@ -379,7 +464,11 @@ class MarkdownMixin:
379
464
  badge_proto = MarkdownProto()
380
465
  badge_proto.body = f":{color}-badge[{icon_str}{escaped_label}]"
381
466
  badge_proto.element_type = MarkdownProto.Type.NATIVE
382
- return self.dg._enqueue("markdown", badge_proto)
467
+
468
+ validate_width(width, allow_content=True)
469
+ layout_config = LayoutConfig(width=width)
470
+
471
+ return self.dg._enqueue("markdown", badge_proto, layout_config=layout_config)
383
472
 
384
473
  @property
385
474
  def dg(self) -> DeltaGenerator: