streamlit 1.50.0__py3-none-any.whl → 1.52.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 (406) hide show
  1. streamlit/__init__.py +5 -1
  2. streamlit/commands/execution_control.py +89 -14
  3. streamlit/commands/navigation.py +4 -6
  4. streamlit/commands/page_config.py +4 -6
  5. streamlit/components/v1/component_arrow.py +7 -7
  6. streamlit/components/v2/__init__.py +514 -0
  7. streamlit/components/v2/bidi_component/__init__.py +20 -0
  8. streamlit/components/v2/bidi_component/constants.py +29 -0
  9. streamlit/components/v2/bidi_component/main.py +534 -0
  10. streamlit/components/v2/bidi_component/serialization.py +272 -0
  11. streamlit/components/v2/bidi_component/state.py +92 -0
  12. streamlit/components/v2/component_definition_resolver.py +143 -0
  13. streamlit/components/v2/component_file_watcher.py +403 -0
  14. streamlit/components/v2/component_manager.py +439 -0
  15. streamlit/components/v2/component_manifest_handler.py +122 -0
  16. streamlit/components/v2/component_path_utils.py +245 -0
  17. streamlit/components/v2/component_registry.py +426 -0
  18. streamlit/components/v2/get_bidi_component_manager.py +51 -0
  19. streamlit/components/v2/manifest_scanner.py +615 -0
  20. streamlit/components/v2/presentation.py +198 -0
  21. streamlit/components/v2/types.py +324 -0
  22. streamlit/config.py +456 -53
  23. streamlit/config_option.py +4 -1
  24. streamlit/config_util.py +650 -1
  25. streamlit/connections/snowflake_connection.py +1 -1
  26. streamlit/connections/snowpark_connection.py +1 -1
  27. streamlit/dataframe_util.py +33 -26
  28. streamlit/delta_generator.py +13 -4
  29. streamlit/delta_generator_singletons.py +11 -15
  30. streamlit/deprecation_util.py +17 -6
  31. streamlit/elements/alert.py +16 -0
  32. streamlit/elements/arrow.py +68 -10
  33. streamlit/elements/bokeh_chart.py +10 -78
  34. streamlit/elements/code.py +2 -2
  35. streamlit/elements/deck_gl_json_chart.py +98 -40
  36. streamlit/elements/dialog_decorator.py +2 -1
  37. streamlit/elements/exception.py +4 -2
  38. streamlit/elements/form.py +27 -0
  39. streamlit/elements/graphviz_chart.py +1 -3
  40. streamlit/elements/heading.py +63 -10
  41. streamlit/elements/html.py +13 -2
  42. streamlit/elements/image.py +3 -5
  43. streamlit/elements/layouts.py +59 -33
  44. streamlit/elements/lib/built_in_chart_utils.py +50 -19
  45. streamlit/elements/lib/color_util.py +9 -19
  46. streamlit/elements/lib/column_config_utils.py +9 -12
  47. streamlit/elements/lib/column_types.py +40 -12
  48. streamlit/elements/lib/dialog.py +2 -2
  49. streamlit/elements/lib/image_utils.py +3 -5
  50. streamlit/elements/lib/layout_utils.py +100 -13
  51. streamlit/elements/lib/mutable_status_container.py +2 -2
  52. streamlit/elements/lib/options_selector_utils.py +2 -2
  53. streamlit/elements/lib/pandas_styler_utils.py +17 -9
  54. streamlit/elements/lib/shortcut_utils.py +152 -0
  55. streamlit/elements/lib/utils.py +4 -4
  56. streamlit/elements/map.py +80 -37
  57. streamlit/elements/markdown.py +50 -3
  58. streamlit/elements/media.py +5 -7
  59. streamlit/elements/metric.py +34 -6
  60. streamlit/elements/pdf.py +2 -4
  61. streamlit/elements/plotly_chart.py +197 -20
  62. streamlit/elements/progress.py +2 -4
  63. streamlit/elements/space.py +113 -0
  64. streamlit/elements/spinner.py +1 -1
  65. streamlit/elements/text.py +20 -3
  66. streamlit/elements/toast.py +2 -0
  67. streamlit/elements/vega_charts.py +356 -149
  68. streamlit/elements/widgets/audio_input.py +12 -11
  69. streamlit/elements/widgets/button.py +280 -43
  70. streamlit/elements/widgets/button_group.py +60 -9
  71. streamlit/elements/widgets/camera_input.py +3 -5
  72. streamlit/elements/widgets/chat.py +307 -43
  73. streamlit/elements/widgets/color_picker.py +8 -1
  74. streamlit/elements/widgets/data_editor.py +88 -44
  75. streamlit/elements/widgets/file_uploader.py +9 -11
  76. streamlit/elements/widgets/multiselect.py +4 -3
  77. streamlit/elements/widgets/number_input.py +4 -4
  78. streamlit/elements/widgets/radio.py +10 -3
  79. streamlit/elements/widgets/select_slider.py +8 -5
  80. streamlit/elements/widgets/selectbox.py +6 -3
  81. streamlit/elements/widgets/slider.py +38 -42
  82. streamlit/elements/widgets/text_widgets.py +2 -0
  83. streamlit/elements/widgets/time_widgets.py +587 -21
  84. streamlit/elements/write.py +27 -6
  85. streamlit/emojis.py +1 -1
  86. streamlit/errors.py +137 -0
  87. streamlit/git_util.py +1 -1
  88. streamlit/hello/hello.py +8 -0
  89. streamlit/hello/utils.py +2 -1
  90. streamlit/material_icon_names.py +1 -1
  91. streamlit/navigation/page.py +11 -1
  92. streamlit/net_util.py +2 -2
  93. streamlit/proto/Alert_pb2.pyi +3 -3
  94. streamlit/proto/AppPage_pb2.pyi +7 -1
  95. streamlit/proto/ArrowData_pb2.py +27 -0
  96. streamlit/proto/ArrowData_pb2.pyi +52 -0
  97. streamlit/proto/ArrowNamedDataSet_pb2.pyi +7 -1
  98. streamlit/proto/ArrowVegaLiteChart_pb2.pyi +7 -1
  99. streamlit/proto/Arrow_pb2.py +10 -10
  100. streamlit/proto/Arrow_pb2.pyi +19 -12
  101. streamlit/proto/AudioInput_pb2.pyi +7 -1
  102. streamlit/proto/Audio_pb2.pyi +7 -1
  103. streamlit/proto/AuthRedirect_pb2.pyi +7 -1
  104. streamlit/proto/AutoRerun_pb2.pyi +7 -1
  105. streamlit/proto/BackMsg_pb2.py +4 -2
  106. streamlit/proto/BackMsg_pb2.pyi +34 -4
  107. streamlit/proto/Balloons_pb2.pyi +7 -1
  108. streamlit/proto/BidiComponent_pb2.py +34 -0
  109. streamlit/proto/BidiComponent_pb2.pyi +159 -0
  110. streamlit/proto/Block_pb2.py +7 -7
  111. streamlit/proto/Block_pb2.pyi +39 -36
  112. streamlit/proto/BokehChart_pb2.pyi +7 -1
  113. streamlit/proto/ButtonGroup_pb2.pyi +9 -9
  114. streamlit/proto/Button_pb2.py +2 -2
  115. streamlit/proto/Button_pb2.pyi +11 -2
  116. streamlit/proto/CameraInput_pb2.pyi +7 -1
  117. streamlit/proto/ChatInput_pb2.py +6 -6
  118. streamlit/proto/ChatInput_pb2.pyi +18 -6
  119. streamlit/proto/Checkbox_pb2.pyi +3 -3
  120. streamlit/proto/ClientState_pb2.pyi +10 -4
  121. streamlit/proto/Code_pb2.pyi +7 -1
  122. streamlit/proto/ColorPicker_pb2.pyi +7 -1
  123. streamlit/proto/Common_pb2.py +3 -3
  124. streamlit/proto/Common_pb2.pyi +35 -23
  125. streamlit/proto/Components_pb2.pyi +19 -13
  126. streamlit/proto/DataFrame_pb2.pyi +55 -49
  127. streamlit/proto/DateInput_pb2.pyi +7 -1
  128. streamlit/proto/DateTimeInput_pb2.py +28 -0
  129. streamlit/proto/DateTimeInput_pb2.pyi +92 -0
  130. streamlit/proto/DeckGlJsonChart_pb2.py +10 -4
  131. streamlit/proto/DeckGlJsonChart_pb2.pyi +12 -6
  132. streamlit/proto/Delta_pb2.pyi +7 -1
  133. streamlit/proto/DocString_pb2.pyi +10 -4
  134. streamlit/proto/DownloadButton_pb2.py +2 -2
  135. streamlit/proto/DownloadButton_pb2.pyi +16 -2
  136. streamlit/proto/Element_pb2.py +7 -3
  137. streamlit/proto/Element_pb2.pyi +33 -5
  138. streamlit/proto/Empty_pb2.pyi +7 -1
  139. streamlit/proto/Exception_pb2.pyi +7 -1
  140. streamlit/proto/Favicon_pb2.pyi +7 -1
  141. streamlit/proto/FileUploader_pb2.pyi +7 -1
  142. streamlit/proto/ForwardMsg_pb2.py +12 -10
  143. streamlit/proto/ForwardMsg_pb2.pyi +42 -15
  144. streamlit/proto/GapSize_pb2.pyi +4 -4
  145. streamlit/proto/GitInfo_pb2.pyi +3 -3
  146. streamlit/proto/GraphVizChart_pb2.pyi +7 -1
  147. streamlit/proto/Heading_pb2.pyi +7 -1
  148. streamlit/proto/HeightConfig_pb2.py +2 -2
  149. streamlit/proto/HeightConfig_pb2.pyi +13 -4
  150. streamlit/proto/Html_pb2.py +2 -2
  151. streamlit/proto/Html_pb2.pyi +11 -2
  152. streamlit/proto/IFrame_pb2.pyi +7 -1
  153. streamlit/proto/Image_pb2.pyi +10 -4
  154. streamlit/proto/Json_pb2.pyi +7 -1
  155. streamlit/proto/LabelVisibilityMessage_pb2.pyi +3 -3
  156. streamlit/proto/LinkButton_pb2.py +2 -2
  157. streamlit/proto/LinkButton_pb2.pyi +15 -2
  158. streamlit/proto/Logo_pb2.pyi +7 -1
  159. streamlit/proto/Markdown_pb2.pyi +3 -3
  160. streamlit/proto/Metric_pb2.pyi +7 -7
  161. streamlit/proto/MetricsEvent_pb2.pyi +10 -4
  162. streamlit/proto/MultiSelect_pb2.pyi +7 -1
  163. streamlit/proto/NamedDataSet_pb2.pyi +7 -1
  164. streamlit/proto/Navigation_pb2.pyi +3 -3
  165. streamlit/proto/NewSession_pb2.py +18 -18
  166. streamlit/proto/NewSession_pb2.pyi +59 -40
  167. streamlit/proto/NumberInput_pb2.pyi +3 -3
  168. streamlit/proto/PageConfig_pb2.pyi +7 -7
  169. streamlit/proto/PageInfo_pb2.pyi +7 -1
  170. streamlit/proto/PageLink_pb2.py +2 -2
  171. streamlit/proto/PageLink_pb2.pyi +11 -2
  172. streamlit/proto/PageNotFound_pb2.pyi +7 -1
  173. streamlit/proto/PageProfile_pb2.pyi +13 -7
  174. streamlit/proto/PagesChanged_pb2.pyi +7 -1
  175. streamlit/proto/ParentMessage_pb2.pyi +7 -1
  176. streamlit/proto/PlotlyChart_pb2.py +8 -6
  177. streamlit/proto/PlotlyChart_pb2.pyi +9 -7
  178. streamlit/proto/Progress_pb2.pyi +7 -1
  179. streamlit/proto/Radio_pb2.pyi +7 -1
  180. streamlit/proto/RootContainer_pb2.pyi +1 -1
  181. streamlit/proto/Selectbox_pb2.pyi +7 -1
  182. streamlit/proto/SessionEvent_pb2.pyi +7 -1
  183. streamlit/proto/SessionStatus_pb2.pyi +7 -1
  184. streamlit/proto/Skeleton_pb2.pyi +3 -3
  185. streamlit/proto/Slider_pb2.pyi +5 -5
  186. streamlit/proto/Snow_pb2.pyi +7 -1
  187. streamlit/proto/Space_pb2.py +27 -0
  188. streamlit/proto/Space_pb2.pyi +48 -0
  189. streamlit/proto/Spinner_pb2.pyi +7 -1
  190. streamlit/proto/TextAlignmentConfig_pb2.py +29 -0
  191. streamlit/proto/TextAlignmentConfig_pb2.pyi +68 -0
  192. streamlit/proto/TextArea_pb2.pyi +7 -1
  193. streamlit/proto/TextInput_pb2.pyi +3 -3
  194. streamlit/proto/Text_pb2.pyi +7 -1
  195. streamlit/proto/TimeInput_pb2.pyi +7 -1
  196. streamlit/proto/Toast_pb2.pyi +7 -1
  197. streamlit/proto/VegaLiteChart_pb2.pyi +7 -1
  198. streamlit/proto/Video_pb2.pyi +6 -6
  199. streamlit/proto/WidgetStates_pb2.py +2 -2
  200. streamlit/proto/WidgetStates_pb2.pyi +23 -7
  201. streamlit/proto/WidthConfig_pb2.py +2 -2
  202. streamlit/proto/WidthConfig_pb2.pyi +13 -4
  203. streamlit/proto/openmetrics_data_model_pb2.pyi +52 -52
  204. streamlit/runtime/app_session.py +65 -2
  205. streamlit/runtime/caching/cache_data_api.py +5 -5
  206. streamlit/runtime/caching/cache_errors.py +4 -1
  207. streamlit/runtime/caching/cache_resource_api.py +5 -4
  208. streamlit/runtime/caching/cache_utils.py +3 -2
  209. streamlit/runtime/caching/cached_message_replay.py +3 -3
  210. streamlit/runtime/caching/hashing.py +4 -5
  211. streamlit/runtime/caching/legacy_cache_api.py +2 -1
  212. streamlit/runtime/connection_factory.py +1 -3
  213. streamlit/runtime/download_data_util.py +53 -0
  214. streamlit/runtime/forward_msg_queue.py +5 -1
  215. streamlit/runtime/fragment.py +2 -1
  216. streamlit/runtime/media_file_manager.py +178 -2
  217. streamlit/runtime/memory_media_file_storage.py +1 -1
  218. streamlit/runtime/metrics_util.py +91 -3
  219. streamlit/runtime/runtime.py +14 -0
  220. streamlit/runtime/scriptrunner/exec_code.py +2 -1
  221. streamlit/runtime/scriptrunner/script_runner.py +5 -3
  222. streamlit/runtime/scriptrunner_utils/script_run_context.py +3 -6
  223. streamlit/runtime/secrets.py +2 -4
  224. streamlit/runtime/session_manager.py +3 -1
  225. streamlit/runtime/state/common.py +30 -5
  226. streamlit/runtime/state/presentation.py +85 -0
  227. streamlit/runtime/state/query_params.py +80 -29
  228. streamlit/runtime/state/safe_session_state.py +2 -2
  229. streamlit/runtime/state/session_state.py +221 -17
  230. streamlit/runtime/state/widgets.py +19 -3
  231. streamlit/runtime/websocket_session_manager.py +3 -1
  232. streamlit/source_util.py +2 -2
  233. streamlit/static/index.html +2 -2
  234. streamlit/static/manifest.json +557 -239
  235. streamlit/static/static/css/{index.CIiu7Ygf.css → index.BpABIXK9.css} +1 -1
  236. streamlit/static/static/css/index.DgR7E2CV.css +1 -0
  237. streamlit/static/static/js/{ErrorOutline.esm.DUpR0_Ka.js → ErrorOutline.esm.ZJDbmVTx.js} +1 -1
  238. streamlit/static/static/js/{FileDownload.esm.CN4j9-1w.js → FileDownload.esm.Dx0vI3vH.js} +1 -1
  239. streamlit/static/static/js/{FileHelper.CaIUKG91.js → FileHelper.B7Ero7qQ.js} +3 -3
  240. streamlit/static/static/js/{FormClearHelper.DTcdrasw.js → FormClearHelper.CG2XN1_g.js} +1 -1
  241. streamlit/static/static/js/IFrameUtil.DefezniK.js +1 -0
  242. streamlit/static/static/js/InputInstructions.Cj5-1zf6.js +1 -0
  243. streamlit/static/static/js/Particles.BfWfv0Aw.js +1 -0
  244. streamlit/static/static/js/{ProgressBar.DetlP5aY.js → ProgressBar.CGQ8OgfO.js} +2 -2
  245. streamlit/static/static/js/StreamlitSyntaxHighlighter.DTKLpwhl.js +20 -0
  246. streamlit/static/static/js/{Toolbar.C77ar7rq.js → Toolbar.B2qFUmd9.js} +1 -1
  247. streamlit/static/static/js/_arrayIncludes.B19Iyn2B.js +1 -0
  248. streamlit/static/static/js/_baseIndexOf.BTknn6Gb.js +1 -0
  249. streamlit/static/static/js/{base-input.BQft14La.js → base-input.o9tL8MDP.js} +4 -4
  250. streamlit/static/static/js/{checkbox.yZOfXCeX.js → checkbox.0BeV1IBL.js} +1 -1
  251. streamlit/static/static/js/{createSuper.Dh9w1cs8.js → createSuper.RBO59fEm.js} +1 -1
  252. streamlit/static/static/js/data-grid-overlay-editor.CiTkUy0t.js +1 -0
  253. streamlit/static/static/js/{downloader.MeHtkq8r.js → downloader.DwNZg3Mw.js} +1 -1
  254. streamlit/static/static/js/embed.XT9xNd3F.js +195 -0
  255. streamlit/static/static/js/{es6.VpBPGCnM.js → es6.x9KsYQg-.js} +2 -2
  256. streamlit/static/static/js/{iframeResizer.contentWindow.yMw_ARIL.js → iframeResizer.contentWindow.ZVXpMPi0.js} +1 -1
  257. streamlit/static/static/js/index.5VPOamri.js +1 -0
  258. streamlit/static/static/js/index.8HslT92O.js +14 -0
  259. streamlit/static/static/js/index.AnXMIBz3.js +7 -0
  260. streamlit/static/static/js/index.B0yp3bM1.js +6 -0
  261. streamlit/static/static/js/index.B1fRb5wF.js +1 -0
  262. streamlit/static/static/js/index.B527JZdO.js +3 -0
  263. streamlit/static/static/js/index.BHgV-yW4.js +1 -0
  264. streamlit/static/static/js/index.BQr-XwGV.js +1 -0
  265. streamlit/static/static/js/index.BTtmaLDB.js +1 -0
  266. streamlit/static/static/js/index.BWB_91TA.js +1 -0
  267. streamlit/static/static/js/index.BfEKaEmw.js +1 -0
  268. streamlit/static/static/js/index.BfXjTO8b.js +1 -0
  269. streamlit/static/static/js/index.Bjy4NRu9.js +3 -0
  270. streamlit/static/static/js/index.Bu5JWpT_.js +1 -0
  271. streamlit/static/static/js/index.BuCx76ZV.js +1 -0
  272. streamlit/static/static/js/index.BxjzhVUb.js +2 -0
  273. streamlit/static/static/js/index.By55VdPY.js +1 -0
  274. streamlit/static/static/js/index.CF5MxTbK.js +1 -0
  275. streamlit/static/static/js/index.CLmq_z9K.js +1 -0
  276. streamlit/static/static/js/index.CNH4rdSz.js +1 -0
  277. streamlit/static/static/js/{index.B0H9IXUJ.js → index.CTgm_-jO.js} +10 -41
  278. streamlit/static/static/js/index.C_rK-Swb.js +188 -0
  279. streamlit/static/static/js/index.CjozwSzS.js +1 -0
  280. streamlit/static/static/js/{index.CH1tqnSs.js → index.CkGVt6-G.js} +1 -1
  281. streamlit/static/static/js/index.CuvXOyER.js +2 -0
  282. streamlit/static/static/js/{index.FFOzOWzC.js → index.CyUHWoCC.js} +2 -2
  283. streamlit/static/static/js/index.CyroQtI4.js +2 -0
  284. streamlit/static/static/js/index.D6HmkoDm.js +263 -0
  285. streamlit/static/static/js/index.DAqCNvsO.js +1 -0
  286. streamlit/static/static/js/index.DB_w_CZQ.js +1 -0
  287. streamlit/static/static/js/index.DBalctjj.js +2 -0
  288. streamlit/static/static/js/index.DK0RFJUG.js +11 -0
  289. streamlit/static/static/js/index.DMxc2XFp.js +151 -0
  290. streamlit/static/static/js/index.DO5utP74.js +2 -0
  291. streamlit/static/static/js/index.DS7lf09n.js +1 -0
  292. streamlit/static/static/js/index.DWexTVLY.js +1 -0
  293. streamlit/static/static/js/index.DXxnU5ej.js +1 -0
  294. streamlit/static/static/js/index.DcU3uDvB.js +2 -0
  295. streamlit/static/static/js/index.DlltaH7J.js +1 -0
  296. streamlit/static/static/js/index.DpNTZz82.js +27 -0
  297. streamlit/static/static/js/index.Dr9HIhQw.js +1 -0
  298. streamlit/static/static/js/index.DsgAU5lc.js +1 -0
  299. streamlit/static/static/js/{index.64ejlaaT.js → index.KfXqjDYy.js} +1 -1
  300. streamlit/static/static/js/index.PaidgjCs.js +1 -0
  301. streamlit/static/static/js/index.RJZuWCGA.js +1 -0
  302. streamlit/static/static/js/{index.Ctn27_AE.js → index.hbeqcRTn.js} +53 -122
  303. streamlit/static/static/js/index.q5hIQwAY.js +1 -0
  304. streamlit/static/static/js/index.rORSX6IW.js +1 -0
  305. streamlit/static/static/js/index.uSX757_v.js +1 -0
  306. streamlit/static/static/js/index.x_QRaLMd.js +1 -0
  307. streamlit/static/static/js/{input.s6pjQ49A.js → input.D5oh9-aB.js} +2 -2
  308. streamlit/static/static/js/main.q9oGOg0H.js +13 -0
  309. streamlit/static/static/js/{memory.Cuvsdfrl.js → memory.5kCSFUJS.js} +1 -1
  310. streamlit/static/static/js/moment.C3j7ZXd7.js +4 -0
  311. streamlit/static/static/js/number-overlay-editor.Cn_LsK8N.js +9 -0
  312. streamlit/static/static/js/pandasStylerUtils.BqhXt51_.js +1 -0
  313. streamlit/static/static/js/{possibleConstructorReturn.CqidKeei.js → possibleConstructorReturn.DD9NK1Z8.js} +1 -1
  314. streamlit/static/static/js/record.B-tDciZb.js +1 -0
  315. streamlit/static/static/js/{sandbox.CCQREcJx.js → sandbox.DACSyz29.js} +1 -1
  316. streamlit/static/static/js/styled-components.C3R090At.js +1 -0
  317. streamlit/static/static/js/threshold.Q1mXg5rX.js +1 -0
  318. streamlit/static/static/js/throttle.B0GR3Iyz.js +1 -0
  319. streamlit/static/static/js/{timepicker.mkJF97Bb.js → timepicker.BdhzPxrv.js} +1 -1
  320. streamlit/static/static/js/timer.C2hYhUse.js +1 -0
  321. streamlit/static/static/js/{toConsumableArray.De7I7KVR.js → toConsumableArray.Db2pdqM2.js} +1 -1
  322. streamlit/static/static/js/uniqueId.CtqIr-Yh.js +1 -0
  323. streamlit/static/static/js/urls.BwSlolu9.js +1 -0
  324. streamlit/static/static/js/{useBasicWidgetState.CedkNjUW.js → useBasicWidgetState.Bfp6TnSw.js} +1 -1
  325. streamlit/static/static/js/useIntlLocale.hRV75Xgj.js +12 -0
  326. streamlit/static/static/js/{useTextInputAutoExpand.Ca7w8dVs.js → useTextInputAutoExpand.QepX7n8Y.js} +1 -1
  327. streamlit/static/static/js/useUpdateUiValue.DHx8TzX6.js +1 -0
  328. streamlit/static/static/js/useWaveformController.WxVzpzEX.js +1 -0
  329. streamlit/static/static/js/value.B4vHRSi7.js +1 -0
  330. streamlit/static/static/js/wavesurfer.esm.vI8Eid4k.js +73 -0
  331. streamlit/static/static/js/withCalculatedWidth.DcKeRSWJ.js +1 -0
  332. streamlit/static/static/js/withFullScreenWrapper.CrHddARq.js +1 -0
  333. streamlit/static/static/media/MaterialSymbols-Rounded.C7IFxh57.woff2 +0 -0
  334. streamlit/string_util.py +9 -4
  335. streamlit/testing/v1/app_test.py +17 -2
  336. streamlit/testing/v1/element_tree.py +85 -9
  337. streamlit/testing/v1/util.py +2 -2
  338. streamlit/type_util.py +3 -4
  339. streamlit/url_util.py +1 -3
  340. streamlit/user_info.py +1 -2
  341. streamlit/util.py +3 -1
  342. streamlit/watcher/event_based_path_watcher.py +23 -12
  343. streamlit/watcher/local_sources_watcher.py +11 -1
  344. streamlit/watcher/path_watcher.py +9 -6
  345. streamlit/watcher/polling_path_watcher.py +4 -1
  346. streamlit/watcher/util.py +2 -2
  347. streamlit/web/bootstrap.py +24 -0
  348. streamlit/web/cli.py +51 -22
  349. streamlit/web/server/bidi_component_request_handler.py +193 -0
  350. streamlit/web/server/component_file_utils.py +97 -0
  351. streamlit/web/server/component_request_handler.py +8 -21
  352. streamlit/web/server/oauth_authlib_routes.py +5 -2
  353. streamlit/web/server/oidc_mixin.py +3 -1
  354. streamlit/web/server/routes.py +2 -2
  355. streamlit/web/server/server.py +9 -0
  356. streamlit/web/server/server_util.py +3 -1
  357. streamlit/web/server/upload_file_request_handler.py +19 -1
  358. {streamlit-1.50.0.dist-info → streamlit-1.52.0.dist-info}/METADATA +10 -7
  359. streamlit-1.52.0.dist-info/RECORD +620 -0
  360. streamlit/static/static/css/index.CHEnSPGk.css +0 -1
  361. streamlit/static/static/js/Hooks.BRba_Own.js +0 -1
  362. streamlit/static/static/js/InputInstructions.xnSDuYeQ.js +0 -1
  363. streamlit/static/static/js/Particles.CElH0XX2.js +0 -1
  364. streamlit/static/static/js/data-grid-overlay-editor.DcuHuCyW.js +0 -1
  365. streamlit/static/static/js/index.6xX1278W.js +0 -975
  366. streamlit/static/static/js/index.B-hiXRzw.js +0 -1
  367. streamlit/static/static/js/index.B4cAbHP6.js +0 -1
  368. streamlit/static/static/js/index.B4dUQfni.js +0 -1
  369. streamlit/static/static/js/index.BPQo7BKk.js +0 -1
  370. streamlit/static/static/js/index.Baqa90pe.js +0 -2
  371. streamlit/static/static/js/index.Bj9JgOEC.js +0 -1
  372. streamlit/static/static/js/index.BjCwMzj4.js +0 -3
  373. streamlit/static/static/js/index.Bm3VbPB5.js +0 -1
  374. streamlit/static/static/js/index.Bxz2yX3P.js +0 -1
  375. streamlit/static/static/js/index.BycLveZ4.js +0 -1
  376. streamlit/static/static/js/index.C9BdUqTi.js +0 -1
  377. streamlit/static/static/js/index.CFMf5_ez.js +0 -197
  378. streamlit/static/static/js/index.CGYqqs6j.js +0 -1
  379. streamlit/static/static/js/index.CMItVsFA.js +0 -1
  380. streamlit/static/static/js/index.CTBk8Vk2.js +0 -1
  381. streamlit/static/static/js/index.CiAQIz1H.js +0 -7
  382. streamlit/static/static/js/index.Cj7DSzVR.js +0 -73
  383. streamlit/static/static/js/index.Ck8rQ9OL.js +0 -1
  384. streamlit/static/static/js/index.ClELlchS.js +0 -1617
  385. streamlit/static/static/js/index.Cnpi3o3E.js +0 -1
  386. streamlit/static/static/js/index.D2QEXQq_.js +0 -1
  387. streamlit/static/static/js/index.DH71Ezyj.js +0 -1
  388. streamlit/static/static/js/index.DHh-U0dK.js +0 -3
  389. streamlit/static/static/js/index.DK7hD7_w.js +0 -1
  390. streamlit/static/static/js/index.DKv_lNO7.js +0 -2
  391. streamlit/static/static/js/index.DNLrMXgm.js +0 -12
  392. streamlit/static/static/js/index.DW0Grddz.js +0 -1
  393. streamlit/static/static/js/index.Dbe-Q3C-.js +0 -2
  394. streamlit/static/static/js/index.DcPNYEUo.js +0 -1
  395. streamlit/static/static/js/index.DuxqVQpd.js +0 -1
  396. streamlit/static/static/js/index.GRUzrudl.js +0 -1
  397. streamlit/static/static/js/number-overlay-editor.DdgVR5m3.js +0 -9
  398. streamlit/static/static/js/uniqueId.RI1LJdtz.js +0 -1
  399. streamlit/static/static/js/useUpdateUiValue.DeXelfRH.js +0 -1
  400. streamlit/static/static/js/withFullScreenWrapper.C3561XxJ.js +0 -1
  401. streamlit/static/static/media/MaterialSymbols-Rounded.DeCZgS-4.woff2 +0 -0
  402. streamlit-1.50.0.dist-info/RECORD +0 -557
  403. {streamlit-1.50.0.data → streamlit-1.52.0.data}/scripts/streamlit.cmd +0 -0
  404. {streamlit-1.50.0.dist-info → streamlit-1.52.0.dist-info}/WHEEL +0 -0
  405. {streamlit-1.50.0.dist-info → streamlit-1.52.0.dist-info}/entry_points.txt +0 -0
  406. {streamlit-1.50.0.dist-info → streamlit-1.52.0.dist-info}/top_level.txt +0 -0
@@ -18,11 +18,22 @@ from __future__ import annotations
18
18
 
19
19
  import json
20
20
  import re
21
+ import threading
21
22
  from contextlib import nullcontext
22
23
  from dataclasses import dataclass
23
- from typing import TYPE_CHECKING, Any, Final, Literal, TypedDict, Union, cast, overload
24
+ from typing import (
25
+ TYPE_CHECKING,
26
+ Any,
27
+ Final,
28
+ Literal,
29
+ TypeAlias,
30
+ TypedDict,
31
+ Union,
32
+ cast,
33
+ overload,
34
+ )
24
35
 
25
- from typing_extensions import Required, TypeAlias
36
+ from typing_extensions import Required
26
37
 
27
38
  from streamlit import dataframe_util, type_util
28
39
  from streamlit.deprecation_util import (
@@ -106,6 +117,8 @@ AltairChart: TypeAlias = Union[
106
117
  "alt.VConcatChart",
107
118
  ]
108
119
 
120
+ _altair_globals_lock = threading.Lock()
121
+
109
122
 
110
123
  class VegaLiteState(TypedDict, total=False):
111
124
  """
@@ -323,7 +336,7 @@ def _marshall_chart_data(
323
336
  dataset = proto.datasets.add()
324
337
  dataset.name = str(dataset_name)
325
338
  dataset.has_name = True
326
- # The ID transformer (id_transform function registered before conversion to dict)
339
+ # The ID transformer (_to_arrow_dataset function registered before conversion to dict)
327
340
  # already serializes the data into Arrow IPC format (bytes) when the Altair object
328
341
  # gets converted into the vega-lite spec dict.
329
342
  # If its already in bytes, we don't need to serialize it here again.
@@ -364,41 +377,46 @@ def _convert_altair_to_vega_lite_spec(
364
377
  """Convert an Altair chart object to a Vega-Lite chart spec."""
365
378
  import altair as alt
366
379
 
380
+ # alt.themes was deprecated in Altair 5.5.0 in favor of alt.theme
381
+ if type_util.is_altair_version_less_than("5.5.0"):
382
+ alt_theme = alt.themes # ty: ignore[unresolved-attribute]
383
+ else:
384
+ alt_theme = alt.theme
385
+
386
+ # This is where we'll store Arrow-serialized versions of the chart data.
387
+ # This happens in _to_arrow_dataset().
388
+ datasets: dict[str, Any] = {}
389
+
367
390
  # Normally altair_chart.to_dict() would transform the dataframe used by the
368
391
  # chart into an array of dictionaries. To avoid that, we install a
369
392
  # transformer that replaces datasets with a reference by the object id of
370
393
  # the dataframe. We then fill in the dataset manually later on.
394
+ #
395
+ # Note: it's OK to re-register this every time we run this function since
396
+ # transformers are stored in a dict. So there's no duplication.
397
+ #
398
+ # type: ignore[arg-type,attr-defined,unused-ignore]
399
+ alt.data_transformers.register("to_arrow_dataset", _to_arrow_dataset)
400
+
401
+ # Settings like alt.theme.enable and alt.data_transformers.enable are global to all
402
+ # threads. So this lock makes sure that whatever we set those to only apply to the
403
+ # current thread.
404
+ with _altair_globals_lock:
405
+ # The default altair theme has some width/height defaults defined
406
+ # which are not useful for Streamlit. Therefore, we change the theme to
407
+ # "none" to avoid those defaults.
408
+ theme_context = (
409
+ alt_theme.enable("none") if alt_theme.active == "default" else nullcontext()
410
+ )
371
411
 
372
- datasets = {}
373
-
374
- def id_transform(data: Any) -> dict[str, str]:
375
- """Altair data transformer that serializes the data,
376
- creates a stable name based on the hash of the data,
377
- stores the bytes into the datasets mapping and
378
- returns this name to have it be used in Altair.
379
- """
380
- # Already serialize the data to be able to create a stable
381
- # dataset name:
382
- data_bytes = dataframe_util.convert_anything_to_arrow_bytes(data)
383
- # Use the md5 hash of the data as the name:
384
- name = calc_md5(str(data_bytes))
385
-
386
- datasets[name] = data_bytes
387
- return {"name": name}
388
-
389
- alt.data_transformers.register("id", id_transform) # type: ignore[arg-type,attr-defined,unused-ignore]
390
-
391
- # alt.themes was deprecated in Altair 5.5.0 in favor of alt.theme
392
- alt_theme = (
393
- alt.themes if type_util.is_altair_version_less_than("5.5.0") else alt.theme # ty: ignore[unresolved-attribute]
394
- )
412
+ data_transformer = alt.data_transformers.enable(
413
+ "to_arrow_dataset", datasets=datasets
414
+ )
395
415
 
396
- # The default altair theme has some width/height defaults defined
397
- # which are not useful for Streamlit. Therefore, we change the theme to
398
- # "none" to avoid those defaults.
399
- with alt_theme.enable("none") if alt_theme.active == "default" else nullcontext(): # ty: ignore
400
- with alt.data_transformers.enable("id"): # type: ignore[attr-defined,unused-ignore]
401
- chart_dict = altair_chart.to_dict()
416
+ with theme_context: # ty: ignore[invalid-context-manager]
417
+ # type: ignore[attr-defined,unused-ignore]
418
+ with data_transformer: # ty: ignore[invalid-context-manager]
419
+ chart_dict = altair_chart.to_dict()
402
420
 
403
421
  # Put datasets back into the chart dict:
404
422
  chart_dict["datasets"] = datasets
@@ -501,7 +519,10 @@ def _reset_counter_pattern(prefix: str, vega_spec: str) -> str:
501
519
  We need to reset these counters on a spec-level to make the
502
520
  spec stable across reruns and avoid changes to the element ID.
503
521
  """
504
- pattern = re.compile(rf'"{prefix}\d+"')
522
+
523
+ # Altair 6.0.0 introduced a new way to handle parameters,
524
+ # by using hashes instead of pure counters:
525
+ pattern = re.compile(rf'"{prefix}[0-9a-z]+"')
505
526
  # Get all matches without duplicates in order of appearance.
506
527
  # Using a set here would not guarantee the order of appearance,
507
528
  # which might lead to different replacements on each run.
@@ -704,17 +725,21 @@ class VegaChartsMixin:
704
725
  fixed height. If the content is larger than the specified
705
726
  height, scrolling is enabled.
706
727
 
707
- use_container_width : bool
708
- Whether to override ``width`` with the width of the parent
709
- container. If ``use_container_width`` is ``True`` (default),
710
- Streamlit sets the width of the chart to match the width of the
711
- parent container. If ``use_container_width`` is ``False``,
712
- Streamlit sets the chart's width according to ``width``.
728
+ use_container_width : bool or None
729
+ Whether to override the chart's native width with the width of
730
+ the parent container. This can be one of the following:
731
+
732
+ - ``None`` (default): Streamlit will use the chart's default behavior.
733
+ - ``True``: Streamlit sets the width of the chart to match the
734
+ width of the parent container.
735
+ - ``False``: Streamlit sets the width of the chart to fit its
736
+ contents according to the plotting library, up to the width of
737
+ the parent container.
713
738
 
714
739
  .. deprecated::
715
- The ``use_container_width`` parameter is deprecated and will
716
- be removed in a future version. Use the ``width`` parameter
717
- with ``width="stretch"`` instead.
740
+ ``use_container_width`` is deprecated and will be removed in a
741
+ future release. For ``use_container_width=True``, use
742
+ ``width="stretch"``.
718
743
 
719
744
  Examples
720
745
  --------
@@ -791,25 +816,6 @@ class VegaChartsMixin:
791
816
  height: 440px
792
817
 
793
818
  """
794
- if use_container_width is not None:
795
- show_deprecation_warning(
796
- make_deprecated_name_warning(
797
- "use_container_width",
798
- "width",
799
- "2025-12-31",
800
- "For `use_container_width=True`, use `width='stretch'`. "
801
- "For `use_container_width=False`, use `width='content'`.",
802
- include_st_prefix=False,
803
- ),
804
- show_in_browser=False,
805
- )
806
- if use_container_width:
807
- width = "stretch"
808
- elif not isinstance(width, int):
809
- # This preserves the existing behavior of setting use_container_width
810
- # to False combined with an integer width.
811
- width = "content"
812
-
813
819
  chart, add_rows_metadata = generate_chart(
814
820
  chart_type=ChartType.LINE,
815
821
  data=data,
@@ -824,12 +830,11 @@ class VegaChartsMixin:
824
830
  use_container_width=(width == "stretch"),
825
831
  )
826
832
 
827
- validate_width(width, allow_content=True)
828
- validate_height(height, allow_content=True)
829
833
  return cast(
830
834
  "DeltaGenerator",
831
835
  self._altair_chart(
832
836
  chart,
837
+ use_container_width=use_container_width,
833
838
  theme="streamlit",
834
839
  add_rows_metadata=add_rows_metadata,
835
840
  width=width,
@@ -848,9 +853,9 @@ class VegaChartsMixin:
848
853
  y_label: str | None = None,
849
854
  color: str | Color | list[Color] | None = None,
850
855
  stack: bool | ChartStackType | None = None,
851
- width: int | None = None,
852
- height: int | None = None,
853
- use_container_width: bool = True,
856
+ width: Width = "stretch",
857
+ height: Height = "content",
858
+ use_container_width: bool | None = None,
854
859
  ) -> DeltaGenerator:
855
860
  """Display an area chart.
856
861
 
@@ -941,27 +946,46 @@ class VegaChartsMixin:
941
946
  - ``"center"``: The areas are stacked and shifted to center their
942
947
  baseline, which creates a steamgraph.
943
948
 
944
- width : int or None
945
- Desired width of the chart expressed in pixels. If ``width`` is
946
- ``None`` (default), Streamlit sets the width of the chart to fit
947
- its contents according to the plotting library, up to the width of
948
- the parent container. If ``width`` is greater than the width of the
949
- parent container, Streamlit sets the chart width to match the width
950
- of the parent container.
949
+ width : "stretch", "content", or int
950
+ The width of the chart element. This can be one of the following:
951
951
 
952
- To use ``width``, you must set ``use_container_width=False``.
952
+ - ``"stretch"`` (default): The width of the element matches the
953
+ width of the parent container.
954
+ - ``"content"``: The width of the element matches the width of its
955
+ content, but doesn't exceed the width of the parent container.
956
+ - An integer specifying the width in pixels: The element has a
957
+ fixed width. If the specified width is greater than the width of
958
+ the parent container, the width of the element matches the width
959
+ of the parent container.
953
960
 
954
- height : int or None
955
- Desired height of the chart expressed in pixels. If ``height`` is
956
- ``None`` (default), Streamlit sets the height of the chart to fit
957
- its contents according to the plotting library.
961
+ height : "stretch", "content", or int
962
+ The height of the chart element. This can be one of the following:
958
963
 
959
- use_container_width : bool
960
- Whether to override ``width`` with the width of the parent
961
- container. If ``use_container_width`` is ``True`` (default),
962
- Streamlit sets the width of the chart to match the width of the
963
- parent container. If ``use_container_width`` is ``False``,
964
- Streamlit sets the chart's width according to ``width``.
964
+ - ``"content"`` (default): The height of the element matches the
965
+ height of its content.
966
+ - ``"stretch"``: The height of the element matches the height of
967
+ its content or the height of the parent container, whichever is
968
+ larger. If the element is not in a parent container, the height
969
+ of the element matches the height of its content.
970
+ - An integer specifying the height in pixels: The element has a
971
+ fixed height. If the content is larger than the specified
972
+ height, scrolling is enabled.
973
+
974
+ use_container_width : bool or None
975
+ Whether to override the chart's native width with the width of
976
+ the parent container. This can be one of the following:
977
+
978
+ - ``None`` (default): Streamlit will use the chart's default behavior.
979
+ - ``True``: Streamlit sets the width of the chart to match the
980
+ width of the parent container.
981
+ - ``False``: Streamlit sets the width of the chart to fit its
982
+ contents according to the plotting library, up to the width of
983
+ the parent container.
984
+
985
+ .. deprecated::
986
+ ``use_container_width`` is deprecated and will be removed in a
987
+ future release. For ``use_container_width=True``, use
988
+ ``width="stretch"``.
965
989
 
966
990
  Examples
967
991
  --------
@@ -1062,7 +1086,6 @@ class VegaChartsMixin:
1062
1086
  height: 440px
1063
1087
 
1064
1088
  """
1065
-
1066
1089
  # Check that the stack parameter is valid, raise more informative error message if not
1067
1090
  maybe_raise_stack_warning(
1068
1091
  stack,
@@ -1092,7 +1115,7 @@ class VegaChartsMixin:
1092
1115
  width=width,
1093
1116
  height=height,
1094
1117
  stack=stack,
1095
- use_container_width=use_container_width,
1118
+ use_container_width=(width == "stretch"),
1096
1119
  )
1097
1120
  return cast(
1098
1121
  "DeltaGenerator",
@@ -1101,6 +1124,8 @@ class VegaChartsMixin:
1101
1124
  use_container_width=use_container_width,
1102
1125
  theme="streamlit",
1103
1126
  add_rows_metadata=add_rows_metadata,
1127
+ width=width,
1128
+ height=height,
1104
1129
  ),
1105
1130
  )
1106
1131
 
@@ -1117,9 +1142,9 @@ class VegaChartsMixin:
1117
1142
  horizontal: bool = False,
1118
1143
  sort: bool | str = True,
1119
1144
  stack: bool | ChartStackType | None = None,
1120
- width: int | None = None,
1121
- height: int | None = None,
1122
- use_container_width: bool = True,
1145
+ width: Width = "stretch",
1146
+ height: Height = "content",
1147
+ use_container_width: bool | None = None,
1123
1148
  ) -> DeltaGenerator:
1124
1149
  """Display a bar chart.
1125
1150
 
@@ -1230,27 +1255,46 @@ class VegaChartsMixin:
1230
1255
  - ``"center"``: The bars are stacked and shifted to center the
1231
1256
  total height around an axis.
1232
1257
 
1233
- width : int or None
1234
- Desired width of the chart expressed in pixels. If ``width`` is
1235
- ``None`` (default), Streamlit sets the width of the chart to fit
1236
- its contents according to the plotting library, up to the width of
1237
- the parent container. If ``width`` is greater than the width of the
1238
- parent container, Streamlit sets the chart width to match the width
1239
- of the parent container.
1258
+ width : "stretch", "content", or int
1259
+ The width of the chart element. This can be one of the following:
1260
+
1261
+ - ``"stretch"`` (default): The width of the element matches the
1262
+ width of the parent container.
1263
+ - ``"content"``: The width of the element matches the width of its
1264
+ content, but doesn't exceed the width of the parent container.
1265
+ - An integer specifying the width in pixels: The element has a
1266
+ fixed width. If the specified width is greater than the width of
1267
+ the parent container, the width of the element matches the width
1268
+ of the parent container.
1269
+
1270
+ height : "stretch", "content", or int
1271
+ The height of the chart element. This can be one of the following:
1272
+
1273
+ - ``"content"`` (default): The height of the element matches the
1274
+ height of its content.
1275
+ - ``"stretch"``: The height of the element matches the height of
1276
+ its content or the height of the parent container, whichever is
1277
+ larger. If the element is not in a parent container, the height
1278
+ of the element matches the height of its content.
1279
+ - An integer specifying the height in pixels: The element has a
1280
+ fixed height. If the content is larger than the specified
1281
+ height, scrolling is enabled.
1240
1282
 
1241
- To use ``width``, you must set ``use_container_width=False``.
1283
+ use_container_width : bool or None
1284
+ Whether to override the chart's native width with the width of
1285
+ the parent container. This can be one of the following:
1242
1286
 
1243
- height : int or None
1244
- Desired height of the chart expressed in pixels. If ``height`` is
1245
- ``None`` (default), Streamlit sets the height of the chart to fit
1246
- its contents according to the plotting library.
1287
+ - ``None`` (default): Streamlit will use the chart's default behavior.
1288
+ - ``True``: Streamlit sets the width of the chart to match the
1289
+ width of the parent container.
1290
+ - ``False``: Streamlit sets the width of the chart to fit its
1291
+ contents according to the plotting library, up to the width of
1292
+ the parent container.
1247
1293
 
1248
- use_container_width : bool
1249
- Whether to override ``width`` with the width of the parent
1250
- container. If ``use_container_width`` is ``True`` (default),
1251
- Streamlit sets the width of the chart to match the width of the
1252
- parent container. If ``use_container_width`` is ``False``,
1253
- Streamlit sets the chart's width according to ``width``.
1294
+ .. deprecated::
1295
+ ``use_container_width`` is deprecated and will be removed in a
1296
+ future release. For ``use_container_width=True``, use
1297
+ ``width="stretch"``.
1254
1298
 
1255
1299
  Examples
1256
1300
  --------
@@ -1368,7 +1412,6 @@ class VegaChartsMixin:
1368
1412
  height: 440px
1369
1413
 
1370
1414
  """
1371
-
1372
1415
  # Check that the stack parameter is valid, raise more informative error message if not
1373
1416
  maybe_raise_stack_warning(
1374
1417
  stack,
@@ -1410,6 +1453,8 @@ class VegaChartsMixin:
1410
1453
  use_container_width=use_container_width,
1411
1454
  theme="streamlit",
1412
1455
  add_rows_metadata=add_rows_metadata,
1456
+ width=width,
1457
+ height=height,
1413
1458
  ),
1414
1459
  )
1415
1460
 
@@ -1424,9 +1469,9 @@ class VegaChartsMixin:
1424
1469
  y_label: str | None = None,
1425
1470
  color: str | Color | list[Color] | None = None,
1426
1471
  size: str | float | int | None = None,
1427
- width: int | None = None,
1428
- height: int | None = None,
1429
- use_container_width: bool = True,
1472
+ width: Width = "stretch",
1473
+ height: Height = "content",
1474
+ use_container_width: bool | None = None,
1430
1475
  ) -> DeltaGenerator:
1431
1476
  """Display a scatterplot chart.
1432
1477
 
@@ -1511,27 +1556,46 @@ class VegaChartsMixin:
1511
1556
  - The name of the column to use for the size. This allows each
1512
1557
  datapoint to be represented by a circle of a different size.
1513
1558
 
1514
- width : int or None
1515
- Desired width of the chart expressed in pixels. If ``width`` is
1516
- ``None`` (default), Streamlit sets the width of the chart to fit
1517
- its contents according to the plotting library, up to the width of
1518
- the parent container. If ``width`` is greater than the width of the
1519
- parent container, Streamlit sets the chart width to match the width
1520
- of the parent container.
1559
+ width : "stretch", "content", or int
1560
+ The width of the chart element. This can be one of the following:
1561
+
1562
+ - ``"stretch"`` (default): The width of the element matches the
1563
+ width of the parent container.
1564
+ - ``"content"``: The width of the element matches the width of its
1565
+ content, but doesn't exceed the width of the parent container.
1566
+ - An integer specifying the width in pixels: The element has a
1567
+ fixed width. If the specified width is greater than the width of
1568
+ the parent container, the width of the element matches the width
1569
+ of the parent container.
1570
+
1571
+ height : "stretch", "content", or int
1572
+ The height of the chart element. This can be one of the following:
1521
1573
 
1522
- To use ``width``, you must set ``use_container_width=False``.
1574
+ - ``"content"`` (default): The height of the element matches the
1575
+ height of its content.
1576
+ - ``"stretch"``: The height of the element matches the height of
1577
+ its content or the height of the parent container, whichever is
1578
+ larger. If the element is not in a parent container, the height
1579
+ of the element matches the height of its content.
1580
+ - An integer specifying the height in pixels: The element has a
1581
+ fixed height. If the content is larger than the specified
1582
+ height, scrolling is enabled.
1583
+
1584
+ use_container_width : bool or None
1585
+ Whether to override the chart's native width with the width of
1586
+ the parent container. This can be one of the following:
1523
1587
 
1524
- height : int or None
1525
- Desired height of the chart expressed in pixels. If ``height`` is
1526
- ``None`` (default), Streamlit sets the height of the chart to fit
1527
- its contents according to the plotting library.
1588
+ - ``None`` (default): Streamlit will use the chart's default behavior.
1589
+ - ``True``: Streamlit sets the width of the chart to match the
1590
+ width of the parent container.
1591
+ - ``False``: Streamlit sets the width of the chart to fit its
1592
+ contents according to the plotting library, up to the width of
1593
+ the parent container.
1528
1594
 
1529
- use_container_width : bool
1530
- Whether to override ``width`` with the width of the parent
1531
- container. If ``use_container_width`` is ``True`` (default),
1532
- Streamlit sets the width of the chart to match the width of the
1533
- parent container. If ``use_container_width`` is ``False``,
1534
- Streamlit sets the chart's width according to ``width``.
1595
+ .. deprecated::
1596
+ ``use_container_width`` is deprecated and will be removed in a
1597
+ future release. For ``use_container_width=True``, use
1598
+ ``width="stretch"``.
1535
1599
 
1536
1600
  Examples
1537
1601
  --------
@@ -1616,7 +1680,6 @@ class VegaChartsMixin:
1616
1680
  height: 440px
1617
1681
 
1618
1682
  """
1619
-
1620
1683
  chart, add_rows_metadata = generate_chart(
1621
1684
  chart_type=ChartType.SCATTER,
1622
1685
  data=data,
@@ -1628,7 +1691,7 @@ class VegaChartsMixin:
1628
1691
  size_from_user=size,
1629
1692
  width=width,
1630
1693
  height=height,
1631
- use_container_width=use_container_width,
1694
+ use_container_width=(width == "stretch"),
1632
1695
  )
1633
1696
  return cast(
1634
1697
  "DeltaGenerator",
@@ -1637,6 +1700,8 @@ class VegaChartsMixin:
1637
1700
  use_container_width=use_container_width,
1638
1701
  theme="streamlit",
1639
1702
  add_rows_metadata=add_rows_metadata,
1703
+ width=width,
1704
+ height=height,
1640
1705
  ),
1641
1706
  )
1642
1707
 
@@ -1646,6 +1711,8 @@ class VegaChartsMixin:
1646
1711
  self,
1647
1712
  altair_chart: AltairChart,
1648
1713
  *,
1714
+ width: Width | None = None,
1715
+ height: Height = "content",
1649
1716
  use_container_width: bool | None = None,
1650
1717
  theme: Literal["streamlit"] | None = "streamlit",
1651
1718
  key: Key | None = None,
@@ -1659,6 +1726,8 @@ class VegaChartsMixin:
1659
1726
  self,
1660
1727
  altair_chart: AltairChart,
1661
1728
  *,
1729
+ width: Width | None = None,
1730
+ height: Height = "content",
1662
1731
  use_container_width: bool | None = None,
1663
1732
  theme: Literal["streamlit"] | None = "streamlit",
1664
1733
  key: Key | None = None,
@@ -1671,6 +1740,8 @@ class VegaChartsMixin:
1671
1740
  self,
1672
1741
  altair_chart: AltairChart,
1673
1742
  *,
1743
+ width: Width | None = None,
1744
+ height: Height = "content",
1674
1745
  use_container_width: bool | None = None,
1675
1746
  theme: Literal["streamlit"] | None = "streamlit",
1676
1747
  key: Key | None = None,
@@ -1690,6 +1761,39 @@ class VegaChartsMixin:
1690
1761
  https://altair-viz.github.io/gallery/ for examples of graph
1691
1762
  descriptions.
1692
1763
 
1764
+ width : "stretch", "content", int, or None
1765
+ The width of the chart element. This can be one of the following:
1766
+
1767
+ - ``"stretch"``: The width of the element matches the width of the
1768
+ parent container.
1769
+ - ``"content"``: The width of the element matches the width of its
1770
+ content, but doesn't exceed the width of the parent container.
1771
+ - An integer specifying the width in pixels: The element has a
1772
+ fixed width. If the specified width is greater than the width of
1773
+ the parent container, the width of the element matches the width
1774
+ of the parent container.
1775
+ - ``None`` (default): Streamlit uses ``"stretch"`` for most charts,
1776
+ and uses ``"content"`` for the following multi-view charts:
1777
+
1778
+ - Facet charts: the spec contains ``"facet"`` or encodings for
1779
+ ``"row"``, ``"column"``, or ``"facet"``.
1780
+ - Horizontal concatenation charts: the spec contains
1781
+ ``"hconcat"``.
1782
+ - Repeat charts: the spec contains ``"repeat"``.
1783
+
1784
+ height : "content", "stretch", or int
1785
+ The height of the chart element. This can be one of the following:
1786
+
1787
+ - ``"content"`` (default): The height of the element matches the
1788
+ height of its content.
1789
+ - ``"stretch"``: The height of the element matches the height of
1790
+ its content or the height of the parent container, whichever is
1791
+ larger. If the element is not in a parent container, the height
1792
+ of the element matches the height of its content.
1793
+ - An integer specifying the height in pixels: The element has a
1794
+ fixed height. If the content is larger than the specified
1795
+ height, scrolling is enabled.
1796
+
1693
1797
  use_container_width : bool or None
1694
1798
  Whether to override the chart's native width with the width of
1695
1799
  the parent container. This can be one of the following:
@@ -1704,6 +1808,11 @@ class VegaChartsMixin:
1704
1808
  contents according to the plotting library, up to the width of
1705
1809
  the parent container.
1706
1810
 
1811
+ .. deprecated::
1812
+ ``use_container_width`` is deprecated and will be removed in a
1813
+ future release. For ``use_container_width=True``, use
1814
+ ``width="stretch"``.
1815
+
1707
1816
  theme : "streamlit" or None
1708
1817
  The theme of the chart. If ``theme`` is ``"streamlit"`` (default),
1709
1818
  Streamlit uses its own design default. If ``theme`` is ``None``,
@@ -1796,6 +1905,8 @@ class VegaChartsMixin:
1796
1905
  """
1797
1906
  return self._altair_chart(
1798
1907
  altair_chart=altair_chart,
1908
+ width=width,
1909
+ height=height,
1799
1910
  use_container_width=use_container_width,
1800
1911
  theme=theme,
1801
1912
  key=key,
@@ -1810,6 +1921,8 @@ class VegaChartsMixin:
1810
1921
  data: Data = None,
1811
1922
  spec: VegaLiteSpec | None = None,
1812
1923
  *,
1924
+ width: Width | None = None,
1925
+ height: Height = "content",
1813
1926
  use_container_width: bool | None = None,
1814
1927
  theme: Literal["streamlit"] | None = "streamlit",
1815
1928
  key: Key | None = None,
@@ -1825,6 +1938,8 @@ class VegaChartsMixin:
1825
1938
  data: Data = None,
1826
1939
  spec: VegaLiteSpec | None = None,
1827
1940
  *,
1941
+ width: Width | None = None,
1942
+ height: Height = "content",
1828
1943
  use_container_width: bool | None = None,
1829
1944
  theme: Literal["streamlit"] | None = "streamlit",
1830
1945
  key: Key | None = None,
@@ -1839,6 +1954,8 @@ class VegaChartsMixin:
1839
1954
  data: Data = None,
1840
1955
  spec: VegaLiteSpec | None = None,
1841
1956
  *,
1957
+ width: Width | None = None,
1958
+ height: Height = "content",
1842
1959
  use_container_width: bool | None = None,
1843
1960
  theme: Literal["streamlit"] | None = "streamlit",
1844
1961
  key: Key | None = None,
@@ -1863,6 +1980,39 @@ class VegaChartsMixin:
1863
1980
  to both ``data`` and ``spec``. See
1864
1981
  https://vega.github.io/vega-lite/docs/ for more info.
1865
1982
 
1983
+ width : "stretch", "content", int, or None
1984
+ The width of the chart element. This can be one of the following:
1985
+
1986
+ - ``"stretch"``: The width of the element matches the width of the
1987
+ parent container.
1988
+ - ``"content"``: The width of the element matches the width of its
1989
+ content, but doesn't exceed the width of the parent container.
1990
+ - An integer specifying the width in pixels: The element has a
1991
+ fixed width. If the specified width is greater than the width of
1992
+ the parent container, the width of the element matches the width
1993
+ of the parent container.
1994
+ - ``None`` (default): Streamlit uses ``"stretch"`` for most charts,
1995
+ and uses ``"content"`` for the following multi-view charts:
1996
+
1997
+ - Facet charts: the spec contains ``"facet"`` or encodings for
1998
+ ``"row"``, ``"column"``, or ``"facet"``.
1999
+ - Horizontal concatenation charts: the spec contains
2000
+ ``"hconcat"``.
2001
+ - Repeat charts: the spec contains ``"repeat"``.
2002
+
2003
+ height : "content", "stretch", or int
2004
+ The height of the chart element. This can be one of the following:
2005
+
2006
+ - ``"content"`` (default): The height of the element matches the
2007
+ height of its content.
2008
+ - ``"stretch"``: The height of the element matches the height of
2009
+ its content or the height of the parent container, whichever is
2010
+ larger. If the element is not in a parent container, the height
2011
+ of the element matches the height of its content.
2012
+ - An integer specifying the height in pixels: The element has a
2013
+ fixed height. If the content is larger than the specified
2014
+ height, scrolling is enabled.
2015
+
1866
2016
  use_container_width : bool or None
1867
2017
  Whether to override the chart's native width with the width of
1868
2018
  the parent container. This can be one of the following:
@@ -1877,6 +2027,11 @@ class VegaChartsMixin:
1877
2027
  contents according to the plotting library, up to the width of
1878
2028
  the parent container.
1879
2029
 
2030
+ .. deprecated::
2031
+ ``use_container_width`` is deprecated and will be removed in a
2032
+ future release. For ``use_container_width=True``, use
2033
+ ``width="stretch"``.
2034
+
1880
2035
  theme : "streamlit" or None
1881
2036
  The theme of the chart. If ``theme`` is ``"streamlit"`` (default),
1882
2037
  Streamlit uses its own design default. If ``theme`` is ``None``,
@@ -1938,6 +2093,11 @@ class VegaChartsMixin:
1938
2093
  The Vega-Lite spec for the chart as keywords. This is an alternative
1939
2094
  to ``spec``.
1940
2095
 
2096
+ .. deprecated::
2097
+ ``**kwargs`` are deprecated and will be removed in a future
2098
+ release. To specify Vega-Lite configuration options, use the
2099
+ ``spec`` argument instead.
2100
+
1941
2101
  Returns
1942
2102
  -------
1943
2103
  element or dict
@@ -1978,6 +2138,14 @@ class VegaChartsMixin:
1978
2138
  translated to the syntax shown above.
1979
2139
 
1980
2140
  """
2141
+ if kwargs:
2142
+ show_deprecation_warning(
2143
+ "Variable keyword arguments for `st.vega_lite_chart` have been "
2144
+ "deprecated and will be removed in a future release. Use the "
2145
+ "`spec` argument instead to specify Vega-Lite configuration "
2146
+ "options."
2147
+ )
2148
+
1981
2149
  return self._vega_lite_chart(
1982
2150
  data=data,
1983
2151
  spec=spec,
@@ -1986,6 +2154,8 @@ class VegaChartsMixin:
1986
2154
  key=key,
1987
2155
  on_select=on_select,
1988
2156
  selection_mode=selection_mode,
2157
+ width=width,
2158
+ height=height,
1989
2159
  **kwargs,
1990
2160
  )
1991
2161
 
@@ -1999,7 +2169,7 @@ class VegaChartsMixin:
1999
2169
  selection_mode: str | Iterable[str] | None = None,
2000
2170
  add_rows_metadata: AddRowsMetadata | None = None,
2001
2171
  width: Width | None = None,
2002
- height: Height | None = None,
2172
+ height: Height = "content",
2003
2173
  ) -> DeltaGenerator | VegaLiteState:
2004
2174
  """Internal method to enqueue a vega-lite chart element based on an Altair chart.
2005
2175
 
@@ -2039,14 +2209,13 @@ class VegaChartsMixin:
2039
2209
  selection_mode: str | Iterable[str] | None = None,
2040
2210
  add_rows_metadata: AddRowsMetadata | None = None,
2041
2211
  width: Width | None = None,
2042
- height: Height | None = None,
2212
+ height: Height = "content",
2043
2213
  **kwargs: Any,
2044
2214
  ) -> DeltaGenerator | VegaLiteState:
2045
2215
  """Internal method to enqueue a vega-lite chart element based on a vega-lite spec.
2046
2216
 
2047
2217
  See the `vega_lite_chart` method docstring for more information.
2048
2218
  """
2049
-
2050
2219
  if theme not in ["streamlit", None]:
2051
2220
  raise StreamlitAPIException(
2052
2221
  f'You set theme="{theme}" while Streamlit charts only support '
@@ -2085,22 +2254,48 @@ class VegaChartsMixin:
2085
2254
  if spec is None:
2086
2255
  spec = {}
2087
2256
 
2088
- # Set the default value for `use_container_width`.
2257
+ # Set the default value for width. Altair and Vega charts have different defaults depending on the chart type,
2258
+ # so they don't default the value in the function signature and width could be None here.
2089
2259
  if use_container_width is None and width is None:
2090
2260
  # Some multi-view charts (facet, horizontal concatenation, and repeat;
2091
2261
  # see https://altair-viz.github.io/user_guide/compound_charts.html)
2092
- # don't work well with `use_container_width=True`, so we disable it for
2262
+ # don't work well with `width=stretch`, so we disable it for
2093
2263
  # those charts (see https://github.com/streamlit/streamlit/issues/9091).
2094
2264
  # All other charts (including vertical concatenation) default to
2095
- # `use_container_width=True` unless width is provided.
2265
+ # `width=stretch` unless width is provided.
2096
2266
  is_facet_chart = "facet" in spec or (
2097
2267
  "encoding" in spec
2098
2268
  and (any(x in spec["encoding"] for x in ["row", "column", "facet"]))
2099
2269
  )
2100
- use_container_width = not (
2101
- is_facet_chart or "hconcat" in spec or "repeat" in spec
2270
+ width = (
2271
+ "stretch"
2272
+ if not (is_facet_chart or "hconcat" in spec or "repeat" in spec)
2273
+ else "content"
2102
2274
  )
2103
2275
 
2276
+ if use_container_width is not None:
2277
+ show_deprecation_warning(
2278
+ make_deprecated_name_warning(
2279
+ "use_container_width",
2280
+ "width",
2281
+ "2025-12-31",
2282
+ "For `use_container_width=True`, use `width='stretch'`. "
2283
+ "For `use_container_width=False`, use `width='content'` or specify an integer width.",
2284
+ include_st_prefix=False,
2285
+ ),
2286
+ show_in_browser=False,
2287
+ )
2288
+ if use_container_width:
2289
+ width = "stretch"
2290
+ elif not isinstance(width, int):
2291
+ # No specific width provided, use content width
2292
+ width = "content"
2293
+ # Otherwise keep the integer width - user explicitly set both use_container_width=False and width=int
2294
+
2295
+ if width is not None:
2296
+ validate_width(width, allow_content=True)
2297
+ validate_height(height, allow_content=True)
2298
+
2104
2299
  vega_lite_proto = ArrowVegaLiteChartProto()
2105
2300
 
2106
2301
  use_container_width_for_spec = (
@@ -2108,11 +2303,13 @@ class VegaChartsMixin:
2108
2303
  if use_container_width is not None
2109
2304
  else width == "stretch"
2110
2305
  )
2306
+
2111
2307
  spec = _prepare_vega_lite_spec(spec, use_container_width_for_spec, **kwargs)
2112
2308
  _marshall_chart_data(vega_lite_proto, spec, data)
2113
2309
 
2114
2310
  # Prevent the spec from changing across reruns:
2115
2311
  vega_lite_proto.spec = _stabilize_vega_json_spec(json.dumps(spec))
2312
+
2116
2313
  if use_container_width is not None:
2117
2314
  vega_lite_proto.use_container_width = use_container_width
2118
2315
  vega_lite_proto.theme = theme or ""
@@ -2158,32 +2355,42 @@ class VegaChartsMixin:
2158
2355
  value_type="string_value",
2159
2356
  )
2160
2357
 
2161
- self.dg._enqueue(
2162
- "arrow_vega_lite_chart",
2163
- vega_lite_proto,
2164
- add_rows_metadata=add_rows_metadata,
2165
- )
2166
- return widget_state.value
2167
-
2168
- # Handle layout config for width/height parameters
2169
- if width is not None or height is not None:
2170
2358
  layout_config = LayoutConfig(width=width, height=height)
2171
- return self.dg._enqueue(
2359
+ self.dg._enqueue(
2172
2360
  "arrow_vega_lite_chart",
2173
2361
  vega_lite_proto,
2174
2362
  add_rows_metadata=add_rows_metadata,
2175
2363
  layout_config=layout_config,
2176
2364
  )
2365
+ return widget_state.value
2177
2366
 
2178
2367
  # If its not used with selections activated, just return
2179
2368
  # the delta generator related to this element.
2369
+ layout_config = LayoutConfig(width=width, height=height)
2180
2370
  return self.dg._enqueue(
2181
2371
  "arrow_vega_lite_chart",
2182
2372
  vega_lite_proto,
2183
2373
  add_rows_metadata=add_rows_metadata,
2374
+ layout_config=layout_config,
2184
2375
  )
2185
2376
 
2186
2377
  @property
2187
2378
  def dg(self) -> DeltaGenerator:
2188
2379
  """Get our DeltaGenerator."""
2189
2380
  return cast("DeltaGenerator", self)
2381
+
2382
+
2383
+ def _to_arrow_dataset(data: Any, datasets: dict[str, Any]) -> dict[str, str]:
2384
+ """Altair data transformer that serializes the data,
2385
+ creates a stable name based on the hash of the data,
2386
+ stores the bytes into the datasets mapping and
2387
+ returns this name to have it be used in Altair.
2388
+ """
2389
+ # Already serialize the data to be able to create a stable
2390
+ # dataset name:
2391
+ data_bytes = dataframe_util.convert_anything_to_arrow_bytes(data)
2392
+ # Use the md5 hash of the data as the name:
2393
+ name = calc_md5(str(data_bytes))
2394
+
2395
+ datasets[name] = data_bytes
2396
+ return {"name": name}