streamlit-nightly 1.32.3.dev20240402__py2.py3-none-any.whl → 1.33.1.dev20240405__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/delta_generator.py +40 -16
- streamlit/elements/spinner.py +1 -1
- streamlit/elements/widgets/chat.py +2 -2
- streamlit/elements/widgets/slider.py +8 -0
- streamlit/static/asset-manifest.json +4 -4
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/2736.914069e5.chunk.js +2 -0
- streamlit/static/static/js/{2736.779ccbc1.chunk.js.LICENSE.txt → 2736.914069e5.chunk.js.LICENSE.txt} +2 -0
- streamlit/static/static/js/8427.b0ed496b.chunk.js +1 -0
- streamlit/static/static/js/{main.6d659dbc.js → main.285df334.js} +2 -2
- {streamlit_nightly-1.32.3.dev20240402.dist-info → streamlit_nightly-1.33.1.dev20240405.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.32.3.dev20240402.dist-info → streamlit_nightly-1.33.1.dev20240405.dist-info}/RECORD +17 -17
- streamlit/static/static/js/2736.779ccbc1.chunk.js +0 -2
- streamlit/static/static/js/8427.44d27448.chunk.js +0 -1
- /streamlit/static/static/js/{main.6d659dbc.js.LICENSE.txt → main.285df334.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.32.3.dev20240402.data → streamlit_nightly-1.33.1.dev20240405.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.32.3.dev20240402.dist-info → streamlit_nightly-1.33.1.dev20240405.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.32.3.dev20240402.dist-info → streamlit_nightly-1.33.1.dev20240405.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.32.3.dev20240402.dist-info → streamlit_nightly-1.33.1.dev20240405.dist-info}/top_level.txt +0 -0
streamlit/delta_generator.py
CHANGED
@@ -119,9 +119,9 @@ ARROW_DELTA_TYPES_THAT_MELT_DATAFRAMES: Final = (
|
|
119
119
|
Value = TypeVar("Value")
|
120
120
|
DG = TypeVar("DG", bound="DeltaGenerator")
|
121
121
|
|
122
|
-
# Type aliases for
|
122
|
+
# Type aliases for Ancestor Block Types
|
123
123
|
BlockType = str
|
124
|
-
|
124
|
+
AncestorBlockTypes = Iterable[BlockType]
|
125
125
|
|
126
126
|
|
127
127
|
_use_warning_has_been_displayed: bool = False
|
@@ -348,7 +348,7 @@ class DeltaGenerator(
|
|
348
348
|
message = (
|
349
349
|
f"Method `{name}()` does not exist for "
|
350
350
|
"`DeltaGenerator` objects. Did you mean "
|
351
|
-
"`st.{name}()`?"
|
351
|
+
f"`st.{name}()`?"
|
352
352
|
)
|
353
353
|
else:
|
354
354
|
message = f"`{name}()` is not a valid Streamlit command."
|
@@ -368,18 +368,27 @@ class DeltaGenerator(
|
|
368
368
|
return dg
|
369
369
|
|
370
370
|
@property
|
371
|
-
def
|
372
|
-
"""Iterate all the block types used by this DeltaGenerator and all
|
373
|
-
its ancestor DeltaGenerators.
|
374
|
-
"""
|
371
|
+
def _ancestors(self) -> Iterable["DeltaGenerator"]:
|
375
372
|
current_dg: DeltaGenerator | None = self
|
376
373
|
while current_dg is not None:
|
377
|
-
|
378
|
-
yield current_dg._block_type
|
374
|
+
yield current_dg
|
379
375
|
current_dg = current_dg._parent
|
380
376
|
|
381
|
-
|
382
|
-
|
377
|
+
@property
|
378
|
+
def _ancestor_block_types(self) -> AncestorBlockTypes:
|
379
|
+
"""Iterate all the block types used by this DeltaGenerator and all
|
380
|
+
its ancestor DeltaGenerators.
|
381
|
+
"""
|
382
|
+
for a in self._ancestors:
|
383
|
+
if a._block_type is not None:
|
384
|
+
yield a._block_type
|
385
|
+
|
386
|
+
def _count_num_of_parent_columns(
|
387
|
+
self, ancestor_block_types: AncestorBlockTypes
|
388
|
+
) -> int:
|
389
|
+
return sum(
|
390
|
+
1 for ancestor_block in ancestor_block_types if ancestor_block == "column"
|
391
|
+
)
|
383
392
|
|
384
393
|
@property
|
385
394
|
def _cursor(self) -> Cursor | None:
|
@@ -509,6 +518,15 @@ class DeltaGenerator(
|
|
509
518
|
"""
|
510
519
|
# Operate on the active DeltaGenerator, in case we're in a `with` block.
|
511
520
|
dg = self._active_dg
|
521
|
+
|
522
|
+
ctx = get_script_run_ctx()
|
523
|
+
if ctx and ctx.current_fragment_id and _writes_directly_to_sidebar(dg):
|
524
|
+
raise StreamlitAPIException(
|
525
|
+
"Calling `st.sidebar` in a function wrapped with `st.experimental_fragment` "
|
526
|
+
"is not supported. To write elements to the sidebar with a fragment, "
|
527
|
+
"call your fragment function inside a `with st.sidebar` context manager."
|
528
|
+
)
|
529
|
+
|
512
530
|
# Warn if we're called from within a legacy @st.cache function
|
513
531
|
legacy_caching.maybe_show_cached_st_function_warning(dg, delta_type)
|
514
532
|
# Warn if we're called from within @st.memo or @st.singleton
|
@@ -587,11 +605,11 @@ class DeltaGenerator(
|
|
587
605
|
# Prevent nested columns & expanders by checking all parents.
|
588
606
|
block_type = block_proto.WhichOneof("type")
|
589
607
|
# Convert the generator to a list, so we can use it multiple times.
|
590
|
-
|
608
|
+
ancestor_block_types = list(dg._ancestor_block_types)
|
591
609
|
|
592
610
|
if block_type == "column":
|
593
611
|
num_of_parent_columns = self._count_num_of_parent_columns(
|
594
|
-
|
612
|
+
ancestor_block_types
|
595
613
|
)
|
596
614
|
if (
|
597
615
|
self._root_container == RootContainer.SIDEBAR
|
@@ -604,15 +622,15 @@ class DeltaGenerator(
|
|
604
622
|
raise StreamlitAPIException(
|
605
623
|
"Columns can only be placed inside other columns up to one level of nesting."
|
606
624
|
)
|
607
|
-
if block_type == "chat_message" and block_type in
|
625
|
+
if block_type == "chat_message" and block_type in ancestor_block_types:
|
608
626
|
raise StreamlitAPIException(
|
609
627
|
"Chat messages cannot nested inside other chat messages."
|
610
628
|
)
|
611
|
-
if block_type == "expandable" and block_type in
|
629
|
+
if block_type == "expandable" and block_type in ancestor_block_types:
|
612
630
|
raise StreamlitAPIException(
|
613
631
|
"Expanders may not be nested inside other expanders."
|
614
632
|
)
|
615
|
-
if block_type == "popover" and block_type in
|
633
|
+
if block_type == "popover" and block_type in ancestor_block_types:
|
616
634
|
raise StreamlitAPIException(
|
617
635
|
"Popovers may not be nested inside other popovers."
|
618
636
|
)
|
@@ -903,3 +921,9 @@ def _enqueue_message(msg: ForwardMsg_pb2.ForwardMsg) -> None:
|
|
903
921
|
msg.delta.fragment_id = ctx.current_fragment_id
|
904
922
|
|
905
923
|
ctx.enqueue(msg)
|
924
|
+
|
925
|
+
|
926
|
+
def _writes_directly_to_sidebar(dg: DG) -> bool:
|
927
|
+
in_sidebar = any(a._root_container == RootContainer.SIDEBAR for a in dg._ancestors)
|
928
|
+
has_container = bool(len(list(dg._ancestor_block_types)))
|
929
|
+
return in_sidebar and not has_container
|
streamlit/elements/spinner.py
CHANGED
@@ -85,7 +85,7 @@ def spinner(text: str = "In progress...", *, _cache: bool = False) -> Iterator[N
|
|
85
85
|
display_message = False
|
86
86
|
with legacy_caching.suppress_cached_st_function_warning():
|
87
87
|
with caching.suppress_cached_st_function_warning():
|
88
|
-
if "chat_message" in set(message._active_dg.
|
88
|
+
if "chat_message" in set(message._active_dg._ancestor_block_types):
|
89
89
|
# Temporary stale element fix:
|
90
90
|
# For chat messages, we are resetting the spinner placeholder to an
|
91
91
|
# empty container instead of an empty placeholder (st.empty) to have
|
@@ -316,10 +316,10 @@ class ChatMixin:
|
|
316
316
|
# Use bottom position if chat input is within the main container
|
317
317
|
# either directly or within a vertical container. If it has any
|
318
318
|
# other container types as parents, we use inline position.
|
319
|
-
|
319
|
+
ancestor_block_types = set(self.dg._active_dg._ancestor_block_types)
|
320
320
|
if (
|
321
321
|
self.dg._active_dg._root_container == RootContainer.MAIN
|
322
|
-
and not
|
322
|
+
and not ancestor_block_types
|
323
323
|
):
|
324
324
|
position = "bottom"
|
325
325
|
else:
|
@@ -604,6 +604,14 @@ class SliderMixin:
|
|
604
604
|
min_value = _date_to_datetime(min_value)
|
605
605
|
max_value = _date_to_datetime(max_value)
|
606
606
|
|
607
|
+
# The frontend will error if the values are equal, so checking here
|
608
|
+
# lets us produce a nicer python error message and stack trace.
|
609
|
+
if min_value == max_value:
|
610
|
+
raise StreamlitAPIException(
|
611
|
+
"Slider `min_value` must be less than the `max_value`."
|
612
|
+
f"\nThe values were {min_value} and {max_value}."
|
613
|
+
)
|
614
|
+
|
607
615
|
# Now, convert to microseconds (so we can serialize datetime to a long)
|
608
616
|
if data_type in TIMELIKE_TYPES:
|
609
617
|
# Restore times/datetimes to original timezone (dates are always naive)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.bf304093.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.285df334.js",
|
5
5
|
"static/js/9336.2d95d840.chunk.js": "./static/js/9336.2d95d840.chunk.js",
|
6
6
|
"static/js/9330.d29313d4.chunk.js": "./static/js/9330.d29313d4.chunk.js",
|
7
7
|
"static/js/7217.d970c074.chunk.js": "./static/js/7217.d970c074.chunk.js",
|
@@ -10,7 +10,7 @@
|
|
10
10
|
"static/js/3092.ad569cc8.chunk.js": "./static/js/3092.ad569cc8.chunk.js",
|
11
11
|
"static/css/43.e3b876c5.chunk.css": "./static/css/43.e3b876c5.chunk.css",
|
12
12
|
"static/js/43.9ae03282.chunk.js": "./static/js/43.9ae03282.chunk.js",
|
13
|
-
"static/js/8427.
|
13
|
+
"static/js/8427.b0ed496b.chunk.js": "./static/js/8427.b0ed496b.chunk.js",
|
14
14
|
"static/js/7323.2808d029.chunk.js": "./static/js/7323.2808d029.chunk.js",
|
15
15
|
"static/js/4185.78230b2a.chunk.js": "./static/js/4185.78230b2a.chunk.js",
|
16
16
|
"static/js/7805.51638fbc.chunk.js": "./static/js/7805.51638fbc.chunk.js",
|
@@ -61,7 +61,7 @@
|
|
61
61
|
"static/js/2187.9469f035.chunk.js": "./static/js/2187.9469f035.chunk.js",
|
62
62
|
"static/js/1479.6709db03.chunk.js": "./static/js/1479.6709db03.chunk.js",
|
63
63
|
"static/js/4132.49bf3f2c.chunk.js": "./static/js/4132.49bf3f2c.chunk.js",
|
64
|
-
"static/js/2736.
|
64
|
+
"static/js/2736.914069e5.chunk.js": "./static/js/2736.914069e5.chunk.js",
|
65
65
|
"static/js/937.a1248039.chunk.js": "./static/js/937.a1248039.chunk.js",
|
66
66
|
"static/media/fireworks.gif": "./static/media/fireworks.0906f02ea43f1018a6d2.gif",
|
67
67
|
"static/media/flake-2.png": "./static/media/flake-2.e3f07d06933dd0e84c24.png",
|
@@ -152,6 +152,6 @@
|
|
152
152
|
},
|
153
153
|
"entrypoints": [
|
154
154
|
"static/css/main.bf304093.css",
|
155
|
-
"static/js/main.
|
155
|
+
"static/js/main.285df334.js"
|
156
156
|
]
|
157
157
|
}
|
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.285df334.js"></script><link href="./static/css/main.bf304093.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|