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
@@ -120,7 +120,8 @@ def navigation(
120
120
  To create labeled sections or page groupings within the navigation
121
121
  menu, ``pages`` must be a dictionary. Each key is the label of a
122
122
  section and each value is the list of page-like objects for
123
- that section.
123
+ that section. If you use ``position="top"``, each grouping will be a
124
+ collapsible item in the navigation menu.
124
125
 
125
126
  When you use a string or path as a page-like object, they are
126
127
  internally passed to ``st.Page`` and converted to ``StreamlitPage``
@@ -128,11 +129,11 @@ def navigation(
128
129
  path inferred from its path or filename. To customize these attributes
129
130
  for your page, initialize your page with ``st.Page``.
130
131
 
131
- position : "sidebar", "hidden", or "top"
132
+ position : "sidebar", "top", or "hidden"
132
133
  The position of the navigation menu. If this is ``"sidebar"``
133
134
  (default), the navigation widget appears at the top of the sidebar. If
134
- this is ``"hidden"``, the navigation widget is not displayed. If this
135
- is ``"top"``, the navigation appears in the top header of the app.
135
+ this is ``"top"``, the navigation appears in the top header of the app.
136
+ If this is ``"hidden"``, the navigation widget is not displayed.
136
137
 
137
138
  If there is only one page in ``pages``, the navigation will be hidden
138
139
  for any value of ``position``.
@@ -148,6 +149,8 @@ def navigation(
148
149
  ``expanded=False`` on a rerun, the menu will stay expanded and a
149
150
  collapse button will be displayed.
150
151
 
152
+ The parameter is only used when ``position="sidebar"``.
153
+
151
154
  Returns
152
155
  -------
153
156
  StreamlitPage
@@ -226,7 +229,38 @@ def navigation(
226
229
  https://doc-navigation-example-2.streamlit.app/
227
230
  height: 300px
228
231
 
229
- **Example 3: Stateful widgets across multiple pages**
232
+
233
+ **Example 3: Use top navigation**
234
+
235
+ You can use the ``position`` parameter to place the navigation at the top
236
+ of the app. This is useful for apps with a lot of pages because it allows
237
+ you to create collapsible sections for each group of pages. The following
238
+ example uses the same directory structure as Example 2 and shows how to
239
+ create a top navigation menu.
240
+
241
+ ``streamlit_app.py``:
242
+
243
+ >>> import streamlit as st
244
+ >>>
245
+ >>> pages = {
246
+ ... "Your account": [
247
+ ... st.Page("create_account.py", title="Create your account"),
248
+ ... st.Page("manage_account.py", title="Manage your account"),
249
+ ... ],
250
+ ... "Resources": [
251
+ ... st.Page("learn.py", title="Learn about us"),
252
+ ... st.Page("trial.py", title="Try it out"),
253
+ ... ],
254
+ ... }
255
+ >>>
256
+ >>> pg = st.navigation(pages, position="top")
257
+ >>> pg.run()
258
+
259
+ .. output::
260
+ https://doc-navigation-top.streamlit.app/
261
+ height: 300px
262
+
263
+ **Example 4: Stateful widgets across multiple pages**
230
264
 
231
265
  Call widget functions in your entrypoint file when you want a widget to be
232
266
  stateful across pages. Assign keys to your common widgets and access their
@@ -110,26 +110,34 @@ def _get_favicon_string(page_icon: PageIcon) -> str:
110
110
  def set_page_config(
111
111
  page_title: str | None = None,
112
112
  page_icon: PageIcon | None = None,
113
- layout: Layout = "centered",
114
- initial_sidebar_state: InitialSideBarState = "auto",
113
+ layout: Layout | None = None,
114
+ initial_sidebar_state: InitialSideBarState | None = None,
115
115
  menu_items: MenuItems | None = None,
116
116
  ) -> None:
117
117
  """
118
- Configures the default settings of the page.
118
+ Configure the default settings of the page.
119
119
 
120
- .. note::
121
- This must be the first Streamlit command used on an app page, and must only
122
- be set once per page.
120
+ This command can be called multiple times in a script run to dynamically
121
+ change the page configuration. The calls are additive, with each successive
122
+ call overriding only the parameters that are specified.
123
123
 
124
124
  Parameters
125
125
  ----------
126
126
  page_title: str or None
127
- The page title, shown in the browser tab. If None, defaults to the
128
- filename of the script ("app.py" would show "app Streamlit").
127
+ The page title, shown in the browser tab. If this is ``None``
128
+ (default), the page title is inherited from the previous call of
129
+ ``st.set_page_config``. If this is ``None`` and no previous call
130
+ exists, the page title is inferred from the page source.
131
+
132
+ If a page source is a Python file, its inferred title is derived from
133
+ the filename. If a page source is a callable object, its inferred title
134
+ is derived from the callable's name.
129
135
 
130
136
  page_icon : Anything supported by st.image (except list), str, or None
131
- The page favicon. If ``page_icon`` is ``None`` (default), the favicon
132
- will be a monochrome Streamlit logo.
137
+ The page favicon. If ``page_icon`` is ``None`` (default), the page icon
138
+ is inherited from the previous call of ``st.set_page_config``. If this
139
+ is ``None`` and no previous call exists, the favicon is a monochrome
140
+ Streamlit logo.
133
141
 
134
142
  In addition to the types supported by |st.image|_ (except list), the
135
143
  following strings are valid:
@@ -160,17 +168,29 @@ def set_page_config(
160
168
  .. |st.image| replace:: ``st.image``
161
169
  .. _st.image: https://docs.streamlit.io/develop/api-reference/media/st.image
162
170
 
163
- layout: "centered" or "wide"
164
- How the page content should be laid out. Defaults to "centered",
165
- which constrains the elements into a centered column of fixed width;
166
- "wide" uses the entire screen.
171
+ layout: "centered", "wide", or None
172
+ How the page content should be laid out. If this is ``None`` (default),
173
+ the page layout is inherited from the previous call of
174
+ ``st.set_page_config``. If this is ``None`` and no previous call
175
+ exists, the page layout is ``"centered"``.
176
+
177
+ ``"centered"`` constrains the elements into a centered column of fixed
178
+ width. ``"wide"`` uses the entire screen.
179
+
180
+ initial_sidebar_state: "auto", "expanded", "collapsed", or None
181
+ How the sidebar should start out. If this is ``None`` (default), the
182
+ sidebar state is inherited from the previous call of
183
+ ``st.set_page_config``. If no previous call exists, the sidebar state
184
+ is ``"auto"``.
185
+
186
+ The folowing states are supported:
187
+
188
+ - ``"auto"``: The sidebar is hidden on small devices and shown otherwise.
189
+ - ``"expanded"``: The sidebar is shown initially.
190
+ - ``"collapsed"``: The sidebar is hidden initially.
167
191
 
168
- initial_sidebar_state: "auto", "expanded", or "collapsed"
169
- How the sidebar should start out. Defaults to "auto",
170
- which hides the sidebar on small devices and shows it otherwise.
171
- "expanded" shows the sidebar initially; "collapsed" hides it.
172
- In most cases, you should just use "auto", otherwise the app will
173
- look bad when embedded and viewed on mobile.
192
+ In most cases, ``"auto"`` provides the best user experience across
193
+ devices of different sizes.
174
194
 
175
195
  menu_items: dict
176
196
  Configure the menu that appears on the top-right side of this app.
@@ -187,6 +207,8 @@ def set_page_config(
187
207
  If None, only shows Streamlit's default About text.
188
208
 
189
209
  The URL may also refer to an email address e.g. ``mailto:john@example.com``.
210
+ To remove an item that was specified in a previous call to
211
+ ``st.set_page_config``, set its value to ``None`` in the dictionary.
190
212
 
191
213
  Example
192
214
  -------
@@ -218,6 +240,9 @@ def set_page_config(
218
240
  pb_layout = PageConfigProto.CENTERED
219
241
  elif layout == "wide":
220
242
  pb_layout = PageConfigProto.WIDE
243
+ elif layout is None:
244
+ # Allows for multiple (additive) calls to set_page_config
245
+ pb_layout = PageConfigProto.LAYOUT_UNSET
221
246
  else:
222
247
  # Note: Pylance incorrectly notes this error as unreachable
223
248
  raise StreamlitInvalidPageLayoutError(layout=layout)
@@ -231,6 +256,9 @@ def set_page_config(
231
256
  pb_sidebar_state = PageConfigProto.EXPANDED
232
257
  elif initial_sidebar_state == "collapsed":
233
258
  pb_sidebar_state = PageConfigProto.COLLAPSED
259
+ elif initial_sidebar_state is None:
260
+ # Allows for multiple (additive) calls to set_page_config
261
+ pb_sidebar_state = PageConfigProto.SIDEBAR_UNSET
234
262
  else:
235
263
  # Note: Pylance incorrectly notes this error as unreachable
236
264
  raise StreamlitInvalidSidebarStateError(
@@ -98,6 +98,9 @@ class BaseCustomComponent(ABC):
98
98
  def __str__(self) -> str:
99
99
  return f"'{self.name}': {self.path if self.path is not None else self.url}"
100
100
 
101
+ def __hash__(self) -> int:
102
+ return hash((self.name, self.path, self.url, self.module_name))
103
+
101
104
  @abstractmethod
102
105
  def __eq__(self, other: object) -> bool:
103
106
  """Equality operator."""
@@ -253,6 +253,8 @@ And if you're using Streamlit Cloud, add "pyarrow" to your requirements.txt."""
253
253
  and self.module_name == other.module_name
254
254
  )
255
255
 
256
+ __hash__ = BaseCustomComponent.__hash__
257
+
256
258
  def __ne__(self, other: object) -> bool:
257
259
  """Inequality operator."""
258
260
 
streamlit/config.py CHANGED
@@ -676,12 +676,11 @@ _create_section("server", "Settings for the Streamlit server")
676
676
  _create_option(
677
677
  "server.folderWatchList",
678
678
  description="""
679
- List of folders to watch for changes.
679
+ List of directories to watch for changes.
680
680
 
681
- By default, Streamlit watches for files in the current working directory.
682
- Use this parameter to specify additional folders to watch.
683
-
684
- Note: This is a list of absolute paths.
681
+ By default, Streamlit watches files in the current working directory
682
+ and its subdirectories. Use this option to specify additional
683
+ directories to watch. Paths must be absolute.
685
684
  """,
686
685
  default_val=[],
687
686
  multiple=True,
@@ -690,9 +689,12 @@ _create_option(
690
689
  _create_option(
691
690
  "server.folderWatchBlacklist",
692
691
  description="""
693
- List of folders that should not be watched for changes.
692
+ List of directories to ignore for changes.
694
693
 
695
- Relative paths will be taken as relative to the current working directory.
694
+ By default, Streamlit watches files in the current working directory
695
+ and its subdirectories. Use this option to specify exceptions within
696
+ watched directories. Paths can be absolute or relative to the current
697
+ working directory.
696
698
 
697
699
  Example: ['/home/user1/env', 'relative/path/to/folder']
698
700
  """,
@@ -840,9 +842,11 @@ _create_option(
840
842
  _create_option(
841
843
  "server.corsAllowedOrigins",
842
844
  description="""
843
- If CORS protection is enabled (when server.enableCORS=True), allows an
844
- app developer to set a list of allowed origins that the Streamlit server
845
- will accept traffic from.
845
+ Allowed list of origins.
846
+
847
+ If CORS protection is enabled (`server.enableCORS=True`), use this
848
+ option to set a list of allowed origins that the Streamlit server will
849
+ accept traffic from.
846
850
 
847
851
  This config option does nothing if CORS protection is disabled.
848
852
 
@@ -1140,6 +1144,15 @@ _create_theme_options(
1140
1144
  """,
1141
1145
  )
1142
1146
 
1147
+ _create_theme_options(
1148
+ "linkUnderline",
1149
+ categories=["theme", CustomThemeCategories.SIDEBAR],
1150
+ description="""
1151
+ Whether or not links should be displayed with an underline.
1152
+ """,
1153
+ type_=bool,
1154
+ )
1155
+
1143
1156
  _create_theme_options(
1144
1157
  "codeBackgroundColor",
1145
1158
  categories=["theme", CustomThemeCategories.SIDEBAR],
@@ -1152,14 +1165,14 @@ _create_theme_options(
1152
1165
  "font",
1153
1166
  categories=["theme", CustomThemeCategories.SIDEBAR],
1154
1167
  description="""
1155
- The font family for all text, except code blocks. This can be one of
1156
- the following:
1168
+ The font family for all text, except code blocks.
1157
1169
 
1170
+ This can be one of the following:
1158
1171
  - "sans-serif"
1159
1172
  - "serif"
1160
1173
  - "monospace"
1161
- - the `family` value for a custom font table under [[theme.fontFaces]]
1162
- - a comma-separated list of these (as a single string) to specify
1174
+ - The `family` value for a custom font table under [[theme.fontFaces]]
1175
+ - A comma-separated list of these (as a single string) to specify
1163
1176
  fallbacks
1164
1177
 
1165
1178
  For example, you can use the following:
@@ -1172,29 +1185,43 @@ _create_theme_options(
1172
1185
  "codeFont",
1173
1186
  categories=["theme", CustomThemeCategories.SIDEBAR],
1174
1187
  description="""
1175
- The font family to use for code (monospace) in the sidebar. This can be
1176
- one of the following:
1188
+ The font family to use for code (monospace) in the sidebar.
1177
1189
 
1190
+ This can be one of the following:
1178
1191
  - "sans-serif"
1179
1192
  - "serif"
1180
1193
  - "monospace"
1181
- - the `family` value for a custom font table under [[theme.fontFaces]]
1182
- - a comma-separated list of these (as a single string) to specify
1194
+ - The `family` value for a custom font table under [[theme.fontFaces]]
1195
+ - A comma-separated list of these (as a single string) to specify
1183
1196
  fallbacks
1184
1197
  """,
1185
1198
  )
1186
1199
 
1200
+ _create_theme_options(
1201
+ "codeFontSize",
1202
+ categories=["theme", CustomThemeCategories.SIDEBAR],
1203
+ description="""
1204
+ Sets the font size (in pixels or rem) for code blocks and code text.
1205
+
1206
+ This applies to code blocks (ex: `st.code`), as well as font in `st.json` and `st.help`.
1207
+ It does not apply to inline code, which is set by default to 0.75em.
1208
+
1209
+ When unset, the code font size will be 0.875rem.
1210
+ """,
1211
+ )
1212
+
1187
1213
  _create_theme_options(
1188
1214
  "headingFont",
1189
1215
  categories=["theme", CustomThemeCategories.SIDEBAR],
1190
1216
  description="""
1191
- The font family to use for headings. This can be one of the following:
1217
+ The font family to use for headings.
1192
1218
 
1219
+ This can be one of the following:
1193
1220
  - "sans-serif"
1194
1221
  - "serif"
1195
1222
  - "monospace"
1196
- - the `family` value for a custom font table under [[theme.fontFaces]]
1197
- - a comma-separated list of these (as a single string) to specify
1223
+ - The `family` value for a custom font table under [[theme.fontFaces]]
1224
+ - A comma-separated list of these (as a single string) to specify
1198
1225
  fallbacks
1199
1226
 
1200
1227
  If no heading font is set, Streamlit uses `theme.font` for headings.
@@ -1207,21 +1234,27 @@ _create_theme_options(
1207
1234
  description="""
1208
1235
  An array of fonts to use in your app.
1209
1236
 
1210
- Each font in the array is a table (dictionary) with the following three
1211
- attributes: family, url, weight, and style.
1237
+ Each font in the array is a table (dictionary) that can have the
1238
+ following attributes, closely resembling CSS font-face definitions:
1239
+ - family
1240
+ - url
1241
+ - weight (optional)
1242
+ - style (optional)
1243
+ - unicodeRange (optional)
1212
1244
 
1213
1245
  To host a font with your app, enable static file serving with
1214
1246
  `server.enableStaticServing=true`.
1215
1247
 
1216
- You can define multiple [[theme.fontFaces]] tables.
1248
+ You can define multiple [[theme.fontFaces]] tables, including multiple
1249
+ tables with the same family if your font is defined by multiple files.
1217
1250
 
1218
- For example, each font is defined in a [[theme.fontFaces]] table as
1219
- follows:
1251
+ For example, a font hosted with your app may have a [[theme.fontFaces]]
1252
+ table as follows:
1220
1253
 
1221
1254
  [[theme.fontFaces]]
1222
1255
  family = "font_name"
1223
1256
  url = "app/static/font_file.woff"
1224
- weight = 400
1257
+ weight = "400"
1225
1258
  style = "normal"
1226
1259
  """,
1227
1260
  )
@@ -1238,9 +1271,10 @@ _create_theme_options(
1238
1271
  - "medium"
1239
1272
  - "large"
1240
1273
  - "full"
1241
- - ...or the number in pixels or rem. For example, you can use "10px",
1242
- "0.5rem", or "2rem". To follow best practices, use rem instead of
1243
- pixels when specifying a numeric size.
1274
+ - The number in pixels or rem.
1275
+
1276
+ For example, you can use "10px", "0.5rem", or "2rem". To follow best
1277
+ practices, use rem instead of pixels when specifying a numeric size.
1244
1278
  """,
1245
1279
  )
1246
1280
 
@@ -1256,9 +1290,12 @@ _create_theme_options(
1256
1290
  - "medium"
1257
1291
  - "large"
1258
1292
  - "full"
1259
- - ...or the number in pixels or rem. For example, you can use "10px",
1260
- "0.5rem", or "2rem". To follow best practices, use rem instead of
1261
- pixels when specifying a numeric size.
1293
+ - The number in pixels or rem.
1294
+
1295
+ For example, you can use "10px", "0.5rem", or "2rem". To follow best
1296
+ practices, use rem instead of pixels when specifying a numeric size.
1297
+
1298
+ If no button radius is set, Streamlit uses `theme.baseRadius` instead.
1262
1299
  """,
1263
1300
  )
1264
1301
 
@@ -1275,6 +1312,9 @@ _create_theme_options(
1275
1312
  categories=["theme", CustomThemeCategories.SIDEBAR],
1276
1313
  description="""
1277
1314
  The color of the border around dataframes and tables.
1315
+
1316
+ If no dataframe border color is set, Streamlit uses `theme.borderColor`
1317
+ instead.
1278
1318
  """,
1279
1319
  )
1280
1320
 
@@ -41,7 +41,6 @@ from typing_extensions import TypeAlias, TypeGuard
41
41
  from streamlit import config, errors, logger, string_util
42
42
  from streamlit.type_util import (
43
43
  CustomDict,
44
- NumpyShape,
45
44
  has_callable_attr,
46
45
  is_custom_dict,
47
46
  is_dataclass_instance,
@@ -924,7 +923,7 @@ def convert_anything_to_list(obj: OptionSequence[V_co]) -> list[V_co]:
924
923
 
925
924
  if isinstance(obj, (str, int, float, bool)):
926
925
  # Wrap basic objects into a list
927
- return [obj]
926
+ return [obj] # type: ignore[list-item]
928
927
 
929
928
  if isinstance(obj, EnumMeta):
930
929
  # Support for enum classes. For string enums, we return the string value
@@ -1167,7 +1166,7 @@ def determine_data_format(input_data: Any) -> DataFormat:
1167
1166
  if isinstance(input_data, pd.DataFrame):
1168
1167
  return DataFormat.PANDAS_DATAFRAME
1169
1168
  if isinstance(input_data, np.ndarray):
1170
- if len(cast("NumpyShape", input_data.shape)) == 1:
1169
+ if len(input_data.shape) == 1:
1171
1170
  # For technical reasons, we need to distinguish one
1172
1171
  # one-dimensional numpy array from multidimensional ones.
1173
1172
  return DataFormat.NUMPY_LIST
@@ -66,13 +66,15 @@ class AlertMixin:
66
66
  Thumb Up icon. Find additional icons in the `Material Symbols \
67
67
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
68
68
  font library.
69
- width : int or "stretch"
70
- The desired width of the alert expressed in pixels. If this is
71
- ``"stretch"`` (default), Streamlit sets the width of the alert to
72
- match the width of the parent container. Otherwise, this must be an
73
- integer. If the specified width is greater than the width of the
74
- parent container, Streamlit sets the width of the alert to match
75
- the width of the parent container.
69
+ width : "stretch" or int
70
+ The width of the alert element. This can be one of the following:
71
+
72
+ - ``"stretch"`` (default): The width of the element matches the
73
+ width of the parent container.
74
+ - An integer specifying the width in pixels: The element has a
75
+ fixed width. If the specified width is greater than the width of
76
+ the parent container, the width of the element matches the width
77
+ of the parent container.
76
78
 
77
79
  Example
78
80
  -------
@@ -137,13 +139,15 @@ class AlertMixin:
137
139
  Thumb Up icon. Find additional icons in the `Material Symbols \
138
140
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
139
141
  font library.
140
- width : int or "stretch"
141
- The desired width of the alert expressed in pixels. If this is
142
- ``"stretch"`` (default), Streamlit sets the width of the alert to
143
- match the width of the parent container. Otherwise, this must be an
144
- integer. If the specified width is greater than the width of the
145
- parent container, Streamlit sets the width of the alert to match
146
- the width of the parent container.
142
+ width : "stretch" or int
143
+ The width of the warning element. This can be one of the following:
144
+
145
+ - ``"stretch"`` (default): The width of the element matches the
146
+ width of the parent container.
147
+ - An integer specifying the width in pixels: The element has a
148
+ fixed width. If the specified width is greater than the width of
149
+ the parent container, the width of the element matches the width
150
+ of the parent container.
147
151
 
148
152
  Example
149
153
  -------
@@ -207,13 +211,15 @@ class AlertMixin:
207
211
  Thumb Up icon. Find additional icons in the `Material Symbols \
208
212
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
209
213
  font library.
210
- width : int or "stretch"
211
- The desired width of the alert expressed in pixels. If this is
212
- ``"stretch"`` (default), Streamlit sets the width of the alert to
213
- match the width of the parent container. Otherwise, this must be an
214
- integer. If the specified width is greater than the width of the
215
- parent container, Streamlit sets the width of the alert to match
216
- the width of the parent container.
214
+ width : "stretch" or int
215
+ The width of the info element. This can be one of the following:
216
+
217
+ - ``"stretch"`` (default): The width of the element matches the
218
+ width of the parent container.
219
+ - An integer specifying the width in pixels: The element has a
220
+ fixed width. If the specified width is greater than the width of
221
+ the parent container, the width of the element matches the width
222
+ of the parent container.
217
223
 
218
224
  Example
219
225
  -------
@@ -278,13 +284,15 @@ class AlertMixin:
278
284
  Thumb Up icon. Find additional icons in the `Material Symbols \
279
285
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
280
286
  font library.
281
- width : int or "stretch"
282
- The desired width of the alert expressed in pixels. If this is
283
- ``"stretch"`` (default), Streamlit sets the width of the alert to
284
- match the width of the parent container. Otherwise, this must be an
285
- integer. If the specified width is greater than the width of the
286
- parent container, Streamlit sets the width of the alert to match
287
- the width of the parent container.
287
+ width : "stretch" or int
288
+ The width of the success element. This can be one of the following:
289
+
290
+ - ``"stretch"`` (default): The width of the element matches the
291
+ width of the parent container.
292
+ - An integer specifying the width in pixels: The element has a
293
+ fixed width. If the specified width is greater than the width of
294
+ the parent container, the width of the element matches the width
295
+ of the parent container.
288
296
 
289
297
  Example
290
298
  -------
@@ -645,7 +645,7 @@ class ArrowMixin:
645
645
  value_type="string_value",
646
646
  )
647
647
  self.dg._enqueue("arrow_data_frame", proto)
648
- return cast("DataframeState", widget_state.value)
648
+ return widget_state.value
649
649
  return self.dg._enqueue("arrow_data_frame", proto)
650
650
 
651
651
  @gather_metrics("table")
@@ -68,16 +68,31 @@ class CodeMixin:
68
68
  An optional boolean indicating whether to wrap lines. This defaults
69
69
  to ``False``.
70
70
 
71
- height : int or None
72
- Desired height of the code block expressed in pixels. If ``height``
73
- is ``None`` (default), Streamlit sets the element's height to fit
74
- its content. Vertical scrolling within the element is enabled when
75
- the height does not accommodate all lines.
71
+ height : "content" or int
72
+ The height of the code block element. This can be one of the following:
73
+
74
+ - ``"content"`` (default): The height of the element matches the
75
+ height of its content.
76
+ - An integer specifying the height in pixels: The element has a
77
+ fixed height. If the content is larger than the specified
78
+ height, scrolling is enabled.
79
+
80
+ .. note::
81
+ Use scrolling containers sparingly. If you use scrolling
82
+ containers, avoid heights that exceed 500 pixels. Otherwise,
83
+ the scroll surface of the container might cover the majority of
84
+ the screen on mobile devices, which makes it hard to scroll the
85
+ rest of the app.
76
86
 
77
87
  width : "stretch" or int
78
- The width of the code block. This can be either:
79
- - "stretch" (default): The code block will stretch to fill the container width
80
- - An integer: The code block will have a fixed width in pixels
88
+ The width of the code block element. This can be one of the following:
89
+
90
+ - ``"stretch"`` (default): The width of the element matches the
91
+ width of the parent container.
92
+ - An integer specifying the width in pixels: The element has a
93
+ fixed width. If the specified width is greater than the width of
94
+ the parent container, the width of the element matches the width
95
+ of the parent container.
81
96
 
82
97
  Examples
83
98
  --------
@@ -529,7 +529,7 @@ class PydeckMixin:
529
529
 
530
530
  self.dg._enqueue("deck_gl_json_chart", pydeck_proto)
531
531
 
532
- return cast("PydeckState", widget_state.value)
532
+ return widget_state.value
533
533
 
534
534
  return self.dg._enqueue("deck_gl_json_chart", pydeck_proto)
535
535
 
@@ -59,8 +59,14 @@ class HelpMixin:
59
59
  The object whose information should be displayed. If left
60
60
  unspecified, this call will display help for Streamlit itself.
61
61
  width : "stretch" or int
62
- The width of the help element. Can be "stretch" to fill the container
63
- width, or an integer to specify a fixed width in pixels.
62
+ The width of the help element. This can be one of the following:
63
+
64
+ - ``"stretch"`` (default): The width of the element matches the
65
+ width of the parent container.
66
+ - An integer specifying the width in pixels: The element has a
67
+ fixed width. If the specified width is greater than the width of
68
+ the parent container, the width of the element matches the width
69
+ of the parent container.
64
70
 
65
71
  Example
66
72
  -------
@@ -60,13 +60,15 @@ class ExceptionMixin:
60
60
  ----------
61
61
  exception : Exception
62
62
  The exception to display.
63
- width : int or "stretch"
64
- The desired width of the exception expressed in pixels. If this is
65
- ``"stretch"`` (default), Streamlit sets the width of the exception
66
- to match the width of the parent container. Otherwise, this must be
67
- an integer. If the specified width is greater than the width of the
68
- parent container, Streamlit sets the width of the exception to
69
- match the width of the parent container.
63
+ width : "stretch" or int
64
+ The width of the exception element. This can be one of the following:
65
+
66
+ - ``"stretch"`` (default): The width of the element matches the
67
+ width of the parent container.
68
+ - An integer specifying the width in pixels: The element has a
69
+ fixed width. If the specified width is greater than the width of
70
+ the parent container, the width of the element matches the width
71
+ of the parent container.
70
72
 
71
73
  Example
72
74
  -------