streamlit 1.48.1__py3-none-any.whl → 1.49.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/__init__.py +3 -10
- streamlit/commands/logo.py +4 -3
- streamlit/commands/navigation.py +1 -1
- streamlit/commands/page_config.py +4 -1
- streamlit/components/v1/custom_component.py +2 -2
- streamlit/config.py +82 -1
- streamlit/connections/snowflake_connection.py +3 -1
- streamlit/delta_generator.py +3 -0
- streamlit/elements/arrow.py +155 -70
- streamlit/elements/bokeh_chart.py +13 -3
- streamlit/elements/deck_gl_json_chart.py +0 -1
- streamlit/elements/dialog_decorator.py +7 -59
- streamlit/elements/form.py +10 -1
- streamlit/elements/graphviz_chart.py +57 -6
- streamlit/elements/heading.py +17 -16
- streamlit/elements/image.py +64 -37
- streamlit/elements/layouts.py +2 -2
- streamlit/elements/lib/built_in_chart_utils.py +2 -5
- streamlit/elements/lib/column_config_utils.py +18 -4
- streamlit/elements/lib/column_types.py +75 -30
- streamlit/elements/lib/dialog.py +3 -3
- streamlit/elements/lib/image_utils.py +19 -11
- streamlit/elements/lib/layout_utils.py +15 -2
- streamlit/elements/lib/utils.py +20 -41
- streamlit/elements/markdown.py +7 -6
- streamlit/elements/media.py +6 -13
- streamlit/elements/metric.py +78 -1
- streamlit/elements/pdf.py +192 -0
- streamlit/elements/plotly_chart.py +3 -2
- streamlit/elements/pyplot.py +53 -11
- streamlit/elements/toast.py +81 -5
- streamlit/elements/vega_charts.py +3 -8
- streamlit/elements/widgets/audio_input.py +0 -1
- streamlit/elements/widgets/button.py +0 -4
- streamlit/elements/widgets/button_group.py +5 -4
- streamlit/elements/widgets/camera_input.py +0 -1
- streamlit/elements/widgets/chat.py +11 -13
- streamlit/elements/widgets/checkbox.py +0 -1
- streamlit/elements/widgets/color_picker.py +0 -1
- streamlit/elements/widgets/data_editor.py +142 -62
- streamlit/elements/widgets/file_uploader.py +74 -37
- streamlit/elements/widgets/multiselect.py +0 -1
- streamlit/elements/widgets/number_input.py +0 -1
- streamlit/elements/widgets/radio.py +0 -1
- streamlit/elements/widgets/select_slider.py +0 -1
- streamlit/elements/widgets/selectbox.py +0 -1
- streamlit/elements/widgets/slider.py +0 -1
- streamlit/elements/widgets/text_widgets.py +0 -2
- streamlit/elements/widgets/time_widgets.py +0 -2
- streamlit/errors.py +11 -0
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/Arrow_pb2.py +14 -8
- streamlit/proto/Arrow_pb2.pyi +11 -3
- streamlit/proto/Block_pb2.py +16 -16
- streamlit/proto/Block_pb2.pyi +2 -0
- streamlit/proto/ChatInput_pb2.py +3 -3
- streamlit/proto/ChatInput_pb2.pyi +2 -0
- streamlit/proto/FileUploader_pb2.py +2 -2
- streamlit/proto/FileUploader_pb2.pyi +5 -1
- streamlit/proto/GraphVizChart_pb2.py +4 -2
- streamlit/proto/GraphVizChart_pb2.pyi +1 -1
- streamlit/proto/Image_pb2.py +4 -2
- streamlit/proto/Image_pb2.pyi +1 -10
- streamlit/proto/Metric_pb2.py +8 -6
- streamlit/proto/Metric_pb2.pyi +34 -10
- streamlit/proto/Toast_pb2.py +2 -2
- streamlit/proto/Toast_pb2.pyi +10 -1
- streamlit/runtime/caching/__init__.py +14 -2
- streamlit/runtime/caching/cache_data_api.py +0 -17
- streamlit/runtime/caching/cache_resource_api.py +0 -16
- streamlit/runtime/caching/cached_message_replay.py +8 -20
- streamlit/runtime/caching/hashing.py +31 -1
- streamlit/runtime/credentials.py +4 -4
- streamlit/runtime/fragment.py +0 -42
- streamlit/runtime/websocket_session_manager.py +1 -1
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +224 -252
- streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
- streamlit/static/static/css/index.COe1010n.css +1 -0
- streamlit/static/static/js/{ErrorOutline.esm.DjObtx4K.js → ErrorOutline.esm.u9XvzxL8.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Bz9nxNC5.js → FileDownload.esm.CaRyZ-b2.js} +1 -1
- streamlit/static/static/js/FileHelper.Dk2SwIi3.js +5 -0
- streamlit/static/static/js/FormClearHelper.l_UPPvkg.js +1 -0
- streamlit/static/static/js/{Hooks.DEoLCfOE.js → Hooks.BxrVEftw.js} +1 -1
- streamlit/static/static/js/InputInstructions.C254RU9X.js +1 -0
- streamlit/static/static/js/Particles.DkY6FDnc.js +1 -0
- streamlit/static/static/js/ProgressBar.BPtSM82n.js +2 -0
- streamlit/static/static/js/Toolbar.BO_3WBaS.js +1 -0
- streamlit/static/static/js/{base-input.BmvSaPd2.js → base-input.egUI4LjJ.js} +4 -4
- streamlit/static/static/js/{checkbox.Cgxgc0et.js → checkbox.ButpszcE.js} +2 -2
- streamlit/static/static/js/createSuper.DYJA5xa6.js +1 -0
- streamlit/static/static/js/data-grid-overlay-editor.C9gQLEnU.js +1 -0
- streamlit/static/static/js/{downloader.M6jQeNDf.js → downloader.B3TjsSPZ.js} +1 -1
- streamlit/static/static/js/es6.BYSNuG4D.js +2 -0
- streamlit/static/static/js/iframeResizer.contentWindow.CNPHJsF2.js +1 -0
- streamlit/static/static/js/index.0tDq1WXk.js +1 -0
- streamlit/static/static/js/index.BBnWuh07.js +976 -0
- streamlit/static/static/js/index.BDZorv41.js +1 -0
- streamlit/static/static/js/{index.CbdWnLqS.js → index.BH79B25f.js} +3 -3
- streamlit/static/static/js/index.BeTC4Yl-.js +197 -0
- streamlit/static/static/js/index.BnOd05Ko.js +2 -0
- streamlit/static/static/js/index.BoJaJReB.js +1 -0
- streamlit/static/static/js/index.Bp1Of6L8.js +1 -0
- streamlit/static/static/js/index.Bpe4-O2W.js +1 -0
- streamlit/static/static/js/index.BrD9sbpx.js +1 -0
- streamlit/static/static/js/index.C1qCS-sd.js +1 -0
- streamlit/static/static/js/index.C3EXAI-u.js +1 -0
- streamlit/static/static/js/index.C77g9sAQ.js +3 -0
- streamlit/static/static/js/{index.BXDq9dj4.js → index.CFePF7s4.js} +1 -1
- streamlit/static/static/js/index.CFjU0x00.js +1 -0
- streamlit/static/static/js/index.Ca3y4ztK.js +1 -0
- streamlit/static/static/js/{index.CgZDfhN4.js → index.Cb9gN2T2.js} +2 -2
- streamlit/static/static/js/{index.tsvTLdio.js → index.CbwuUwu4.js} +9 -9
- streamlit/static/static/js/index.CeXLlclc.js +1 -0
- streamlit/static/static/js/index.CfiZGqj3.js +3 -0
- streamlit/static/static/js/index.CjQnYKID.js +1 -0
- streamlit/static/static/js/index.Cl_966eE.js +3858 -0
- streamlit/static/static/js/{index.Cqa4gqqN.js → index.CqSRo6zQ.js} +1 -1
- streamlit/static/static/js/index.CuEFSQ-o.js +1 -0
- streamlit/static/static/js/index.D4jR1m1z.js +1 -0
- streamlit/static/static/js/index.DGcW849X.js +1 -0
- streamlit/static/static/js/index.DKb-BAE2.js +1 -0
- streamlit/static/static/js/index.DP1rDFP0.js +1 -0
- streamlit/static/static/js/{index.D1EayrNh.js → index.DStzYLqM.js} +2 -2
- streamlit/static/static/js/index.DVKQKDLu.js +1 -0
- streamlit/static/static/js/index.DWedOrkQ.js +1 -0
- streamlit/static/static/js/index.DYbRPmVF.js +1 -0
- streamlit/static/static/js/index.DgpIMUsr.js +1 -0
- streamlit/static/static/js/index.DtwkPJs5.js +5367 -0
- streamlit/static/static/js/{index.D1jHqUJq.js → index.MQLQLR5Z.js} +1 -1
- streamlit/static/static/js/index.uInpwWAP.js +1 -0
- streamlit/static/static/js/index.z992t-BQ.js +7 -0
- streamlit/static/static/js/{input.DZd6EQlV.js → input.CbP5ZuQ7.js} +2 -2
- streamlit/static/static/js/{memory.ptkfuI71.js → memory.BuacVo2L.js} +1 -1
- streamlit/static/static/js/number-overlay-editor.BZb9zRl_.js +9 -0
- streamlit/static/static/js/{possibleConstructorReturn.Bd4ImlQ9.js → possibleConstructorReturn.DSM84rOS.js} +1 -1
- streamlit/static/static/js/{sandbox.DsH8LuID.js → sandbox.C480llMG.js} +1 -1
- streamlit/static/static/js/{timepicker.QVekV78C.js → timepicker.BunxCVp7.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.BJvaP8gb.js → toConsumableArray.B4o8rEx1.js} +3 -3
- streamlit/static/static/js/uniqueId.tii0yosY.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.DB3vMS9V.js → useBasicWidgetState.Bnm4FD6K.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.CBkGkaRt.js → useTextInputAutoExpand.Dgtwc1m0.js} +2 -2
- streamlit/static/static/js/useUpdateUiValue.DjXdMFGw.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.0cy2pVf5.js +1 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
- streamlit/user_info.py +3 -1
- streamlit/web/server/browser_websocket_handler.py +15 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/METADATA +4 -2
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/RECORD +153 -156
- streamlit/static/static/css/index.CQt5TjGB.css +0 -1
- streamlit/static/static/js/FileHelper.BrQvUXVD.js +0 -5
- streamlit/static/static/js/FormClearHelper.DF4gFAOO.js +0 -1
- streamlit/static/static/js/InputInstructions.D8zoMog9.js +0 -1
- streamlit/static/static/js/Particles.CCFySwdL.js +0 -1
- streamlit/static/static/js/ProgressBar.COK9j1l0.js +0 -2
- streamlit/static/static/js/Toolbar.Dt4jIKlY.js +0 -1
- streamlit/static/static/js/createSuper.siQeagI2.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.Ct51iCb_.js +0 -1
- streamlit/static/static/js/es6.CMaUdEZ5.js +0 -2
- streamlit/static/static/js/iframeResizer.contentWindow.C33BryyP.js +0 -1
- streamlit/static/static/js/index.8GJD0eeD.js +0 -1
- streamlit/static/static/js/index.8QEYHMQD.js +0 -1
- streamlit/static/static/js/index.Ay41Wnu9.js +0 -1
- streamlit/static/static/js/index.BLiKiJ7_.js +0 -1
- streamlit/static/static/js/index.BT78cJmU.js +0 -1
- streamlit/static/static/js/index.BdGvnhlM.js +0 -1
- streamlit/static/static/js/index.BfasrT0d.js +0 -1
- streamlit/static/static/js/index.CCdtFMFG.js +0 -1
- streamlit/static/static/js/index.CFRGZDz1.js +0 -1
- streamlit/static/static/js/index.CFSFYiPA.js +0 -5366
- streamlit/static/static/js/index.CeiIiXap.js +0 -1
- streamlit/static/static/js/index.CzX2xpyc.js +0 -1
- streamlit/static/static/js/index.D1ErX5go.js +0 -2
- streamlit/static/static/js/index.D5gweoL5.js +0 -7
- streamlit/static/static/js/index.DByVKZgq.js +0 -1
- streamlit/static/static/js/index.DEND45D1.js +0 -3
- streamlit/static/static/js/index.DKN5MVff.js +0 -781
- streamlit/static/static/js/index.DfoxW1gP.js +0 -3855
- streamlit/static/static/js/index.Dtf1Ac0x.js +0 -1
- streamlit/static/static/js/index.DxrLhpeO.js +0 -1
- streamlit/static/static/js/index.J7o-_HIh.js +0 -1
- streamlit/static/static/js/index.LU8juINp.js +0 -197
- streamlit/static/static/js/index.L_N2iylt.js +0 -1
- streamlit/static/static/js/index.PZUX2kRz.js +0 -3
- streamlit/static/static/js/index.ROjU6K0k.js +0 -1
- streamlit/static/static/js/index.WSNLkF94.js +0 -1
- streamlit/static/static/js/index.X5W3gJLn.js +0 -1
- streamlit/static/static/js/index.k9LYqfSL.js +0 -1
- streamlit/static/static/js/index.pnHtHv_c.js +0 -203
- streamlit/static/static/js/index.tPUXqsfW.js +0 -1
- streamlit/static/static/js/mergeWith.GRNk8iwv.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DXS2qb1U.js +0 -9
- streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
- streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
- streamlit/static/static/js/uniqueId.D_5M8Dgf.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.C7ZKpLQK.js +0 -1
- streamlit/static/static/js/value.CgPGBV_l.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.C-gXt0Rl.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
- {streamlit-1.48.1.data → streamlit-1.49.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/WHEEL +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.0.dist-info}/top_level.txt +0 -0
|
@@ -17,13 +17,12 @@ from __future__ import annotations
|
|
|
17
17
|
import contextlib
|
|
18
18
|
import threading
|
|
19
19
|
from dataclasses import dataclass
|
|
20
|
-
from typing import TYPE_CHECKING, Any, Callable, Generic,
|
|
20
|
+
from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar, Union
|
|
21
21
|
|
|
22
22
|
from typing_extensions import ParamSpec
|
|
23
23
|
|
|
24
24
|
import streamlit as st
|
|
25
25
|
from streamlit import runtime, util
|
|
26
|
-
from streamlit.deprecation_util import show_deprecation_warning
|
|
27
26
|
from streamlit.runtime.caching.cache_errors import CacheReplayClosureError
|
|
28
27
|
from streamlit.runtime.scriptrunner_utils.script_run_context import (
|
|
29
28
|
in_cached_function,
|
|
@@ -35,6 +34,7 @@ if TYPE_CHECKING:
|
|
|
35
34
|
from google.protobuf.message import Message
|
|
36
35
|
|
|
37
36
|
from streamlit.delta_generator import DeltaGenerator
|
|
37
|
+
from streamlit.elements.lib.layout_utils import LayoutConfig
|
|
38
38
|
from streamlit.proto.Block_pb2 import Block
|
|
39
39
|
from streamlit.runtime.caching.cache_type import CacheType
|
|
40
40
|
|
|
@@ -59,6 +59,7 @@ class ElementMsgData:
|
|
|
59
59
|
id_of_dg_called_on: str
|
|
60
60
|
returned_dgs_id: str
|
|
61
61
|
media_data: list[MediaMsgData] | None = None
|
|
62
|
+
layout_config: LayoutConfig | None = None
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
@dataclass(frozen=True)
|
|
@@ -168,6 +169,7 @@ class CachedMessageReplayContext(threading.local):
|
|
|
168
169
|
invoked_dg_id: str,
|
|
169
170
|
used_dg_id: str,
|
|
170
171
|
returned_dg_id: str,
|
|
172
|
+
layout_config: LayoutConfig | None = None,
|
|
171
173
|
) -> None:
|
|
172
174
|
"""Record the element protobuf as having been produced during any currently
|
|
173
175
|
executing cached functions, so they can be replayed any time the function's
|
|
@@ -187,6 +189,7 @@ class CachedMessageReplayContext(threading.local):
|
|
|
187
189
|
id_to_save,
|
|
188
190
|
returned_dg_id,
|
|
189
191
|
media_data,
|
|
192
|
+
layout_config,
|
|
190
193
|
)
|
|
191
194
|
for msgs in self._cached_message_stack:
|
|
192
195
|
msgs.append(element_msg_data)
|
|
@@ -275,7 +278,9 @@ def replay_cached_messages(
|
|
|
275
278
|
data.media, data.mimetype, data.media_id
|
|
276
279
|
)
|
|
277
280
|
dg = returned_dgs[msg.id_of_dg_called_on]
|
|
278
|
-
maybe_dg = dg._enqueue(
|
|
281
|
+
maybe_dg = dg._enqueue(
|
|
282
|
+
msg.delta_type, msg.message, layout_config=msg.layout_config
|
|
283
|
+
)
|
|
279
284
|
if isinstance(maybe_dg, DeltaGenerator):
|
|
280
285
|
returned_dgs[msg.returned_dgs_id] = maybe_dg
|
|
281
286
|
elif isinstance(msg, BlockMsgData):
|
|
@@ -284,20 +289,3 @@ def replay_cached_messages(
|
|
|
284
289
|
returned_dgs[msg.returned_dgs_id] = new_dg
|
|
285
290
|
except KeyError as ex:
|
|
286
291
|
raise CacheReplayClosureError(cache_type, cached_func) from ex
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
def show_widget_replay_deprecation(
|
|
290
|
-
decorator: Literal["cache_data", "cache_resource"],
|
|
291
|
-
) -> None:
|
|
292
|
-
show_deprecation_warning(
|
|
293
|
-
"The cached widget replay feature was removed in 1.38. The "
|
|
294
|
-
"`experimental_allow_widgets` parameter will also be removed "
|
|
295
|
-
"in a future release. Please remove the `experimental_allow_widgets` parameter "
|
|
296
|
-
f"from the `@st.{decorator}` decorator and move all widget commands outside of "
|
|
297
|
-
"cached functions.\n\nTo speed up your app, we recommend moving your widgets "
|
|
298
|
-
"into fragments. Find out more about fragments in "
|
|
299
|
-
"[our docs](https://docs.streamlit.io/develop/api-reference/execution-flow/st.fragment). "
|
|
300
|
-
"\n\nIf you have a specific use-case that requires the "
|
|
301
|
-
"`experimental_allow_widgets` functionality, please tell us via an "
|
|
302
|
-
"[issue on Github](https://github.com/streamlit/streamlit/issues)."
|
|
303
|
-
)
|
|
@@ -412,6 +412,7 @@ class _CacheFuncHasher:
|
|
|
412
412
|
|
|
413
413
|
if not isinstance(obj, type) and dataclasses.is_dataclass(obj):
|
|
414
414
|
return self.to_bytes(dataclasses.asdict(obj))
|
|
415
|
+
|
|
415
416
|
if isinstance(obj, Enum):
|
|
416
417
|
return str(obj).encode()
|
|
417
418
|
|
|
@@ -446,12 +447,14 @@ class _CacheFuncHasher:
|
|
|
446
447
|
|
|
447
448
|
if len(df_obj) >= _PANDAS_ROWS_LARGE:
|
|
448
449
|
df_obj = df_obj.sample(n=_PANDAS_SAMPLE_SIZE, random_state=0)
|
|
450
|
+
|
|
449
451
|
try:
|
|
450
452
|
column_hash_bytes = self.to_bytes(hash_pandas_object(df_obj.dtypes))
|
|
451
453
|
self.update(h, column_hash_bytes)
|
|
452
454
|
values_hash_bytes = self.to_bytes(hash_pandas_object(df_obj))
|
|
453
455
|
self.update(h, values_hash_bytes)
|
|
454
456
|
return h.digest()
|
|
457
|
+
|
|
455
458
|
except TypeError:
|
|
456
459
|
_LOGGER.warning(
|
|
457
460
|
"Pandas DataFrame hash failed. Falling back to pickling the object.",
|
|
@@ -475,6 +478,7 @@ class _CacheFuncHasher:
|
|
|
475
478
|
try:
|
|
476
479
|
self.update(h, obj.hash(seed=0).to_arrow().to_string().encode())
|
|
477
480
|
return h.digest()
|
|
481
|
+
|
|
478
482
|
except TypeError:
|
|
479
483
|
_LOGGER.warning(
|
|
480
484
|
"Polars Series hash failed. Falling back to pickling the object.",
|
|
@@ -484,6 +488,7 @@ class _CacheFuncHasher:
|
|
|
484
488
|
# Use pickle if polars cannot hash the object for example if
|
|
485
489
|
# it contains unhashable objects.
|
|
486
490
|
return b"%s" % pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
|
|
491
|
+
|
|
487
492
|
elif type_util.is_type(obj, "polars.dataframe.frame.DataFrame"):
|
|
488
493
|
import polars as pl # noqa: TC002
|
|
489
494
|
|
|
@@ -503,6 +508,7 @@ class _CacheFuncHasher:
|
|
|
503
508
|
|
|
504
509
|
self.update(h, values_hash_bytes)
|
|
505
510
|
return h.digest()
|
|
511
|
+
|
|
506
512
|
except TypeError:
|
|
507
513
|
_LOGGER.warning(
|
|
508
514
|
"Polars DataFrame hash failed. Falling back to pickling the object.",
|
|
@@ -512,6 +518,7 @@ class _CacheFuncHasher:
|
|
|
512
518
|
# Use pickle if polars cannot hash the object for example if
|
|
513
519
|
# it contains unhashable objects.
|
|
514
520
|
return b"%s" % pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
|
|
521
|
+
|
|
515
522
|
elif type_util.is_type(obj, "numpy.ndarray"):
|
|
516
523
|
np_obj: npt.NDArray[Any] = cast("npt.NDArray[Any]", obj)
|
|
517
524
|
self.update(h, np_obj.shape)
|
|
@@ -525,6 +532,7 @@ class _CacheFuncHasher:
|
|
|
525
532
|
|
|
526
533
|
self.update(h, np_obj.tobytes())
|
|
527
534
|
return h.digest()
|
|
535
|
+
|
|
528
536
|
elif type_util.is_type(obj, "PIL.Image.Image"):
|
|
529
537
|
import numpy as np
|
|
530
538
|
|
|
@@ -562,7 +570,8 @@ class _CacheFuncHasher:
|
|
|
562
570
|
# on-disk and in-memory StringIO/BytesIO file representations.
|
|
563
571
|
# That means that this condition must come *before* the next
|
|
564
572
|
# condition, which just checks for StringIO/BytesIO.
|
|
565
|
-
|
|
573
|
+
# Just to appease MyPy.
|
|
574
|
+
obj_name = getattr(obj, "name", "wonthappen")
|
|
566
575
|
self.update(h, obj_name)
|
|
567
576
|
self.update(h, os.path.getmtime(obj_name))
|
|
568
577
|
self.update(h, obj.tell())
|
|
@@ -610,6 +619,27 @@ class _CacheFuncHasher:
|
|
|
610
619
|
self.update(h, obj.keywords)
|
|
611
620
|
return h.digest()
|
|
612
621
|
|
|
622
|
+
elif type_util.is_pydantic_model(obj):
|
|
623
|
+
try:
|
|
624
|
+
# We have a choice to use pickle.dumps(), obj.model_dump(), or
|
|
625
|
+
# obj.model_dump_json(). The advantage of pickle and JSON is that
|
|
626
|
+
# we'd be treating Pydantic objects opaquely, so there are no surprises
|
|
627
|
+
# for Pydantic users. And the reason to choose JSON over pickle is
|
|
628
|
+
# that JSON is faster, weirdly enough.
|
|
629
|
+
any_obj = cast("Any", obj)
|
|
630
|
+
if hasattr(any_obj, "model_dump_json"):
|
|
631
|
+
# Pydantic v2
|
|
632
|
+
json_data = any_obj.model_dump_json()
|
|
633
|
+
else:
|
|
634
|
+
# Pydantic v1
|
|
635
|
+
json_data = any_obj.json()
|
|
636
|
+
self.update(h, json_data)
|
|
637
|
+
return h.digest()
|
|
638
|
+
except Exception as ex:
|
|
639
|
+
raise UnhashableTypeError("""
|
|
640
|
+
Pydantic object contains unhashable members, such as functions.
|
|
641
|
+
""") from ex
|
|
642
|
+
|
|
613
643
|
else:
|
|
614
644
|
# As a last resort, hash the output of the object's __reduce__ method
|
|
615
645
|
try:
|
streamlit/runtime/credentials.py
CHANGED
|
@@ -247,8 +247,6 @@ class Credentials:
|
|
|
247
247
|
"`streamlit activate reset` then `streamlit activate`"
|
|
248
248
|
)
|
|
249
249
|
else:
|
|
250
|
-
if not config.get_option("server.showEmailPrompt"):
|
|
251
|
-
return
|
|
252
250
|
activated = False
|
|
253
251
|
|
|
254
252
|
while not activated:
|
|
@@ -345,9 +343,11 @@ def check_credentials() -> None:
|
|
|
345
343
|
check, since credential would be automatically set to an empty string.
|
|
346
344
|
|
|
347
345
|
"""
|
|
348
|
-
from streamlit import config
|
|
349
346
|
|
|
350
|
-
if not _check_credential_file_exists() and
|
|
347
|
+
if not _check_credential_file_exists() and (
|
|
348
|
+
config.get_option("server.headless")
|
|
349
|
+
or not config.get_option("server.showEmailPrompt")
|
|
350
|
+
):
|
|
351
351
|
if not config.is_manually_set("browser.gatherUsageStats"):
|
|
352
352
|
# If not manually defined, show short message about usage stats gathering.
|
|
353
353
|
cli_util.print_to_cli(_TELEMETRY_HEADLESS_TEXT)
|
streamlit/runtime/fragment.py
CHANGED
|
@@ -21,10 +21,6 @@ from copy import deepcopy
|
|
|
21
21
|
from functools import wraps
|
|
22
22
|
from typing import TYPE_CHECKING, Any, Callable, Protocol, TypeVar, overload
|
|
23
23
|
|
|
24
|
-
from streamlit.deprecation_util import (
|
|
25
|
-
make_deprecated_name_warning,
|
|
26
|
-
show_deprecation_warning,
|
|
27
|
-
)
|
|
28
24
|
from streamlit.error_util import handle_uncaught_app_exception
|
|
29
25
|
from streamlit.errors import FragmentHandledException, FragmentStorageKeyError
|
|
30
26
|
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
|
|
@@ -138,7 +134,6 @@ def _fragment(
|
|
|
138
134
|
*,
|
|
139
135
|
run_every: int | float | timedelta | str | None = None,
|
|
140
136
|
additional_hash_info: str = "",
|
|
141
|
-
should_show_deprecation_warning: bool = False,
|
|
142
137
|
) -> Callable[[F], F] | F:
|
|
143
138
|
"""Contains the actual fragment logic.
|
|
144
139
|
|
|
@@ -179,15 +174,6 @@ def _fragment(
|
|
|
179
174
|
def wrapped_fragment() -> Any:
|
|
180
175
|
import streamlit as st
|
|
181
176
|
|
|
182
|
-
if should_show_deprecation_warning:
|
|
183
|
-
show_deprecation_warning(
|
|
184
|
-
make_deprecated_name_warning(
|
|
185
|
-
"experimental_fragment",
|
|
186
|
-
"fragment",
|
|
187
|
-
"2025-01-01",
|
|
188
|
-
)
|
|
189
|
-
)
|
|
190
|
-
|
|
191
177
|
# NOTE: We need to call get_script_run_ctx here again and can't just use the
|
|
192
178
|
# value of ctx from above captured by the closure because subsequent
|
|
193
179
|
# fragment runs will generally run in a new script run, thus we'll have a
|
|
@@ -449,31 +435,3 @@ def fragment(
|
|
|
449
435
|
|
|
450
436
|
"""
|
|
451
437
|
return _fragment(func, run_every=run_every)
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
@overload
|
|
455
|
-
def experimental_fragment(
|
|
456
|
-
func: F,
|
|
457
|
-
*,
|
|
458
|
-
run_every: int | float | timedelta | str | None = None,
|
|
459
|
-
) -> F: ...
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
# Support being able to pass parameters to this decorator (that is, being able to write
|
|
463
|
-
# `@fragment(run_every=5.0)`).
|
|
464
|
-
@overload
|
|
465
|
-
def experimental_fragment(
|
|
466
|
-
func: None = None,
|
|
467
|
-
*,
|
|
468
|
-
run_every: int | float | timedelta | str | None = None,
|
|
469
|
-
) -> Callable[[F], F]: ...
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
@gather_metrics("experimental_fragment")
|
|
473
|
-
def experimental_fragment(
|
|
474
|
-
func: F | None = None,
|
|
475
|
-
*,
|
|
476
|
-
run_every: int | float | timedelta | str | None = None,
|
|
477
|
-
) -> Callable[[F], F] | F:
|
|
478
|
-
"""Deprecated alias for @st.fragment. See the docstring for the decorator's new name."""
|
|
479
|
-
return _fragment(func, run_every=run_every, should_show_deprecation_warning=True)
|
|
@@ -85,7 +85,7 @@ class WebsocketSessionManager(SessionManager):
|
|
|
85
85
|
and self._session_storage.get(existing_session_id)
|
|
86
86
|
)
|
|
87
87
|
|
|
88
|
-
if session_info:
|
|
88
|
+
if isinstance(session_info, SessionInfo):
|
|
89
89
|
existing_session = session_info.session
|
|
90
90
|
existing_session.register_file_watchers()
|
|
91
91
|
|
streamlit/static/index.html
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
<script>
|
|
38
38
|
window.prerenderReady = false
|
|
39
39
|
</script>
|
|
40
|
-
<script type="module" crossorigin src="./static/js/index.
|
|
41
|
-
<link rel="stylesheet" crossorigin href="./static/css/index.
|
|
40
|
+
<script type="module" crossorigin src="./static/js/index.BBnWuh07.js"></script>
|
|
41
|
+
<link rel="stylesheet" crossorigin href="./static/css/index.C8X8rNzw.css">
|
|
42
42
|
</head>
|
|
43
43
|
<body>
|
|
44
44
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|