streamlit-nightly 1.35.1.dev20240617__py2.py3-none-any.whl → 1.36.1.dev20240621__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 CHANGED
@@ -77,8 +77,6 @@ from streamlit.runtime.caching import (
77
77
  cache_resource as _cache_resource,
78
78
  cache_data as _cache_data,
79
79
  cache as _cache,
80
- experimental_singleton as _experimental_singleton,
81
- experimental_memo as _experimental_memo,
82
80
  )
83
81
  from streamlit.runtime.connection_factory import (
84
82
  connection_factory as _connection,
@@ -113,7 +111,6 @@ from streamlit.commands.page_config import set_page_config as set_page_config
113
111
  from streamlit.commands.execution_control import (
114
112
  stop as stop,
115
113
  rerun as rerun,
116
- experimental_rerun as _experimental_rerun,
117
114
  switch_page as switch_page,
118
115
  )
119
116
 
@@ -239,11 +236,8 @@ connection = _connection
239
236
  # Experimental APIs
240
237
  experimental_dialog = _dialog_decorator
241
238
  experimental_fragment = _fragment
242
- experimental_memo = _experimental_memo
243
- experimental_singleton = _experimental_singleton
244
239
  experimental_user = _UserInfoProxy()
245
240
 
246
-
247
241
  _EXPERIMENTAL_QUERY_PARAMS_DEPRECATE_MSG = "Refer to our [docs page](https://docs.streamlit.io/develop/api-reference/caching-and-state/st.query_params) for more information."
248
242
 
249
243
  experimental_get_query_params = _deprecate_func_name(
@@ -260,11 +254,7 @@ experimental_set_query_params = _deprecate_func_name(
260
254
  _EXPERIMENTAL_QUERY_PARAMS_DEPRECATE_MSG,
261
255
  name_override="query_params",
262
256
  )
263
- experimental_rerun = _experimental_rerun
264
- experimental_data_editor = _main.experimental_data_editor
265
- experimental_connection = _deprecate_func_name(
266
- connection, "experimental_connection", "2024-04-01", name_override="connection"
267
- )
257
+
268
258
 
269
259
  # make it possible to call streamlit.components.v1.html etc. by importing it here
270
260
  # import in the very end to avoid partially-initialized module import errors, because
@@ -18,7 +18,6 @@ import os
18
18
  from typing import Final, NoReturn
19
19
 
20
20
  import streamlit as st
21
- from streamlit.deprecation_util import make_deprecated_name_warning
22
21
  from streamlit.errors import NoSessionContext, StreamlitAPIException
23
22
  from streamlit.file_util import get_main_script_directory, normalize_path_join
24
23
  from streamlit.logger import get_logger
@@ -65,6 +64,12 @@ def rerun() -> NoReturn: # type: ignore[misc]
65
64
 
66
65
  ctx = get_script_run_ctx()
67
66
 
67
+ # TODO: (rerun[scope] project): in order to make it a fragment-scoped rerun, pass
68
+ # the fragment_id_queue to the RerunData object and add the following line:
69
+ # fragment_id_queue=[ctx.current_fragment_id] if scope == "fragment" else []
70
+ # The script_runner RerunException is checking for the fragment_id_queue to decide
71
+ # whether or not to reset the dg_stack.
72
+
68
73
  if ctx and ctx.script_requests:
69
74
  query_string = ctx.query_string
70
75
  page_script_hash = ctx.page_script_hash
@@ -79,22 +84,6 @@ def rerun() -> NoReturn: # type: ignore[misc]
79
84
  st.empty()
80
85
 
81
86
 
82
- @gather_metrics("experimental_rerun")
83
- def experimental_rerun() -> NoReturn:
84
- """Rerun the script immediately.
85
-
86
- When ``st.experimental_rerun()`` is called, the script is halted - no
87
- more statements will be run, and the script will be queued to re-run
88
- from the top.
89
- """
90
- msg = make_deprecated_name_warning("experimental_rerun", "rerun", "2024-04-01")
91
- # Log warning before the rerun, or else it would be interrupted
92
- # by the rerun. We do not send a frontend warning because it wouldn't
93
- # be seen.
94
- _LOGGER.warning(msg)
95
- rerun()
96
-
97
-
98
87
  @gather_metrics("switch_page")
99
88
  def switch_page(page: str | StreamlitPage) -> NoReturn: # type: ignore[misc]
100
89
  """Programmatically switch the current page in a multipage app.
@@ -673,11 +673,16 @@ sidebar_dg = DeltaGenerator(root_container=RootContainer.SIDEBAR, parent=main_dg
673
673
  event_dg = DeltaGenerator(root_container=RootContainer.EVENT, parent=main_dg)
674
674
  bottom_dg = DeltaGenerator(root_container=RootContainer.BOTTOM, parent=main_dg)
675
675
 
676
+
676
677
  # The dg_stack tracks the currently active DeltaGenerator, and is pushed to when
677
678
  # a DeltaGenerator is entered via a `with` block. This is implemented as a ContextVar
678
679
  # so that different threads or async tasks can have their own stacks.
680
+ def get_default_dg_stack() -> tuple[DeltaGenerator, ...]:
681
+ return (main_dg,)
682
+
683
+
679
684
  dg_stack: ContextVar[tuple[DeltaGenerator, ...]] = ContextVar(
680
- "dg_stack", default=(main_dg,)
685
+ "dg_stack", default=get_default_dg_stack()
681
686
  )
682
687
 
683
688
 
@@ -39,7 +39,6 @@ from typing_extensions import TypeAlias
39
39
 
40
40
  from streamlit import logger as _logger
41
41
  from streamlit import type_util
42
- from streamlit.deprecation_util import deprecate_func_name
43
42
  from streamlit.elements.form import current_form_id
44
43
  from streamlit.elements.lib.column_config_utils import (
45
44
  INDEX_IDENTIFIER,
@@ -602,14 +601,6 @@ class DataEditorMixin:
602
601
 
603
602
  The data editor widget allows you to edit dataframes and many other data structures in a table-like UI.
604
603
 
605
- .. warning::
606
- When going from ``st.experimental_data_editor`` to ``st.data_editor`` in
607
- 1.23.0, the data editor's representation in ``st.session_state`` was changed.
608
- The ``edited_cells`` dictionary is now called ``edited_rows`` and uses a
609
- different format (``{0: {"column name": "edited value"}}`` instead of
610
- ``{"0:1": "edited value"}``). You may need to adjust the code if your app uses
611
- ``st.experimental_data_editor`` in combination with ``st.session_state``.
612
-
613
604
  Parameters
614
605
  ----------
615
606
  data : pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.DataFrame, list, set, tuple, dict, or None
@@ -951,17 +942,3 @@ class DataEditorMixin:
951
942
  def dg(self) -> DeltaGenerator:
952
943
  """Get our DeltaGenerator."""
953
944
  return cast("DeltaGenerator", self)
954
-
955
- # TODO(lukasmasuch): Remove the deprecated function name after 2023-09-01:
956
- # Also remove the warning message in the `st.data_editor` docstring.
957
- experimental_data_editor = deprecate_func_name(
958
- gather_metrics("experimental_data_editor", data_editor),
959
- "experimental_data_editor",
960
- "2023-09-01",
961
- """
962
- **Breaking change:** The data editor's representation in `st.session_state` was changed. The `edited_cells` dictionary is now called `edited_rows` and uses a
963
- different format (`{0: {"column name": "edited value"}}` instead of
964
- `{"0:1": "edited value"}`). You may need to adjust the code if your app uses
965
- `st.experimental_data_editor` in combination with `st.session_state`."
966
- """,
967
- )