streamlit-nightly 1.36.1.dev20240630__py2.py3-none-any.whl → 1.36.1.dev20240703__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 (61) hide show
  1. streamlit/commands/navigation.py +2 -2
  2. streamlit/components/v1/component_arrow.py +16 -11
  3. streamlit/components/v1/custom_component.py +2 -1
  4. streamlit/config.py +1 -136
  5. streamlit/dataframe_util.py +835 -0
  6. streamlit/delta_generator.py +5 -3
  7. streamlit/elements/arrow.py +17 -13
  8. streamlit/elements/dialog_decorator.py +1 -1
  9. streamlit/elements/exception.py +2 -8
  10. streamlit/elements/image.py +2 -1
  11. streamlit/elements/lib/built_in_chart_utils.py +78 -12
  12. streamlit/elements/lib/column_config_utils.py +1 -1
  13. streamlit/elements/lib/pandas_styler_utils.py +2 -2
  14. streamlit/elements/lib/policies.py +20 -2
  15. streamlit/elements/lib/utils.py +100 -10
  16. streamlit/elements/map.py +2 -2
  17. streamlit/elements/media.py +1 -1
  18. streamlit/elements/metric.py +5 -2
  19. streamlit/elements/plotly_chart.py +1 -1
  20. streamlit/elements/pyplot.py +26 -39
  21. streamlit/elements/vega_charts.py +6 -5
  22. streamlit/elements/widgets/button.py +1 -1
  23. streamlit/elements/widgets/camera_input.py +7 -2
  24. streamlit/elements/widgets/chat.py +1 -1
  25. streamlit/elements/widgets/checkbox.py +7 -2
  26. streamlit/elements/widgets/color_picker.py +7 -2
  27. streamlit/elements/widgets/data_editor.py +10 -9
  28. streamlit/elements/widgets/file_uploader.py +7 -2
  29. streamlit/elements/widgets/multiselect.py +6 -7
  30. streamlit/elements/widgets/number_input.py +7 -2
  31. streamlit/elements/widgets/radio.py +6 -7
  32. streamlit/elements/widgets/select_slider.py +6 -7
  33. streamlit/elements/widgets/selectbox.py +6 -7
  34. streamlit/elements/widgets/slider.py +7 -2
  35. streamlit/elements/widgets/text_widgets.py +8 -5
  36. streamlit/elements/widgets/time_widgets.py +7 -2
  37. streamlit/elements/write.py +5 -5
  38. streamlit/errors.py +0 -29
  39. streamlit/navigation/page.py +8 -3
  40. streamlit/proto/NewSession_pb2.pyi +1 -1
  41. streamlit/runtime/app_session.py +0 -4
  42. streamlit/runtime/caching/cache_utils.py +1 -1
  43. streamlit/runtime/scriptrunner/script_runner.py +7 -22
  44. streamlit/runtime/state/common.py +51 -2
  45. streamlit/runtime/state/session_state.py +2 -1
  46. streamlit/runtime/state/session_state_proxy.py +1 -1
  47. streamlit/runtime/state/widgets.py +1 -1
  48. streamlit/static/asset-manifest.json +2 -2
  49. streamlit/static/index.html +1 -1
  50. streamlit/static/static/js/main.28e3c6e9.js +2 -0
  51. streamlit/testing/v1/element_tree.py +3 -3
  52. streamlit/type_util.py +0 -1069
  53. streamlit/watcher/path_watcher.py +1 -2
  54. {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/METADATA +1 -1
  55. {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/RECORD +60 -59
  56. {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/WHEEL +1 -1
  57. streamlit/static/static/js/main.0326e951.js +0 -2
  58. /streamlit/static/static/js/{main.0326e951.js.LICENSE.txt → main.28e3c6e9.js.LICENSE.txt} +0 -0
  59. {streamlit_nightly-1.36.1.dev20240630.data → streamlit_nightly-1.36.1.dev20240703.data}/scripts/streamlit.cmd +0 -0
  60. {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/entry_points.txt +0 -0
  61. {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/top_level.txt +0 -0
@@ -69,7 +69,7 @@ def navigation(
69
69
  ``streamlit run``) acts like a router or frame of common elements around
70
70
  each of your pages. Streamlit executes the entrypoint file with every app
71
71
  rerun. To execute the current page, you must call the ``.run()`` method on
72
- the page object returned by ``st.navigation``.
72
+ the ``StreamlitPage`` object returned by ``st.navigation``.
73
73
 
74
74
  The set of available pages can be updated with each rerun for dynamic
75
75
  navigation. By default, ``st.navigation`` draws the available pages in the
@@ -155,7 +155,7 @@ def navigation(
155
155
  >>> st.sidebar.selectbox("Foo", ["A", "B", "C"], key="foo")
156
156
  >>> st.sidebar.checkbox("Bar", key="bar")
157
157
  >>>
158
- >>> pg = st.navigation(st.Page(page1), st.Page(page2))
158
+ >>> pg = st.navigation([st.Page(page1), st.Page(page2)])
159
159
  >>> pg.run()
160
160
 
161
161
  """
@@ -20,7 +20,7 @@ from __future__ import annotations
20
20
 
21
21
  from typing import TYPE_CHECKING, Any
22
22
 
23
- from streamlit import type_util
23
+ from streamlit import dataframe_util, type_util
24
24
  from streamlit.elements.lib import pandas_styler_utils
25
25
 
26
26
  if TYPE_CHECKING:
@@ -29,6 +29,11 @@ if TYPE_CHECKING:
29
29
  from streamlit.proto.Components_pb2 import ArrowTable as ArrowTableProto
30
30
 
31
31
 
32
+ def _maybe_tuple_to_list(item: Any) -> Any:
33
+ """Convert a tuple to a list. Leave as is if it's not a tuple."""
34
+ return list(item) if isinstance(item, tuple) else item
35
+
36
+
32
37
  def marshall(
33
38
  proto: ArrowTableProto, data: Any, default_uuid: str | None = None
34
39
  ) -> None:
@@ -43,10 +48,10 @@ def marshall(
43
48
  Something that is or can be converted to a dataframe.
44
49
 
45
50
  """
46
- if type_util.is_pandas_styler(data):
51
+ if dataframe_util.is_pandas_styler(data):
47
52
  pandas_styler_utils.marshall_styler(proto, data, default_uuid) # type: ignore
48
53
 
49
- df = type_util.convert_anything_to_df(data)
54
+ df = dataframe_util.convert_anything_to_pandas_df(data)
50
55
  _marshall_index(proto, df.index)
51
56
  _marshall_columns(proto, df.columns)
52
57
  _marshall_data(proto, df)
@@ -67,9 +72,9 @@ def _marshall_index(proto: ArrowTableProto, index: Index) -> None:
67
72
  """
68
73
  import pandas as pd
69
74
 
70
- index = map(type_util.maybe_tuple_to_list, index.values)
75
+ index = map(_maybe_tuple_to_list, index.values)
71
76
  index_df = pd.DataFrame(index)
72
- proto.index = type_util.data_frame_to_bytes(index_df)
77
+ proto.index = dataframe_util.data_frame_to_bytes(index_df)
73
78
 
74
79
 
75
80
  def _marshall_columns(proto: ArrowTableProto, columns: Series) -> None:
@@ -87,9 +92,9 @@ def _marshall_columns(proto: ArrowTableProto, columns: Series) -> None:
87
92
  """
88
93
  import pandas as pd
89
94
 
90
- columns = map(type_util.maybe_tuple_to_list, columns.values)
95
+ columns = map(_maybe_tuple_to_list, columns.values)
91
96
  columns_df = pd.DataFrame(columns)
92
- proto.columns = type_util.data_frame_to_bytes(columns_df)
97
+ proto.columns = dataframe_util.data_frame_to_bytes(columns_df)
93
98
 
94
99
 
95
100
  def _marshall_data(proto: ArrowTableProto, df: DataFrame) -> None:
@@ -104,7 +109,7 @@ def _marshall_data(proto: ArrowTableProto, df: DataFrame) -> None:
104
109
  A dataframe to marshall.
105
110
 
106
111
  """
107
- proto.data = type_util.data_frame_to_bytes(df)
112
+ proto.data = dataframe_util.data_frame_to_bytes(df)
108
113
 
109
114
 
110
115
  def arrow_proto_to_dataframe(proto: ArrowTableProto) -> DataFrame:
@@ -125,9 +130,9 @@ def arrow_proto_to_dataframe(proto: ArrowTableProto) -> DataFrame:
125
130
 
126
131
  import pandas as pd
127
132
 
128
- data = type_util.bytes_to_data_frame(proto.data)
129
- index = type_util.bytes_to_data_frame(proto.index)
130
- columns = type_util.bytes_to_data_frame(proto.columns)
133
+ data = dataframe_util.bytes_to_data_frame(proto.data)
134
+ index = dataframe_util.bytes_to_data_frame(proto.index)
135
+ columns = dataframe_util.bytes_to_data_frame(proto.columns)
131
136
 
132
137
  return pd.DataFrame(
133
138
  data.values, index=index.values.T.tolist(), columns=columns.values.T.tolist()
@@ -18,6 +18,7 @@ import json
18
18
  from typing import TYPE_CHECKING, Any
19
19
 
20
20
  from streamlit.components.types.base_custom_component import BaseCustomComponent
21
+ from streamlit.dataframe_util import is_dataframe_like
21
22
  from streamlit.delta_generator import main_dg
22
23
  from streamlit.elements.form import current_form_id
23
24
  from streamlit.elements.lib.policies import check_cache_replay_rules
@@ -29,7 +30,7 @@ from streamlit.runtime.metrics_util import gather_metrics
29
30
  from streamlit.runtime.scriptrunner import get_script_run_ctx
30
31
  from streamlit.runtime.state import NoValue, register_widget
31
32
  from streamlit.runtime.state.common import compute_widget_id
32
- from streamlit.type_util import is_bytes_like, is_dataframe_like, to_bytes
33
+ from streamlit.type_util import is_bytes_like, to_bytes
33
34
 
34
35
  if TYPE_CHECKING:
35
36
  from streamlit.delta_generator import DeltaGenerator
streamlit/config.py CHANGED
@@ -95,8 +95,6 @@ def set_user_option(key: str, value: Any) -> None:
95
95
 
96
96
  Currently, only the following config options can be set within the script itself:
97
97
  * client.caching
98
- * client.displayEnabled
99
- * deprecation.*
100
98
 
101
99
  Calling with any other options will raise StreamlitAPIException.
102
100
 
@@ -270,23 +268,6 @@ def _delete_option(key: str) -> None:
270
268
 
271
269
  _create_section("global", "Global options that apply across all of Streamlit.")
272
270
 
273
- _create_option(
274
- "global.disableWatchdogWarning",
275
- description="""
276
- By default, Streamlit checks if the Python watchdog module is available
277
- and, if not, prints a warning asking for you to install it. The watchdog
278
- module is not required, but highly recommended. It improves Streamlit's
279
- ability to detect changes to files in your filesystem.
280
-
281
- If you'd like to turn off this warning, set this to True.
282
- """,
283
- default_val=False,
284
- type_=bool,
285
- deprecated=True,
286
- deprecation_text="global.disableWatchdogWarning has been deprecated and will be removed in a future version.",
287
- expiration_date="2024-01-20",
288
- )
289
-
290
271
 
291
272
  _create_option(
292
273
  "global.disableWidgetStateDuplicationWarning",
@@ -328,18 +309,6 @@ def _global_development_mode() -> bool:
328
309
  )
329
310
 
330
311
 
331
- _create_option(
332
- "global.logLevel",
333
- description="""Level of logging: 'error', 'warning', 'info', or 'debug'.
334
-
335
- Default: 'info'
336
- """,
337
- deprecated=True,
338
- deprecation_text="global.logLevel has been replaced with logger.level",
339
- expiration_date="2020-11-30",
340
- replaced_by="logger.level",
341
- )
342
-
343
312
  _create_option(
344
313
  "global.e2eTest",
345
314
  description="Are we in an e2e (playwright) test? Set automatically when our e2e tests are running.",
@@ -401,21 +370,6 @@ _create_option(
401
370
  type_=bool,
402
371
  )
403
372
 
404
- _create_option(
405
- "global.dataFrameSerialization",
406
- description="""
407
- DataFrame serialization.
408
-
409
- Acceptable values:
410
- - 'legacy': Serialize DataFrames using Streamlit's custom format. Slow
411
- but battle-tested.
412
- - 'arrow': Serialize DataFrames using Apache Arrow. Much faster and versatile.""",
413
- default_val="arrow",
414
- type_=str,
415
- deprecated=True,
416
- deprecation_text="Legacy serialization has been removed. All dataframes will be serialized using Apache Arrow.",
417
- expiration_date="2023-11-01",
418
- )
419
373
 
420
374
  # Config Section: Logger #
421
375
  _create_section("logger", "Settings to customize Streamlit log messages.")
@@ -427,9 +381,7 @@ def _logger_log_level() -> str:
427
381
 
428
382
  Default: 'info'
429
383
  """
430
- if get_option("global.logLevel"):
431
- return str(get_option("global.logLevel"))
432
- elif get_option("global.developmentMode"):
384
+ if get_option("global.developmentMode"):
433
385
  return "debug"
434
386
  else:
435
387
  return "info"
@@ -471,17 +423,6 @@ _create_option(
471
423
 
472
424
  _create_section("client", "Settings for scripts that use Streamlit.")
473
425
 
474
- _create_option(
475
- "client.displayEnabled",
476
- description="""If false, makes your Streamlit script not draw to a
477
- Streamlit app.""",
478
- default_val=True,
479
- type_=bool,
480
- scriptable=True,
481
- deprecated=True,
482
- deprecation_text="client.displayEnabled has been deprecated and will be removed in a future version.",
483
- expiration_date="2024-01-20",
484
- )
485
426
 
486
427
  _create_option(
487
428
  "client.showErrorDetails",
@@ -544,33 +485,6 @@ _create_option(
544
485
  type_=bool,
545
486
  )
546
487
 
547
- _create_option(
548
- "runner.installTracer",
549
- description="""
550
- Install a Python tracer to allow you to stop or pause your script at
551
- any point and introspect it. As a side-effect, this slows down your
552
- script's execution.
553
- """,
554
- default_val=False,
555
- type_=bool,
556
- deprecated=True,
557
- deprecation_text="runner.installTracer has been deprecated and will be removed in a future version.",
558
- expiration_date="2024-01-20",
559
- )
560
-
561
- _create_option(
562
- "runner.fixMatplotlib",
563
- description="""
564
- Sets the MPLBACKEND environment variable to Agg inside Streamlit to
565
- prevent Python crashing.
566
- """,
567
- default_val=True,
568
- deprecated=True,
569
- deprecation_text="runner.fixMatplotlib has been deprecated and will be removed in a future version.",
570
- expiration_date="2024-01-20",
571
- type_=bool,
572
- )
573
-
574
488
  _create_option(
575
489
  "runner.postScriptGC",
576
490
  description="""
@@ -925,17 +839,6 @@ _create_option(
925
839
  visibility="hidden",
926
840
  )
927
841
 
928
- _create_option(
929
- "ui.hideSidebarNav",
930
- description="Flag to hide the sidebar page navigation component.",
931
- default_val=False,
932
- type_=bool,
933
- deprecated=True,
934
- deprecation_text="ui.hideSidebarNav has been deprecated and replaced with client.showSidebarNavigation. It will be removed in a future version.",
935
- expiration_date="2024-01-20",
936
- visibility="hidden",
937
- )
938
-
939
842
 
940
843
  # Config Section: Mapbox #
941
844
 
@@ -982,44 +885,6 @@ _create_option(
982
885
  )
983
886
 
984
887
 
985
- # Config Section: deprecations
986
-
987
- _create_section("deprecation", "Configuration to show or hide deprecation warnings.")
988
-
989
- _create_option(
990
- "deprecation.showfileUploaderEncoding",
991
- description="Set to false to disable the deprecation warning for the file uploader encoding.",
992
- default_val=True,
993
- scriptable=True,
994
- type_=bool,
995
- deprecated=True,
996
- deprecation_text="deprecation.showfileUploaderEncoding has been deprecated and will be removed in a future version.",
997
- expiration_date="2021-01-06",
998
- )
999
-
1000
- _create_option(
1001
- "deprecation.showImageFormat",
1002
- description="Set to false to disable the deprecation warning for the image format parameter.",
1003
- default_val=True,
1004
- scriptable=True,
1005
- type_=bool,
1006
- deprecated=True,
1007
- deprecation_text="The format parameter for st.image has been removed.",
1008
- expiration_date="2021-03-24",
1009
- )
1010
-
1011
- _create_option(
1012
- "deprecation.showPyplotGlobalUse",
1013
- description="Set to false to disable the deprecation warning for using the global pyplot instance.",
1014
- default_val=True,
1015
- scriptable=True,
1016
- deprecated=True,
1017
- deprecation_text="The support for global pyplot instances is planned to be removed soon.",
1018
- expiration_date="2024-04-15",
1019
- type_=bool,
1020
- )
1021
-
1022
-
1023
888
  # Config Section: Custom Theme #
1024
889
 
1025
890
  _create_section("theme", "Settings to define a custom theme for your Streamlit app.")