streamlit-nightly 1.45.2.dev20250616__py3-none-any.whl → 1.45.2.dev20250617__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.
- streamlit/commands/navigation.py +39 -5
- streamlit/commands/page_config.py +48 -20
- streamlit/config.py +64 -33
- streamlit/dataframe_util.py +2 -3
- streamlit/elements/alert.py +36 -28
- streamlit/elements/arrow.py +1 -1
- streamlit/elements/code.py +23 -8
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/doc_string.py +8 -2
- streamlit/elements/exception.py +9 -7
- streamlit/elements/form.py +28 -0
- streamlit/elements/heading.py +34 -13
- streamlit/elements/json.py +8 -3
- streamlit/elements/layouts.py +69 -13
- streamlit/elements/lib/color_util.py +1 -1
- streamlit/elements/lib/image_utils.py +3 -5
- streamlit/elements/markdown.py +57 -24
- streamlit/elements/media.py +31 -24
- streamlit/elements/metric.py +11 -4
- streamlit/elements/plotly_chart.py +1 -1
- streamlit/elements/progress.py +9 -3
- streamlit/elements/spinner.py +11 -3
- streamlit/elements/text.py +12 -4
- streamlit/elements/vega_charts.py +1 -1
- streamlit/elements/widgets/audio_input.py +8 -3
- streamlit/elements/widgets/button.py +7 -6
- streamlit/elements/widgets/camera_input.py +9 -3
- streamlit/elements/widgets/chat.py +23 -11
- streamlit/elements/widgets/checkbox.py +24 -6
- streamlit/elements/widgets/color_picker.py +13 -4
- streamlit/elements/widgets/file_uploader.py +9 -3
- streamlit/elements/widgets/number_input.py +10 -2
- streamlit/elements/widgets/radio.py +12 -3
- streamlit/elements/widgets/select_slider.py +9 -3
- streamlit/elements/widgets/selectbox.py +9 -3
- streamlit/elements/widgets/slider.py +10 -2
- streamlit/elements/widgets/text_widgets.py +20 -4
- streamlit/elements/widgets/time_widgets.py +17 -10
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +7 -2
- streamlit/proto/PageConfig_pb2.py +5 -5
- streamlit/proto/PageConfig_pb2.pyi +16 -0
- streamlit/runtime/context.py +22 -1
- streamlit/runtime/state/query_params_proxy.py +2 -0
- streamlit/runtime/state/session_state.py +4 -2
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +214 -214
- streamlit/static/static/js/{ErrorOutline.esm.BBFVdWjb.js → ErrorOutline.esm.1znYgwZa.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DvdwDAxp.js → FileDownload.esm.MlshysxD.js} +1 -1
- streamlit/static/static/js/{FileHelper.CjU1Ef50.js → FileHelper.DJjfImdO.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CIb6LGNE.js → FormClearHelper.tzcHfSQm.js} +1 -1
- streamlit/static/static/js/{Hooks.GJR4p5ub.js → Hooks.CUwe1mU9.js} +1 -1
- streamlit/static/static/js/{InputInstructions.nsoutNDU.js → InputInstructions.ibDI_m0Z.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DqtkCWgY.js → ProgressBar.B4yod1d4.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CocQHyjY.js → RenderInPortalIfExists.sxtf_tkp.js} +1 -1
- streamlit/static/static/js/{Toolbar.UeCiz5bZ.js → Toolbar.D2TSK_7z.js} +1 -1
- streamlit/static/static/js/{base-input.ChMOqefY.js → base-input.DBGTsu79.js} +1 -1
- streamlit/static/static/js/{checkbox.mFAkcYlJ.js → checkbox.Cv3M11iz.js} +1 -1
- streamlit/static/static/js/{createSuper.CWlw4uuT.js → createSuper.CZYzqRu7.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.BRuPFGVT.js → data-grid-overlay-editor.Dnwp2SeP.js} +1 -1
- streamlit/static/static/js/{downloader.D-JZV5KC.js → downloader.OkIJTahw.js} +1 -1
- streamlit/static/static/js/{es6.8aYd2mZD.js → es6.CWUYJnwB.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.jbTJNegv.js → iframeResizer.contentWindow.BGMetL4r.js} +1 -1
- streamlit/static/static/js/{index.Bll2-rP6.js → index.BLLY_wCb.js} +1 -1
- streamlit/static/static/js/{index.CBxfNa4S.js → index.BNQdHQ9A.js} +1 -1
- streamlit/static/static/js/{index.D7n0aj1W.js → index.BRUfGLJs.js} +1 -1
- streamlit/static/static/js/{index.D2DTU1aY.js → index.BZhFm-tC.js} +1 -1
- streamlit/static/static/js/{index.DcylHZOn.js → index.Bi_xDLKC.js} +1 -1
- streamlit/static/static/js/{index.C5Jk6yHy.js → index.Bio4VfuK.js} +1 -1
- streamlit/static/static/js/{index.BSBLj6fd.js → index.BlRNHzJT.js} +1 -1
- streamlit/static/static/js/{index.D6aDPgRk.js → index.BvPXgYL1.js} +1 -1
- streamlit/static/static/js/{index.EmgmixKr.js → index.C8UyejlW.js} +1 -1
- streamlit/static/static/js/{index.MuhC3L76.js → index.CATKfyKP.js} +1 -1
- streamlit/static/static/js/{index.D9LSzO5n.js → index.CImNFEsN.js} +1 -1
- streamlit/static/static/js/{index.CeJjESM2.js → index.CP9S4-UC.js} +1 -1
- streamlit/static/static/js/{index.2vhUbWYE.js → index.CaH9iZrA.js} +1 -1
- streamlit/static/static/js/{index.DwGCBH5W.js → index.CfU3gX6G.js} +1 -1
- streamlit/static/static/js/{index.5VmqWrFJ.js → index.CghNjnWG.js} +1 -1
- streamlit/static/static/js/{index.B5CU57Qf.js → index.ClByuhfh.js} +62 -62
- streamlit/static/static/js/{index.ZJ-p6xZJ.js → index.CyScXVPk.js} +1 -1
- streamlit/static/static/js/{index.Dat8JgZf.js → index.D3yL8Boz.js} +5 -5
- streamlit/static/static/js/{index.CQG85lDO.js → index.DHrbHxMA.js} +1 -1
- streamlit/static/static/js/{index.g86WIJtm.js → index.DXby5BWo.js} +1 -1
- streamlit/static/static/js/{index.Ddznlirl.js → index.Dgicxx_R.js} +1 -1
- streamlit/static/static/js/{index.BuwwBXlt.js → index.DhZtGReO.js} +1 -1
- streamlit/static/static/js/{index.TEOqOk4H.js → index.DqoNxwFW.js} +1 -1
- streamlit/static/static/js/{index.gcWbHnPE.js → index.DrAi2KWE.js} +1 -1
- streamlit/static/static/js/{index._beSUPH2.js → index.DuQBFADi.js} +1 -1
- streamlit/static/static/js/{index.DiKxaWW9.js → index.DxX0zYtM.js} +1 -1
- streamlit/static/static/js/{index.CrLOSpGd.js → index.GbpCpBCj.js} +1 -1
- streamlit/static/static/js/{index.45n3hxWl.js → index.aKXX7Ba_.js} +1 -1
- streamlit/static/static/js/{index.BrZrTW9I.js → index.bK_LT6WV.js} +1 -1
- streamlit/static/static/js/{index.RqdD1cln.js → index.cFdge3NU.js} +1 -1
- streamlit/static/static/js/{index.C-qKPIAc.js → index.cbAks8a8.js} +1 -1
- streamlit/static/static/js/{index.B_K-sbDk.js → index.eeGQgksq.js} +1 -1
- streamlit/static/static/js/{index.CmYORNI1.js → index.fybg-SX6.js} +1 -1
- streamlit/static/static/js/{index.DlBss_D9.js → index.igD8dUid.js} +1 -1
- streamlit/static/static/js/{index.B_IVL8xE.js → index.jzzHl6U7.js} +1 -1
- streamlit/static/static/js/{index.Cf2Ujw1i.js → index.vJGalypl.js} +1 -1
- streamlit/static/static/js/{index.CwtQIKUg.js → index.yh03tq2H.js} +1 -1
- streamlit/static/static/js/{input.DXa_gBzj.js → input.DG4M8O5Z.js} +1 -1
- streamlit/static/static/js/{memory.D5rOUj2Y.js → memory.cZDDDDRN.js} +1 -1
- streamlit/static/static/js/{mergeWith.DSXoP_ea.js → mergeWith.CbuU4RN8.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DOlAMQ4z.js → number-overlay-editor.GDhzbbBH.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.C8PlFdhp.js → possibleConstructorReturn.CJFaNdfh.js} +1 -1
- streamlit/static/static/js/{sandbox.Cbgzd0RE.js → sandbox.SJvDMGmc.js} +1 -1
- streamlit/static/static/js/{textarea.CwmJHkZd.js → textarea.CA5HbAYe.js} +1 -1
- streamlit/static/static/js/{timepicker.D-HemJVg.js → timepicker.Dw_Jp_TE.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.K58gdyL6.js → toConsumableArray.DrYe4LQW.js} +1 -1
- streamlit/static/static/js/{uniqueId.D6CfbZfn.js → uniqueId.D-hUXA0O.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.t6CdhaX9.js → useBasicWidgetState.ByTJlmUY.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.D_GNOmUw.js → useOnInputChange.4waR08fC.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DILaf-7C.js → withFullScreenWrapper.BbZgX6-q.js} +1 -1
- {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.45.2.dev20250617.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.45.2.dev20250617.dist-info}/RECORD +119 -119
- {streamlit_nightly-1.45.2.dev20250616.data → streamlit_nightly-1.45.2.dev20250617.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.45.2.dev20250617.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.45.2.dev20250617.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250616.dist-info → streamlit_nightly-1.45.2.dev20250617.dist-info}/top_level.txt +0 -0
streamlit/commands/navigation.py
CHANGED
@@ -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", "
|
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 ``"
|
135
|
-
is ``"
|
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
|
-
|
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 =
|
114
|
-
initial_sidebar_state: InitialSideBarState =
|
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
|
-
|
118
|
+
Configure the default settings of the page.
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
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
|
128
|
-
|
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
|
132
|
-
|
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"
|
164
|
-
How the page content should be laid out.
|
165
|
-
|
166
|
-
|
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
|
-
|
169
|
-
|
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(
|
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
|
679
|
+
List of directories to watch for changes.
|
680
680
|
|
681
|
-
By default, Streamlit watches
|
682
|
-
Use this
|
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
|
692
|
+
List of directories to ignore for changes.
|
694
693
|
|
695
|
-
|
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
|
-
|
844
|
-
|
845
|
-
|
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
|
|
@@ -1152,14 +1156,14 @@ _create_theme_options(
|
|
1152
1156
|
"font",
|
1153
1157
|
categories=["theme", CustomThemeCategories.SIDEBAR],
|
1154
1158
|
description="""
|
1155
|
-
The font family for all text, except code blocks.
|
1156
|
-
the following:
|
1159
|
+
The font family for all text, except code blocks.
|
1157
1160
|
|
1161
|
+
This can be one of the following:
|
1158
1162
|
- "sans-serif"
|
1159
1163
|
- "serif"
|
1160
1164
|
- "monospace"
|
1161
|
-
-
|
1162
|
-
-
|
1165
|
+
- The `family` value for a custom font table under [[theme.fontFaces]]
|
1166
|
+
- A comma-separated list of these (as a single string) to specify
|
1163
1167
|
fallbacks
|
1164
1168
|
|
1165
1169
|
For example, you can use the following:
|
@@ -1172,29 +1176,43 @@ _create_theme_options(
|
|
1172
1176
|
"codeFont",
|
1173
1177
|
categories=["theme", CustomThemeCategories.SIDEBAR],
|
1174
1178
|
description="""
|
1175
|
-
The font family to use for code (monospace) in the sidebar.
|
1176
|
-
one of the following:
|
1179
|
+
The font family to use for code (monospace) in the sidebar.
|
1177
1180
|
|
1181
|
+
This can be one of the following:
|
1178
1182
|
- "sans-serif"
|
1179
1183
|
- "serif"
|
1180
1184
|
- "monospace"
|
1181
|
-
-
|
1182
|
-
-
|
1185
|
+
- The `family` value for a custom font table under [[theme.fontFaces]]
|
1186
|
+
- A comma-separated list of these (as a single string) to specify
|
1183
1187
|
fallbacks
|
1184
1188
|
""",
|
1185
1189
|
)
|
1186
1190
|
|
1191
|
+
_create_theme_options(
|
1192
|
+
"codeFontSize",
|
1193
|
+
categories=["theme", CustomThemeCategories.SIDEBAR],
|
1194
|
+
description="""
|
1195
|
+
Sets the font size (in pixels or rem) for code blocks and code text.
|
1196
|
+
|
1197
|
+
This applies to code blocks (ex: `st.code`), as well as font in `st.json` and `st.help`.
|
1198
|
+
It does not apply to inline code, which is set by default to 0.75em.
|
1199
|
+
|
1200
|
+
When unset, the code font size will be 0.875rem.
|
1201
|
+
""",
|
1202
|
+
)
|
1203
|
+
|
1187
1204
|
_create_theme_options(
|
1188
1205
|
"headingFont",
|
1189
1206
|
categories=["theme", CustomThemeCategories.SIDEBAR],
|
1190
1207
|
description="""
|
1191
|
-
The font family to use for headings.
|
1208
|
+
The font family to use for headings.
|
1192
1209
|
|
1210
|
+
This can be one of the following:
|
1193
1211
|
- "sans-serif"
|
1194
1212
|
- "serif"
|
1195
1213
|
- "monospace"
|
1196
|
-
-
|
1197
|
-
-
|
1214
|
+
- The `family` value for a custom font table under [[theme.fontFaces]]
|
1215
|
+
- A comma-separated list of these (as a single string) to specify
|
1198
1216
|
fallbacks
|
1199
1217
|
|
1200
1218
|
If no heading font is set, Streamlit uses `theme.font` for headings.
|
@@ -1207,21 +1225,27 @@ _create_theme_options(
|
|
1207
1225
|
description="""
|
1208
1226
|
An array of fonts to use in your app.
|
1209
1227
|
|
1210
|
-
Each font in the array is a table (dictionary)
|
1211
|
-
attributes
|
1228
|
+
Each font in the array is a table (dictionary) that can have the
|
1229
|
+
following attributes, closely resembling CSS font-face definitions:
|
1230
|
+
- family
|
1231
|
+
- url
|
1232
|
+
- weight (optional)
|
1233
|
+
- style (optional)
|
1234
|
+
- unicodeRange (optional)
|
1212
1235
|
|
1213
1236
|
To host a font with your app, enable static file serving with
|
1214
1237
|
`server.enableStaticServing=true`.
|
1215
1238
|
|
1216
|
-
You can define multiple [[theme.fontFaces]] tables
|
1239
|
+
You can define multiple [[theme.fontFaces]] tables, including multiple
|
1240
|
+
tables with the same family if your font is defined by multiple files.
|
1217
1241
|
|
1218
|
-
For example,
|
1219
|
-
follows:
|
1242
|
+
For example, a font hosted with your app may have a [[theme.fontFaces]]
|
1243
|
+
table as follows:
|
1220
1244
|
|
1221
1245
|
[[theme.fontFaces]]
|
1222
1246
|
family = "font_name"
|
1223
1247
|
url = "app/static/font_file.woff"
|
1224
|
-
weight = 400
|
1248
|
+
weight = "400"
|
1225
1249
|
style = "normal"
|
1226
1250
|
""",
|
1227
1251
|
)
|
@@ -1238,9 +1262,10 @@ _create_theme_options(
|
|
1238
1262
|
- "medium"
|
1239
1263
|
- "large"
|
1240
1264
|
- "full"
|
1241
|
-
-
|
1242
|
-
|
1243
|
-
|
1265
|
+
- The number in pixels or rem.
|
1266
|
+
|
1267
|
+
For example, you can use "10px", "0.5rem", or "2rem". To follow best
|
1268
|
+
practices, use rem instead of pixels when specifying a numeric size.
|
1244
1269
|
""",
|
1245
1270
|
)
|
1246
1271
|
|
@@ -1256,9 +1281,12 @@ _create_theme_options(
|
|
1256
1281
|
- "medium"
|
1257
1282
|
- "large"
|
1258
1283
|
- "full"
|
1259
|
-
-
|
1260
|
-
|
1261
|
-
|
1284
|
+
- The number in pixels or rem.
|
1285
|
+
|
1286
|
+
For example, you can use "10px", "0.5rem", or "2rem". To follow best
|
1287
|
+
practices, use rem instead of pixels when specifying a numeric size.
|
1288
|
+
|
1289
|
+
If no button radius is set, Streamlit uses `theme.baseRadius` instead.
|
1262
1290
|
""",
|
1263
1291
|
)
|
1264
1292
|
|
@@ -1275,6 +1303,9 @@ _create_theme_options(
|
|
1275
1303
|
categories=["theme", CustomThemeCategories.SIDEBAR],
|
1276
1304
|
description="""
|
1277
1305
|
The color of the border around dataframes and tables.
|
1306
|
+
|
1307
|
+
If no dataframe border color is set, Streamlit uses `theme.borderColor`
|
1308
|
+
instead.
|
1278
1309
|
""",
|
1279
1310
|
)
|
1280
1311
|
|
streamlit/dataframe_util.py
CHANGED
@@ -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(
|
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
|
streamlit/elements/alert.py
CHANGED
@@ -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 :
|
70
|
-
The
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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 :
|
141
|
-
The
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
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 :
|
211
|
-
The
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
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 :
|
282
|
-
The
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
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
|
-------
|
streamlit/elements/arrow.py
CHANGED
@@ -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
|
648
|
+
return widget_state.value
|
649
649
|
return self.dg._enqueue("arrow_data_frame", proto)
|
650
650
|
|
651
651
|
@gather_metrics("table")
|
streamlit/elements/code.py
CHANGED
@@ -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 :
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
79
|
-
|
80
|
-
-
|
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
|
--------
|
streamlit/elements/doc_string.py
CHANGED
@@ -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.
|
63
|
-
|
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
|
-------
|
streamlit/elements/exception.py
CHANGED
@@ -60,13 +60,15 @@ class ExceptionMixin:
|
|
60
60
|
----------
|
61
61
|
exception : Exception
|
62
62
|
The exception to display.
|
63
|
-
width :
|
64
|
-
The
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-------
|
streamlit/elements/form.py
CHANGED
@@ -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:
|