streamlit-nightly 1.35.1.dev20240604__py2.py3-none-any.whl → 1.35.1.dev20240605__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.
@@ -94,10 +94,7 @@ Your script uses a widget command in a cached function
94
94
  This code will only be called when we detect a cache "miss",
95
95
  which can lead to unexpected results.
96
96
 
97
- How to fix this:
98
- * Move all widget commands outside the cached function.
99
- * Or, if you know what you're doing, use `experimental_allow_widgets=True`
100
- in the cache decorator to enable widget replay and suppress this warning.
97
+ To fix this, move all widget commands outside the cached function.
101
98
  """
102
99
  )
103
100
 
@@ -267,7 +267,7 @@ class SelectboxMixin:
267
267
 
268
268
  if index is not None and len(opt) > 0 and not 0 <= index < len(opt):
269
269
  raise StreamlitAPIException(
270
- "Selectbox index must be between 0 and length of options"
270
+ "Selectbox index must be greater than or equal to 0 and less than the length of options."
271
271
  )
272
272
 
273
273
  session_state = get_session_state().filtered_state
@@ -42,6 +42,7 @@ from streamlit.runtime.caching.cached_message_replay import (
42
42
  ElementMsgData,
43
43
  MsgData,
44
44
  MultiCacheResults,
45
+ show_widget_replay_deprecation,
45
46
  )
46
47
  from streamlit.runtime.caching.hashing import HashFuncsDict
47
48
  from streamlit.runtime.caching.storage import (
@@ -443,7 +444,9 @@ class CacheDataAPI:
443
444
  Support for widgets in cached functions is currently experimental.
444
445
  Setting this parameter to True may lead to excessive memory use since the
445
446
  widget value is treated as an additional input parameter to the cache.
446
- We may remove support for this option at any time without notice.
447
+
448
+ .. note::
449
+ This parameter is deprecated and will be removed in a future release.
447
450
 
448
451
  hash_funcs : dict or None
449
452
  Mapping of types or fully qualified names to hash functions.
@@ -559,6 +562,9 @@ class CacheDataAPI:
559
562
 
560
563
  self._maybe_show_deprecation_warning()
561
564
 
565
+ if experimental_allow_widgets:
566
+ show_widget_replay_deprecation("cache_data")
567
+
562
568
  def wrapper(f):
563
569
  return make_cached_func_wrapper(
564
570
  CachedDataFuncInfo(
@@ -42,6 +42,7 @@ from streamlit.runtime.caching.cached_message_replay import (
42
42
  ElementMsgData,
43
43
  MsgData,
44
44
  MultiCacheResults,
45
+ show_widget_replay_deprecation,
45
46
  )
46
47
  from streamlit.runtime.caching.hashing import HashFuncsDict
47
48
  from streamlit.runtime.metrics_util import gather_metrics
@@ -325,7 +326,9 @@ class CacheResourceAPI:
325
326
  Support for widgets in cached functions is currently experimental.
326
327
  Setting this parameter to True may lead to excessive memory use since the
327
328
  widget value is treated as an additional input parameter to the cache.
328
- We may remove support for this option at any time without notice.
329
+
330
+ .. note::
331
+ This parameter is deprecated and will be removed in a future release.
329
332
 
330
333
  hash_funcs : dict or None
331
334
  Mapping of types or fully qualified names to hash functions.
@@ -419,6 +422,9 @@ class CacheResourceAPI:
419
422
  """
420
423
  self._maybe_show_deprecation_warning()
421
424
 
425
+ if experimental_allow_widgets:
426
+ show_widget_replay_deprecation("cache_resource")
427
+
422
428
  # Support passing the params via function decorator, e.g.
423
429
  # @st.cache_resource(show_spinner=False)
424
430
  if func is None:
@@ -19,12 +19,13 @@ import hashlib
19
19
  import threading
20
20
  import types
21
21
  from dataclasses import dataclass
22
- from typing import TYPE_CHECKING, Any, Iterator, Union
22
+ from typing import TYPE_CHECKING, Any, Iterator, Literal, Union
23
23
 
24
24
  from google.protobuf.message import Message
25
25
 
26
26
  import streamlit as st
27
27
  from streamlit import runtime, util
28
+ from streamlit.deprecation_util import show_deprecation_warning
28
29
  from streamlit.proto.Block_pb2 import Block
29
30
  from streamlit.runtime.caching.cache_errors import CacheReplayClosureError
30
31
  from streamlit.runtime.caching.cache_type import CacheType
@@ -427,3 +428,17 @@ def _make_widget_key(widgets: list[tuple[str, Any]], cache_type: CacheType) -> s
427
428
  update_hash(widget_id_val, func_hasher, cache_type)
428
429
 
429
430
  return func_hasher.hexdigest()
431
+
432
+
433
+ def show_widget_replay_deprecation(
434
+ decorator: Literal["cache_data", "cache_resource"]
435
+ ) -> None:
436
+ show_deprecation_warning(
437
+ "The `experimental_allow_widgets` parameter is deprecated and will be removed "
438
+ "in a future release. Please remove the `experimental_allow_widgets` parameter "
439
+ f"from the `@st.{decorator}` decorator and move all widget commands outside of "
440
+ "cached functions.\n\nTo speed up your app, we recommend moving your widgets into fragments. "
441
+ "Find out more about fragments in [our docs](https://docs.streamlit.io/develop/api-reference/execution-flow/st.fragment). "
442
+ "\n\nIf you have a specific use-case that requires the `experimental_allow_widgets` functionality, "
443
+ "please tell us via an [issue on Github](https://github.com/streamlit/streamlit/issues)."
444
+ )
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.3aaaea00.css",
4
- "main.js": "./static/js/main.ea823277.js",
4
+ "main.js": "./static/js/main.343fe878.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.ea823277.js"
154
+ "static/js/main.343fe878.js"
155
155
  ]
156
156
  }
@@ -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.ea823277.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>
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.343fe878.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>