streamlit-nightly 1.45.2.dev20250616__py3-none-any.whl → 1.46.1.dev20250618__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 (125) hide show
  1. streamlit/commands/navigation.py +39 -5
  2. streamlit/commands/page_config.py +48 -20
  3. streamlit/components/types/base_custom_component.py +3 -0
  4. streamlit/components/v1/custom_component.py +2 -0
  5. streamlit/config.py +73 -33
  6. streamlit/dataframe_util.py +2 -3
  7. streamlit/elements/alert.py +36 -28
  8. streamlit/elements/arrow.py +1 -1
  9. streamlit/elements/code.py +23 -8
  10. streamlit/elements/deck_gl_json_chart.py +1 -1
  11. streamlit/elements/doc_string.py +8 -2
  12. streamlit/elements/exception.py +9 -7
  13. streamlit/elements/form.py +28 -0
  14. streamlit/elements/heading.py +34 -13
  15. streamlit/elements/json.py +8 -3
  16. streamlit/elements/layouts.py +69 -13
  17. streamlit/elements/lib/color_util.py +1 -1
  18. streamlit/elements/lib/image_utils.py +3 -5
  19. streamlit/elements/markdown.py +57 -24
  20. streamlit/elements/media.py +31 -24
  21. streamlit/elements/metric.py +11 -4
  22. streamlit/elements/plotly_chart.py +1 -1
  23. streamlit/elements/progress.py +9 -3
  24. streamlit/elements/spinner.py +11 -3
  25. streamlit/elements/text.py +12 -4
  26. streamlit/elements/vega_charts.py +1 -1
  27. streamlit/elements/widgets/audio_input.py +8 -3
  28. streamlit/elements/widgets/button.py +7 -6
  29. streamlit/elements/widgets/camera_input.py +9 -3
  30. streamlit/elements/widgets/chat.py +23 -11
  31. streamlit/elements/widgets/checkbox.py +24 -6
  32. streamlit/elements/widgets/color_picker.py +13 -4
  33. streamlit/elements/widgets/file_uploader.py +9 -3
  34. streamlit/elements/widgets/number_input.py +10 -2
  35. streamlit/elements/widgets/radio.py +12 -3
  36. streamlit/elements/widgets/select_slider.py +9 -3
  37. streamlit/elements/widgets/selectbox.py +9 -3
  38. streamlit/elements/widgets/slider.py +10 -2
  39. streamlit/elements/widgets/text_widgets.py +20 -4
  40. streamlit/elements/widgets/time_widgets.py +17 -10
  41. streamlit/proto/NewSession_pb2.py +16 -16
  42. streamlit/proto/NewSession_pb2.pyi +12 -2
  43. streamlit/proto/PageConfig_pb2.py +5 -5
  44. streamlit/proto/PageConfig_pb2.pyi +16 -0
  45. streamlit/runtime/context.py +22 -1
  46. streamlit/runtime/state/query_params_proxy.py +2 -0
  47. streamlit/runtime/state/session_state.py +4 -2
  48. streamlit/runtime/uploaded_file_manager.py +3 -0
  49. streamlit/static/index.html +1 -1
  50. streamlit/static/manifest.json +214 -214
  51. streamlit/static/static/js/{ErrorOutline.esm.BBFVdWjb.js → ErrorOutline.esm.BmIZNTls.js} +1 -1
  52. streamlit/static/static/js/{FileDownload.esm.DvdwDAxp.js → FileDownload.esm.BANz7qEu.js} +1 -1
  53. streamlit/static/static/js/{FileHelper.CjU1Ef50.js → FileHelper.Bn_I1AoA.js} +1 -1
  54. streamlit/static/static/js/{FormClearHelper.CIb6LGNE.js → FormClearHelper.DngQDUHj.js} +1 -1
  55. streamlit/static/static/js/{Hooks.GJR4p5ub.js → Hooks.BvgTYyDl.js} +1 -1
  56. streamlit/static/static/js/{InputInstructions.nsoutNDU.js → InputInstructions.Dz68Mi4g.js} +1 -1
  57. streamlit/static/static/js/{ProgressBar.DqtkCWgY.js → ProgressBar.CBQ2YdYU.js} +1 -1
  58. streamlit/static/static/js/{RenderInPortalIfExists.CocQHyjY.js → RenderInPortalIfExists.DbNxALcQ.js} +1 -1
  59. streamlit/static/static/js/{Toolbar.UeCiz5bZ.js → Toolbar.Be9ReaBo.js} +1 -1
  60. streamlit/static/static/js/{base-input.ChMOqefY.js → base-input.CuYAUcgr.js} +1 -1
  61. streamlit/static/static/js/{checkbox.mFAkcYlJ.js → checkbox.CHeWw9QN.js} +1 -1
  62. streamlit/static/static/js/{createSuper.CWlw4uuT.js → createSuper.cbLRgPSA.js} +1 -1
  63. streamlit/static/static/js/{data-grid-overlay-editor.BRuPFGVT.js → data-grid-overlay-editor.BtDffWRm.js} +1 -1
  64. streamlit/static/static/js/{downloader.D-JZV5KC.js → downloader.CqSIsk34.js} +1 -1
  65. streamlit/static/static/js/{es6.8aYd2mZD.js → es6.Cf5x23Le.js} +2 -2
  66. streamlit/static/static/js/{iframeResizer.contentWindow.jbTJNegv.js → iframeResizer.contentWindow.w5G78o8J.js} +1 -1
  67. streamlit/static/static/js/{index.MuhC3L76.js → index.3x2ivJwf.js} +1 -1
  68. streamlit/static/static/js/{index.Bll2-rP6.js → index.BThEsAWi.js} +1 -1
  69. streamlit/static/static/js/{index.C-qKPIAc.js → index.BY9g96EZ.js} +1 -1
  70. streamlit/static/static/js/{index.45n3hxWl.js → index.BYMqFCBA.js} +1 -1
  71. streamlit/static/static/js/{index._beSUPH2.js → index.BbnvJ70n.js} +1 -1
  72. streamlit/static/static/js/{index.g86WIJtm.js → index.Bi464CyL.js} +1 -1
  73. streamlit/static/static/js/{index.D2DTU1aY.js → index.C0eW2K8y.js} +1 -1
  74. streamlit/static/static/js/{index.gcWbHnPE.js → index.CAbis03n.js} +1 -1
  75. streamlit/static/static/js/{index.DcylHZOn.js → index.CBOeW9a3.js} +1 -1
  76. streamlit/static/static/js/{index.CQG85lDO.js → index.CDPtgf1I.js} +1 -1
  77. streamlit/static/static/js/{index.BuwwBXlt.js → index.CI8kv2N4.js} +1 -1
  78. streamlit/static/static/js/{index.C5Jk6yHy.js → index.CIa-BnGt.js} +1 -1
  79. streamlit/static/static/js/{index.Dat8JgZf.js → index.CO4lsynG.js} +5 -5
  80. streamlit/static/static/js/{index.CeJjESM2.js → index.CPAaINBO.js} +1 -1
  81. streamlit/static/static/js/{index.BrZrTW9I.js → index.CPybvB14.js} +1 -1
  82. streamlit/static/static/js/{index.CwtQIKUg.js → index.CSmW4aEL.js} +1 -1
  83. streamlit/static/static/js/{index.RqdD1cln.js → index.CsbNNPg-.js} +1 -1
  84. streamlit/static/static/js/{index.B_K-sbDk.js → index.CvAxzLGy.js} +1 -1
  85. streamlit/static/static/js/{index.Cf2Ujw1i.js → index.D3RUL8hc.js} +1 -1
  86. streamlit/static/static/js/{index.CrLOSpGd.js → index.D7skVg6V.js} +1 -1
  87. streamlit/static/static/js/{index.ZJ-p6xZJ.js → index.D9cNUJxT.js} +1 -1
  88. streamlit/static/static/js/{index.BSBLj6fd.js → index.D9rP3sec.js} +2 -2
  89. streamlit/static/static/js/{index.Ddznlirl.js → index.DFb8oLEy.js} +1 -1
  90. streamlit/static/static/js/{index.CmYORNI1.js → index.DUFSCgUU.js} +1 -1
  91. streamlit/static/static/js/{index.D9LSzO5n.js → index.DhOEtnPS.js} +1 -1
  92. streamlit/static/static/js/{index.DlBss_D9.js → index.Dka0l3y3.js} +1 -1
  93. streamlit/static/static/js/{index.D6aDPgRk.js → index.DqUqQYLj.js} +1 -1
  94. streamlit/static/static/js/{index.EmgmixKr.js → index.Dve6LvwK.js} +1 -1
  95. streamlit/static/static/js/{index.5VmqWrFJ.js → index.E59z5B9V.js} +1 -1
  96. streamlit/static/static/js/{index.2vhUbWYE.js → index.HCf1LzCz.js} +1 -1
  97. streamlit/static/static/js/{index.CBxfNa4S.js → index.IFt67CpH.js} +1 -1
  98. streamlit/static/static/js/{index.D7n0aj1W.js → index.Mr8WFWji.js} +1 -1
  99. streamlit/static/static/js/{index.TEOqOk4H.js → index.OWQJmAOF.js} +1 -1
  100. streamlit/static/static/js/{index.B_IVL8xE.js → index.kZ6mI-nG.js} +1 -1
  101. streamlit/static/static/js/{index.B5CU57Qf.js → index.u9xbgcFq.js} +113 -114
  102. streamlit/static/static/js/{index.DiKxaWW9.js → index.vMjoJQjc.js} +1 -1
  103. streamlit/static/static/js/{index.DwGCBH5W.js → index.xUOdHmh_.js} +1 -1
  104. streamlit/static/static/js/{input.DXa_gBzj.js → input.CI-6PkTz.js} +1 -1
  105. streamlit/static/static/js/{memory.D5rOUj2Y.js → memory.C3s3Nr3T.js} +1 -1
  106. streamlit/static/static/js/{mergeWith.DSXoP_ea.js → mergeWith.BaIFtAzQ.js} +1 -1
  107. streamlit/static/static/js/{number-overlay-editor.DOlAMQ4z.js → number-overlay-editor.DG_TIpZI.js} +1 -1
  108. streamlit/static/static/js/{possibleConstructorReturn.C8PlFdhp.js → possibleConstructorReturn.DnjFJxG8.js} +1 -1
  109. streamlit/static/static/js/{sandbox.Cbgzd0RE.js → sandbox.DkNGv8rg.js} +1 -1
  110. streamlit/static/static/js/{textarea.CwmJHkZd.js → textarea.Wdt3uXnP.js} +1 -1
  111. streamlit/static/static/js/{timepicker.D-HemJVg.js → timepicker.BEyYdc_Z.js} +1 -1
  112. streamlit/static/static/js/{toConsumableArray.K58gdyL6.js → toConsumableArray.CAwuKyRj.js} +1 -1
  113. streamlit/static/static/js/{uniqueId.D6CfbZfn.js → uniqueId.-FDr5eeU.js} +1 -1
  114. streamlit/static/static/js/{useBasicWidgetState.t6CdhaX9.js → useBasicWidgetState.DOr4_K__.js} +1 -1
  115. streamlit/static/static/js/{useOnInputChange.D_GNOmUw.js → useOnInputChange.KHtPR_lb.js} +1 -1
  116. streamlit/static/static/js/{withFullScreenWrapper.DILaf-7C.js → withFullScreenWrapper.CJ_ynFQD.js} +1 -1
  117. streamlit/testing/v1/element_tree.py +3 -0
  118. streamlit/watcher/event_based_path_watcher.py +18 -13
  119. streamlit/web/server/oidc_mixin.py +0 -1
  120. {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.46.1.dev20250618.dist-info}/METADATA +1 -1
  121. {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.46.1.dev20250618.dist-info}/RECORD +125 -125
  122. {streamlit_nightly-1.45.2.dev20250616.data → streamlit_nightly-1.46.1.dev20250618.data}/scripts/streamlit.cmd +0 -0
  123. {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.46.1.dev20250618.dist-info}/WHEEL +0 -0
  124. {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.46.1.dev20250618.dist-info}/entry_points.txt +0 -0
  125. {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.46.1.dev20250618.dist-info}/top_level.txt +0 -0
@@ -131,6 +131,34 @@ class FormMixin:
131
131
  there's another border (e.g. because of an expander) or the form is small
132
132
  (e.g. just a text input and a submit button).
133
133
 
134
+ width : "stretch", "content", or int
135
+ The width of the form container. This can be one of the following:
136
+
137
+ - ``"stretch"`` (default): The width of the container matches the
138
+ width of the parent container.
139
+ - ``"content"``: The width of the container matches the width of its
140
+ content, but doesn't exceed the width of the parent container.
141
+ - An integer specifying the width in pixels: The container has a
142
+ fixed width. If the specified width is greater than the width of
143
+ the parent container, the width of the container matches the width
144
+ of the parent container.
145
+
146
+ height : "content" or int
147
+ The height of the form container. This can be one of the following:
148
+
149
+ - ``"content"`` (default): The height of the container matches the
150
+ height of its content.
151
+ - An integer specifying the height in pixels: The container has a
152
+ fixed height. If the content is larger than the specified
153
+ height, scrolling is enabled.
154
+
155
+ .. note::
156
+ Use scrolling containers sparingly. If you use scrolling
157
+ containers, avoid heights that exceed 500 pixels. Otherwise,
158
+ the scroll surface of the container might cover the majority of
159
+ the screen on mobile devices, which makes it hard to scroll the
160
+ rest of the app.
161
+
134
162
  Examples
135
163
  --------
136
164
  Inserting elements using ``with`` notation:
@@ -79,7 +79,7 @@ class HeadingMixin:
79
79
  including the Markdown directives described in the ``body``
80
80
  parameter of ``st.markdown``.
81
81
 
82
- divider : bool or “blue”, “green”, “orange”, “red”, “violet”, “gray”/"grey", or “rainbow”
82
+ divider : bool, “blue”, “green”, “orange”, “red”, “violet”, “gray”/"grey", or “rainbow”
83
83
  Shows a colored divider below the header. If True, successive
84
84
  headers will cycle through divider colors. That is, the first
85
85
  header will have a blue line, the second header will have a
@@ -87,10 +87,17 @@ class HeadingMixin:
87
87
  the following: blue, green, orange, red, violet, gray/grey, or
88
88
  rainbow.
89
89
 
90
- width : int or "stretch" or "content"
91
- The width of the header. Can be an integer (pixels), "stretch" to
92
- use the full width of the container, or "content" (default) to size
93
- based on the content.
90
+ width : "stretch", "content", or int
91
+ The width of the header element. This can be one of the following:
92
+
93
+ - ``"stretch"`` (default): The width of the element matches the
94
+ width of the parent container.
95
+ - ``"content"``: The width of the element matches the width of its
96
+ content, but doesn't exceed the width of the parent container.
97
+ - An integer specifying the width in pixels: The element has a
98
+ fixed width. If the specified width is greater than the width of
99
+ the parent container, the width of the element matches the width
100
+ of the parent container.
94
101
 
95
102
  Examples
96
103
  --------
@@ -169,10 +176,17 @@ class HeadingMixin:
169
176
  the following: blue, green, orange, red, violet, gray/grey, or
170
177
  rainbow.
171
178
 
172
- width : int or "stretch" or "content"
173
- The width of the subheader. Can be an integer (pixels), "stretch" to
174
- use the full width of the container, or "content" (default) to size
175
- based on the content.
179
+ width : "stretch", "content", or int
180
+ The width of the subheader element. This can be one of the following:
181
+
182
+ - ``"stretch"`` (default): The width of the element matches the
183
+ width of the parent container.
184
+ - ``"content"``: The width of the element matches the width of its
185
+ content, but doesn't exceed the width of the parent container.
186
+ - An integer specifying the width in pixels: The element has a
187
+ fixed width. If the specified width is greater than the width of
188
+ the parent container, the width of the element matches the width
189
+ of the parent container.
176
190
 
177
191
  Examples
178
192
  --------
@@ -245,10 +259,17 @@ class HeadingMixin:
245
259
  including the Markdown directives described in the ``body``
246
260
  parameter of ``st.markdown``.
247
261
 
248
- width : int or "stretch" or "content"
249
- The width of the title. Can be an integer (pixels), "stretch" to
250
- use the full width of the container, or "content" (default) to size
251
- based on the content.
262
+ width : "stretch", "content", or int
263
+ The width of the title element. This can be one of the following:
264
+
265
+ - ``"stretch"`` (default): The width of the element matches the
266
+ width of the parent container.
267
+ - ``"content"``: The width of the element matches the width of its
268
+ content, but doesn't exceed the width of the parent container.
269
+ - An integer specifying the width in pixels: The element has a
270
+ fixed width. If the specified width is greater than the width of
271
+ the parent container, the width of the element matches the width
272
+ of the parent container.
252
273
 
253
274
  Examples
254
275
  --------
@@ -76,9 +76,14 @@ class JsonMixin:
76
76
  expand any key-value pair to show or hide any part of the object.
77
77
 
78
78
  width : "stretch" or int
79
- The width of the JSON element. This can be either:
80
- - "stretch" (default): The element will stretch to fill the container width
81
- - An integer: The element will have a fixed width in pixels
79
+ The width of the JSON element. This can be one of the following:
80
+
81
+ - ``"stretch"`` (default): The width of the element matches the
82
+ width of the parent container.
83
+ - An integer specifying the width in pixels: The element has a
84
+ fixed width. If the specified width is greater than the width of
85
+ the parent container, the width of the element matches the width
86
+ of the parent container.
82
87
 
83
88
  Example
84
89
  -------
@@ -74,10 +74,11 @@ class LayoutsMixin:
74
74
  to visually separate its scroll surface from the rest of the app.
75
75
 
76
76
  .. note::
77
- Use containers with scroll sparingly. If you do, try to keep
78
- the height small (below 500 pixels). Otherwise, the scroll
79
- surface of the container might cover the majority of the screen
80
- on mobile devices, which makes it hard to scroll the rest of the app.
77
+ Use scrolling containers sparingly. If you use scrolling
78
+ containers, avoid heights that exceed 500 pixels. Otherwise,
79
+ the scroll surface of the container might cover the majority of
80
+ the screen on mobile devices, which makes it hard to scroll the
81
+ rest of the app.
81
82
 
82
83
  border : bool or None
83
84
  Whether to show a border around the container. If ``None`` (default), a
@@ -205,7 +206,8 @@ class LayoutsMixin:
205
206
  examples below.
206
207
 
207
208
  .. note::
208
- We recommend against nesting columns more than once since it might look bad on smaller devices.
209
+ To follow best design practices and maintain a good appearance on
210
+ all screen sizes, don't nest columns more than once.
209
211
 
210
212
  Parameters
211
213
  ----------
@@ -221,7 +223,16 @@ class LayoutsMixin:
221
223
  the width of the first one, and the third one is three times that width.
222
224
 
223
225
  gap : "small", "medium", "large", or None
224
- The size of the gap between the columns. The default is ``"small"``.
226
+ The size of the gap between the columns. This can be one of the
227
+ following:
228
+
229
+ - ``"small"`` (default): 1rem gap between the columns.
230
+ - ``"medium"``: 2rem gap between the columns.
231
+ - ``"large"``: 4rem gap between the columns.
232
+ - ``None``: No gap between the columns.
233
+
234
+ The rem unit is relative to the ``theme.baseFontSize``
235
+ configuration option.
225
236
 
226
237
  vertical_alignment : "top", "center", or "bottom"
227
238
  The vertical alignment of the content inside the columns. The
@@ -422,9 +433,12 @@ class LayoutsMixin:
422
433
  (preferred) or just call methods directly on the returned object. See
423
434
  examples below.
424
435
 
425
- .. warning::
426
- All the content of every tab is always sent to and rendered on the frontend.
427
- Conditional rendering is currently not supported.
436
+ .. note::
437
+ All content within every tab is computed and sent to the frontend,
438
+ regardless of which tab is selected. Tabs do not currently support
439
+ conditional rendering. If you have a slow-loading tab, consider
440
+ using a widget like ``st.segmented_control`` to conditionally
441
+ render content instead.
428
442
 
429
443
  Parameters
430
444
  ----------
@@ -447,6 +461,16 @@ class LayoutsMixin:
447
461
  .. |st.markdown| replace:: ``st.markdown``
448
462
  .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
449
463
 
464
+ width : "stretch" or int
465
+ The width of the tab container. This can be one of the following:
466
+
467
+ - ``"stretch"`` (default): The width of the container matches the
468
+ width of the parent container.
469
+ - An integer specifying the width in pixels: The container has a
470
+ fixed width. If the specified width is greater than the width of
471
+ the parent container, the width of the container matches the width
472
+ of the parent container.
473
+
450
474
  Returns
451
475
  -------
452
476
  list of containers
@@ -536,6 +560,13 @@ class LayoutsMixin:
536
560
  (preferred) or just call methods directly on the returned object. See
537
561
  examples below.
538
562
 
563
+ .. note::
564
+ All content within the expander is computed and sent to the
565
+ frontend, even if the expander is closed.
566
+
567
+ To follow best design practices and maintain a good appearance on
568
+ all screen sizes, don't nest expanders.
569
+
539
570
  Parameters
540
571
  ----------
541
572
  label : str
@@ -576,6 +607,16 @@ class LayoutsMixin:
576
607
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
577
608
  font library.
578
609
 
610
+ width : "stretch" or int
611
+ The width of the expander container. This can be one of the following:
612
+
613
+ - ``"stretch"`` (default): The width of the container matches the
614
+ width of the parent container.
615
+ - An integer specifying the width in pixels: The container has a
616
+ fixed width. If the specified width is greater than the width of
617
+ the parent container, the width of the container matches the width
618
+ of the parent container.
619
+
579
620
  Examples
580
621
  --------
581
622
  You can use the ``with`` notation to insert any element into an expander
@@ -655,8 +696,8 @@ class LayoutsMixin:
655
696
  notation (preferred) or just call methods directly on the returned object.
656
697
  See examples below.
657
698
 
658
- .. warning::
659
- We strongly advise against nesting popovers.
699
+ .. note::
700
+ To follow best design practices, don't nest popovers.
660
701
 
661
702
  Parameters
662
703
  ----------
@@ -797,6 +838,13 @@ class LayoutsMixin:
797
838
  ``with`` notation, it automatically updates to the "complete" state at the end
798
839
  of the "with" block. See examples below for more details.
799
840
 
841
+ .. note::
842
+ All content within the status container is computed and sent to the
843
+ frontend, even if the status container is closed.
844
+
845
+ To follow best design practices and maintain a good appearance on
846
+ all screen sizes, don't nest status containers.
847
+
800
848
  Parameters
801
849
  ----------
802
850
  label : str
@@ -825,11 +873,19 @@ class LayoutsMixin:
825
873
  shown:
826
874
 
827
875
  - ``running`` (default): A spinner icon is shown.
828
-
829
876
  - ``complete``: A checkmark icon is shown.
830
-
831
877
  - ``error``: An error icon is shown.
832
878
 
879
+ width : "stretch" or int
880
+ The width of the status container. This can be one of the following:
881
+
882
+ - ``"stretch"`` (default): The width of the container matches the
883
+ width of the parent container.
884
+ - An integer specifying the width in pixels: The container has a
885
+ fixed width. If the specified width is greater than the width of
886
+ the parent container, the width of the container matches the width
887
+ of the parent container.
888
+
833
889
  Returns
834
890
  -------
835
891
  StatusContainer
@@ -225,7 +225,7 @@ def _normalize_tuple(
225
225
  return r, g, b
226
226
 
227
227
  if len(color) == 4:
228
- color_4tuple = cast("Color4Tuple", color)
228
+ color_4tuple = color
229
229
  r = rgb_formatter(color_4tuple[0], color_4tuple)
230
230
  g = rgb_formatter(color_4tuple[1], color_4tuple)
231
231
  b = rgb_formatter(color_4tuple[2], color_4tuple)
@@ -311,7 +311,7 @@ def image_to_url(
311
311
  image = _clip_image(_verify_np_shape(image), clamp)
312
312
 
313
313
  if channels == "BGR":
314
- if len(cast("NumpyShape", image.shape)) == 3:
314
+ if len(image.shape) == 3:
315
315
  image = image[:, :, [2, 1, 0]]
316
316
  else:
317
317
  raise StreamlitAPIException(
@@ -397,7 +397,7 @@ def marshall_images(
397
397
  images: Sequence[AtomicImage]
398
398
  if isinstance(image, (list, set, tuple)):
399
399
  images = list(image)
400
- elif isinstance(image, np.ndarray) and len(cast("NumpyShape", image.shape)) == 4:
400
+ elif isinstance(image, np.ndarray) and len(image.shape) == 4:
401
401
  images = _4d_to_list_3d(image)
402
402
  else:
403
403
  images = cast("Sequence[AtomicImage]", [image])
@@ -406,9 +406,7 @@ def marshall_images(
406
406
  captions: Sequence[str | None] = caption
407
407
  elif isinstance(caption, str):
408
408
  captions = [caption]
409
- elif (
410
- isinstance(caption, np.ndarray) and len(cast("NumpyShape", caption.shape)) == 1
411
- ):
409
+ elif isinstance(caption, np.ndarray) and len(caption.shape) == 1:
412
410
  captions = caption.tolist()
413
411
  elif caption is None:
414
412
  captions = [None] * len(images)
@@ -117,10 +117,17 @@ class MarkdownMixin:
117
117
  including the Markdown directives described in the ``body``
118
118
  parameter of ``st.markdown``.
119
119
 
120
- width : int or "stretch" or "content"
121
- The width of the markdown element. Can be an integer (pixels),
122
- "stretch" (default) to use the full width of the container, or "content"
123
- to size based on the content.
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.
124
131
 
125
132
  Examples
126
133
  --------
@@ -205,10 +212,17 @@ class MarkdownMixin:
205
212
  including the Markdown directives described in the ``body``
206
213
  parameter of ``st.markdown``.
207
214
 
208
- width : int or "stretch" or "content"
209
- The width of the caption. Can be an integer (pixels), "stretch"
210
- (default) to use the full width of the container, or "content" to
211
- size based on the content.
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.
212
226
 
213
227
  Examples
214
228
  --------
@@ -261,11 +275,17 @@ class MarkdownMixin:
261
275
  including the Markdown directives described in the ``body``
262
276
  parameter of ``st.markdown``.
263
277
 
264
- width : int or "stretch" or "content"
265
- The width of the LaTeX expression. If "stretch" (default), the
266
- expression will take up the full width of the container. If "content",
267
- the expression will take up only as much width as needed. If an integer,
268
- the width will be set to that number of pixels.
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.
269
289
 
270
290
  Example
271
291
  -------
@@ -299,17 +319,22 @@ class MarkdownMixin:
299
319
  def divider(self, *, width: WidthWithoutContent = "stretch") -> DeltaGenerator:
300
320
  """Display a horizontal rule.
301
321
 
302
- Parameters
303
- ----------
304
- width : int or "stretch"
305
- The width of the divider. If "stretch" (default), the divider will
306
- take up the full width of the container. If an integer, the width
307
- will be set to that number of pixels.
308
-
309
322
  .. note::
310
323
  You can achieve the same effect with st.write("---") or
311
324
  even just "---" in your script (via magic).
312
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
+
313
338
  Example
314
339
  -------
315
340
  >>> import streamlit as st
@@ -398,10 +423,18 @@ class MarkdownMixin:
398
423
  ``"primary"``, Streamlit will use the default primary accent color
399
424
  unless you set the ``theme.primaryColor`` configuration option.
400
425
 
401
- width : int or "stretch" or "content"
402
- The width of the badge. Can be an integer (pixels), "stretch" to
403
- use the full width of the container, or "content" (default) to size
404
- based on the content.
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.
405
438
 
406
439
  Examples
407
440
  --------
@@ -41,7 +41,6 @@ if TYPE_CHECKING:
41
41
  from numpy import typing as npt
42
42
 
43
43
  from streamlit.delta_generator import DeltaGenerator
44
- from streamlit.type_util import NumpyShape
45
44
 
46
45
 
47
46
  MediaData: TypeAlias = Union[
@@ -109,7 +108,7 @@ class MediaMixin:
109
108
  For more information about MIME types, see
110
109
  https://www.iana.org/assignments/media-types/media-types.xhtml.
111
110
 
112
- start_time: int, float, timedelta, str, or None
111
+ start_time : int, float, timedelta, str, or None
113
112
  The time from which the element should start playing. This can be
114
113
  one of the following:
115
114
 
@@ -122,10 +121,10 @@ class MediaMixin:
122
121
  - A ``timedelta`` object from `Python's built-in datetime library
123
122
  <https://docs.python.org/3/library/datetime.html#timedelta-objects>`_,
124
123
  e.g. ``timedelta(seconds=70)``.
125
- sample_rate: int or None
124
+ sample_rate : int or None
126
125
  The sample rate of the audio data in samples per second. This is
127
126
  only required if ``data`` is a NumPy array.
128
- end_time: int, float, timedelta, str, or None
127
+ end_time : int, float, timedelta, str, or None
129
128
  The time at which the element should stop playing. This can be
130
129
  one of the following:
131
130
 
@@ -138,18 +137,22 @@ class MediaMixin:
138
137
  - A ``timedelta`` object from `Python's built-in datetime library
139
138
  <https://docs.python.org/3/library/datetime.html#timedelta-objects>`_,
140
139
  e.g. ``timedelta(seconds=70)``.
141
- loop: bool
140
+ loop : bool
142
141
  Whether the audio should loop playback.
143
- autoplay: bool
142
+ autoplay : bool
144
143
  Whether the audio file should start playing automatically. This is
145
144
  ``False`` by default. Browsers will not autoplay audio files if the
146
145
  user has not interacted with the page by clicking somewhere.
147
- width: int or "stretch"
148
- The width of the audio player. This can be one of the following:
146
+ width : "stretch" or int
147
+ The width of the audio player element. This can be one of the
148
+ following:
149
149
 
150
- - An int: The width in pixels, e.g. ``200`` for a width of 200 pixels.
151
- - ``"stretch"``: The default value. The audio player stretches to fill
152
- available space in its container.
150
+ - ``"stretch"`` (default): The width of the element matches the
151
+ width of the parent container.
152
+ - An integer specifying the width in pixels: The element has a
153
+ fixed width. If the specified width is greater than the width of
154
+ the parent container, the width of the element matches the width
155
+ of the parent container.
153
156
 
154
157
  Examples
155
158
  --------
@@ -254,7 +257,7 @@ class MediaMixin:
254
257
  For more information about MIME types, see
255
258
  https://www.iana.org/assignments/media-types/media-types.xhtml.
256
259
 
257
- start_time: int, float, timedelta, str, or None
260
+ start_time : int, float, timedelta, str, or None
258
261
  The time from which the element should start playing. This can be
259
262
  one of the following:
260
263
 
@@ -267,7 +270,7 @@ class MediaMixin:
267
270
  - A ``timedelta`` object from `Python's built-in datetime library
268
271
  <https://docs.python.org/3/library/datetime.html#timedelta-objects>`_,
269
272
  e.g. ``timedelta(seconds=70)``.
270
- subtitles: str, bytes, Path, io.BytesIO, or dict
273
+ subtitles : str, bytes, Path, io.BytesIO, or dict
271
274
  Optional subtitle data for the video, supporting several input types:
272
275
 
273
276
  - ``None`` (default): No subtitles.
@@ -293,7 +296,7 @@ class MediaMixin:
293
296
  in a dictrionary's first pair: ``{"None": "", "English": "path/to/english.vtt"}``
294
297
 
295
298
  Not supported for YouTube videos.
296
- end_time: int, float, timedelta, str, or None
299
+ end_time : int, float, timedelta, str, or None
297
300
  The time at which the element should stop playing. This can be
298
301
  one of the following:
299
302
 
@@ -306,24 +309,28 @@ class MediaMixin:
306
309
  - A ``timedelta`` object from `Python's built-in datetime library
307
310
  <https://docs.python.org/3/library/datetime.html#timedelta-objects>`_,
308
311
  e.g. ``timedelta(seconds=70)``.
309
- loop: bool
312
+ loop : bool
310
313
  Whether the video should loop playback.
311
- autoplay: bool
314
+ autoplay : bool
312
315
  Whether the video should start playing automatically. This is
313
316
  ``False`` by default. Browsers will not autoplay unmuted videos
314
317
  if the user has not interacted with the page by clicking somewhere.
315
318
  To enable autoplay without user interaction, you must also set
316
319
  ``muted=True``.
317
- muted: bool
320
+ muted : bool
318
321
  Whether the video should play with the audio silenced. This is
319
322
  ``False`` by default. Use this in conjunction with ``autoplay=True``
320
323
  to enable autoplay without user interaction.
321
- width: int or "stretch"
322
- The width of the video player. This can be one of the following:
324
+ width : "stretch" or int
325
+ The width of the video player element. This can be one of the
326
+ following:
323
327
 
324
- - An int: The width in pixels, e.g. ``200`` for a width of 200 pixels.
325
- - ``"stretch"``: The default value. The video player stretches to fill
326
- available space in its container.
328
+ - ``"stretch"`` (default): The width of the element matches the
329
+ width of the parent container.
330
+ - An integer specifying the width in pixels: The element has a
331
+ fixed width. If the specified width is greater than the width of
332
+ the parent container, the width of the element matches the width
333
+ of the parent container.
327
334
 
328
335
  Example
329
336
  -------
@@ -476,7 +483,7 @@ def _marshall_av_media(
476
483
  return
477
484
  data_or_filename = read_data
478
485
  elif type_util.is_type(data, "numpy.ndarray"):
479
- data_or_filename = cast("npt.NDArray[Any]", data).tobytes()
486
+ data_or_filename = data.tobytes()
480
487
  else:
481
488
  raise RuntimeError(f"Invalid binary data format: {type(data)}")
482
489
 
@@ -701,7 +708,7 @@ def _validate_and_normalize(data: npt.NDArray[Any]) -> tuple[bytes, int]:
701
708
 
702
709
  transformed_data: npt.NDArray[Any] = np.array(data, dtype=float)
703
710
 
704
- if len(cast("NumpyShape", transformed_data.shape)) == 1:
711
+ if len(transformed_data.shape) == 1:
705
712
  nchan = 1
706
713
  elif len(transformed_data.shape) == 2:
707
714
  # In wave files,channels are interleaved. E.g.,
@@ -124,10 +124,17 @@ class MetricMixin:
124
124
  ``False`` (default), no border is shown. If this is ``True``, a
125
125
  border is shown.
126
126
 
127
- width : int or "stretch" or "content"
128
- The width of the metric. Can be either an integer (pixels), "stretch", or "content".
129
- Defaults to "stretch". If "stretch", the metric will stretch to fill the available
130
- space. If "content", the metric will adjust its width to fit its content.
127
+ width : "stretch", "content", or int
128
+ The width of the metric element. This can be one of the following:
129
+
130
+ - ``"stretch"`` (default): The width of the element matches the
131
+ width of the parent container.
132
+ - ``"content"``: The width of the element matches the width of its
133
+ content, but doesn't exceed the width of the parent container.
134
+ - An integer specifying the width in pixels: The element has a
135
+ fixed width. If the specified width is greater than the width of
136
+ the parent container, the width of the element matches the width
137
+ of the parent container.
131
138
 
132
139
  Examples
133
140
  --------
@@ -537,7 +537,7 @@ class PlotlyMixin:
537
537
  )
538
538
 
539
539
  self.dg._enqueue("plotly_chart", plotly_chart_proto)
540
- return cast("PlotlyState", widget_state.value)
540
+ return widget_state.value
541
541
  return self.dg._enqueue("plotly_chart", plotly_chart_proto)
542
542
 
543
543
  @property
@@ -123,9 +123,15 @@ class ProgressMixin:
123
123
  .. |st.markdown| replace:: ``st.markdown``
124
124
  .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
125
125
 
126
- width : int or str
127
- The width of the progress bar. Can be either "stretch" to use the full
128
- container width, or an integer for a fixed width in pixels.
126
+ width : "stretch" or int
127
+ The width of the progress element. This can be one of the following:
128
+
129
+ - ``"stretch"`` (default): The width of the element matches the
130
+ width of the parent container.
131
+ - An integer specifying the width in pixels: The element has a
132
+ fixed width. If the specified width is greater than the width of
133
+ the parent container, the width of the element matches the width
134
+ of the parent container.
129
135
 
130
136
  Example
131
137
  -------