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.
Files changed (28) hide show
  1. streamlit/__init__.py +1 -0
  2. streamlit/delta_generator.py +15 -6
  3. streamlit/elements/arrow_altair.py +82 -59
  4. streamlit/elements/dataframe_selector.py +108 -60
  5. streamlit/elements/heading.py +29 -15
  6. streamlit/elements/layouts.py +128 -2
  7. streamlit/elements/lib/mutable_status_container.py +179 -0
  8. streamlit/elements/markdown.py +17 -3
  9. streamlit/elements/widgets/button.py +1 -0
  10. streamlit/elements/widgets/chat.py +2 -2
  11. streamlit/elements/widgets/checkbox.py +9 -1
  12. streamlit/elements/widgets/radio.py +9 -6
  13. streamlit/external/langchain/streamlit_callback_handler.py +60 -92
  14. streamlit/proto/Block_pb2.py +13 -13
  15. streamlit/static/asset-manifest.json +3 -3
  16. streamlit/static/index.html +1 -1
  17. streamlit/static/static/js/6853.3c23374a.chunk.js +1 -0
  18. streamlit/static/static/js/main.a097c1ce.js +2 -0
  19. {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/METADATA +1 -1
  20. {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/RECORD +25 -25
  21. streamlit/external/langchain/mutable_expander.py +0 -172
  22. streamlit/static/static/js/6853.a92ae425.chunk.js +0 -1
  23. streamlit/static/static/js/main.59efacbc.js +0 -2
  24. /streamlit/static/static/js/{main.59efacbc.js.LICENSE.txt → main.a097c1ce.js.LICENSE.txt} +0 -0
  25. {streamlit_nightly-1.25.1.dev20230817.data → streamlit_nightly-1.25.1.dev20230819.data}/scripts/streamlit.cmd +0 -0
  26. {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/WHEEL +0 -0
  27. {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/entry_points.txt +0 -0
  28. {streamlit_nightly-1.25.1.dev20230817.dist-info → streamlit_nightly-1.25.1.dev20230819.dist-info}/top_level.txt +0 -0
streamlit/__init__.py CHANGED
@@ -174,6 +174,7 @@ video = _main.video
174
174
  warning = _main.warning
175
175
  write = _main.write
176
176
  color_picker = _main.color_picker
177
+ status = _main.status
177
178
 
178
179
  # Events - Note: these methods cannot be called directly on sidebar (ex: st.sidebar.toast)
179
180
  toast = event.toast
@@ -582,6 +582,7 @@ class DeltaGenerator(
582
582
  def _block(
583
583
  self,
584
584
  block_proto: Block_pb2.Block = Block_pb2.Block(),
585
+ dg_type: type | None = None,
585
586
  ) -> DeltaGenerator:
586
587
  # Operate on the active DeltaGenerator, in case we're in a `with` block.
587
588
  dg = self._active_dg
@@ -629,11 +630,20 @@ class DeltaGenerator(
629
630
  root_container=dg._root_container,
630
631
  parent_path=dg._cursor.parent_path + (dg._cursor.index,),
631
632
  )
632
- block_dg = DeltaGenerator(
633
- root_container=dg._root_container,
634
- cursor=block_cursor,
635
- parent=dg,
636
- block_type=block_type,
633
+
634
+ # `dg_type` param added for st.status container. It allows us to
635
+ # instantiate DeltaGenerator subclasses from the function.
636
+ if dg_type is None:
637
+ dg_type = DeltaGenerator
638
+
639
+ block_dg = cast(
640
+ DeltaGenerator,
641
+ dg_type(
642
+ root_container=dg._root_container,
643
+ cursor=block_cursor,
644
+ parent=dg,
645
+ block_type=block_type,
646
+ ),
637
647
  )
638
648
  # Blocks inherit their parent form ids.
639
649
  # NOTE: Container form ids aren't set in proto.
@@ -903,7 +913,6 @@ def _prep_data_for_add_rows(
903
913
  add_rows_metadata: AddRowsMetadata,
904
914
  is_legacy: bool,
905
915
  ) -> tuple[Data, AddRowsMetadata]:
906
-
907
916
  out_data: Data
908
917
 
909
918
  # For some delta types we have to reshape the data structure
@@ -133,32 +133,32 @@ class ArrowAltairMixin:
133
133
  The color to use for different lines in this chart. This argument
134
134
  can only be supplied by keyword.
135
135
 
136
- For a line chart with just 1 line, this can be:
136
+ For a line chart with just one line, this can be:
137
137
 
138
138
  * None, to use the default color.
139
139
  * A hex string like "#ffaa00" or "#ffaa0088".
140
- * An RGB or RGBA tuple with the red, green, #04f, and alpha
140
+ * An RGB or RGBA tuple with the red, green, blue, and alpha
141
141
  components specified as ints from 0 to 255 or floats from 0.0 to
142
142
  1.0.
143
143
 
144
144
  For a line chart with multiple lines, where the dataframe is in
145
- long format (that is, y is None or just 1 column), this can be:
145
+ long format (that is, y is None or just one column), this can be:
146
146
 
147
147
  * None, to use the default colors.
148
148
  * The name of a column in the dataset. Data points will be grouped
149
149
  into lines of the same color based on the value of this column.
150
- In addition, if the values in this column in one of the color
150
+ In addition, if the values in this column match one of the color
151
151
  formats above (hex string or color tuple), then that color will
152
152
  be used.
153
153
 
154
154
  For example: if the dataset has 1000 rows, but this column can
155
- only contains the values "adult", "child", "baby",
156
- then those 1000 datapoints will be grouped into 3 lines, whose
155
+ only contains the values "adult", "child", "baby", then
156
+ those 1000 datapoints will be grouped into three lines, whose
157
157
  colors will be automatically selected from the default palette.
158
158
 
159
159
  But, if for the same 1000-row dataset, this column contained
160
160
  the values "#ffaa00", "#f0f", "#0000ff", then then those 1000
161
- datapoints would still be grouped into 3 lines, but their
161
+ datapoints would still be grouped into three lines, but their
162
162
  colors would be "#ffaa00", "#f0f", "#0000ff" this time around.
163
163
 
164
164
  For a line chart with multiple lines, where the dataframe is in
@@ -167,10 +167,8 @@ class ArrowAltairMixin:
167
167
  * None, to use the default colors.
168
168
  * A list of string colors or color tuples to be used for each of
169
169
  the lines in the chart. This list should have the same length
170
- as the number of y values.
171
-
172
- For example, for a chart with have 3 lines this argument can
173
- be set to ``color=["#fd0", "#f0f", "#04f"]``.
170
+ as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
171
+ for three lines).
174
172
 
175
173
  width : int
176
174
  The chart width in pixels. If 0, selects the width automatically.
@@ -194,7 +192,7 @@ class ArrowAltairMixin:
194
192
  >>> chart_data = pd.DataFrame(
195
193
  ... np.random.randn(20, 3),
196
194
  ... columns=['a', 'b', 'c'])
197
- ...
195
+ >>>
198
196
  >>> st._arrow_line_chart(chart_data)
199
197
 
200
198
  .. output::
@@ -205,30 +203,40 @@ class ArrowAltairMixin:
205
203
  the color dynamically based on a 3rd column (assuming your dataframe is in
206
204
  long format):
207
205
 
208
- >>> chart_data = pd.DataFrame(
209
- ... np.random.randn(20, 4),
210
- ... columns=['col1', 'col2', 'col3'])
211
- ...
206
+ >>> import streamlit as st
207
+ >>> import pandas as pd
208
+ >>> import numpy as np
209
+ >>>
210
+ >>> chart_data = pd.DataFrame({
211
+ ... 'col1' : np.random.randn(20),
212
+ ... 'col2' : np.random.randn(20),
213
+ ... 'col3' : np.random.choice(['A','B','C'], 20)
214
+ ... })
215
+ >>>
212
216
  >>> st._arrow_line_chart(
213
217
  ... chart_data,
214
- ... x='col1',
215
- ... y='col2',
216
- ... color='col3',
218
+ ... x = 'col1',
219
+ ... y = 'col2',
220
+ ... color = 'col3'
217
221
  ... )
218
222
 
219
223
  Finally, if your dataframe is in wide format, you can group multiple
220
224
  columns under the y argument to show multiple lines with different
221
225
  colors:
222
226
 
227
+ >>> import streamlit as st
228
+ >>> import pandas as pd
229
+ >>> import numpy as np
230
+ >>>
223
231
  >>> chart_data = pd.DataFrame(
224
- ... np.random.randn(20, 4),
225
- ... columns=['col1', 'col2', 'col3'])
226
- ...
232
+ ... np.random.randn(20, 3),
233
+ ... columns = ['col1', 'col2', 'col3'])
234
+ >>>
227
235
  >>> st._arrow_line_chart(
228
236
  ... chart_data,
229
- ... x='col1',
230
- ... y=['col2', 'col3'],
231
- ... color=['red', 'black'],
237
+ ... x = 'col1',
238
+ ... y = ['col2', 'col3'],
239
+ ... color = ['#FF0000', '#0000FF'] # Optional
232
240
  ... )
233
241
 
234
242
  """
@@ -294,17 +302,17 @@ class ArrowAltairMixin:
294
302
 
295
303
  * None, to use the default color.
296
304
  * A hex string like "#ffaa00" or "#ffaa0088".
297
- * An RGB or RGBA tuple with the red, green, #04f, and alpha
305
+ * An RGB or RGBA tuple with the red, green, blue, and alpha
298
306
  components specified as ints from 0 to 255 or floats from 0.0 to
299
307
  1.0.
300
308
 
301
309
  For an area chart with multiple series, where the dataframe is in
302
- long format (that is, y is None or just 1 column), this can be:
310
+ long format (that is, y is None or just one column), this can be:
303
311
 
304
312
  * None, to use the default colors.
305
313
  * The name of a column in the dataset. Data points will be grouped
306
314
  into series of the same color based on the value of this column.
307
- In addition, if the values in this column in one of the color
315
+ In addition, if the values in this column match one of the color
308
316
  formats above (hex string or color tuple), then that color will
309
317
  be used.
310
318
 
@@ -324,10 +332,8 @@ class ArrowAltairMixin:
324
332
  * None, to use the default colors.
325
333
  * A list of string colors or color tuples to be used for each of
326
334
  the series in the chart. This list should have the same length
327
- as the number of y values.
328
-
329
- For example, for a chart with have 3 series this argument can
330
- be set to ``color=["#fd0", "#f0f", "#04f"]``.
335
+ as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
336
+ for three lines).
331
337
 
332
338
  width : int
333
339
  The chart width in pixels. If 0, selects the width automatically.
@@ -349,8 +355,8 @@ class ArrowAltairMixin:
349
355
  >>>
350
356
  >>> chart_data = pd.DataFrame(
351
357
  ... np.random.randn(20, 3),
352
- ... columns=['a', 'b', 'c'])
353
- ...
358
+ ... columns = ['a', 'b', 'c'])
359
+ >>>
354
360
  >>> st._arrow_area_chart(chart_data)
355
361
 
356
362
  .. output::
@@ -361,30 +367,40 @@ class ArrowAltairMixin:
361
367
  the color dynamically based on a 3rd column (assuming your dataframe is in
362
368
  long format):
363
369
 
364
- >>> chart_data = pd.DataFrame(
365
- ... np.random.randn(20, 4),
366
- ... columns=['col1', 'col2', 'col3'])
367
- ...
370
+ >>> import streamlit as st
371
+ >>> import pandas as pd
372
+ >>> import numpy as np
373
+ >>>
374
+ >>> chart_data = pd.DataFrame({
375
+ ... 'col1' : np.random.randn(20),
376
+ ... 'col2' : np.random.randn(20),
377
+ ... 'col3' : np.random.choice(['A', 'B', 'C'], 20)
378
+ ... })
379
+ >>>
368
380
  >>> st._arrow_area_chart(
369
381
  ... chart_data,
370
- ... x='col1',
371
- ... y='col2',
372
- ... color='col3',
382
+ ... x = 'col1',
383
+ ... y = 'col2',
384
+ ... color = 'col3'
373
385
  ... )
374
386
 
375
387
  Finally, if your dataframe is in wide format, you can group multiple
376
388
  columns under the y argument to show multiple lines with different
377
389
  colors:
378
390
 
391
+ >>> import streamlit as st
392
+ >>> import pandas as pd
393
+ >>> import numpy as np
394
+ >>>
379
395
  >>> chart_data = pd.DataFrame(
380
- ... np.random.randn(20, 4),
396
+ ... np.random.randn(20, 3),
381
397
  ... columns=['col1', 'col2', 'col3'])
382
398
  ...
383
399
  >>> st._arrow_area_chart(
384
400
  ... chart_data,
385
401
  ... x='col1',
386
402
  ... y=['col2', 'col3'],
387
- ... color=['red', 'black'],
403
+ ... color=['#FF0000','#0000FF']
388
404
  ... )
389
405
 
390
406
  """
@@ -451,17 +467,17 @@ class ArrowAltairMixin:
451
467
 
452
468
  * None, to use the default color.
453
469
  * A hex string like "#ffaa00" or "#ffaa0088".
454
- * An RGB or RGBA tuple with the red, green, #04f, and alpha
470
+ * An RGB or RGBA tuple with the red, green, blue, and alpha
455
471
  components specified as ints from 0 to 255 or floats from 0.0 to
456
472
  1.0.
457
473
 
458
474
  For a bar chart with multiple series, where the dataframe is in
459
- long format (that is, y is None or just 1 column), this can be:
475
+ long format (that is, y is None or just one column), this can be:
460
476
 
461
477
  * None, to use the default colors.
462
478
  * The name of a column in the dataset. Data points will be grouped
463
479
  into series of the same color based on the value of this column.
464
- In addition, if the values in this column in one of the color
480
+ In addition, if the values in this column match one of the color
465
481
  formats above (hex string or color tuple), then that color will
466
482
  be used.
467
483
 
@@ -481,10 +497,8 @@ class ArrowAltairMixin:
481
497
  * None, to use the default colors.
482
498
  * A list of string colors or color tuples to be used for each of
483
499
  the series in the chart. This list should have the same length
484
- as the number of y values.
485
-
486
- For example, for a chart with have 3 series this argument can
487
- be set to ``color=["#fd0", "#f0f", "#04f"]``.
500
+ as the number of y values (e.g. ``color=["#fd0", "#f0f", "#04f"]``
501
+ for three lines).
488
502
 
489
503
  width : int
490
504
  The chart width in pixels. If 0, selects the width automatically.
@@ -519,30 +533,39 @@ class ArrowAltairMixin:
519
533
  the color dynamically based on a 3rd column (assuming your dataframe is in
520
534
  long format):
521
535
 
522
- >>> chart_data = pd.DataFrame(
523
- ... np.random.randn(20, 4),
524
- ... columns=['col1', 'col2', 'col3'])
525
- ...
536
+ >>> import streamlit as st
537
+ >>> import pandas as pd
538
+ >>> import numpy as np
539
+ >>>
540
+ >>> chart_data = pd.DataFrame({
541
+ ... 'col1' : np.random.randn(20),
542
+ ... 'col2' : np.random.randn(20),
543
+ ... 'col3' : np.random.choice(['A','B','C'],20)
544
+ ... })
545
+ >>>
526
546
  >>> st._arrow_bar_chart(
527
547
  ... chart_data,
528
548
  ... x='col1',
529
549
  ... y='col2',
530
- ... color='col3',
550
+ ... color='col3'
531
551
  ... )
532
-
533
552
  Finally, if your dataframe is in wide format, you can group multiple
534
553
  columns under the y argument to show multiple lines with different
535
554
  colors:
536
555
 
556
+ >>> import streamlit as st
557
+ >>> import pandas as pd
558
+ >>> import numpy as np
559
+ >>>
537
560
  >>> chart_data = pd.DataFrame(
538
- ... np.random.randn(20, 4),
561
+ ... np.random.randn(20, 3),
539
562
  ... columns=['col1', 'col2', 'col3'])
540
563
  ...
541
564
  >>> st._arrow_bar_chart(
542
565
  ... chart_data,
543
566
  ... x='col1',
544
567
  ... y=['col2', 'col3'],
545
- ... color=['red', 'black'],
568
+ ... color=['#FF0000','#0000FF']
546
569
  ... )
547
570
 
548
571
  """
@@ -1314,7 +1337,7 @@ This does not look like a valid color argument: `{color_from_user}`.
1314
1337
  The color argument can be:
1315
1338
 
1316
1339
  * A hex string like "#ffaa00" or "#ffaa0088".
1317
- * An RGB or RGBA tuple with the red, green, #04f, and alpha
1340
+ * An RGB or RGBA tuple with the red, green, blue, and alpha
1318
1341
  components specified as ints from 0 to 255 or floats from 0.0 to
1319
1342
  1.0.
1320
1343
  * The name of a column.