streamlit-nightly 1.37.1.dev20240729__py2.py3-none-any.whl → 1.37.1.dev20240730__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
@@ -246,18 +246,8 @@ dialog = _dialog_decorator
246
246
  fragment = _fragment
247
247
 
248
248
  # Experimental APIs
249
- experimental_dialog = _deprecate_func_name(
250
- _experimental_dialog_decorator,
251
- "experimental_dialog",
252
- "2025-01-01",
253
- name_override="dialog",
254
- )
255
- experimental_fragment = _deprecate_func_name(
256
- _experimental_fragment,
257
- "experimental_fragment",
258
- "2025-01-01",
259
- name_override="fragment",
260
- )
249
+ experimental_dialog = _experimental_dialog_decorator
250
+ experimental_fragment = _experimental_fragment
261
251
  experimental_user = _UserInfoProxy()
262
252
 
263
253
  _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."
@@ -309,7 +309,7 @@ def convert_anything_to_pandas_df(
309
309
  # back to Arrow when marshalled to protobuf, but area/bar/line charts need
310
310
  # DataFrame magic to generate the correct output.
311
311
  if hasattr(data, "to_pandas"):
312
- return cast(pd.DataFrame, data.to_pandas())
312
+ return pd.DataFrame(data.to_pandas())
313
313
 
314
314
  # Try to convert to pandas.DataFrame. This will raise an error is df is not
315
315
  # compatible with the pandas.DataFrame constructor.
@@ -18,6 +18,10 @@ from functools import wraps
18
18
  from typing import TYPE_CHECKING, Callable, TypeVar, cast, overload
19
19
 
20
20
  from streamlit.delta_generator import event_dg, get_last_dg_added_to_context_stack
21
+ from streamlit.deprecation_util import (
22
+ make_deprecated_name_warning,
23
+ show_deprecation_warning,
24
+ )
21
25
  from streamlit.errors import StreamlitAPIException
22
26
  from streamlit.runtime.fragment import _fragment
23
27
  from streamlit.runtime.metrics_util import gather_metrics
@@ -54,7 +58,11 @@ F = TypeVar("F", bound=Callable[..., None])
54
58
 
55
59
 
56
60
  def _dialog_decorator(
57
- non_optional_func: F, title: str, *, width: DialogWidth = "small"
61
+ non_optional_func: F,
62
+ title: str,
63
+ *,
64
+ width: DialogWidth = "small",
65
+ should_show_deprecation_warning: bool = False,
58
66
  ) -> F:
59
67
  if title is None or title == "":
60
68
  raise StreamlitAPIException(
@@ -72,6 +80,15 @@ def _dialog_decorator(
72
80
  dialog.open()
73
81
 
74
82
  def dialog_content() -> None:
83
+ if should_show_deprecation_warning:
84
+ show_deprecation_warning(
85
+ make_deprecated_name_warning(
86
+ "experimental_dialog",
87
+ "dialog",
88
+ "2025-01-01",
89
+ )
90
+ )
91
+
75
92
  # if the dialog should be closed, st.rerun() has to be called
76
93
  # (same behavior as with st.fragment)
77
94
  _ = non_optional_func(*args, **kwargs)
@@ -223,4 +240,21 @@ def experimental_dialog_decorator(
223
240
  title: F | str, *, width: DialogWidth = "small"
224
241
  ) -> F | Callable[[F], F]:
225
242
  """Deprecated alias for @st.dialog. See the docstring for the decorator's new name."""
226
- return dialog_decorator(title, width=width)
243
+ func_or_title = title
244
+ if isinstance(func_or_title, str):
245
+ # Support passing the params via function decorator
246
+ def wrapper(f: F) -> F:
247
+ title: str = func_or_title
248
+ return _dialog_decorator(
249
+ non_optional_func=f,
250
+ title=title,
251
+ width=width,
252
+ should_show_deprecation_warning=True,
253
+ )
254
+
255
+ return wrapper
256
+
257
+ func: F = func_or_title
258
+ return _dialog_decorator(
259
+ func, "", width=width, should_show_deprecation_warning=True
260
+ )
@@ -22,6 +22,10 @@ from copy import deepcopy
22
22
  from functools import wraps
23
23
  from typing import TYPE_CHECKING, Any, Callable, Protocol, TypeVar, overload
24
24
 
25
+ from streamlit.deprecation_util import (
26
+ make_deprecated_name_warning,
27
+ show_deprecation_warning,
28
+ )
25
29
  from streamlit.error_util import handle_uncaught_app_exception
26
30
  from streamlit.errors import FragmentHandledException, FragmentStorageKeyError
27
31
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
@@ -129,6 +133,7 @@ def _fragment(
129
133
  *,
130
134
  run_every: int | float | timedelta | str | None = None,
131
135
  additional_hash_info: str = "",
136
+ should_show_deprecation_warning: bool = False,
132
137
  ) -> Callable[[F], F] | F:
133
138
  """Contains the actual fragment logic.
134
139
 
@@ -172,6 +177,15 @@ def _fragment(
172
177
  def wrapped_fragment():
173
178
  import streamlit as st
174
179
 
180
+ if should_show_deprecation_warning:
181
+ show_deprecation_warning(
182
+ make_deprecated_name_warning(
183
+ "experimental_fragment",
184
+ "fragment",
185
+ "2025-01-01",
186
+ )
187
+ )
188
+
175
189
  # NOTE: We need to call get_script_run_ctx here again and can't just use the
176
190
  # value of ctx from above captured by the closure because subsequent
177
191
  # fragment runs will generally run in a new script run, thus we'll have a
@@ -462,4 +476,4 @@ def experimental_fragment(
462
476
  run_every: int | float | timedelta | str | None = None,
463
477
  ) -> Callable[[F], F] | F:
464
478
  """Deprecated alias for @st.fragment. See the docstring for the decorator's new name."""
465
- return _fragment(func, run_every=run_every)
479
+ return _fragment(func, run_every=run_every, should_show_deprecation_warning=True)
@@ -16,7 +16,10 @@ from streamlit.runtime.scriptrunner.script_requests import RerunData
16
16
  from streamlit.util import repr_
17
17
 
18
18
 
19
- class ScriptControlException(Exception):
19
+ # We inherit from BaseException to avoid being caught by user code.
20
+ # For example, having it inherit from Exception might make st.rerun not
21
+ # work in a try/except block.
22
+ class ScriptControlException(BaseException): # NOSONAR
20
23
  """Base exception for ScriptRunner."""
21
24
 
22
25
  pass
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.554f96d9.css",
4
- "main.js": "./static/js/main.b29f5517.js",
4
+ "main.js": "./static/js/main.0467dc11.js",
5
5
  "static/js/9336.3e046ad7.chunk.js": "./static/js/9336.3e046ad7.chunk.js",
6
6
  "static/js/9330.2b4c99e0.chunk.js": "./static/js/9330.2b4c99e0.chunk.js",
7
7
  "static/js/2736.7d516fcc.chunk.js": "./static/js/2736.7d516fcc.chunk.js",
@@ -152,6 +152,6 @@
152
152
  },
153
153
  "entrypoints": [
154
154
  "static/css/main.554f96d9.css",
155
- "static/js/main.b29f5517.js"
155
+ "static/js/main.0467dc11.js"
156
156
  ]
157
157
  }
@@ -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.b29f5517.js"></script><link href="./static/css/main.554f96d9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
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.0467dc11.js"></script><link href="./static/css/main.554f96d9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>