streamlit-nightly 1.35.1.dev20240617__py2.py3-none-any.whl → 1.36.1.dev20240621__py2.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 +1 -11
- streamlit/commands/execution_control.py +6 -17
- streamlit/delta_generator.py +6 -1
- streamlit/elements/widgets/data_editor.py +0 -23
- streamlit/emojis.py +1 -1
- streamlit/runtime/app_session.py +10 -6
- streamlit/runtime/caching/__init__.py +0 -22
- streamlit/runtime/caching/cache_data_api.py +2 -21
- streamlit/runtime/caching/cache_resource_api.py +2 -21
- streamlit/runtime/scriptrunner/exec_code.py +13 -3
- streamlit/runtime/scriptrunner/script_runner.py +6 -1
- streamlit/static/asset-manifest.json +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{main.7994a814.js → main.5b854b9d.js} +2 -2
- {streamlit_nightly-1.35.1.dev20240617.dist-info → streamlit_nightly-1.36.1.dev20240621.dist-info}/METADATA +4 -4
- {streamlit_nightly-1.35.1.dev20240617.dist-info → streamlit_nightly-1.36.1.dev20240621.dist-info}/RECORD +21 -21
- {streamlit_nightly-1.35.1.dev20240617.dist-info → streamlit_nightly-1.36.1.dev20240621.dist-info}/WHEEL +1 -1
- /streamlit/static/static/js/{main.7994a814.js.LICENSE.txt → main.5b854b9d.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.35.1.dev20240617.data → streamlit_nightly-1.36.1.dev20240621.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.35.1.dev20240617.dist-info → streamlit_nightly-1.36.1.dev20240621.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.35.1.dev20240617.dist-info → streamlit_nightly-1.36.1.dev20240621.dist-info}/top_level.txt +0 -0
streamlit/runtime/app_session.py
CHANGED
@@ -435,7 +435,9 @@ class AppSession:
|
|
435
435
|
return True
|
436
436
|
|
437
437
|
def _on_source_file_changed(self, filepath: str | None = None) -> None:
|
438
|
-
"""One of our source files changed. Clear the cache and schedule a rerun if
|
438
|
+
"""One of our source files changed. Clear the cache and schedule a rerun if
|
439
|
+
appropriate.
|
440
|
+
"""
|
439
441
|
self._script_cache.clear()
|
440
442
|
|
441
443
|
if filepath is not None and not self._should_rerun_on_file_change(filepath):
|
@@ -449,11 +451,13 @@ class AppSession:
|
|
449
451
|
def _on_secrets_file_changed(self, _) -> None:
|
450
452
|
"""Called when `secrets.file_change_listener` emits a Signal."""
|
451
453
|
|
452
|
-
# NOTE: At the time of writing, this function only calls
|
453
|
-
# The reason behind creating this function instead of
|
454
|
-
#
|
455
|
-
#
|
456
|
-
#
|
454
|
+
# NOTE: At the time of writing, this function only calls
|
455
|
+
# `_on_source_file_changed`. The reason behind creating this function instead of
|
456
|
+
# just passing `_on_source_file_changed` to `connect` / `disconnect` directly is
|
457
|
+
# that every function that is passed to `connect` / `disconnect` must have at
|
458
|
+
# least one argument for `sender` (in this case we don't really care about it,
|
459
|
+
# thus `_`), and introducing an unnecessary argument to
|
460
|
+
# `_on_source_file_changed` just for this purpose sounded finicky.
|
457
461
|
self._on_source_file_changed()
|
458
462
|
|
459
463
|
def _on_pages_changed(self, _) -> None:
|
@@ -93,26 +93,6 @@ cache_resource = CacheResourceAPI(decorator_metric_name="cache_resource")
|
|
93
93
|
# and it should be removed in the future.
|
94
94
|
cache = _cache
|
95
95
|
|
96
|
-
# Deprecated singletons
|
97
|
-
_MEMO_WARNING = (
|
98
|
-
f"`st.experimental_memo` is deprecated. Please use the new command `st.cache_data` instead, "
|
99
|
-
f"which has the same behavior. More information [in our docs]({CACHE_DOCS_URL})."
|
100
|
-
)
|
101
|
-
|
102
|
-
experimental_memo = CacheDataAPI(
|
103
|
-
decorator_metric_name="experimental_memo", deprecation_warning=_MEMO_WARNING
|
104
|
-
)
|
105
|
-
|
106
|
-
_SINGLETON_WARNING = (
|
107
|
-
f"`st.experimental_singleton` is deprecated. Please use the new command `st.cache_resource` instead, "
|
108
|
-
f"which has the same behavior. More information [in our docs]({CACHE_DOCS_URL})."
|
109
|
-
)
|
110
|
-
|
111
|
-
experimental_singleton = CacheResourceAPI(
|
112
|
-
decorator_metric_name="experimental_singleton",
|
113
|
-
deprecation_warning=_SINGLETON_WARNING,
|
114
|
-
)
|
115
|
-
|
116
96
|
|
117
97
|
__all__ = [
|
118
98
|
"cache",
|
@@ -125,6 +105,4 @@ __all__ = [
|
|
125
105
|
"get_resource_cache_stats_provider",
|
126
106
|
"cache_data",
|
127
107
|
"cache_resource",
|
128
|
-
"experimental_memo",
|
129
|
-
"experimental_singleton",
|
130
108
|
]
|
@@ -35,7 +35,6 @@ from typing_extensions import TypeAlias
|
|
35
35
|
|
36
36
|
import streamlit as st
|
37
37
|
from streamlit import runtime
|
38
|
-
from streamlit.deprecation_util import show_deprecation_warning
|
39
38
|
from streamlit.errors import StreamlitAPIException
|
40
39
|
from streamlit.logger import get_logger
|
41
40
|
from streamlit.runtime.caching.cache_errors import CacheError, CacheKeyNotFoundError
|
@@ -328,20 +327,13 @@ class CacheDataAPI:
|
|
328
327
|
st.cache_data.clear().
|
329
328
|
"""
|
330
329
|
|
331
|
-
def __init__(
|
332
|
-
self, decorator_metric_name: str, deprecation_warning: str | None = None
|
333
|
-
):
|
330
|
+
def __init__(self, decorator_metric_name: str):
|
334
331
|
"""Create a CacheDataAPI instance.
|
335
332
|
|
336
333
|
Parameters
|
337
334
|
----------
|
338
335
|
decorator_metric_name
|
339
|
-
The metric name to record for decorator usage.
|
340
|
-
deprecated, but we're still supporting it and tracking its usage separately
|
341
|
-
from `@st.cache_data`.
|
342
|
-
|
343
|
-
deprecation_warning
|
344
|
-
An optional deprecation warning to show when the API is accessed.
|
336
|
+
The metric name to record for decorator usage.
|
345
337
|
"""
|
346
338
|
|
347
339
|
# Parameterize the decorator metric name.
|
@@ -349,7 +341,6 @@ class CacheDataAPI:
|
|
349
341
|
self._decorator = gather_metrics( # type: ignore
|
350
342
|
decorator_metric_name, self._decorator
|
351
343
|
)
|
352
|
-
self._deprecation_warning = deprecation_warning
|
353
344
|
|
354
345
|
# Type-annotate the decorator function.
|
355
346
|
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
@@ -572,8 +563,6 @@ class CacheDataAPI:
|
|
572
563
|
f"Unsupported persist option '{persist}'. Valid values are 'disk' or None."
|
573
564
|
)
|
574
565
|
|
575
|
-
self._maybe_show_deprecation_warning()
|
576
|
-
|
577
566
|
if experimental_allow_widgets:
|
578
567
|
show_widget_replay_deprecation("cache_data")
|
579
568
|
|
@@ -608,16 +597,8 @@ class CacheDataAPI:
|
|
608
597
|
@gather_metrics("clear_data_caches")
|
609
598
|
def clear(self) -> None:
|
610
599
|
"""Clear all in-memory and on-disk data caches."""
|
611
|
-
self._maybe_show_deprecation_warning()
|
612
600
|
_data_caches.clear_all()
|
613
601
|
|
614
|
-
def _maybe_show_deprecation_warning(self):
|
615
|
-
"""If the API is being accessed with the deprecated `st.experimental_memo` name,
|
616
|
-
show a deprecation warning.
|
617
|
-
"""
|
618
|
-
if self._deprecation_warning is not None:
|
619
|
-
show_deprecation_warning(self._deprecation_warning)
|
620
|
-
|
621
602
|
|
622
603
|
class DataCache(Cache):
|
623
604
|
"""Manages cached values for a single st.cache_data function."""
|
@@ -25,7 +25,6 @@ from cachetools import TTLCache
|
|
25
25
|
from typing_extensions import TypeAlias
|
26
26
|
|
27
27
|
import streamlit as st
|
28
|
-
from streamlit.deprecation_util import show_deprecation_warning
|
29
28
|
from streamlit.logger import get_logger
|
30
29
|
from streamlit.runtime.caching import cache_utils
|
31
30
|
from streamlit.runtime.caching.cache_errors import CacheKeyNotFoundError
|
@@ -198,26 +197,18 @@ class CacheResourceAPI:
|
|
198
197
|
and st.cache_resource.clear().
|
199
198
|
"""
|
200
199
|
|
201
|
-
def __init__(
|
202
|
-
self, decorator_metric_name: str, deprecation_warning: str | None = None
|
203
|
-
):
|
200
|
+
def __init__(self, decorator_metric_name: str):
|
204
201
|
"""Create a CacheResourceAPI instance.
|
205
202
|
|
206
203
|
Parameters
|
207
204
|
----------
|
208
205
|
decorator_metric_name
|
209
|
-
The metric name to record for decorator usage.
|
210
|
-
deprecated, but we're still supporting it and tracking its usage separately
|
211
|
-
from `@st.cache_resource`.
|
212
|
-
|
213
|
-
deprecation_warning
|
214
|
-
An optional deprecation warning to show when the API is accessed.
|
206
|
+
The metric name to record for decorator usage.
|
215
207
|
"""
|
216
208
|
|
217
209
|
# Parameterize the decorator metric name.
|
218
210
|
# (Ignore spurious mypy complaints - https://github.com/python/mypy/issues/2427)
|
219
211
|
self._decorator = gather_metrics(decorator_metric_name, self._decorator) # type: ignore
|
220
|
-
self._deprecation_warning = deprecation_warning
|
221
212
|
|
222
213
|
# Type-annotate the decorator function.
|
223
214
|
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
@@ -422,8 +413,6 @@ class CacheResourceAPI:
|
|
422
413
|
... def get_person_name(person: Person):
|
423
414
|
... return person.name
|
424
415
|
"""
|
425
|
-
self._maybe_show_deprecation_warning()
|
426
|
-
|
427
416
|
if experimental_allow_widgets:
|
428
417
|
show_widget_replay_deprecation("cache_resource")
|
429
418
|
|
@@ -457,16 +446,8 @@ class CacheResourceAPI:
|
|
457
446
|
@gather_metrics("clear_resource_caches")
|
458
447
|
def clear(self) -> None:
|
459
448
|
"""Clear all cache_resource caches."""
|
460
|
-
self._maybe_show_deprecation_warning()
|
461
449
|
_resource_caches.clear_all()
|
462
450
|
|
463
|
-
def _maybe_show_deprecation_warning(self):
|
464
|
-
"""If the API is being accessed with the deprecated `st.experimental_singleton` name,
|
465
|
-
show a deprecation warning.
|
466
|
-
"""
|
467
|
-
if self._deprecation_warning is not None:
|
468
|
-
show_deprecation_warning(self._deprecation_warning)
|
469
|
-
|
470
451
|
|
471
452
|
class ResourceCache(Cache):
|
472
453
|
"""Manages cached values for a single st.cache_resource function."""
|
@@ -62,7 +62,7 @@ def exec_func_with_error_handling(
|
|
62
62
|
"""
|
63
63
|
|
64
64
|
# Avoid circular imports
|
65
|
-
from streamlit.delta_generator import dg_stack
|
65
|
+
from streamlit.delta_generator import dg_stack, get_default_dg_stack
|
66
66
|
|
67
67
|
run_without_errors = True
|
68
68
|
|
@@ -94,8 +94,18 @@ def exec_func_with_error_handling(
|
|
94
94
|
raise e
|
95
95
|
|
96
96
|
rerun_exception_data = e.rerun_data
|
97
|
-
|
98
|
-
|
97
|
+
if rerun_exception_data.fragment_id_queue:
|
98
|
+
# This is a fragment-specific rerun, so we need to restore the stack
|
99
|
+
ctx.cursors = original_cursors
|
100
|
+
dg_stack.set(original_dg_stack)
|
101
|
+
else:
|
102
|
+
# If it is a full-app rerun, the stack needs to be refreshed.
|
103
|
+
# We should land here when `st.rerun` is called from within a
|
104
|
+
# fragment. Since we re-use the same thread, we have to clear the
|
105
|
+
# stack or otherwise we might render the main app in the old
|
106
|
+
# fragment's dg_stack.
|
107
|
+
ctx.cursors.clear()
|
108
|
+
dg_stack.set(get_default_dg_stack())
|
99
109
|
# Interruption due to a rerun is usually from `st.rerun()`, which
|
100
110
|
# we want to count as a script completion so triggers reset.
|
101
111
|
# It is also possible for this to happen if fast reruns is off,
|
@@ -269,7 +269,8 @@ class ScriptRunner:
|
|
269
269
|
if ctx is None:
|
270
270
|
# This should never be possible on the script_runner thread.
|
271
271
|
raise RuntimeError(
|
272
|
-
"ScriptRunner thread has a null ScriptRunContext.
|
272
|
+
"ScriptRunner thread has a null ScriptRunContext. "
|
273
|
+
"Something has gone very wrong!"
|
273
274
|
)
|
274
275
|
return ctx
|
275
276
|
|
@@ -570,6 +571,8 @@ class ScriptRunner:
|
|
570
571
|
exec(code, module.__dict__)
|
571
572
|
|
572
573
|
self._session_state.maybe_check_serializable()
|
574
|
+
# check for control requests, e.g. rerun requests have arrived
|
575
|
+
self._maybe_handle_execution_control_request()
|
573
576
|
|
574
577
|
prep_time = timer() - start_time
|
575
578
|
(
|
@@ -578,6 +581,8 @@ class ScriptRunner:
|
|
578
581
|
rerun_exception_data,
|
579
582
|
premature_stop,
|
580
583
|
) = exec_func_with_error_handling(code_to_exec, ctx)
|
584
|
+
# setting the session state here triggers a yield-callback call
|
585
|
+
# which reads self._requests and checks for rerun data
|
581
586
|
self._session_state[SCRIPT_RUN_WITHOUT_ERRORS_KEY] = run_without_errors
|
582
587
|
|
583
588
|
if rerun_exception_data:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.3aaaea00.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.5b854b9d.js",
|
5
5
|
"static/js/9336.3e046ad7.chunk.js": "./static/js/9336.3e046ad7.chunk.js",
|
6
6
|
"static/js/9330.2b4c99e0.chunk.js": "./static/js/9330.2b4c99e0.chunk.js",
|
7
7
|
"static/js/2736.4336e2b9.chunk.js": "./static/js/2736.4336e2b9.chunk.js",
|
@@ -151,6 +151,6 @@
|
|
151
151
|
},
|
152
152
|
"entrypoints": [
|
153
153
|
"static/css/main.3aaaea00.css",
|
154
|
-
"static/js/main.
|
154
|
+
"static/js/main.5b854b9d.js"
|
155
155
|
]
|
156
156
|
}
|
streamlit/static/index.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.5b854b9d.js"></script><link href="./static/css/main.3aaaea00.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|