streamlit-nightly 1.44.1.dev20250327__py3-none-any.whl → 1.44.2.dev20250403__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 +3 -0
- streamlit/commands/page_config.py +1 -1
- streamlit/config.py +0 -26
- streamlit/elements/write.py +8 -0
- streamlit/proto/ClientState_pb2.py +2 -2
- streamlit/proto/ClientState_pb2.pyi +11 -1
- streamlit/proto/ForwardMsg_pb2.pyi +4 -7
- streamlit/runtime/app_session.py +5 -4
- streamlit/runtime/context.py +14 -0
- streamlit/runtime/forward_msg_cache.py +35 -230
- streamlit/runtime/forward_msg_queue.py +41 -23
- streamlit/runtime/runtime.py +2 -60
- streamlit/runtime/runtime_util.py +15 -14
- streamlit/runtime/scriptrunner/script_runner.py +9 -1
- streamlit/runtime/scriptrunner_utils/script_requests.py +3 -0
- streamlit/runtime/scriptrunner_utils/script_run_context.py +25 -3
- streamlit/runtime/session_manager.py +5 -6
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.jX-9l2Ep.js → FileDownload.esm.B3kD8CdX.js} +1 -1
- streamlit/static/static/js/{FileHelper.aCeQQwv9.js → FileHelper.CZMZF2jC.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CWUgHOqb.js → FormClearHelper.BjztopwY.js} +1 -1
- streamlit/static/static/js/{Hooks.z6bpnOa4.js → Hooks.B2w-p718.js} +1 -1
- streamlit/static/static/js/{InputInstructions.CxNXqmaa.js → InputInstructions.CuF13wx9.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DeJx_v03.js → ProgressBar.BbIgSlVa.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.BzVEnQEP.js → RenderInPortalIfExists.yENMDBLa.js} +1 -1
- streamlit/static/static/js/{Toolbar.Buaxb3gQ.js → Toolbar.DJ7G2mIO.js} +1 -1
- streamlit/static/static/js/{base-input.B02pchZb.js → base-input.DIlOlDo4.js} +1 -1
- streamlit/static/static/js/{checkbox.BNevNWhL.js → checkbox.BQjuWiaH.js} +1 -1
- streamlit/static/static/js/{createSuper.HF1JI-bK.js → createSuper.DsCxV-v8.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DHpEpsQ_.js → data-grid-overlay-editor.D4K6HcP0.js} +1 -1
- streamlit/static/static/js/{downloader.B32k91dq.js → downloader.Lq-fJZlW.js} +1 -1
- streamlit/static/static/js/{es6.j4L3xv_m.js → es6.BE-9QZmp.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.DQOV--zq.js → iframeResizer.contentWindow.CVN6zezL.js} +1 -1
- streamlit/static/static/js/{index.BTG2J5Pk.js → index.0HztFnVa.js} +1 -1
- streamlit/static/static/js/{index.ChvqDLgw.js → index.5819-zgt.js} +1 -1
- streamlit/static/static/js/{index.DaJw5fna.js → index.B-KH-iJ1.js} +1 -1
- streamlit/static/static/js/{index.1tdxODWC.js → index.B0f5Sqj9.js} +1 -1
- streamlit/static/static/js/{index.CKYXxi_d.js → index.B1gZ98Ih.js} +1 -1
- streamlit/static/static/js/{index.DTDyF8nE.js → index.B2XNA40L.js} +1 -1
- streamlit/static/static/js/index.B7RGQCfs.js +1 -0
- streamlit/static/static/js/{index.CTwaWONb.js → index.BB3TfMGO.js} +1 -1
- streamlit/static/static/js/{index.DsRxnb2z.js → index.BDovkxCx.js} +1 -1
- streamlit/static/static/js/{index.CpDe9l-f.js → index.BMWHViZF.js} +1 -1
- streamlit/static/static/js/{index.R8Go3XlF.js → index.BM_qS2Z6.js} +1 -1
- streamlit/static/static/js/{index.BT-PT2u0.js → index.BYWoEwfP.js} +1 -1
- streamlit/static/static/js/{index.BDIF1v3E.js → index.Bs_nrSu4.js} +1 -1
- streamlit/static/static/js/{index.Cq_L2WtW.js → index.BwOqVS7B.js} +1 -1
- streamlit/static/static/js/{index.CExICAHy.js → index.BysxR7v7.js} +1 -1
- streamlit/static/static/js/{index.CTgHTp02.js → index.C6uLzsGN.js} +1 -1
- streamlit/static/static/js/{index.DbqewZ6W.js → index.CDspsVkR.js} +1 -1
- streamlit/static/static/js/{index.C1B9TyzK.js → index.CE-qPTwY.js} +1 -1
- streamlit/static/static/js/{index.BnYJb__c.js → index.CFnDv8Ab.js} +1 -1
- streamlit/static/static/js/{index.CcMFXZBL.js → index.CQYXOt0H.js} +1 -1
- streamlit/static/static/js/{index.B2-yUxP6.js → index.CU_SzKbN.js} +1 -1
- streamlit/static/static/js/{index.C-GJaT09.js → index.CWOluRqa.js} +1 -1
- streamlit/static/static/js/{index.V3D0L00K.js → index.CbDE21BB.js} +1 -1
- streamlit/static/static/js/{index.DNURUtUa.js → index.ChX_XN9v.js} +1 -1
- streamlit/static/static/js/index.Cn3q8ZVn.js +2 -0
- streamlit/static/static/js/{index.DBEif7dq.js → index.CzzEyXiC.js} +3 -3
- streamlit/static/static/js/{index.B28jf8c_.js → index.DIxzN4oM.js} +51 -51
- streamlit/static/static/js/index.DSsFpl6V.js +3 -0
- streamlit/static/static/js/{index.ClfebD_T.js → index.DmZP-_fu.js} +1 -1
- streamlit/static/static/js/{index.Nb8G9oM-.js → index.Dw1CjpSH.js} +1 -1
- streamlit/static/static/js/index.IydYP9PK.js +1 -0
- streamlit/static/static/js/{index.Uid-bSyh.js → index.TnCoD1oP.js} +1 -1
- streamlit/static/static/js/{index.BRDvEQpe.js → index.WW1pXc2g.js} +1 -1
- streamlit/static/static/js/{index.qkhdJyyt.js → index.eNGIEtgK.js} +7 -7
- streamlit/static/static/js/{index.BBHrAwbG.js → index.m_aVBz2b.js} +1 -1
- streamlit/static/static/js/{index.BeuGcxG8.js → index.rPwcP7b8.js} +1 -1
- streamlit/static/static/js/{index.m0rRkw04.js → index.u-RVYMyk.js} +1 -1
- streamlit/static/static/js/{input.DogdK8Cg.js → input.CVw5KI0x.js} +2 -2
- streamlit/static/static/js/{memory.B_1d0kyG.js → memory.CnrS2dOM.js} +1 -1
- streamlit/static/static/js/{mergeWith.9h0p6sC_.js → mergeWith.DUDC520V.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.yRe6Yodu.js → number-overlay-editor.Ccw3Yu2p.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.C73_6grg.js → possibleConstructorReturn.wVJHSwqv.js} +1 -1
- streamlit/static/static/js/{sandbox.2u3nOS5d.js → sandbox.CpAztCDM.js} +1 -1
- streamlit/static/static/js/{textarea.DFCEFjUj.js → textarea.CFjEVTUg.js} +2 -2
- streamlit/static/static/js/{timepicker.GuNna1EN.js → timepicker.DMKQZM-V.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DARzcvE5.js → toConsumableArray.KVlxKIgo.js} +1 -1
- streamlit/static/static/js/{uniqueId.fceb1ayN.js → uniqueId.kOCufBPt.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.D6255-xX.js → useBasicWidgetState.Bs_D3hOD.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.BjnOKne4.js → useOnInputChange.BH-JyYhR.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.B7h9p1kI.js → withFullScreenWrapper.vQYihw6n.js} +1 -1
- streamlit/web/server/routes.py +1 -59
- streamlit/web/server/server.py +7 -8
- {streamlit_nightly-1.44.1.dev20250327.dist-info → streamlit_nightly-1.44.2.dev20250403.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.44.1.dev20250327.dist-info → streamlit_nightly-1.44.2.dev20250403.dist-info}/RECORD +91 -91
- streamlit/static/static/js/index.BUz0sS-V.js +0 -1
- streamlit/static/static/js/index.CDMGlkYx.js +0 -3
- streamlit/static/static/js/index.CPMy5pwd.js +0 -1
- streamlit/static/static/js/index.DfvKnm4Q.js +0 -2
- {streamlit_nightly-1.44.1.dev20250327.data → streamlit_nightly-1.44.2.dev20250403.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.44.1.dev20250327.dist-info → streamlit_nightly-1.44.2.dev20250403.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.44.1.dev20250327.dist-info → streamlit_nightly-1.44.2.dev20250403.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.44.1.dev20250327.dist-info → streamlit_nightly-1.44.2.dev20250403.dist-info}/top_level.txt +0 -0
streamlit/runtime/runtime.py
CHANGED
@@ -21,7 +21,6 @@ from dataclasses import dataclass, field
|
|
21
21
|
from enum import Enum
|
22
22
|
from typing import TYPE_CHECKING, Final, NamedTuple
|
23
23
|
|
24
|
-
from streamlit import config
|
25
24
|
from streamlit.components.lib.local_component_registry import LocalComponentRegistry
|
26
25
|
from streamlit.logger import get_logger
|
27
26
|
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
|
@@ -33,14 +32,8 @@ from streamlit.runtime.caching import (
|
|
33
32
|
from streamlit.runtime.caching.storage.local_disk_cache_storage import (
|
34
33
|
LocalDiskCacheStorageManager,
|
35
34
|
)
|
36
|
-
from streamlit.runtime.forward_msg_cache import (
|
37
|
-
ForwardMsgCache,
|
38
|
-
create_reference_msg,
|
39
|
-
populate_hash_if_needed,
|
40
|
-
)
|
41
35
|
from streamlit.runtime.media_file_manager import MediaFileManager
|
42
36
|
from streamlit.runtime.memory_session_storage import MemorySessionStorage
|
43
|
-
from streamlit.runtime.runtime_util import is_cacheable_msg
|
44
37
|
from streamlit.runtime.script_data import ScriptData
|
45
38
|
from streamlit.runtime.scriptrunner.script_cache import ScriptCache
|
46
39
|
from streamlit.runtime.session_manager import (
|
@@ -203,7 +196,6 @@ class Runtime:
|
|
203
196
|
|
204
197
|
# Initialize managers
|
205
198
|
self._component_registry = config.component_registry
|
206
|
-
self._message_cache = ForwardMsgCache()
|
207
199
|
self._uploaded_file_mgr = config.uploaded_file_manager
|
208
200
|
self._media_file_mgr = MediaFileManager(storage=config.media_file_storage)
|
209
201
|
self._cache_storage_manager = config.cache_storage_manager
|
@@ -219,7 +211,6 @@ class Runtime:
|
|
219
211
|
self._stats_mgr = StatsManager()
|
220
212
|
self._stats_mgr.register_provider(get_data_cache_stats_provider())
|
221
213
|
self._stats_mgr.register_provider(get_resource_cache_stats_provider())
|
222
|
-
self._stats_mgr.register_provider(self._message_cache)
|
223
214
|
self._stats_mgr.register_provider(self._uploaded_file_mgr)
|
224
215
|
self._stats_mgr.register_provider(SessionStateStatProvider(self._session_mgr))
|
225
216
|
|
@@ -231,10 +222,6 @@ class Runtime:
|
|
231
222
|
def component_registry(self) -> BaseComponentRegistry:
|
232
223
|
return self._component_registry
|
233
224
|
|
234
|
-
@property
|
235
|
-
def message_cache(self) -> ForwardMsgCache:
|
236
|
-
return self._message_cache
|
237
|
-
|
238
225
|
@property
|
239
226
|
def uploaded_file_mgr(self) -> UploadedFileManager:
|
240
227
|
return self._uploaded_file_mgr
|
@@ -449,7 +436,6 @@ class Runtime:
|
|
449
436
|
"""
|
450
437
|
session_info = self._session_mgr.get_session_info(session_id)
|
451
438
|
if session_info:
|
452
|
-
self._message_cache.remove_refs_for_session(session_info.session)
|
453
439
|
self._session_mgr.close_session(session_id)
|
454
440
|
self._on_session_disconnected()
|
455
441
|
|
@@ -474,14 +460,6 @@ class Runtime:
|
|
474
460
|
"""
|
475
461
|
session_info = self._session_mgr.get_active_session_info(session_id)
|
476
462
|
if session_info:
|
477
|
-
# NOTE: Ideally, we'd like to keep ForwardMsgCache refs for a session around
|
478
|
-
# when a session is disconnected (and defer their cleanup until the session
|
479
|
-
# is garbage collected), but this would be difficult to do as the
|
480
|
-
# ForwardMsgCache is not thread safe, and we have no guarantee that the
|
481
|
-
# garbage collector will only run on the eventloop thread. Because of this,
|
482
|
-
# we clean up refs now and accept the risk that we're deleting cache entries
|
483
|
-
# that will be useful once the browser tab reconnects.
|
484
|
-
self._message_cache.remove_refs_for_session(session_info.session)
|
485
463
|
self._session_mgr.disconnect_session(session_id)
|
486
464
|
self._on_session_disconnected()
|
487
465
|
|
@@ -698,7 +676,6 @@ Please report this bug at https://github.com/streamlit/streamlit/issues.
|
|
698
676
|
|
699
677
|
def _send_message(self, session_info: ActiveSessionInfo, msg: ForwardMsg) -> None:
|
700
678
|
"""Send a message to a client.
|
701
|
-
|
702
679
|
If the client is likely to have already cached the message, we may
|
703
680
|
instead send a "reference" message that contains only the hash of the
|
704
681
|
message.
|
@@ -714,51 +691,16 @@ Please report this bug at https://github.com/streamlit/streamlit/issues.
|
|
714
691
|
-----
|
715
692
|
Threading: UNSAFE. Must be called on the eventloop thread.
|
716
693
|
"""
|
717
|
-
msg.metadata.cacheable = is_cacheable_msg(msg)
|
718
|
-
msg_to_send = msg
|
719
|
-
if msg.metadata.cacheable:
|
720
|
-
populate_hash_if_needed(msg)
|
721
|
-
|
722
|
-
if self._message_cache.has_message_reference(
|
723
|
-
msg, session_info.session, session_info.script_run_count
|
724
|
-
):
|
725
|
-
# This session has probably cached this message. Send
|
726
|
-
# a reference instead.
|
727
|
-
_LOGGER.debug("Sending cached message ref (hash=%s)", msg.hash)
|
728
|
-
msg_to_send = create_reference_msg(msg)
|
729
|
-
|
730
|
-
# Cache the message so it can be referenced in the future.
|
731
|
-
# If the message is already cached, this will reset its
|
732
|
-
# age.
|
733
|
-
_LOGGER.debug("Caching message (hash=%s)", msg.hash)
|
734
|
-
self._message_cache.add_message(
|
735
|
-
msg, session_info.session, session_info.script_run_count
|
736
|
-
)
|
737
694
|
|
738
695
|
# If this was a `script_finished` message, we increment the
|
739
|
-
# script_run_count for this session
|
696
|
+
# script_run_count for this session
|
740
697
|
if msg.WhichOneof("type") == "script_finished" and (
|
741
698
|
msg.script_finished == ForwardMsg.FINISHED_SUCCESSFULLY
|
742
|
-
or (
|
743
|
-
config.get_option(
|
744
|
-
"global.includeFragmentRunsInForwardMessageCacheCount"
|
745
|
-
)
|
746
|
-
and msg.script_finished == ForwardMsg.FINISHED_FRAGMENT_RUN_SUCCESSFULLY
|
747
|
-
)
|
748
699
|
):
|
749
|
-
_LOGGER.debug(
|
750
|
-
"Script run finished successfully; "
|
751
|
-
"removing expired entries from MessageCache "
|
752
|
-
"(max_age=%s)",
|
753
|
-
config.get_option("global.maxCachedMessageAge"),
|
754
|
-
)
|
755
700
|
session_info.script_run_count += 1
|
756
|
-
self._message_cache.remove_expired_entries_for_session(
|
757
|
-
session_info.session, session_info.script_run_count
|
758
|
-
)
|
759
701
|
|
760
702
|
# Ship it off!
|
761
|
-
session_info.client.write_forward_msg(
|
703
|
+
session_info.client.write_forward_msg(msg)
|
762
704
|
|
763
705
|
def _enqueued_some_message(self) -> None:
|
764
706
|
"""Callback called by AppSession after the AppSession has enqueued a
|
@@ -16,15 +16,17 @@
|
|
16
16
|
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
-
from
|
19
|
+
from logging import getLogger
|
20
|
+
from typing import TYPE_CHECKING, Any, Final
|
20
21
|
|
21
22
|
from streamlit import config
|
22
23
|
from streamlit.errors import MarkdownFormattedException, StreamlitAPIException
|
23
|
-
from streamlit.runtime.forward_msg_cache import populate_hash_if_needed
|
24
24
|
|
25
25
|
if TYPE_CHECKING:
|
26
26
|
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
|
27
27
|
|
28
|
+
_LOGGER: Final = getLogger(__name__)
|
29
|
+
|
28
30
|
|
29
31
|
class MessageSizeError(MarkdownFormattedException):
|
30
32
|
"""Exception raised when a websocket message is larger than the configured limit."""
|
@@ -60,29 +62,28 @@ class BadDurationStringError(StreamlitAPIException):
|
|
60
62
|
)
|
61
63
|
|
62
64
|
|
63
|
-
def is_cacheable_msg(msg: ForwardMsg) -> bool:
|
64
|
-
"""True if the given message qualifies for caching."""
|
65
|
-
if msg.WhichOneof("type") in {"ref_hash", "initialize"}:
|
66
|
-
# Some message types never get cached
|
67
|
-
return False
|
68
|
-
return msg.ByteSize() >= int(config.get_option("global.minCachedMessageSize"))
|
69
|
-
|
70
|
-
|
71
65
|
def serialize_forward_msg(msg: ForwardMsg) -> bytes:
|
72
66
|
"""Serialize a ForwardMsg to send to a client.
|
73
67
|
|
74
68
|
If the message is too large, it will be converted to an exception message
|
75
69
|
instead.
|
76
70
|
"""
|
77
|
-
|
71
|
+
|
78
72
|
msg_str = msg.SerializeToString()
|
79
73
|
|
80
74
|
if len(msg_str) > get_max_message_size_bytes():
|
81
|
-
import streamlit.elements.exception as exception
|
82
|
-
|
83
75
|
# Overwrite the offending ForwardMsg.delta with an error to display.
|
84
76
|
# This assumes that the size limit wasn't exceeded due to metadata.
|
85
|
-
|
77
|
+
import streamlit.elements.exception as exception
|
78
|
+
|
79
|
+
msg_size_error = MessageSizeError(msg_str)
|
80
|
+
_LOGGER.warning(
|
81
|
+
"Websocket message size limit exceeded. "
|
82
|
+
f"Showing error to the user: {msg_size_error}"
|
83
|
+
)
|
84
|
+
exception.marshall(msg.delta.new_element.exception, msg_size_error)
|
85
|
+
# Deactivate caching for this error message:
|
86
|
+
msg.metadata.cacheable = False
|
86
87
|
msg_str = msg.SerializeToString()
|
87
88
|
|
88
89
|
return msg_str
|
@@ -134,7 +134,14 @@ def _mpa_v1(main_script_path: str):
|
|
134
134
|
# Read out the my_pages folder and create a page for every script:
|
135
135
|
pages = PAGES_FOLDER.glob("*.py")
|
136
136
|
pages = sorted(
|
137
|
-
[
|
137
|
+
[
|
138
|
+
page
|
139
|
+
for page in pages
|
140
|
+
if page.name.endswith(".py")
|
141
|
+
and not page.name.startswith(".")
|
142
|
+
and not page.name == "__init__.py"
|
143
|
+
],
|
144
|
+
key=page_sort_key,
|
138
145
|
)
|
139
146
|
|
140
147
|
# Use this script as the main page and
|
@@ -514,6 +521,7 @@ class ScriptRunner:
|
|
514
521
|
query_string=rerun_data.query_string,
|
515
522
|
page_script_hash=page_script_hash,
|
516
523
|
fragment_ids_this_run=fragment_ids_this_run,
|
524
|
+
cached_message_hashes=rerun_data.cached_message_hashes,
|
517
525
|
context_info=rerun_data.context_info,
|
518
526
|
)
|
519
527
|
|
@@ -57,6 +57,8 @@ class RerunData:
|
|
57
57
|
is_fragment_scoped_rerun: bool = False
|
58
58
|
# set to true when a script is rerun by the fragment auto-rerun mechanism
|
59
59
|
is_auto_rerun: bool = False
|
60
|
+
# Hashes of messages that are cached in the client browser:
|
61
|
+
cached_message_hashes: set[str] = field(default_factory=set)
|
60
62
|
# context_info is used to store information from the user browser (e.g. timezone)
|
61
63
|
context_info: ContextInfo | None = None
|
62
64
|
|
@@ -234,6 +236,7 @@ class ScriptRequests:
|
|
234
236
|
page_script_hash=new_data.page_script_hash,
|
235
237
|
page_name=new_data.page_name,
|
236
238
|
fragment_id_queue=fragment_id_queue,
|
239
|
+
cached_message_hashes=new_data.cached_message_hashes,
|
237
240
|
is_fragment_scoped_rerun=new_data.is_fragment_scoped_rerun,
|
238
241
|
is_auto_rerun=new_data.is_auto_rerun,
|
239
242
|
context_info=new_data.context_info,
|
@@ -36,6 +36,10 @@ from streamlit.errors import (
|
|
36
36
|
StreamlitSetPageConfigMustBeFirstCommandError,
|
37
37
|
)
|
38
38
|
from streamlit.logger import get_logger
|
39
|
+
from streamlit.runtime.forward_msg_cache import (
|
40
|
+
create_reference_msg,
|
41
|
+
populate_hash_if_needed,
|
42
|
+
)
|
39
43
|
|
40
44
|
if TYPE_CHECKING:
|
41
45
|
from pathlib import Path
|
@@ -86,6 +90,8 @@ class ScriptRunContext:
|
|
86
90
|
fragment_storage: FragmentStorage
|
87
91
|
pages_manager: PagesManager
|
88
92
|
|
93
|
+
# Hashes of messages that are cached in the client browser:
|
94
|
+
cached_message_hashes: set[str] = field(default_factory=set)
|
89
95
|
context_info: ContextInfo | None = None
|
90
96
|
gather_usage_stats: bool = False
|
91
97
|
command_tracking_deactivated: bool = False
|
@@ -140,6 +146,7 @@ class ScriptRunContext:
|
|
140
146
|
query_string: str = "",
|
141
147
|
page_script_hash: str = "",
|
142
148
|
fragment_ids_this_run: list[str] | None = None,
|
149
|
+
cached_message_hashes: set[str] | None = None,
|
143
150
|
context_info: ContextInfo | None = None,
|
144
151
|
) -> None:
|
145
152
|
self.cursors = {}
|
@@ -161,6 +168,8 @@ class ScriptRunContext:
|
|
161
168
|
self.fragment_ids_this_run = fragment_ids_this_run
|
162
169
|
self.new_fragment_ids = set()
|
163
170
|
self.has_dialog_opened = False
|
171
|
+
self.cached_message_hashes = cached_message_hashes or set()
|
172
|
+
|
164
173
|
in_cached_function.set(False)
|
165
174
|
|
166
175
|
parsed_query_params = parse.parse_qs(query_string, keep_blank_values=True)
|
@@ -192,15 +201,28 @@ class ScriptRunContext:
|
|
192
201
|
|
193
202
|
msg.metadata.active_script_hash = self.active_script_hash
|
194
203
|
|
204
|
+
# We populate the hash and cacheable field for all messages.
|
205
|
+
# Besides the forward message cache, the hash might also be used
|
206
|
+
# for other aspects within the frontend.
|
207
|
+
populate_hash_if_needed(msg)
|
208
|
+
msg_to_send = msg
|
209
|
+
if (
|
210
|
+
msg.metadata.cacheable
|
211
|
+
and msg.hash
|
212
|
+
and msg.hash in self.cached_message_hashes
|
213
|
+
):
|
214
|
+
_LOGGER.debug("Sending cached message ref (hash=%s)", msg.hash)
|
215
|
+
msg_to_send = create_reference_msg(msg)
|
216
|
+
|
195
217
|
# Pass the message up to our associated ScriptRunner.
|
196
|
-
self._enqueue(
|
218
|
+
self._enqueue(msg_to_send)
|
197
219
|
|
198
220
|
def ensure_single_query_api_used(self):
|
199
221
|
if self._experimental_query_params_used and self._production_query_params_used:
|
200
222
|
raise StreamlitAPIException(
|
201
223
|
"Using `st.query_params` together with either `st.experimental_get_query_params` "
|
202
|
-
"or `st.experimental_set_query_params` is not supported. Please
|
203
|
-
"to only use `st.query_params`"
|
224
|
+
"or `st.experimental_set_query_params` is not supported. Please "
|
225
|
+
" convert your app to only use `st.query_params`"
|
204
226
|
)
|
205
227
|
|
206
228
|
def mark_experimental_query_params_used(self):
|
@@ -53,20 +53,19 @@ class ActiveSessionInfo:
|
|
53
53
|
|
54
54
|
client: SessionClient
|
55
55
|
session: AppSession
|
56
|
+
# The number of times the script has been run for this session.
|
57
|
+
# At the moment, this is only used for testing and debugging purposes.
|
56
58
|
script_run_count: int = 0
|
57
59
|
|
58
60
|
|
59
61
|
@dataclass
|
60
62
|
class SessionInfo:
|
61
|
-
"""Type containing data related to an AppSession.
|
62
|
-
|
63
|
-
For each AppSession, the Runtime tracks that session's
|
64
|
-
script_run_count. This is used to track the age of messages in
|
65
|
-
the ForwardMsgCache.
|
66
|
-
"""
|
63
|
+
"""Type containing data related to an AppSession."""
|
67
64
|
|
68
65
|
client: SessionClient | None
|
69
66
|
session: AppSession
|
67
|
+
# The number of times the script has been run for this session.
|
68
|
+
# At the moment, this is only used for testing and debugging purposes.
|
70
69
|
script_run_count: int = 0
|
71
70
|
|
72
71
|
def is_active(self) -> bool:
|
streamlit/static/index.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
<script>
|
52
52
|
window.prerenderReady = false
|
53
53
|
</script>
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
54
|
+
<script type="module" crossorigin src="./static/js/index.DIxzN4oM.js"></script>
|
55
55
|
<link rel="stylesheet" crossorigin href="./static/css/index.DKr_zoDj.css">
|
56
56
|
</head>
|
57
57
|
<body>
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,E as n,_ as a}from"./index.
|
1
|
+
import{r as e,E as n,_ as a}from"./index.DIxzN4oM.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
|