streamlit-nightly 1.25.1.dev20230817__py2.py3-none-any.whl → 1.25.1.dev20230819__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 -0
- streamlit/delta_generator.py +15 -6
- streamlit/elements/arrow_altair.py +82 -59
- streamlit/elements/dataframe_selector.py +108 -60
- streamlit/elements/heading.py +29 -15
- streamlit/elements/layouts.py +128 -2
- streamlit/elements/lib/mutable_status_container.py +179 -0
- streamlit/elements/markdown.py +17 -3
- streamlit/elements/widgets/button.py +1 -0
- streamlit/elements/widgets/chat.py +2 -2
- streamlit/elements/widgets/checkbox.py +9 -1
- streamlit/elements/widgets/radio.py +9 -6
- streamlit/external/langchain/streamlit_callback_handler.py +60 -92
- streamlit/proto/Block_pb2.py +13 -13
- streamlit/static/asset-manifest.json +3 -3
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/6853.3c23374a.chunk.js +1 -0
- streamlit/static/static/js/main.a097c1ce.js +2 -0
- {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/RECORD +25 -25
- streamlit/external/langchain/mutable_expander.py +0 -172
- streamlit/static/static/js/6853.a92ae425.chunk.js +0 -1
- streamlit/static/static/js/main.59efacbc.js +0 -2
- /streamlit/static/static/js/{main.59efacbc.js.LICENSE.txt → main.a097c1ce.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.25.1.dev20230817.data → streamlit_nightly-1.25.1.dev20230819.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/top_level.txt +0 -0
@@ -273,32 +273,32 @@ class DataFrameSelectorMixin:
|
|
273
273
|
The color to use for different lines in this chart. This argument
|
274
274
|
can only be supplied by keyword.
|
275
275
|
|
276
|
-
For a line chart with just
|
276
|
+
For a line chart with just one line, this can be:
|
277
277
|
|
278
278
|
* None, to use the default color.
|
279
279
|
* A hex string like "#ffaa00" or "#ffaa0088".
|
280
|
-
* An RGB or RGBA tuple with the red, green,
|
280
|
+
* An RGB or RGBA tuple with the red, green, blue, and alpha
|
281
281
|
components specified as ints from 0 to 255 or floats from 0.0 to
|
282
282
|
1.0.
|
283
283
|
|
284
284
|
For a line chart with multiple lines, where the dataframe is in
|
285
|
-
long format (that is, y is None or just
|
285
|
+
long format (that is, y is None or just one column), this can be:
|
286
286
|
|
287
287
|
* None, to use the default colors.
|
288
288
|
* The name of a column in the dataset. Data points will be grouped
|
289
289
|
into lines of the same color based on the value of this column.
|
290
|
-
In addition, if the values in this column
|
290
|
+
In addition, if the values in this column match one of the color
|
291
291
|
formats above (hex string or color tuple), then that color will
|
292
292
|
be used.
|
293
293
|
|
294
294
|
For example: if the dataset has 1000 rows, but this column can
|
295
|
-
only contains the values "adult", "child", "baby",
|
296
|
-
|
295
|
+
only contains the values "adult", "child", "baby", then
|
296
|
+
those 1000 datapoints will be grouped into three lines, whose
|
297
297
|
colors will be automatically selected from the default palette.
|
298
298
|
|
299
299
|
But, if for the same 1000-row dataset, this column contained
|
300
300
|
the values "#ffaa00", "#f0f", "#0000ff", then then those 1000
|
301
|
-
datapoints would still be grouped into
|
301
|
+
datapoints would still be grouped into three lines, but their
|
302
302
|
colors would be "#ffaa00", "#f0f", "#0000ff" this time around.
|
303
303
|
|
304
304
|
For a line chart with multiple lines, where the dataframe is in
|
@@ -307,10 +307,8 @@ class DataFrameSelectorMixin:
|
|
307
307
|
* None, to use the default colors.
|
308
308
|
* A list of string colors or color tuples to be used for each of
|
309
309
|
the lines in the chart. This list should have the same length
|
310
|
-
as the number of y values.
|
311
|
-
|
312
|
-
For example, for a chart with have 3 lines this argument can
|
313
|
-
be set to ``color=["#fd0", "#f0f", "#04f"]``.
|
310
|
+
as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
|
311
|
+
for three lines).
|
314
312
|
|
315
313
|
width : int
|
316
314
|
The chart width in pixels. If 0, selects the width automatically.
|
@@ -334,43 +332,61 @@ class DataFrameSelectorMixin:
|
|
334
332
|
>>> chart_data = pd.DataFrame(
|
335
333
|
... np.random.randn(20, 3),
|
336
334
|
... columns=['a', 'b', 'c'])
|
337
|
-
|
335
|
+
>>>
|
338
336
|
>>> st.line_chart(chart_data)
|
339
337
|
|
340
338
|
.. output::
|
341
339
|
https://doc-line-chart.streamlit.app/
|
342
|
-
height:
|
340
|
+
height: 440px
|
343
341
|
|
344
342
|
You can also choose different columns to use for x and y, as well as set
|
345
343
|
the color dynamically based on a 3rd column (assuming your dataframe is in
|
346
344
|
long format):
|
347
345
|
|
348
|
-
>>>
|
349
|
-
|
350
|
-
|
351
|
-
|
346
|
+
>>> import streamlit as st
|
347
|
+
>>> import pandas as pd
|
348
|
+
>>> import numpy as np
|
349
|
+
>>>
|
350
|
+
>>> chart_data = pd.DataFrame({
|
351
|
+
... 'col1' : np.random.randn(20),
|
352
|
+
... 'col2' : np.random.randn(20),
|
353
|
+
... 'col3' : np.random.choice(['A','B','C'], 20)
|
354
|
+
... })
|
355
|
+
>>>
|
352
356
|
>>> st.line_chart(
|
353
357
|
... chart_data,
|
354
|
-
... x='col1',
|
355
|
-
... y='col2',
|
356
|
-
... color='col3'
|
358
|
+
... x = 'col1',
|
359
|
+
... y = 'col2',
|
360
|
+
... color = 'col3'
|
357
361
|
... )
|
358
362
|
|
363
|
+
.. output::
|
364
|
+
https://doc-line-chart1.streamlit.app/
|
365
|
+
height: 440px
|
366
|
+
|
359
367
|
Finally, if your dataframe is in wide format, you can group multiple
|
360
368
|
columns under the y argument to show multiple lines with different
|
361
369
|
colors:
|
362
370
|
|
371
|
+
>>> import streamlit as st
|
372
|
+
>>> import pandas as pd
|
373
|
+
>>> import numpy as np
|
374
|
+
>>>
|
363
375
|
>>> chart_data = pd.DataFrame(
|
364
|
-
... np.random.randn(20,
|
365
|
-
... columns=['col1', 'col2', 'col3'])
|
366
|
-
|
376
|
+
... np.random.randn(20, 3),
|
377
|
+
... columns = ['col1', 'col2', 'col3'])
|
378
|
+
>>>
|
367
379
|
>>> st.line_chart(
|
368
380
|
... chart_data,
|
369
|
-
... x='col1',
|
370
|
-
... y=['col2', 'col3'],
|
371
|
-
... color=['
|
381
|
+
... x = 'col1',
|
382
|
+
... y = ['col2', 'col3'],
|
383
|
+
... color = ['#FF0000', '#0000FF'] # Optional
|
372
384
|
... )
|
373
385
|
|
386
|
+
.. output::
|
387
|
+
https://doc-line-chart2.streamlit.app/
|
388
|
+
height: 440px
|
389
|
+
|
374
390
|
"""
|
375
391
|
if _use_arrow():
|
376
392
|
return self.dg._arrow_line_chart(
|
@@ -439,17 +455,17 @@ class DataFrameSelectorMixin:
|
|
439
455
|
|
440
456
|
* None, to use the default color.
|
441
457
|
* A hex string like "#ffaa00" or "#ffaa0088".
|
442
|
-
* An RGB or RGBA tuple with the red, green,
|
458
|
+
* An RGB or RGBA tuple with the red, green, blue, and alpha
|
443
459
|
components specified as ints from 0 to 255 or floats from 0.0 to
|
444
460
|
1.0.
|
445
461
|
|
446
462
|
For an area chart with multiple series, where the dataframe is in
|
447
|
-
long format (that is, y is None or just
|
463
|
+
long format (that is, y is None or just one column), this can be:
|
448
464
|
|
449
465
|
* None, to use the default colors.
|
450
466
|
* The name of a column in the dataset. Data points will be grouped
|
451
467
|
into series of the same color based on the value of this column.
|
452
|
-
In addition, if the values in this column
|
468
|
+
In addition, if the values in this column match one of the color
|
453
469
|
formats above (hex string or color tuple), then that color will
|
454
470
|
be used.
|
455
471
|
|
@@ -469,10 +485,8 @@ class DataFrameSelectorMixin:
|
|
469
485
|
* None, to use the default colors.
|
470
486
|
* A list of string colors or color tuples to be used for each of
|
471
487
|
the series in the chart. This list should have the same length
|
472
|
-
as the number of y values.
|
473
|
-
|
474
|
-
For example, for a chart with have 3 series this argument can
|
475
|
-
be set to ``color=["#fd0", "#f0f", "#04f"]``.
|
488
|
+
as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
|
489
|
+
for three lines).
|
476
490
|
|
477
491
|
width : int
|
478
492
|
The chart width in pixels. If 0, selects the width automatically.
|
@@ -495,44 +509,62 @@ class DataFrameSelectorMixin:
|
|
495
509
|
>>>
|
496
510
|
>>> chart_data = pd.DataFrame(
|
497
511
|
... np.random.randn(20, 3),
|
498
|
-
... columns=['a', 'b', 'c'])
|
499
|
-
|
512
|
+
... columns = ['a', 'b', 'c'])
|
513
|
+
>>>
|
500
514
|
>>> st.area_chart(chart_data)
|
501
515
|
|
502
516
|
.. output::
|
503
517
|
https://doc-area-chart.streamlit.app/
|
504
|
-
height:
|
518
|
+
height: 440px
|
505
519
|
|
506
520
|
You can also choose different columns to use for x and y, as well as set
|
507
521
|
the color dynamically based on a 3rd column (assuming your dataframe is in
|
508
522
|
long format):
|
509
523
|
|
510
|
-
>>>
|
511
|
-
|
512
|
-
|
513
|
-
|
524
|
+
>>> import streamlit as st
|
525
|
+
>>> import pandas as pd
|
526
|
+
>>> import numpy as np
|
527
|
+
>>>
|
528
|
+
>>> chart_data = pd.DataFrame({
|
529
|
+
... 'col1' : np.random.randn(20),
|
530
|
+
... 'col2' : np.random.randn(20),
|
531
|
+
... 'col3' : np.random.choice(['A', 'B', 'C'], 20)
|
532
|
+
... })
|
533
|
+
>>>
|
514
534
|
>>> st.area_chart(
|
515
535
|
... chart_data,
|
516
|
-
... x='col1',
|
517
|
-
... y='col2',
|
518
|
-
... color='col3'
|
536
|
+
... x = 'col1',
|
537
|
+
... y = 'col2',
|
538
|
+
... color = 'col3'
|
519
539
|
... )
|
520
540
|
|
541
|
+
.. output::
|
542
|
+
https://doc-area-chart1.streamlit.app/
|
543
|
+
height: 440px
|
544
|
+
|
521
545
|
Finally, if your dataframe is in wide format, you can group multiple
|
522
546
|
columns under the y argument to show multiple series with different
|
523
547
|
colors:
|
524
548
|
|
549
|
+
>>> import streamlit as st
|
550
|
+
>>> import pandas as pd
|
551
|
+
>>> import numpy as np
|
552
|
+
>>>
|
525
553
|
>>> chart_data = pd.DataFrame(
|
526
|
-
... np.random.randn(20,
|
554
|
+
... np.random.randn(20, 3),
|
527
555
|
... columns=['col1', 'col2', 'col3'])
|
528
556
|
...
|
529
557
|
>>> st.area_chart(
|
530
558
|
... chart_data,
|
531
559
|
... x='col1',
|
532
560
|
... y=['col2', 'col3'],
|
533
|
-
... color=['
|
561
|
+
... color=['#FF0000','#0000FF'] # Optional
|
534
562
|
... )
|
535
563
|
|
564
|
+
.. output::
|
565
|
+
https://doc-area-chart2.streamlit.app/
|
566
|
+
height: 440px
|
567
|
+
|
536
568
|
"""
|
537
569
|
if _use_arrow():
|
538
570
|
return self.dg._arrow_area_chart(
|
@@ -601,17 +633,17 @@ class DataFrameSelectorMixin:
|
|
601
633
|
|
602
634
|
* None, to use the default color.
|
603
635
|
* A hex string like "#ffaa00" or "#ffaa0088".
|
604
|
-
* An RGB or RGBA tuple with the red, green,
|
636
|
+
* An RGB or RGBA tuple with the red, green, blue, and alpha
|
605
637
|
components specified as ints from 0 to 255 or floats from 0.0 to
|
606
638
|
1.0.
|
607
639
|
|
608
640
|
For a bar chart with multiple series, where the dataframe is in
|
609
|
-
long format (that is, y is None or just
|
641
|
+
long format (that is, y is None or just one column), this can be:
|
610
642
|
|
611
643
|
* None, to use the default colors.
|
612
644
|
* The name of a column in the dataset. Data points will be grouped
|
613
645
|
into series of the same color based on the value of this column.
|
614
|
-
In addition, if the values in this column
|
646
|
+
In addition, if the values in this column match one of the color
|
615
647
|
formats above (hex string or color tuple), then that color will
|
616
648
|
be used.
|
617
649
|
|
@@ -631,10 +663,8 @@ class DataFrameSelectorMixin:
|
|
631
663
|
* None, to use the default colors.
|
632
664
|
* A list of string colors or color tuples to be used for each of
|
633
665
|
the series in the chart. This list should have the same length
|
634
|
-
as the number of y values.
|
635
|
-
|
636
|
-
For example, for a chart with have 3 series this argument can
|
637
|
-
be set to ``color=["#fd0", "#f0f", "#04f"]``.
|
666
|
+
as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
|
667
|
+
for three lines).
|
638
668
|
|
639
669
|
width : int
|
640
670
|
The chart width in pixels. If 0, selects the width automatically.
|
@@ -663,38 +693,56 @@ class DataFrameSelectorMixin:
|
|
663
693
|
|
664
694
|
.. output::
|
665
695
|
https://doc-bar-chart.streamlit.app/
|
666
|
-
height:
|
696
|
+
height: 440px
|
667
697
|
|
668
698
|
You can also choose different columns to use for x and y, as well as set
|
669
699
|
the color dynamically based on a 3rd column (assuming your dataframe is in
|
670
700
|
long format):
|
671
701
|
|
672
|
-
>>>
|
673
|
-
|
674
|
-
|
675
|
-
|
702
|
+
>>> import streamlit as st
|
703
|
+
>>> import pandas as pd
|
704
|
+
>>> import numpy as np
|
705
|
+
>>>
|
706
|
+
>>> chart_data = pd.DataFrame({
|
707
|
+
... 'col1' : np.random.randn(20),
|
708
|
+
... 'col2' : np.random.randn(20),
|
709
|
+
... 'col3' : np.random.choice(['A','B','C'],20)
|
710
|
+
... })
|
711
|
+
>>>
|
676
712
|
>>> st.bar_chart(
|
677
713
|
... chart_data,
|
678
714
|
... x='col1',
|
679
715
|
... y='col2',
|
680
|
-
... color='col3'
|
716
|
+
... color='col3'
|
681
717
|
... )
|
682
718
|
|
719
|
+
.. output::
|
720
|
+
https://doc-bar-chart1.streamlit.app/
|
721
|
+
height: 440px
|
722
|
+
|
683
723
|
Finally, if your dataframe is in wide format, you can group multiple
|
684
724
|
columns under the y argument to show multiple series with different
|
685
725
|
colors:
|
686
726
|
|
727
|
+
>>> import streamlit as st
|
728
|
+
>>> import pandas as pd
|
729
|
+
>>> import numpy as np
|
730
|
+
>>>
|
687
731
|
>>> chart_data = pd.DataFrame(
|
688
|
-
... np.random.randn(20,
|
732
|
+
... np.random.randn(20, 3),
|
689
733
|
... columns=['col1', 'col2', 'col3'])
|
690
734
|
...
|
691
735
|
>>> st.bar_chart(
|
692
736
|
... chart_data,
|
693
737
|
... x='col1',
|
694
738
|
... y=['col2', 'col3'],
|
695
|
-
... color=['
|
739
|
+
... color=['#FF0000','#0000FF'] # Optional
|
696
740
|
... )
|
697
741
|
|
742
|
+
.. output::
|
743
|
+
https://doc-bar-chart2.streamlit.app/
|
744
|
+
height: 440px
|
745
|
+
|
698
746
|
"""
|
699
747
|
|
700
748
|
if _use_arrow():
|
streamlit/elements/heading.py
CHANGED
@@ -78,18 +78,23 @@ class HeadingMixin:
|
|
78
78
|
An optional tooltip that gets displayed next to the header.
|
79
79
|
|
80
80
|
divider : bool or “blue”, “green”, “orange”, “red”, “violet”, “gray”/"grey", or “rainbow”
|
81
|
-
Shows a colored divider below the header. If True,
|
82
|
-
|
83
|
-
will have a blue line, the second
|
84
|
-
|
85
|
-
red, violet, gray/grey, or
|
81
|
+
Shows a colored divider below the header. If True, successive
|
82
|
+
headers will cycle through divider colors. That is, the first
|
83
|
+
header will have a blue line, the second header will have a
|
84
|
+
green line, and so on. If a string, the color can be set to one of
|
85
|
+
the following: blue, green, orange, red, violet, gray/grey, or
|
86
|
+
rainbow.
|
86
87
|
|
87
88
|
Examples
|
88
89
|
--------
|
89
90
|
>>> import streamlit as st
|
90
91
|
>>>
|
91
|
-
>>> st.header('This is a header')
|
92
|
-
>>> st.header('
|
92
|
+
>>> st.header('This is a header with a divider', divider='rainbow')
|
93
|
+
>>> st.header('_Streamlit_ is :blue[cool] :sunglasses:')
|
94
|
+
|
95
|
+
.. output::
|
96
|
+
https://doc-header.streamlit.app/
|
97
|
+
height: 220px
|
93
98
|
|
94
99
|
"""
|
95
100
|
return self.dg._enqueue(
|
@@ -143,18 +148,23 @@ class HeadingMixin:
|
|
143
148
|
An optional tooltip that gets displayed next to the subheader.
|
144
149
|
|
145
150
|
divider : bool or “blue”, “green”, “orange”, “red”, “violet”, “gray”/"grey", or “rainbow”
|
146
|
-
Shows a colored divider below the header. If True,
|
147
|
-
|
148
|
-
will have a blue line, the second
|
149
|
-
|
150
|
-
red, violet, gray/grey, or
|
151
|
+
Shows a colored divider below the header. If True, successive
|
152
|
+
headers will cycle through divider colors. That is, the first
|
153
|
+
header will have a blue line, the second header will have a
|
154
|
+
green line, and so on. If a string, the color can be set to one of
|
155
|
+
the following: blue, green, orange, red, violet, gray/grey, or
|
156
|
+
rainbow.
|
151
157
|
|
152
158
|
Examples
|
153
159
|
--------
|
154
160
|
>>> import streamlit as st
|
155
161
|
>>>
|
156
|
-
>>> st.subheader('This is a subheader')
|
157
|
-
>>> st.subheader('
|
162
|
+
>>> st.subheader('This is a subheader with a divider', divider='rainbow')
|
163
|
+
>>> st.subheader('_Streamlit_ is :blue[cool] :sunglasses:')
|
164
|
+
|
165
|
+
.. output::
|
166
|
+
https://doc-subheader.streamlit.app/
|
167
|
+
height: 220px
|
158
168
|
|
159
169
|
"""
|
160
170
|
return self.dg._enqueue(
|
@@ -214,7 +224,11 @@ class HeadingMixin:
|
|
214
224
|
>>> import streamlit as st
|
215
225
|
>>>
|
216
226
|
>>> st.title('This is a title')
|
217
|
-
>>> st.title('
|
227
|
+
>>> st.title('_Streamlit_ is :blue[cool] :sunglasses:')
|
228
|
+
|
229
|
+
.. output::
|
230
|
+
https://doc-title.streamlit.app/
|
231
|
+
height: 220px
|
218
232
|
|
219
233
|
"""
|
220
234
|
return self.dg._enqueue(
|
streamlit/elements/layouts.py
CHANGED
@@ -11,7 +11,10 @@
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
|
-
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
17
|
+
from typing import TYPE_CHECKING, List, Literal, Optional, Sequence, Union, cast
|
15
18
|
|
16
19
|
from streamlit.errors import StreamlitAPIException
|
17
20
|
from streamlit.proto.Block_pb2 import Block as BlockProto
|
@@ -19,6 +22,7 @@ from streamlit.runtime.metrics_util import gather_metrics
|
|
19
22
|
|
20
23
|
if TYPE_CHECKING:
|
21
24
|
from streamlit.delta_generator import DeltaGenerator
|
25
|
+
from streamlit.elements.lib.mutable_status_container import StatusContainer
|
22
26
|
|
23
27
|
SpecType = Union[int, Sequence[Union[int, float]]]
|
24
28
|
|
@@ -402,11 +406,133 @@ class LayoutsMixin:
|
|
402
406
|
expandable_proto.label = label
|
403
407
|
|
404
408
|
block_proto = BlockProto()
|
405
|
-
block_proto.allow_empty =
|
409
|
+
block_proto.allow_empty = False
|
406
410
|
block_proto.expandable.CopyFrom(expandable_proto)
|
407
411
|
|
408
412
|
return self.dg._block(block_proto=block_proto)
|
409
413
|
|
414
|
+
@gather_metrics("status")
|
415
|
+
def status(
|
416
|
+
self,
|
417
|
+
label: str,
|
418
|
+
*,
|
419
|
+
expanded: bool = False,
|
420
|
+
state: Literal["running", "complete", "error"] = "running",
|
421
|
+
) -> "StatusContainer":
|
422
|
+
"""Insert a status container to display output from long-running tasks.
|
423
|
+
|
424
|
+
Inserts a container into your app that is typically used to show the status and
|
425
|
+
details of a process or task. The container can hold multiple elements and can
|
426
|
+
be expanded or collapsed by the user similar to ``st.expander``.
|
427
|
+
When collapsed, all that is visible is the status icon and label.
|
428
|
+
|
429
|
+
The label, state, and expanded state can all be updated by calling ``.update()``
|
430
|
+
on the returned object. To add elements to the returned container, you can
|
431
|
+
use "with" notation (preferred) or just call methods directly on the returned
|
432
|
+
object.
|
433
|
+
|
434
|
+
By default, ``st.status()`` initializes in the "running" state. When called using
|
435
|
+
"with" notation, it automatically updates to the "complete" state at the end
|
436
|
+
of the "with" block. See examples below for more details.
|
437
|
+
|
438
|
+
Parameters
|
439
|
+
----------
|
440
|
+
|
441
|
+
label : str
|
442
|
+
The initial label of the status container. The label can optionally
|
443
|
+
contain Markdown and supports the following elements: Bold,
|
444
|
+
Italics, Strikethroughs, Inline Code, Emojis, and Links.
|
445
|
+
|
446
|
+
This also supports:
|
447
|
+
|
448
|
+
* Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
|
449
|
+
For a list of all supported codes,
|
450
|
+
see https://share.streamlit.io/streamlit/emoji-shortcodes.
|
451
|
+
|
452
|
+
* LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
|
453
|
+
must be on their own lines). Supported LaTeX functions are listed
|
454
|
+
at https://katex.org/docs/supported.html.
|
455
|
+
|
456
|
+
* Colored text, using the syntax ``:color[text to be colored]``,
|
457
|
+
where ``color`` needs to be replaced with any of the following
|
458
|
+
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
459
|
+
|
460
|
+
Unsupported elements are unwrapped so only their children (text contents)
|
461
|
+
render. Display unsupported elements as literal characters by
|
462
|
+
backslash-escaping them. E.g. ``1\. Not an ordered list``.
|
463
|
+
|
464
|
+
expanded : bool
|
465
|
+
If True, initializes the status container in "expanded" state. Defaults to
|
466
|
+
False (collapsed).
|
467
|
+
|
468
|
+
state : "running", "complete", or "error"
|
469
|
+
The initial state of the status container which determines which icon is
|
470
|
+
shown:
|
471
|
+
|
472
|
+
* ``running`` (default): A spinner icon is shown.
|
473
|
+
|
474
|
+
* ``complete``: A checkmark icon is shown.
|
475
|
+
|
476
|
+
* ``error``: An error icon is shown.
|
477
|
+
|
478
|
+
Returns
|
479
|
+
-------
|
480
|
+
|
481
|
+
StatusContainer
|
482
|
+
A mutable status container that can hold multiple elements. The label, state,
|
483
|
+
and expanded state can be updated after creation via ``.update()``.
|
484
|
+
|
485
|
+
Examples
|
486
|
+
--------
|
487
|
+
|
488
|
+
You can use `with` notation to insert any element into an status container:
|
489
|
+
|
490
|
+
>>> import time
|
491
|
+
>>> import streamlit as st
|
492
|
+
>>>
|
493
|
+
>>> with st.status("Downloading data..."):
|
494
|
+
... st.write("Searching for data...")
|
495
|
+
... time.sleep(2)
|
496
|
+
... st.write("Found URL.")
|
497
|
+
... time.sleep(1)
|
498
|
+
... st.write("Downloading data...")
|
499
|
+
... time.sleep(1)
|
500
|
+
>>>
|
501
|
+
>>> st.button('Rerun')
|
502
|
+
|
503
|
+
.. output ::
|
504
|
+
https://doc-status.streamlit.app/
|
505
|
+
height: 300px
|
506
|
+
|
507
|
+
You can also use `.update()` on the container to change the label, state,
|
508
|
+
or expanded state:
|
509
|
+
|
510
|
+
>>> import time
|
511
|
+
>>> import streamlit as st
|
512
|
+
>>>
|
513
|
+
>>> with st.status("Downloading data...", expanded=True) as status:
|
514
|
+
... st.write("Searching for data...")
|
515
|
+
... time.sleep(2)
|
516
|
+
... st.write("Found URL.")
|
517
|
+
... time.sleep(1)
|
518
|
+
... st.write("Downloading data...")
|
519
|
+
... time.sleep(1)
|
520
|
+
... status.update(label="Download complete!", state="complete", expanded=False)
|
521
|
+
>>>
|
522
|
+
>>> st.button('Rerun')
|
523
|
+
|
524
|
+
.. output ::
|
525
|
+
https://doc-status-update.streamlit.app/
|
526
|
+
height: 300px
|
527
|
+
|
528
|
+
"""
|
529
|
+
# We need to import StatusContainer here to avoid a circular import
|
530
|
+
from streamlit.elements.lib.mutable_status_container import StatusContainer
|
531
|
+
|
532
|
+
return StatusContainer._create(
|
533
|
+
self.dg, label=label, expanded=expanded, state=state
|
534
|
+
)
|
535
|
+
|
410
536
|
@property
|
411
537
|
def dg(self) -> "DeltaGenerator":
|
412
538
|
"""Get our DeltaGenerator."""
|