streamlit-nightly 1.45.1.dev20250509__py3-none-any.whl → 1.45.1.dev20250511__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/execution_control.py +1 -1
- streamlit/commands/navigation.py +1 -1
- streamlit/commands/page_config.py +6 -26
- streamlit/delta_generator_singletons.py +1 -1
- streamlit/elements/arrow.py +2 -2
- streamlit/elements/code.py +1 -1
- streamlit/elements/lib/built_in_chart_utils.py +1 -1
- streamlit/elements/lib/column_types.py +2 -2
- streamlit/elements/lib/image_utils.py +1 -1
- streamlit/elements/lib/options_selector_utils.py +2 -2
- streamlit/elements/metric.py +1 -1
- streamlit/elements/vega_charts.py +1 -1
- streamlit/elements/widgets/audio_input.py +1 -1
- streamlit/elements/widgets/button.py +1 -1
- streamlit/elements/widgets/button_group.py +2 -2
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/checkbox.py +2 -2
- streamlit/elements/widgets/color_picker.py +1 -1
- streamlit/elements/widgets/data_editor.py +1 -1
- streamlit/elements/widgets/file_uploader.py +1 -1
- streamlit/elements/widgets/multiselect.py +1 -1
- streamlit/elements/widgets/number_input.py +2 -2
- streamlit/elements/widgets/radio.py +1 -1
- streamlit/elements/widgets/select_slider.py +1 -1
- streamlit/elements/widgets/selectbox.py +1 -1
- streamlit/elements/widgets/slider.py +3 -3
- streamlit/elements/widgets/text_widgets.py +2 -2
- streamlit/elements/widgets/time_widgets.py +2 -2
- streamlit/errors.py +0 -13
- streamlit/git_util.py +1 -1
- streamlit/proto/DataFrame_pb2.pyi +1 -1
- streamlit/proto/NamedDataSet_pb2.pyi +1 -1
- streamlit/proto/PageConfig_pb2.py +7 -7
- streamlit/proto/PageConfig_pb2.pyi +5 -1
- streamlit/runtime/connection_factory.py +3 -3
- streamlit/runtime/scriptrunner_utils/script_run_context.py +0 -15
- streamlit/runtime/state/query_params_proxy.py +1 -1
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.C-0hf1-k.js → ErrorOutline.esm.B5LmzpSn.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.B-fFGI-X.js → FileDownload.esm.BgWveG3s.js} +1 -1
- streamlit/static/static/js/{FileHelper.ACYo0OZo.js → FileHelper.DepIpP48.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CVNTT-bJ.js → FormClearHelper.C_BjP_35.js} +1 -1
- streamlit/static/static/js/{Hooks.C3thlpd2.js → Hooks.BpH4YuRQ.js} +1 -1
- streamlit/static/static/js/{InputInstructions.CwAxousX.js → InputInstructions.CjdwGigq.js} +1 -1
- streamlit/static/static/js/{ProgressBar.xh599Rum.js → ProgressBar.D1hXcW3N.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CQLIsNPE.js → RenderInPortalIfExists.A1T2s6z-.js} +1 -1
- streamlit/static/static/js/{Toolbar.LKdyvP0u.js → Toolbar.y7vr7z0G.js} +1 -1
- streamlit/static/static/js/{base-input.D8OdS4WW.js → base-input.BKhd-BLG.js} +1 -1
- streamlit/static/static/js/{checkbox.DSdYKlOI.js → checkbox.DC-GFdrh.js} +1 -1
- streamlit/static/static/js/{createSuper.B2pyCfWw.js → createSuper.D5WUtJEy.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DhO2r0ne.js → data-grid-overlay-editor.BPJ38mWp.js} +1 -1
- streamlit/static/static/js/{downloader.C24skoDM.js → downloader.C6a4LRBw.js} +1 -1
- streamlit/static/static/js/{es6.DHkvCKPh.js → es6.DgMlYq8q.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.2ckQaC2c.js → iframeResizer.contentWindow.BpQxex73.js} +1 -1
- streamlit/static/static/js/{index.BVgTQbOJ.js → index.20fI9wQF.js} +1 -1
- streamlit/static/static/js/{index.BHTbGZPQ.js → index.49Q6A5_9.js} +1 -1
- streamlit/static/static/js/{index.D0R7Xh4Z.js → index.4Gtr9egA.js} +1 -1
- streamlit/static/static/js/{index.CkTL9bAR.js → index.5k30-U6O.js} +1 -1
- streamlit/static/static/js/{index.CsbhsAPy.js → index.B3UoUwtN.js} +1 -1
- streamlit/static/static/js/{index.0dGwl8CJ.js → index.B8ca7fYO.js} +1 -1
- streamlit/static/static/js/{index.BNXtQAj4.js → index.BLpDfH1w.js} +1 -1
- streamlit/static/static/js/{index.D7SCC3z9.js → index.BRN41-Jy.js} +1 -1
- streamlit/static/static/js/{index.CwuKadAX.js → index.BbhQIRth.js} +1 -1
- streamlit/static/static/js/{index.BAafqHfB.js → index.BcbB70bz.js} +1 -1
- streamlit/static/static/js/{index.By-NmdnB.js → index.BgEbLy94.js} +5 -5
- streamlit/static/static/js/{index.CUsk52t2.js → index.BhGEwO_d.js} +1 -1
- streamlit/static/static/js/{index.BflIniLm.js → index.Bj81ZRkx.js} +1 -1
- streamlit/static/static/js/{index.CVO14oQG.js → index.Bo-z1JM2.js} +1 -1
- streamlit/static/static/js/{index.DZiilxEt.js → index.BydIp_VR.js} +1 -1
- streamlit/static/static/js/{index.yzoj_DuM.js → index.C2GjbQtf.js} +1 -1
- streamlit/static/static/js/{index.gFjPlsMT.js → index.CHnID3dI.js} +1 -1
- streamlit/static/static/js/{index.CRxaBCJ7.js → index.CY8tg9lY.js} +1 -1
- streamlit/static/static/js/{index.CU-pbYVN.js → index.CcvbHTJu.js} +1 -1
- streamlit/static/static/js/{index.jCJYMVED.js → index.Cfi3u2-T.js} +1 -1
- streamlit/static/static/js/{index.fz_c3Xh_.js → index.CiO2JPl_.js} +1 -1
- streamlit/static/static/js/{index.BSOiJVQd.js → index.CkBnHCIQ.js} +1 -1
- streamlit/static/static/js/{index.B5A28NpR.js → index.Cqla7uBZ.js} +1 -1
- streamlit/static/static/js/{index.JtIlC6Uq.js → index.D3tgBU6x.js} +1 -1
- streamlit/static/static/js/{index.D2D75EDw.js → index.D5PANKHd.js} +1 -1
- streamlit/static/static/js/{index.CIoOEhZ2.js → index.DAO4Lj-D.js} +1 -1
- streamlit/static/static/js/{index.CXFuA6J-.js → index.DB42JCH0.js} +1 -1
- streamlit/static/static/js/{index.Dvr1cEJS.js → index.DPiBGVm8.js} +1 -1
- streamlit/static/static/js/{index.C_dd5q7u.js → index.DSPS70gp.js} +1 -1
- streamlit/static/static/js/{index.B5EFweZ4.js → index.DT0CWGt3.js} +1 -1
- streamlit/static/static/js/{index.BjeNtZIz.js → index.Du1Pbz0y.js} +1 -1
- streamlit/static/static/js/{index.CjWUnKIN.js → index.VPO2zcSN.js} +1 -1
- streamlit/static/static/js/{index.D4eMiZ1F.js → index._oOkpIXS.js} +1 -1
- streamlit/static/static/js/{index.CRCdonis.js → index.br6zwNIk.js} +6 -6
- streamlit/static/static/js/{index.xldt56AE.js → index.ryD8hMpi.js} +1 -1
- streamlit/static/static/js/{index.BRhKaVdO.js → index.sKXwUANU.js} +1 -1
- streamlit/static/static/js/{index.CtCnBUtk.js → index.xIQLhQKv.js} +1 -1
- streamlit/static/static/js/{input.BP6LX_Bg.js → input.CNjMviuo.js} +1 -1
- streamlit/static/static/js/{memory.E9x2ZYJv.js → memory.f8X97LPt.js} +1 -1
- streamlit/static/static/js/{mergeWith.CZP2AaVS.js → mergeWith.DU9BO8BA.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.D-Kl79U_.js → number-overlay-editor.xJPBNdGQ.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.P2ILVC_6.js → possibleConstructorReturn.BjPX9m9m.js} +1 -1
- streamlit/static/static/js/{sandbox.DfzJIGMV.js → sandbox.B23JuuVd.js} +1 -1
- streamlit/static/static/js/{textarea.4PjzfDWF.js → textarea.DodnI6GX.js} +1 -1
- streamlit/static/static/js/{timepicker.DMQdaNzO.js → timepicker.ClHKNfP9.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.BEdkbHYx.js → toConsumableArray.CK6YGgcW.js} +1 -1
- streamlit/static/static/js/{uniqueId.CAs7ftHC.js → uniqueId.BAAVLIKj.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.Cedp0V76.js → useBasicWidgetState.B1oropKY.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CvRKHHKx.js → useOnInputChange.CHQJz2sf.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BbmjZAzW.js → withFullScreenWrapper.DZ1W8JUx.js} +1 -1
- streamlit/vendor/pympler/asizeof.py +1 -1
- {streamlit_nightly-1.45.1.dev20250509.dist-info → streamlit_nightly-1.45.1.dev20250511.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.1.dev20250509.dist-info → streamlit_nightly-1.45.1.dev20250511.dist-info}/RECORD +111 -111
- {streamlit_nightly-1.45.1.dev20250509.data → streamlit_nightly-1.45.1.dev20250511.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.1.dev20250509.dist-info → streamlit_nightly-1.45.1.dev20250511.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.1.dev20250509.dist-info → streamlit_nightly-1.45.1.dev20250511.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.1.dev20250509.dist-info → streamlit_nightly-1.45.1.dev20250511.dist-info}/top_level.txt +0 -0
@@ -70,7 +70,7 @@ def _new_fragment_id_queue(
|
|
70
70
|
# If st.rerun(scope="fragment") is called during a full script run, we raise an
|
71
71
|
# exception. This occurs, of course, if st.rerun(scope="fragment") is called
|
72
72
|
# outside of a fragment, but it somewhat surprisingly occurs if it gets called
|
73
|
-
# from within a fragment during a run of the full script. While this
|
73
|
+
# from within a fragment during a run of the full script. While this behavior may
|
74
74
|
# be surprising, it seems somewhat reasonable given that the correct behavior of
|
75
75
|
# calling st.rerun(scope="fragment") in this situation is unclear to me:
|
76
76
|
# * Rerunning just the fragment immediately may cause weirdness down the line
|
streamlit/commands/navigation.py
CHANGED
@@ -318,7 +318,7 @@ def _navigation(
|
|
318
318
|
|
319
319
|
script_hash = page._script_hash
|
320
320
|
if script_hash in pagehash_to_pageinfo:
|
321
|
-
# The page script hash is
|
321
|
+
# The page script hash is solely based on the url path
|
322
322
|
# So duplicate page script hashes are due to duplicate url paths
|
323
323
|
raise StreamlitAPIException(
|
324
324
|
f"Multiple Pages specified with URL pathname {page.url_path}. "
|
@@ -52,34 +52,10 @@ _About: TypeAlias = Literal["About", "about"]
|
|
52
52
|
MenuKey: TypeAlias = Literal[_GetHelp, _ReportABug, _About]
|
53
53
|
MenuItems: TypeAlias = Mapping[MenuKey, Union[str, None]]
|
54
54
|
|
55
|
-
# Emojis recommended by https://share.streamlit.io/rensdimmendaal/emoji-recommender/main/app/streamlit.py
|
56
|
-
# for the term "streamlit". Watch out for zero-width joiners,
|
57
|
-
# as they won't parse correctly in the list() call!
|
58
55
|
RANDOM_EMOJIS: Final = list(
|
59
56
|
"🔥™🎉🚀🌌💣✨🌙🎆🎇💥🤩🤙🌛🤘⬆💡🤪🥂⚡💨🌠🎊🍿😛🔮🤟🌃🍃🍾💫▪🌴🎈🎬🌀🎄😝☔⛽🍂💃😎🍸🎨🥳☀😍🅱🌞😻🌟😜💦💅🦄😋😉👻🍁🤤👯🌻‼🌈👌🎃💛😚🔫🙌👽🍬🌅☁🍷👭☕🌚💁👅🥰🍜😌🎥🕺❕🧡☄💕🍻✅🌸🚬🤓🍹®☺💪😙☘🤠✊🤗🍵🤞😂💯😏📻🎂💗💜🌊❣🌝😘💆🤑🌿🦋😈⛄🚿😊🌹🥴😽💋😭🖤🙆👐⚪💟☃🙈🍭💻🥀🚗🤧🍝💎💓🤝💄💖🔞⁉⏰🕊🎧☠♥🌳🏾🙉⭐💊🍳🌎🙊💸❤🔪😆🌾✈📚💀🏠✌🏃🌵🚨💂🤫🤭😗😄🍒👏🙃🖖💞😅🎅🍄🆓👉💩🔊🤷⌚👸😇🚮💏👳🏽💘💿💉👠🎼🎶🎤👗❄🔐🎵🤒🍰👓🏄🌲🎮🙂📈🚙📍😵🗣❗🌺🙄👄🚘🥺🌍🏡♦💍🌱👑👙☑👾🍩🥶📣🏼🤣☯👵🍫➡🎀😃✋🍞🙇😹🙏👼🐝⚫🎁🍪🔨🌼👆👀😳🌏📖👃🎸👧💇🔒💙😞⛅🏻🍴😼🗿🍗♠🦁✔🤖☮🐢🐎💤😀🍺😁😴📺☹😲👍🎭💚🍆🍋🔵🏁🔴🔔🧐👰☎🏆🤡🐠📲🙋📌🐬✍🔑📱💰🐱💧🎓🍕👟🐣👫🍑😸🍦👁🆗🎯📢🚶🦅🐧💢🏀🚫💑🐟🌽🏊🍟💝💲🐍🍥🐸☝♣👊⚓❌🐯🏈📰🌧👿🐳💷🐺📞🆒🍀🤐🚲🍔👹🙍🌷🙎🐥💵🔝📸⚠❓🎩✂🍼😑⬇⚾🍎💔🐔⚽💭🏌🐷🍍✖🍇📝🍊🐙👋🤔🥊🗽🐑🐘🐰💐🐴♀🐦🍓✏👂🏴👇🆘😡🏉👩💌😺✝🐼🐒🐶👺🖕👬🍉🐻🐾⬅⏬▶👮🍌♂🔸👶🐮👪⛳🐐🎾🐕👴🐨🐊🔹©🎣👦👣👨👈💬⭕📹📷"
|
60
57
|
)
|
61
58
|
|
62
|
-
# Also pick out some vanity emojis.
|
63
|
-
ENG_EMOJIS: Final = [
|
64
|
-
"🎈", # st.balloons 🎈🎈
|
65
|
-
"🤓", # Abhi
|
66
|
-
"🏈", # Amey
|
67
|
-
"🚲", # Thiago
|
68
|
-
"🐧", # Matteo
|
69
|
-
"🦒", # Ken
|
70
|
-
"🐳", # Karrie
|
71
|
-
"🕹️", # Jonathan
|
72
|
-
"🇦🇲", # Henrikh
|
73
|
-
"🎸", # Guido
|
74
|
-
"🦈", # Austin
|
75
|
-
"💎", # Emiliano
|
76
|
-
"👩🎤", # Naomi
|
77
|
-
"🧙♂️", # Jon
|
78
|
-
"🐻", # Brandon
|
79
|
-
"🎎", # James
|
80
|
-
# TODO: Solicit emojis from the rest of Streamlit
|
81
|
-
]
|
82
|
-
|
83
59
|
|
84
60
|
def _lower_clean_dict_keys(dict: MenuItems) -> dict[str, Any]:
|
85
61
|
return {str(k).lower().strip(): v for k, v in dict.items()}
|
@@ -243,6 +219,7 @@ def set_page_config(
|
|
243
219
|
elif layout == "wide":
|
244
220
|
pb_layout = PageConfigProto.WIDE
|
245
221
|
else:
|
222
|
+
# Note: Pylance incorrectly notes this error as unreachable
|
246
223
|
raise StreamlitInvalidPageLayoutError(layout=layout)
|
247
224
|
|
248
225
|
msg.page_config_changed.layout = pb_layout
|
@@ -255,6 +232,7 @@ def set_page_config(
|
|
255
232
|
elif initial_sidebar_state == "collapsed":
|
256
233
|
pb_sidebar_state = PageConfigProto.COLLAPSED
|
257
234
|
else:
|
235
|
+
# Note: Pylance incorrectly notes this error as unreachable
|
258
236
|
raise StreamlitInvalidSidebarStateError(
|
259
237
|
initial_sidebar_state=initial_sidebar_state
|
260
238
|
)
|
@@ -274,9 +252,8 @@ def set_page_config(
|
|
274
252
|
|
275
253
|
|
276
254
|
def get_random_emoji() -> str:
|
277
|
-
# Weigh our emojis 10x, cuz we're awesome!
|
278
255
|
# TODO: fix the random seed with a hash of the user's app code, for stability?
|
279
|
-
return random.choice(RANDOM_EMOJIS
|
256
|
+
return random.choice(RANDOM_EMOJIS) # noqa: S311
|
280
257
|
|
281
258
|
|
282
259
|
def set_menu_items_proto(
|
@@ -297,6 +274,9 @@ def set_menu_items_proto(
|
|
297
274
|
if ABOUT_KEY in lowercase_menu_items:
|
298
275
|
if lowercase_menu_items[ABOUT_KEY] is not None:
|
299
276
|
menu_items_proto.about_section_md = dedent(lowercase_menu_items[ABOUT_KEY])
|
277
|
+
else:
|
278
|
+
# For multiple calls to set_page_config, clears previously set about markdown
|
279
|
+
menu_items_proto.clear_about_md = True
|
300
280
|
|
301
281
|
|
302
282
|
def validate_menu_items(menu_items: MenuItems) -> None:
|
@@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
|
33
33
|
class DeltaGeneratorSingleton:
|
34
34
|
"""Used to initialize the DeltaGenerator classes and store them as singletons.
|
35
35
|
This module allows us to avoid circular imports between DeltaGenerator and elements,
|
36
|
-
because
|
36
|
+
because elements can import this singleton module instead of DeltaGenerator directly.
|
37
37
|
"""
|
38
38
|
|
39
39
|
_instance: DeltaGeneratorSingleton | None = None
|
streamlit/elements/arrow.py
CHANGED
@@ -93,7 +93,7 @@ class DataframeSelectionState(TypedDict, total=False):
|
|
93
93
|
The selected rows, identified by their integer position. The integer
|
94
94
|
positions match the original dataframe, even if the user sorts the
|
95
95
|
dataframe in their browser. For a ``pandas.DataFrame``, you can
|
96
|
-
retrieve data from its
|
96
|
+
retrieve data from its integer position using methods like ``.iloc[]``
|
97
97
|
or ``.iat[]``.
|
98
98
|
columns : list[str]
|
99
99
|
The selected columns, identified by their names.
|
@@ -327,7 +327,7 @@ class ArrowMixin:
|
|
327
327
|
Desired height of the dataframe expressed in pixels. If ``height``
|
328
328
|
is ``None`` (default), Streamlit sets the height to show at most
|
329
329
|
ten rows. Vertical scrolling within the dataframe element is
|
330
|
-
enabled when the height does not
|
330
|
+
enabled when the height does not accommodate all rows.
|
331
331
|
|
332
332
|
use_container_width : bool
|
333
333
|
Whether to override ``width`` with the width of the parent
|
streamlit/elements/code.py
CHANGED
@@ -67,7 +67,7 @@ class CodeMixin:
|
|
67
67
|
Desired height of the code block expressed in pixels. If ``height``
|
68
68
|
is ``None`` (default), Streamlit sets the element's height to fit
|
69
69
|
its content. Vertical scrolling within the element is enabled when
|
70
|
-
the height does not
|
70
|
+
the height does not accommodate all lines.
|
71
71
|
|
72
72
|
width : "stretch" or int
|
73
73
|
The width of the code block. This can be either:
|
@@ -964,7 +964,7 @@ def _get_color_encoding(
|
|
964
964
|
|
965
965
|
return alt.ColorValue(to_css_color(cast("Any", color_value)))
|
966
966
|
|
967
|
-
# If the color value is a list of colors of
|
967
|
+
# If the color value is a list of colors of appropriate length, return that.
|
968
968
|
if isinstance(color_value, (list, tuple)):
|
969
969
|
color_values = cast("Collection[Color]", color_value)
|
970
970
|
|
@@ -432,7 +432,7 @@ def NumberColumn(
|
|
432
432
|
- ``"engineering"``: Show the number in engineering notation (e.g. "1.235E3").
|
433
433
|
- printf-style format string: Format the number with a printf
|
434
434
|
specifier, like ``"%d"`` to show a signed integer (e.g. "1234") or
|
435
|
-
``"%X"`` to show an unsigned
|
435
|
+
``"%X"`` to show an unsigned hexadecimal integer (e.g. "4D2"). You
|
436
436
|
can also add prefixes and suffixes. To show British pounds, use
|
437
437
|
``"£ %.2f"`` (e.g. "£ 1234.57"). For more information, see `sprint-js
|
438
438
|
<https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
|
@@ -2007,7 +2007,7 @@ def ProgressColumn(
|
|
2007
2007
|
- ``"engineering"``: Show the number in engineering notation (e.g. "1.235E3").
|
2008
2008
|
- printf-style format string: Format the number with a printf
|
2009
2009
|
specifier, like ``"%d"`` to show a signed integer (e.g. "1234") or
|
2010
|
-
``"%X"`` to show an unsigned
|
2010
|
+
``"%X"`` to show an unsigned hexadecimal integer (e.g. "4D2"). You
|
2011
2011
|
can also add prefixes and suffixes. To show British pounds, use
|
2012
2012
|
``"£ %.2f"`` (e.g. "£ 1234.57"). For more information, see `sprint-js
|
2013
2013
|
<https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
|
@@ -360,7 +360,7 @@ def marshall_images(
|
|
360
360
|
Parameters
|
361
361
|
----------
|
362
362
|
coordinates
|
363
|
-
A string
|
363
|
+
A string identifying the images' location in the frontend.
|
364
364
|
image
|
365
365
|
The image or images to include in the ImageListProto.
|
366
366
|
caption
|
@@ -105,7 +105,7 @@ _ALLOWED_ENUM_COERCION_CONFIG_SETTINGS = ("off", "nameOnly", "nameAndValue")
|
|
105
105
|
def _coerce_enum(from_enum_value: E1, to_enum_class: type[E2]) -> E1 | E2:
|
106
106
|
"""Attempt to coerce an Enum value to another EnumMeta.
|
107
107
|
|
108
|
-
An Enum value of EnumMeta E1 is considered
|
108
|
+
An Enum value of EnumMeta E1 is considered coercible to EnumType E2
|
109
109
|
if the EnumMeta __qualname__ match and the names of their members
|
110
110
|
match as well. (This is configurable in streamlist configs)
|
111
111
|
"""
|
@@ -149,7 +149,7 @@ def _coerce_enum(from_enum_value: E1, to_enum_class: type[E2]) -> E1 | E2:
|
|
149
149
|
_LOGGER.debug("Failed to coerce %s to class %s", from_enum_value, to_enum_class)
|
150
150
|
return from_enum_value # do not attempt to coerce
|
151
151
|
|
152
|
-
# At this point we think the Enum is
|
152
|
+
# At this point we think the Enum is coercible, and we know
|
153
153
|
# E1 and E2 have the same member names. We convert from E1 to E2 using _name_
|
154
154
|
# (since user Enum subclasses can override the .name property in 3.11)
|
155
155
|
_LOGGER.debug("Coerced %s to class %s", from_enum_value, to_enum_class)
|
streamlit/elements/metric.py
CHANGED
@@ -114,7 +114,7 @@ class MetricMixin:
|
|
114
114
|
label_visibility : "visible", "hidden", or "collapsed"
|
115
115
|
The visibility of the label. The default is ``"visible"``. If this
|
116
116
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
117
|
-
label, which can help keep the widget
|
117
|
+
label, which can help keep the widget aligned with other widgets.
|
118
118
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
119
119
|
|
120
120
|
border : bool
|
@@ -1567,7 +1567,7 @@ class VegaChartsMixin:
|
|
1567
1567
|
as a dictionary.
|
1568
1568
|
|
1569
1569
|
To use selection events, the object passed to ``altair_chart`` must
|
1570
|
-
include selection
|
1570
|
+
include selection parameters. To learn about defining interactions
|
1571
1571
|
in Altair and how to declare selection-type parameters, see
|
1572
1572
|
`Interactive Charts \
|
1573
1573
|
<https://altair-viz.github.io/user_guide/interactions.html>`_
|
@@ -160,7 +160,7 @@ class AudioInputMixin:
|
|
160
160
|
label_visibility : "visible", "hidden", or "collapsed"
|
161
161
|
The visibility of the label. The default is ``"visible"``. If this
|
162
162
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
163
|
-
label, which can help keep the widget
|
163
|
+
label, which can help keep the widget aligned with other widgets.
|
164
164
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
165
165
|
|
166
166
|
width : "stretch" or int
|
@@ -420,7 +420,7 @@ class ButtonMixin:
|
|
420
420
|
data with a cached function. When working with a download button, it's
|
421
421
|
similarly recommended to convert your data into a downloadable format
|
422
422
|
with a cached function. Caching ensures that the app reruns
|
423
|
-
|
423
|
+
efficiently.
|
424
424
|
|
425
425
|
>>> import streamlit as st
|
426
426
|
>>> import pandas as pd
|
@@ -550,7 +550,7 @@ class ButtonGroupMixin:
|
|
550
550
|
label_visibility: "visible", "hidden", or "collapsed"
|
551
551
|
The visibility of the label. The default is ``"visible"``. If this
|
552
552
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
553
|
-
label, which can help keep the widget
|
553
|
+
label, which can help keep the widget aligned with other widgets.
|
554
554
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
555
555
|
|
556
556
|
Returns
|
@@ -759,7 +759,7 @@ class ButtonGroupMixin:
|
|
759
759
|
label_visibility: "visible", "hidden", or "collapsed"
|
760
760
|
The visibility of the label. The default is ``"visible"``. If this
|
761
761
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
762
|
-
label, which can help keep the widget
|
762
|
+
label, which can help keep the widget aligned with other widgets.
|
763
763
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
764
764
|
|
765
765
|
Returns
|
@@ -160,7 +160,7 @@ class CameraInputMixin:
|
|
160
160
|
label_visibility : "visible", "hidden", or "collapsed"
|
161
161
|
The visibility of the label. The default is ``"visible"``. If this
|
162
162
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
163
|
-
label, which can help keep the widget
|
163
|
+
label, which can help keep the widget aligned with other widgets.
|
164
164
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
165
165
|
|
166
166
|
width : "stretch" or int
|
@@ -130,7 +130,7 @@ class CheckboxMixin:
|
|
130
130
|
label_visibility : "visible", "hidden", or "collapsed"
|
131
131
|
The visibility of the label. The default is ``"visible"``. If this
|
132
132
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
133
|
-
label, which can help keep the widget
|
133
|
+
label, which can help keep the widget aligned with other widgets.
|
134
134
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
135
135
|
|
136
136
|
Returns
|
@@ -241,7 +241,7 @@ class CheckboxMixin:
|
|
241
241
|
label_visibility : "visible", "hidden", or "collapsed"
|
242
242
|
The visibility of the label. The default is ``"visible"``. If this
|
243
243
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
244
|
-
label, which can help keep the widget
|
244
|
+
label, which can help keep the widget aligned with other widgets.
|
245
245
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
246
246
|
|
247
247
|
Returns
|
@@ -133,7 +133,7 @@ class ColorPickerMixin:
|
|
133
133
|
label_visibility : "visible", "hidden", or "collapsed"
|
134
134
|
The visibility of the label. The default is ``"visible"``. If this
|
135
135
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
136
|
-
label, which can help keep the widget
|
136
|
+
label, which can help keep the widget aligned with other widgets.
|
137
137
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
138
138
|
|
139
139
|
Returns
|
@@ -666,7 +666,7 @@ class DataEditorMixin:
|
|
666
666
|
Desired height of the data editor expressed in pixels. If ``height``
|
667
667
|
is ``None`` (default), Streamlit sets the height to show at most
|
668
668
|
ten rows. Vertical scrolling within the data editor element is
|
669
|
-
enabled when the height does not
|
669
|
+
enabled when the height does not accommodate all rows.
|
670
670
|
|
671
671
|
use_container_width : bool
|
672
672
|
Whether to override ``width`` with the width of the parent
|
@@ -330,7 +330,7 @@ class FileUploaderMixin:
|
|
330
330
|
label_visibility : "visible", "hidden", or "collapsed"
|
331
331
|
The visibility of the label. The default is ``"visible"``. If this
|
332
332
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
333
|
-
label, which can help keep the widget
|
333
|
+
label, which can help keep the widget aligned with other widgets.
|
334
334
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
335
335
|
|
336
336
|
width : "stretch" or int
|
@@ -316,7 +316,7 @@ class MultiSelectMixin:
|
|
316
316
|
label_visibility: "visible", "hidden", or "collapsed"
|
317
317
|
The visibility of the label. The default is ``"visible"``. If this
|
318
318
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
319
|
-
label, which can help keep the widget
|
319
|
+
label, which can help keep the widget aligned with other widgets.
|
320
320
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
321
321
|
|
322
322
|
accept_new_options: bool
|
@@ -235,7 +235,7 @@ class NumberInputMixin:
|
|
235
235
|
|
236
236
|
.. note::
|
237
237
|
Integer values exceeding +/- ``(1<<53) - 1`` cannot be accurately
|
238
|
-
stored or returned by the widget due to serialization
|
238
|
+
stored or returned by the widget due to serialization constraints
|
239
239
|
between the Python server and JavaScript client. You must handle
|
240
240
|
such numbers as floats, leading to a loss in precision.
|
241
241
|
|
@@ -331,7 +331,7 @@ class NumberInputMixin:
|
|
331
331
|
label_visibility : "visible", "hidden", or "collapsed"
|
332
332
|
The visibility of the label. The default is ``"visible"``. If this
|
333
333
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
334
|
-
label, which can help keep the widget
|
334
|
+
label, which can help keep the widget aligned with other widgets.
|
335
335
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
336
336
|
|
337
337
|
icon : str, None
|
@@ -219,7 +219,7 @@ class RadioMixin:
|
|
219
219
|
label_visibility : "visible", "hidden", or "collapsed"
|
220
220
|
The visibility of the label. The default is ``"visible"``. If this
|
221
221
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
222
|
-
label, which can help keep the widget
|
222
|
+
label, which can help keep the widget aligned with other widgets.
|
223
223
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
224
224
|
|
225
225
|
Returns
|
@@ -255,7 +255,7 @@ class SelectSliderMixin:
|
|
255
255
|
label_visibility : "visible", "hidden", or "collapsed"
|
256
256
|
The visibility of the label. The default is ``"visible"``. If this
|
257
257
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
258
|
-
label, which can help keep the widget
|
258
|
+
label, which can help keep the widget aligned with other widgets.
|
259
259
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
260
260
|
|
261
261
|
width : "stretch" or int
|
@@ -334,7 +334,7 @@ class SelectboxMixin:
|
|
334
334
|
label_visibility : "visible", "hidden", or "collapsed"
|
335
335
|
The visibility of the label. The default is ``"visible"``. If this
|
336
336
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
337
|
-
label, which can help keep the widget
|
337
|
+
label, which can help keep the widget aligned with other widgets.
|
338
338
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
339
339
|
|
340
340
|
accept_new_options : bool
|
@@ -426,7 +426,7 @@ class SliderMixin:
|
|
426
426
|
|
427
427
|
.. note::
|
428
428
|
Integer values exceeding +/- ``(1<<53) - 1`` cannot be accurately
|
429
|
-
stored or returned by the widget due to serialization
|
429
|
+
stored or returned by the widget due to serialization constraints
|
430
430
|
between the Python server and JavaScript client. You must handle
|
431
431
|
such numbers as floats, leading to a loss in precision.
|
432
432
|
|
@@ -534,7 +534,7 @@ class SliderMixin:
|
|
534
534
|
label_visibility : "visible", "hidden", or "collapsed"
|
535
535
|
The visibility of the label. The default is ``"visible"``. If this
|
536
536
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
537
|
-
label, which can help keep the widget
|
537
|
+
label, which can help keep the widget aligned with other widgets.
|
538
538
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
539
539
|
|
540
540
|
width : "stretch" or pixel width
|
@@ -661,7 +661,7 @@ class SliderMixin:
|
|
661
661
|
if value is None:
|
662
662
|
# We need to know if this is a single or range slider, but don't have
|
663
663
|
# a default value, so we check if session_state can tell us.
|
664
|
-
# We already
|
664
|
+
# We already calculated the id, so there is no risk of this causing
|
665
665
|
# the id to change.
|
666
666
|
|
667
667
|
single_value = True
|
@@ -218,7 +218,7 @@ class TextWidgetsMixin:
|
|
218
218
|
label_visibility : "visible", "hidden", or "collapsed"
|
219
219
|
The visibility of the label. The default is ``"visible"``. If this
|
220
220
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
221
|
-
label, which can help keep the widget
|
221
|
+
label, which can help keep the widget aligned with other widgets.
|
222
222
|
|
223
223
|
icon : str, None
|
224
224
|
An optional emoji or icon to display within the input field to the
|
@@ -531,7 +531,7 @@ class TextWidgetsMixin:
|
|
531
531
|
label_visibility : "visible", "hidden", or "collapsed"
|
532
532
|
The visibility of the label. The default is ``"visible"``. If this
|
533
533
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
534
|
-
label, which can help keep the widget
|
534
|
+
label, which can help keep the widget aligned with other widgets.
|
535
535
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
536
536
|
|
537
537
|
width : WidthWithoutContent
|
@@ -430,7 +430,7 @@ class TimeWidgetsMixin:
|
|
430
430
|
label_visibility : "visible", "hidden", or "collapsed"
|
431
431
|
The visibility of the label. The default is ``"visible"``. If this
|
432
432
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
433
|
-
label, which can help keep the widget
|
433
|
+
label, which can help keep the widget aligned with other widgets.
|
434
434
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
435
435
|
|
436
436
|
step : int or timedelta
|
@@ -771,7 +771,7 @@ class TimeWidgetsMixin:
|
|
771
771
|
label_visibility : "visible", "hidden", or "collapsed"
|
772
772
|
The visibility of the label. The default is ``"visible"``. If this
|
773
773
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
774
|
-
label, which can help keep the widget
|
774
|
+
label, which can help keep the widget aligned with other widgets.
|
775
775
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
776
776
|
|
777
777
|
width : "stretch" or int
|
streamlit/errors.py
CHANGED
@@ -174,19 +174,6 @@ class LocalizableStreamlitException(StreamlitAPIException):
|
|
174
174
|
return self._exec_kwargs
|
175
175
|
|
176
176
|
|
177
|
-
# st.set_page_config
|
178
|
-
class StreamlitSetPageConfigMustBeFirstCommandError(LocalizableStreamlitException):
|
179
|
-
"""Exception raised when the set_page_config command is not the first executed streamlit command."""
|
180
|
-
|
181
|
-
def __init__(self):
|
182
|
-
super().__init__(
|
183
|
-
"`set_page_config()` can only be called once per app page, "
|
184
|
-
"and must be called as the first Streamlit command in your script.\n\n"
|
185
|
-
"For more information refer to the [docs]"
|
186
|
-
"(https://docs.streamlit.io/develop/api-reference/configuration/st.set_page_config)."
|
187
|
-
)
|
188
|
-
|
189
|
-
|
190
177
|
class StreamlitInvalidPageLayoutError(LocalizableStreamlitException):
|
191
178
|
"""Exception raised when an invalid value is specified for layout."""
|
192
179
|
|
streamlit/git_util.py
CHANGED
@@ -41,7 +41,7 @@ class GitRepo:
|
|
41
41
|
|
42
42
|
# GitPython is not fully typed, and mypy is outputting inconsistent
|
43
43
|
# type errors on Mac and Linux. We bypass type checking entirely
|
44
|
-
# by
|
44
|
+
# by redeclaring the `git` import as an "Any".
|
45
45
|
git_package: Any = git
|
46
46
|
self.repo = git_package.Repo(path, search_parent_directories=True)
|
47
47
|
self.git_version = self.repo.git.version_info
|
@@ -29,7 +29,7 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
|
29
29
|
|
30
30
|
@typing.final
|
31
31
|
class DataFrame(google.protobuf.message.Message):
|
32
|
-
"""DEPRECATED: This proto message is deprecated and
|
32
|
+
"""DEPRECATED: This proto message is deprecated and unused. Use Arrow.proto instead.
|
33
33
|
Represents a pandas DataFrame.
|
34
34
|
"""
|
35
35
|
|
@@ -27,7 +27,7 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
|
27
27
|
|
28
28
|
@typing.final
|
29
29
|
class NamedDataSet(google.protobuf.message.Message):
|
30
|
-
"""DEPRECATED: This proto message is deprecated and
|
30
|
+
"""DEPRECATED: This proto message is deprecated and unused.
|
31
31
|
A dataset that can be referenced by name.
|
32
32
|
"""
|
33
33
|
|
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n streamlit/proto/PageConfig.proto\"\
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n streamlit/proto/PageConfig.proto\"\xaf\x03\n\nPageConfig\x12\r\n\x05title\x18\x01 \x01(\t\x12\x0f\n\x07\x66\x61vicon\x18\x02 \x01(\t\x12\"\n\x06layout\x18\x03 \x01(\x0e\x32\x12.PageConfig.Layout\x12\x37\n\x15initial_sidebar_state\x18\x04 \x01(\x0e\x32\x18.PageConfig.SidebarState\x12)\n\nmenu_items\x18\x05 \x01(\x0b\x32\x15.PageConfig.MenuItems\x1a\x9f\x01\n\tMenuItems\x12\x14\n\x0cget_help_url\x18\x01 \x01(\t\x12\x15\n\rhide_get_help\x18\x02 \x01(\x08\x12\x18\n\x10report_a_bug_url\x18\x03 \x01(\t\x12\x19\n\x11hide_report_a_bug\x18\x04 \x01(\x08\x12\x18\n\x10\x61\x62out_section_md\x18\x05 \x01(\t\x12\x16\n\x0e\x63lear_about_md\x18\x06 \x01(\x08\" \n\x06Layout\x12\x0c\n\x08\x43\x45NTERED\x10\x00\x12\x08\n\x04WIDE\x10\x01\"5\n\x0cSidebarState\x12\x08\n\x04\x41UTO\x10\x00\x12\x0c\n\x08\x45XPANDED\x10\x01\x12\r\n\tCOLLAPSED\x10\x02\x42/\n\x1c\x63om.snowflake.apps.streamlitB\x0fPageConfigProtob\x06proto3')
|
18
18
|
|
19
19
|
_globals = globals()
|
20
20
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -23,11 +23,11 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
23
23
|
_globals['DESCRIPTOR']._loaded_options = None
|
24
24
|
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\017PageConfigProto'
|
25
25
|
_globals['_PAGECONFIG']._serialized_start=37
|
26
|
-
_globals['_PAGECONFIG']._serialized_end=
|
26
|
+
_globals['_PAGECONFIG']._serialized_end=468
|
27
27
|
_globals['_PAGECONFIG_MENUITEMS']._serialized_start=220
|
28
|
-
_globals['_PAGECONFIG_MENUITEMS']._serialized_end=
|
29
|
-
_globals['_PAGECONFIG_LAYOUT']._serialized_start=
|
30
|
-
_globals['_PAGECONFIG_LAYOUT']._serialized_end=
|
31
|
-
_globals['_PAGECONFIG_SIDEBARSTATE']._serialized_start=
|
32
|
-
_globals['_PAGECONFIG_SIDEBARSTATE']._serialized_end=
|
28
|
+
_globals['_PAGECONFIG_MENUITEMS']._serialized_end=379
|
29
|
+
_globals['_PAGECONFIG_LAYOUT']._serialized_start=381
|
30
|
+
_globals['_PAGECONFIG_LAYOUT']._serialized_end=413
|
31
|
+
_globals['_PAGECONFIG_SIDEBARSTATE']._serialized_start=415
|
32
|
+
_globals['_PAGECONFIG_SIDEBARSTATE']._serialized_end=468
|
33
33
|
# @@protoc_insertion_point(module_scope)
|
@@ -84,11 +84,14 @@ class PageConfig(google.protobuf.message.Message):
|
|
84
84
|
REPORT_A_BUG_URL_FIELD_NUMBER: builtins.int
|
85
85
|
HIDE_REPORT_A_BUG_FIELD_NUMBER: builtins.int
|
86
86
|
ABOUT_SECTION_MD_FIELD_NUMBER: builtins.int
|
87
|
+
CLEAR_ABOUT_MD_FIELD_NUMBER: builtins.int
|
87
88
|
get_help_url: builtins.str
|
88
89
|
hide_get_help: builtins.bool
|
89
90
|
report_a_bug_url: builtins.str
|
90
91
|
hide_report_a_bug: builtins.bool
|
91
92
|
about_section_md: builtins.str
|
93
|
+
clear_about_md: builtins.bool
|
94
|
+
"""For multiple calls to set_page_config, clears set about markdown"""
|
92
95
|
def __init__(
|
93
96
|
self,
|
94
97
|
*,
|
@@ -97,8 +100,9 @@ class PageConfig(google.protobuf.message.Message):
|
|
97
100
|
report_a_bug_url: builtins.str = ...,
|
98
101
|
hide_report_a_bug: builtins.bool = ...,
|
99
102
|
about_section_md: builtins.str = ...,
|
103
|
+
clear_about_md: builtins.bool = ...,
|
100
104
|
) -> None: ...
|
101
|
-
def ClearField(self, field_name: typing.Literal["about_section_md", b"about_section_md", "get_help_url", b"get_help_url", "hide_get_help", b"hide_get_help", "hide_report_a_bug", b"hide_report_a_bug", "report_a_bug_url", b"report_a_bug_url"]) -> None: ...
|
105
|
+
def ClearField(self, field_name: typing.Literal["about_section_md", b"about_section_md", "clear_about_md", b"clear_about_md", "get_help_url", b"get_help_url", "hide_get_help", b"hide_get_help", "hide_report_a_bug", b"hide_report_a_bug", "report_a_bug_url", b"report_a_bug_url"]) -> None: ...
|
102
106
|
|
103
107
|
TITLE_FIELD_NUMBER: builtins.int
|
104
108
|
FAVICON_FIELD_NUMBER: builtins.int
|
@@ -233,7 +233,7 @@ def connection_factory(
|
|
233
233
|
The type of connection to create. This can be one of the following:
|
234
234
|
|
235
235
|
- ``None`` (default): Streamlit will infer the connection type from
|
236
|
-
``name``. If the type is not
|
236
|
+
``name``. If the type is not inferable from ``name``, the type must
|
237
237
|
be specified in ``secrets.toml`` instead.
|
238
238
|
- ``"snowflake"``: Streamlit will initialize a connection with
|
239
239
|
|SnowflakeConnection|_.
|
@@ -267,7 +267,7 @@ def connection_factory(
|
|
267
267
|
**kwargs : any
|
268
268
|
Connection-specific keyword arguments that are passed to the
|
269
269
|
connection's ``._connect()`` method. ``**kwargs`` are typically
|
270
|
-
combined with (and take
|
270
|
+
combined with (and take precedence over) key-value pairs in
|
271
271
|
``secrets.toml``. To learn more, see the specific connection's
|
272
272
|
documentation.
|
273
273
|
|
@@ -370,7 +370,7 @@ def connection_factory(
|
|
370
370
|
|
371
371
|
if name.startswith(USE_ENV_PREFIX):
|
372
372
|
# It'd be nice to use str.removeprefix() here, but we won't be able to do that
|
373
|
-
# until the
|
373
|
+
# until the minimum Python version we support is 3.9.
|
374
374
|
envvar_name = name[len(USE_ENV_PREFIX) :]
|
375
375
|
name = os.environ[envvar_name]
|
376
376
|
|
@@ -33,7 +33,6 @@ from typing_extensions import TypeAlias
|
|
33
33
|
from streamlit.errors import (
|
34
34
|
NoSessionContext,
|
35
35
|
StreamlitAPIException,
|
36
|
-
StreamlitSetPageConfigMustBeFirstCommandError,
|
37
36
|
)
|
38
37
|
from streamlit.logger import get_logger
|
39
38
|
from streamlit.runtime.forward_msg_cache import (
|
@@ -98,7 +97,6 @@ class ScriptRunContext:
|
|
98
97
|
command_tracking_deactivated: bool = False
|
99
98
|
tracked_commands: list[Command] = field(default_factory=list)
|
100
99
|
tracked_commands_counter: Counter[str] = field(default_factory=collections.Counter)
|
101
|
-
_set_page_config_allowed: bool = True
|
102
100
|
_has_script_started: bool = False
|
103
101
|
widget_ids_this_run: set[str] = field(default_factory=set)
|
104
102
|
widget_user_keys_this_run: set[str] = field(default_factory=set)
|
@@ -159,8 +157,6 @@ class ScriptRunContext:
|
|
159
157
|
self.context_info = context_info
|
160
158
|
self.pages_manager.set_current_page_script_hash(page_script_hash)
|
161
159
|
self._active_script_hash = self.pages_manager.main_script_hash
|
162
|
-
# Permit set_page_config when the ScriptRunContext is reused on a rerun
|
163
|
-
self._set_page_config_allowed = True
|
164
160
|
self._has_script_started = False
|
165
161
|
self.command_tracking_deactivated: bool = False
|
166
162
|
self.tracked_commands = []
|
@@ -190,17 +186,6 @@ class ScriptRunContext:
|
|
190
186
|
|
191
187
|
def enqueue(self, msg: ForwardMsg) -> None:
|
192
188
|
"""Enqueue a ForwardMsg for this context's session."""
|
193
|
-
if msg.HasField("page_config_changed") and not self._set_page_config_allowed:
|
194
|
-
raise StreamlitSetPageConfigMustBeFirstCommandError()
|
195
|
-
|
196
|
-
# We want to disallow set_page config if one of the following occurs:
|
197
|
-
# - set_page_config was called on this message
|
198
|
-
# - The script has already started and a different st call occurs (a delta)
|
199
|
-
if msg.HasField("page_config_changed") or (
|
200
|
-
msg.HasField("delta") and self._has_script_started
|
201
|
-
):
|
202
|
-
self._set_page_config_allowed = False
|
203
|
-
|
204
189
|
msg.metadata.active_script_hash = self.active_script_hash
|
205
190
|
|
206
191
|
# We populate the hash and cacheable field for all messages.
|
@@ -159,7 +159,7 @@ class QueryParamsProxy(MutableMapping[str, str]):
|
|
159
159
|
Returns
|
160
160
|
-------
|
161
161
|
Dict[str,str]
|
162
|
-
A dictionary of the current query
|
162
|
+
A dictionary of the current query parameters in the app's URL.
|
163
163
|
"""
|
164
164
|
with get_session_state().query_params() as qp:
|
165
165
|
return qp.to_dict()
|