streamlit-nightly 1.35.1.dev20240526__py2.py3-none-any.whl → 1.35.1.dev20240528__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.
Files changed (40) hide show
  1. streamlit/components/v1/custom_component.py +1 -1
  2. streamlit/elements/arrow.py +5 -8
  3. streamlit/elements/form.py +1 -1
  4. streamlit/elements/lib/policies.py +122 -0
  5. streamlit/elements/{utils.py → lib/utils.py} +2 -84
  6. streamlit/elements/metric.py +1 -1
  7. streamlit/elements/plotly_chart.py +20 -11
  8. streamlit/elements/vega_charts.py +5 -7
  9. streamlit/elements/widgets/button.py +5 -14
  10. streamlit/elements/widgets/camera_input.py +2 -2
  11. streamlit/elements/widgets/chat.py +1 -1
  12. streamlit/elements/widgets/checkbox.py +2 -2
  13. streamlit/elements/widgets/color_picker.py +2 -2
  14. streamlit/elements/widgets/data_editor.py +5 -5
  15. streamlit/elements/widgets/file_uploader.py +2 -2
  16. streamlit/elements/widgets/multiselect.py +3 -1
  17. streamlit/elements/widgets/number_input.py +2 -2
  18. streamlit/elements/widgets/radio.py +3 -1
  19. streamlit/elements/widgets/select_slider.py +3 -1
  20. streamlit/elements/widgets/selectbox.py +3 -1
  21. streamlit/elements/widgets/slider.py +2 -2
  22. streamlit/elements/widgets/text_widgets.py +2 -2
  23. streamlit/elements/widgets/time_widgets.py +2 -2
  24. streamlit/static/asset-manifest.json +6 -6
  25. streamlit/static/index.html +1 -1
  26. streamlit/static/static/js/5379.f08eddd1.chunk.js +1 -0
  27. streamlit/static/static/js/{7175.be4076bc.chunk.js → 7175.583ff733.chunk.js} +1 -1
  28. streamlit/static/static/js/8148.293984e0.chunk.js +1 -0
  29. streamlit/static/static/js/8691.4211c305.chunk.js +1 -0
  30. streamlit/static/static/js/{main.e93f99a3.js → main.206766ee.js} +2 -2
  31. {streamlit_nightly-1.35.1.dev20240526.dist-info → streamlit_nightly-1.35.1.dev20240528.dist-info}/METADATA +1 -1
  32. {streamlit_nightly-1.35.1.dev20240526.dist-info → streamlit_nightly-1.35.1.dev20240528.dist-info}/RECORD +37 -36
  33. streamlit/static/static/js/5379.6571574f.chunk.js +0 -1
  34. streamlit/static/static/js/8148.a17a918e.chunk.js +0 -1
  35. streamlit/static/static/js/8691.9ccf7f89.chunk.js +0 -1
  36. /streamlit/static/static/js/{main.e93f99a3.js.LICENSE.txt → main.206766ee.js.LICENSE.txt} +0 -0
  37. {streamlit_nightly-1.35.1.dev20240526.data → streamlit_nightly-1.35.1.dev20240528.data}/scripts/streamlit.cmd +0 -0
  38. {streamlit_nightly-1.35.1.dev20240526.dist-info → streamlit_nightly-1.35.1.dev20240528.dist-info}/WHEEL +0 -0
  39. {streamlit_nightly-1.35.1.dev20240526.dist-info → streamlit_nightly-1.35.1.dev20240528.dist-info}/entry_points.txt +0 -0
  40. {streamlit_nightly-1.35.1.dev20240526.dist-info → streamlit_nightly-1.35.1.dev20240528.dist-info}/top_level.txt +0 -0
@@ -20,7 +20,7 @@ from typing import TYPE_CHECKING, Any
20
20
  from streamlit import _main, type_util
21
21
  from streamlit.components.types.base_custom_component import BaseCustomComponent
22
22
  from streamlit.elements.form import current_form_id
23
- from streamlit.elements.utils import check_cache_replay_rules
23
+ from streamlit.elements.lib.policies import check_cache_replay_rules
24
24
  from streamlit.errors import StreamlitAPIException
25
25
  from streamlit.proto.Components_pb2 import ArrowTable as ArrowTableProto
26
26
  from streamlit.proto.Components_pb2 import SpecialArg
@@ -44,6 +44,11 @@ from streamlit.elements.lib.column_config_utils import (
44
44
  )
45
45
  from streamlit.elements.lib.event_utils import AttributeDictionary
46
46
  from streamlit.elements.lib.pandas_styler_utils import marshall_styler
47
+ from streamlit.elements.lib.policies import (
48
+ check_cache_replay_rules,
49
+ check_callback_rules,
50
+ check_session_state_rules,
51
+ )
47
52
  from streamlit.errors import StreamlitAPIException
48
53
  from streamlit.proto.Arrow_pb2 import Arrow as ArrowProto
49
54
  from streamlit.runtime.metrics_util import gather_metrics
@@ -476,14 +481,6 @@ class ArrowMixin:
476
481
 
477
482
  if is_selection_activated:
478
483
  # Run some checks that are only relevant when selections are activated
479
-
480
- # Import here to avoid circular imports
481
- from streamlit.elements.utils import (
482
- check_cache_replay_rules,
483
- check_callback_rules,
484
- check_session_state_rules,
485
- )
486
-
487
484
  check_cache_replay_rules()
488
485
  if callable(on_select):
489
486
  check_callback_rules(self.dg, on_select)
@@ -194,7 +194,7 @@ class FormMixin:
194
194
 
195
195
  """
196
196
  # Import this here to avoid circular imports.
197
- from streamlit.elements.utils import (
197
+ from streamlit.elements.lib.policies import (
198
198
  check_cache_replay_rules,
199
199
  check_session_state_rules,
200
200
  )
@@ -0,0 +1,122 @@
1
+ # Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from __future__ import annotations
16
+
17
+ from typing import TYPE_CHECKING, Any
18
+
19
+ from streamlit import config, runtime
20
+ from streamlit.elements.form import is_in_form
21
+ from streamlit.errors import StreamlitAPIException, StreamlitAPIWarning
22
+ from streamlit.runtime.scriptrunner.script_run_context import get_script_run_ctx
23
+ from streamlit.runtime.state import WidgetCallback, get_session_state
24
+
25
+ if TYPE_CHECKING:
26
+ from streamlit.delta_generator import DeltaGenerator
27
+
28
+
29
+ def check_callback_rules(dg: DeltaGenerator, on_change: WidgetCallback | None) -> None:
30
+ """Ensures that widgets other than `st.form_submit` within a form don't have an on_change callback set.
31
+
32
+ Raises
33
+ ------
34
+ StreamlitAPIException:
35
+ Raised when the described rule is violated.
36
+ """
37
+
38
+ if runtime.exists() and is_in_form(dg) and on_change is not None:
39
+ raise StreamlitAPIException(
40
+ "With forms, callbacks can only be defined on the `st.form_submit_button`."
41
+ " Defining callbacks on other widgets inside a form is not allowed."
42
+ )
43
+
44
+
45
+ _shown_default_value_warning: bool = False
46
+
47
+
48
+ def check_session_state_rules(
49
+ default_value: Any, key: str | None, writes_allowed: bool = True
50
+ ) -> None:
51
+ """Ensures that no values are set for widgets with the given key when writing is not allowed.
52
+
53
+ Additionally, if `global.disableWidgetStateDuplicationWarning` is False a warning is shown when a widget has a default value but its value is also set via session state.
54
+
55
+ Raises
56
+ ------
57
+ StreamlitAPIException:
58
+ Raised when the described rule is violated.
59
+ """
60
+ global _shown_default_value_warning
61
+
62
+ if key is None or not runtime.exists():
63
+ return
64
+
65
+ session_state = get_session_state()
66
+ if not session_state.is_new_state_value(key):
67
+ return
68
+
69
+ if not writes_allowed:
70
+ raise StreamlitAPIException(
71
+ f'Values for the widget with key "{key}" cannot be set using `st.session_state`.'
72
+ )
73
+
74
+ if (
75
+ default_value is not None
76
+ and not _shown_default_value_warning
77
+ and not config.get_option("global.disableWidgetStateDuplicationWarning")
78
+ ):
79
+ from streamlit import warning
80
+
81
+ warning(
82
+ f'The widget with key "{key}" was created with a default value but'
83
+ " also had its value set via the Session State API."
84
+ )
85
+ _shown_default_value_warning = True
86
+
87
+
88
+ class CachedWidgetWarning(StreamlitAPIWarning):
89
+ def __init__(self):
90
+ super().__init__(
91
+ """
92
+ Your script uses a widget command in a cached function
93
+ (function decorated with `@st.cache_data` or `@st.cache_resource`).
94
+ This code will only be called when we detect a cache "miss",
95
+ which can lead to unexpected results.
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.
101
+ """
102
+ )
103
+
104
+
105
+ def check_cache_replay_rules() -> None:
106
+ """Check if a widget is allowed to be used in the current context.
107
+ More specifically, this checks if the current context is inside a
108
+ cached function that disallows widget usage. If so, it raises a warning.
109
+
110
+ If there are other similar checks in the future, we could extend this
111
+ function to check for those as well. And rename it to check_widget_usage_rules.
112
+ """
113
+ if runtime.exists():
114
+ # from streamlit.runtime.scriptrunner.script_run_context import get_script_run_ctx
115
+
116
+ ctx = get_script_run_ctx()
117
+ if ctx and ctx.disallow_cached_widget_usage:
118
+ from streamlit import exception
119
+
120
+ # We use an exception here to show a proper stack trace
121
+ # that indicates to the user where the issue is.
122
+ exception(CachedWidgetWarning())
@@ -15,95 +15,13 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  from enum import Enum, EnumMeta
18
- from typing import TYPE_CHECKING, Any, Iterable, Sequence, overload
18
+ from typing import Any, Iterable, Sequence, overload
19
19
 
20
- import streamlit
21
- from streamlit import config, runtime, type_util
22
- from streamlit.elements.form import is_in_form
23
- from streamlit.errors import StreamlitAPIException, StreamlitAPIWarning
20
+ from streamlit import type_util
24
21
  from streamlit.proto.LabelVisibilityMessage_pb2 import LabelVisibilityMessage
25
- from streamlit.runtime.state import WidgetCallback, get_session_state
26
22
  from streamlit.runtime.state.common import RegisterWidgetResult
27
23
  from streamlit.type_util import T
28
24
 
29
- if TYPE_CHECKING:
30
- from streamlit.delta_generator import DeltaGenerator
31
-
32
-
33
- def check_callback_rules(dg: DeltaGenerator, on_change: WidgetCallback | None) -> None:
34
- if runtime.exists() and is_in_form(dg) and on_change is not None:
35
- raise StreamlitAPIException(
36
- "With forms, callbacks can only be defined on the `st.form_submit_button`."
37
- " Defining callbacks on other widgets inside a form is not allowed."
38
- )
39
-
40
-
41
- _shown_default_value_warning: bool = False
42
-
43
-
44
- def check_session_state_rules(
45
- default_value: Any, key: str | None, writes_allowed: bool = True
46
- ) -> None:
47
- global _shown_default_value_warning
48
-
49
- if key is None or not runtime.exists():
50
- return
51
-
52
- session_state = get_session_state()
53
- if not session_state.is_new_state_value(key):
54
- return
55
-
56
- if not writes_allowed:
57
- raise StreamlitAPIException(
58
- f'Values for the widget with key "{key}" cannot be set using `st.session_state`.'
59
- )
60
-
61
- if (
62
- default_value is not None
63
- and not _shown_default_value_warning
64
- and not config.get_option("global.disableWidgetStateDuplicationWarning")
65
- ):
66
- streamlit.warning(
67
- f'The widget with key "{key}" was created with a default value but'
68
- " also had its value set via the Session State API."
69
- )
70
- _shown_default_value_warning = True
71
-
72
-
73
- class CachedWidgetWarning(StreamlitAPIWarning):
74
- def __init__(self):
75
- super().__init__(
76
- """
77
- Your script uses a widget command in a cached function
78
- (function decorated with `@st.cache_data` or `@st.cache_resource`).
79
- This code will only be called when we detect a cache "miss",
80
- which can lead to unexpected results.
81
-
82
- How to fix this:
83
- * Move all widget commands outside the cached function.
84
- * Or, if you know what you're doing, use `experimental_allow_widgets=True`
85
- in the cache decorator to enable widget replay and suppress this warning.
86
- """
87
- )
88
-
89
-
90
- def check_cache_replay_rules() -> None:
91
- """Check if a widget is allowed to be used in the current context.
92
- More specifically, this checks if the current context is inside a
93
- cached function that disallows widget usage. If so, it raises a warning.
94
-
95
- If there are other similar checks in the future, we could extend this
96
- function to check for those as well. And rename it to check_widget_usage_rules.
97
- """
98
- if runtime.exists():
99
- from streamlit.runtime.scriptrunner.script_run_context import get_script_run_ctx
100
-
101
- ctx = get_script_run_ctx()
102
- if ctx and ctx.disallow_cached_widget_usage:
103
- # We use an exception here to show a proper stack trace
104
- # that indicates to the user where the issue is.
105
- streamlit.exception(CachedWidgetWarning())
106
-
107
25
 
108
26
  def get_label_visibility_proto_value(
109
27
  label_visibility_string: type_util.LabelVisibility,
@@ -20,7 +20,7 @@ from typing import TYPE_CHECKING, Literal, Union, cast
20
20
 
21
21
  from typing_extensions import TypeAlias
22
22
 
23
- from streamlit.elements.utils import get_label_visibility_proto_value
23
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
24
24
  from streamlit.errors import StreamlitAPIException
25
25
  from streamlit.proto.Metric_pb2 import Metric as MetricProto
26
26
  from streamlit.runtime.metrics_util import gather_metrics
@@ -38,6 +38,11 @@ from streamlit import type_util
38
38
  from streamlit.deprecation_util import show_deprecation_warning
39
39
  from streamlit.elements.form import current_form_id
40
40
  from streamlit.elements.lib.event_utils import AttributeDictionary
41
+ from streamlit.elements.lib.policies import (
42
+ check_cache_replay_rules,
43
+ check_callback_rules,
44
+ check_session_state_rules,
45
+ )
41
46
  from streamlit.elements.lib.streamlit_plotly_theme import (
42
47
  configure_streamlit_plotly_theme,
43
48
  )
@@ -274,7 +279,11 @@ class PlotlyMixin:
274
279
  key: Key | None = None,
275
280
  on_select: Literal["ignore"], # No default value here to make it work with mypy
276
281
  selection_mode: SelectionMode
277
- | Iterable[SelectionMode] = ("points", "box", "lasso"),
282
+ | Iterable[SelectionMode] = (
283
+ "points",
284
+ "box",
285
+ "lasso",
286
+ ),
278
287
  **kwargs: Any,
279
288
  ) -> DeltaGenerator:
280
289
  ...
@@ -289,7 +298,11 @@ class PlotlyMixin:
289
298
  key: Key | None = None,
290
299
  on_select: Literal["rerun"] | WidgetCallback = "rerun",
291
300
  selection_mode: SelectionMode
292
- | Iterable[SelectionMode] = ("points", "box", "lasso"),
301
+ | Iterable[SelectionMode] = (
302
+ "points",
303
+ "box",
304
+ "lasso",
305
+ ),
293
306
  **kwargs: Any,
294
307
  ) -> PlotlyState:
295
308
  ...
@@ -304,7 +317,11 @@ class PlotlyMixin:
304
317
  key: Key | None = None,
305
318
  on_select: Literal["rerun", "ignore"] | WidgetCallback = "ignore",
306
319
  selection_mode: SelectionMode
307
- | Iterable[SelectionMode] = ("points", "box", "lasso"),
320
+ | Iterable[SelectionMode] = (
321
+ "points",
322
+ "box",
323
+ "lasso",
324
+ ),
308
325
  **kwargs: Any,
309
326
  ) -> DeltaGenerator | PlotlyState:
310
327
  """Display an interactive Plotly chart.
@@ -450,14 +467,6 @@ class PlotlyMixin:
450
467
 
451
468
  if is_selection_activated:
452
469
  # Run some checks that are only relevant when selections are activated
453
-
454
- # Import here to avoid circular imports
455
- from streamlit.elements.utils import (
456
- check_cache_replay_rules,
457
- check_callback_rules,
458
- check_session_state_rules,
459
- )
460
-
461
470
  check_cache_replay_rules()
462
471
  if callable(on_select):
463
472
  check_callback_rules(self.dg, on_select)
@@ -43,6 +43,11 @@ from streamlit.elements.lib.built_in_chart_utils import (
43
43
  generate_chart,
44
44
  )
45
45
  from streamlit.elements.lib.event_utils import AttributeDictionary
46
+ from streamlit.elements.lib.policies import (
47
+ check_cache_replay_rules,
48
+ check_callback_rules,
49
+ check_session_state_rules,
50
+ )
46
51
  from streamlit.errors import StreamlitAPIException
47
52
  from streamlit.proto.ArrowVegaLiteChart_pb2 import (
48
53
  ArrowVegaLiteChart as ArrowVegaLiteChartProto,
@@ -1651,13 +1656,6 @@ class VegaChartsMixin:
1651
1656
  if is_selection_activated:
1652
1657
  # Run some checks that are only relevant when selections are activated
1653
1658
 
1654
- # Import here to avoid circular imports
1655
- from streamlit.elements.utils import (
1656
- check_cache_replay_rules,
1657
- check_callback_rules,
1658
- check_session_state_rules,
1659
- )
1660
-
1661
1659
  check_cache_replay_rules()
1662
1660
  if callable(on_select):
1663
1661
  check_callback_rules(self.dg, on_select)
@@ -24,6 +24,11 @@ from typing_extensions import TypeAlias
24
24
 
25
25
  from streamlit import runtime, source_util
26
26
  from streamlit.elements.form import current_form_id, is_in_form
27
+ from streamlit.elements.lib.policies import (
28
+ check_cache_replay_rules,
29
+ check_callback_rules,
30
+ check_session_state_rules,
31
+ )
27
32
  from streamlit.errors import StreamlitAPIException
28
33
  from streamlit.file_util import get_main_script_directory, normalize_path_join
29
34
  from streamlit.proto.Button_pb2 import Button as ButtonProto
@@ -574,13 +579,6 @@ class ButtonMixin:
574
579
  ) -> bool:
575
580
  key = to_key(key)
576
581
 
577
- # Importing these functions here to avoid circular imports
578
- from streamlit.elements.utils import (
579
- check_cache_replay_rules,
580
- check_callback_rules,
581
- check_session_state_rules,
582
- )
583
-
584
582
  check_cache_replay_rules()
585
583
  check_session_state_rules(default_value=None, key=key, writes_allowed=False)
586
584
  check_callback_rules(self.dg, on_click)
@@ -738,13 +736,6 @@ class ButtonMixin:
738
736
  ) -> bool:
739
737
  key = to_key(key)
740
738
 
741
- # Importing these functions here to avoid circular imports
742
- from streamlit.elements.utils import (
743
- check_cache_replay_rules,
744
- check_callback_rules,
745
- check_session_state_rules,
746
- )
747
-
748
739
  if not is_form_submitter:
749
740
  check_callback_rules(self.dg, on_click)
750
741
  check_cache_replay_rules()
@@ -21,12 +21,12 @@ from typing import TYPE_CHECKING, Union, cast
21
21
  from typing_extensions import TypeAlias
22
22
 
23
23
  from streamlit.elements.form import current_form_id
24
- from streamlit.elements.utils import (
24
+ from streamlit.elements.lib.policies import (
25
25
  check_cache_replay_rules,
26
26
  check_callback_rules,
27
27
  check_session_state_rules,
28
- get_label_visibility_proto_value,
29
28
  )
29
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
30
30
  from streamlit.elements.widgets.file_uploader import _get_upload_files
31
31
  from streamlit.proto.CameraInput_pb2 import CameraInput as CameraInputProto
32
32
  from streamlit.proto.Common_pb2 import FileUploaderState as FileUploaderStateProto
@@ -311,7 +311,7 @@ class ChatMixin:
311
311
  default = ""
312
312
  key = to_key(key)
313
313
 
314
- from streamlit.elements.utils import (
314
+ from streamlit.elements.lib.policies import (
315
315
  check_cache_replay_rules,
316
316
  check_callback_rules,
317
317
  check_session_state_rules,
@@ -19,12 +19,12 @@ from textwrap import dedent
19
19
  from typing import TYPE_CHECKING, cast
20
20
 
21
21
  from streamlit.elements.form import current_form_id
22
- from streamlit.elements.utils import (
22
+ from streamlit.elements.lib.policies import (
23
23
  check_cache_replay_rules,
24
24
  check_callback_rules,
25
25
  check_session_state_rules,
26
- get_label_visibility_proto_value,
27
26
  )
27
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
28
28
  from streamlit.proto.Checkbox_pb2 import Checkbox as CheckboxProto
29
29
  from streamlit.runtime.metrics_util import gather_metrics
30
30
  from streamlit.runtime.scriptrunner import ScriptRunContext, get_script_run_ctx
@@ -21,12 +21,12 @@ from typing import cast
21
21
 
22
22
  import streamlit
23
23
  from streamlit.elements.form import current_form_id
24
- from streamlit.elements.utils import (
24
+ from streamlit.elements.lib.policies import (
25
25
  check_cache_replay_rules,
26
26
  check_callback_rules,
27
27
  check_session_state_rules,
28
- get_label_visibility_proto_value,
29
28
  )
29
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
30
30
  from streamlit.errors import StreamlitAPIException
31
31
  from streamlit.proto.ColorPicker_pb2 import ColorPicker as ColorPickerProto
32
32
  from streamlit.runtime.metrics_util import gather_metrics
@@ -55,6 +55,11 @@ from streamlit.elements.lib.column_config_utils import (
55
55
  update_column_config,
56
56
  )
57
57
  from streamlit.elements.lib.pandas_styler_utils import marshall_styler
58
+ from streamlit.elements.lib.policies import (
59
+ check_cache_replay_rules,
60
+ check_callback_rules,
61
+ check_session_state_rules,
62
+ )
58
63
  from streamlit.errors import StreamlitAPIException
59
64
  from streamlit.proto.Arrow_pb2 import Arrow as ArrowProto
60
65
  from streamlit.runtime.metrics_util import gather_metrics
@@ -787,11 +792,6 @@ class DataEditorMixin:
787
792
  import pyarrow as pa
788
793
 
789
794
  # Import here to avoid cyclic import warning
790
- from streamlit.elements.utils import (
791
- check_cache_replay_rules,
792
- check_callback_rules,
793
- check_session_state_rules,
794
- )
795
795
 
796
796
  key = to_key(key)
797
797
 
@@ -22,12 +22,12 @@ from typing_extensions import TypeAlias
22
22
 
23
23
  from streamlit import config
24
24
  from streamlit.elements.form import current_form_id
25
- from streamlit.elements.utils import (
25
+ from streamlit.elements.lib.policies import (
26
26
  check_cache_replay_rules,
27
27
  check_callback_rules,
28
28
  check_session_state_rules,
29
- get_label_visibility_proto_value,
30
29
  )
30
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
31
31
  from streamlit.proto.Common_pb2 import FileUploaderState as FileUploaderStateProto
32
32
  from streamlit.proto.Common_pb2 import UploadedFileInfo as UploadedFileInfoProto
33
33
  from streamlit.proto.FileUploader_pb2 import FileUploader as FileUploaderProto
@@ -19,10 +19,12 @@ from textwrap import dedent
19
19
  from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, cast, overload
20
20
 
21
21
  from streamlit.elements.form import current_form_id
22
- from streamlit.elements.utils import (
22
+ from streamlit.elements.lib.policies import (
23
23
  check_cache_replay_rules,
24
24
  check_callback_rules,
25
25
  check_session_state_rules,
26
+ )
27
+ from streamlit.elements.lib.utils import (
26
28
  get_label_visibility_proto_value,
27
29
  maybe_coerce_enum_sequence,
28
30
  )
@@ -22,12 +22,12 @@ from typing import TYPE_CHECKING, Literal, Union, cast, overload
22
22
  from typing_extensions import TypeAlias
23
23
 
24
24
  from streamlit.elements.form import current_form_id
25
- from streamlit.elements.utils import (
25
+ from streamlit.elements.lib.policies import (
26
26
  check_cache_replay_rules,
27
27
  check_callback_rules,
28
28
  check_session_state_rules,
29
- get_label_visibility_proto_value,
30
29
  )
30
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
31
31
  from streamlit.errors import StreamlitAPIException
32
32
  from streamlit.js_number import JSNumber, JSNumberBoundsException
33
33
  from streamlit.proto.NumberInput_pb2 import NumberInput as NumberInputProto
@@ -19,10 +19,12 @@ from textwrap import dedent
19
19
  from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, cast
20
20
 
21
21
  from streamlit.elements.form import current_form_id
22
- from streamlit.elements.utils import (
22
+ from streamlit.elements.lib.policies import (
23
23
  check_cache_replay_rules,
24
24
  check_callback_rules,
25
25
  check_session_state_rules,
26
+ )
27
+ from streamlit.elements.lib.utils import (
26
28
  get_label_visibility_proto_value,
27
29
  maybe_coerce_enum,
28
30
  )
@@ -21,10 +21,12 @@ from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, Tuple, cast
21
21
  from typing_extensions import TypeGuard
22
22
 
23
23
  from streamlit.elements.form import current_form_id
24
- from streamlit.elements.utils import (
24
+ from streamlit.elements.lib.policies import (
25
25
  check_cache_replay_rules,
26
26
  check_callback_rules,
27
27
  check_session_state_rules,
28
+ )
29
+ from streamlit.elements.lib.utils import (
28
30
  get_label_visibility_proto_value,
29
31
  maybe_coerce_enum,
30
32
  maybe_coerce_enum_sequence,
@@ -18,10 +18,12 @@ from textwrap import dedent
18
18
  from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, cast
19
19
 
20
20
  from streamlit.elements.form import current_form_id
21
- from streamlit.elements.utils import (
21
+ from streamlit.elements.lib.policies import (
22
22
  check_cache_replay_rules,
23
23
  check_callback_rules,
24
24
  check_session_state_rules,
25
+ )
26
+ from streamlit.elements.lib.utils import (
25
27
  get_label_visibility_proto_value,
26
28
  maybe_coerce_enum,
27
29
  )
@@ -23,12 +23,12 @@ from typing import TYPE_CHECKING, Any, Final, Sequence, Tuple, TypeVar, Union, c
23
23
  from typing_extensions import TypeAlias
24
24
 
25
25
  from streamlit.elements.form import current_form_id
26
- from streamlit.elements.utils import (
26
+ from streamlit.elements.lib.policies import (
27
27
  check_cache_replay_rules,
28
28
  check_callback_rules,
29
29
  check_session_state_rules,
30
- get_label_visibility_proto_value,
31
30
  )
31
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
32
32
  from streamlit.errors import StreamlitAPIException
33
33
  from streamlit.js_number import JSNumber, JSNumberBoundsException
34
34
  from streamlit.proto.Slider_pb2 import Slider as SliderProto
@@ -19,12 +19,12 @@ from textwrap import dedent
19
19
  from typing import TYPE_CHECKING, Literal, cast, overload
20
20
 
21
21
  from streamlit.elements.form import current_form_id
22
- from streamlit.elements.utils import (
22
+ from streamlit.elements.lib.policies import (
23
23
  check_cache_replay_rules,
24
24
  check_callback_rules,
25
25
  check_session_state_rules,
26
- get_label_visibility_proto_value,
27
26
  )
27
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
28
28
  from streamlit.errors import StreamlitAPIException
29
29
  from streamlit.proto.TextArea_pb2 import TextArea as TextAreaProto
30
30
  from streamlit.proto.TextInput_pb2 import TextInput as TextInputProto
@@ -33,12 +33,12 @@ from typing import (
33
33
  from typing_extensions import TypeAlias
34
34
 
35
35
  from streamlit.elements.form import current_form_id
36
- from streamlit.elements.utils import (
36
+ from streamlit.elements.lib.policies import (
37
37
  check_cache_replay_rules,
38
38
  check_callback_rules,
39
39
  check_session_state_rules,
40
- get_label_visibility_proto_value,
41
40
  )
41
+ from streamlit.elements.lib.utils import get_label_visibility_proto_value
42
42
  from streamlit.errors import StreamlitAPIException
43
43
  from streamlit.proto.DateInput_pb2 import DateInput as DateInputProto
44
44
  from streamlit.proto.TimeInput_pb2 import TimeInput as TimeInputProto