streamlit-nightly 1.38.1.dev20240903__py2.py3-none-any.whl → 1.38.1.dev20240905__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/config.py CHANGED
@@ -747,6 +747,17 @@ _create_option(
747
747
  type_=bool,
748
748
  )
749
749
 
750
+ _create_option(
751
+ "server.disconnectedSessionTTL",
752
+ description="""
753
+ TTL in seconds for sessions whose websockets have been disconnected. The server
754
+ may choose to clean up session state, uploaded files, etc for a given session
755
+ with no active websocket connection at any point after this time has passed.
756
+ """,
757
+ default_val=120,
758
+ type_=int,
759
+ )
760
+
750
761
  # Config Section: Browser #
751
762
 
752
763
  _create_section("browser", "Configuration of non-UI browser options.")
@@ -14,7 +14,6 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- import time
18
17
  from typing import TYPE_CHECKING, Literal, cast
19
18
 
20
19
  from typing_extensions import Self, TypeAlias
@@ -87,8 +86,9 @@ class Dialog(DeltaGenerator):
87
86
  block_proto.dialog.dismissible = dismissible
88
87
  block_proto.dialog.width = _process_dialog_width_input(width)
89
88
 
90
- # We store the delta path here, because in _update we enqueue a new proto message to update the
91
- # open status. Without this, the dialog content is gone when the _update message is sent
89
+ # We store the delta path here, because in _update we enqueue a new proto
90
+ # message to update the open status. Without this, the dialog content is gone
91
+ # when the _update message is sent
92
92
  delta_path: list[int] = (
93
93
  parent._active_dg._cursor.delta_path if parent._active_dg._cursor else []
94
94
  )
@@ -96,9 +96,6 @@ class Dialog(DeltaGenerator):
96
96
 
97
97
  dialog._delta_path = delta_path
98
98
  dialog._current_proto = block_proto
99
- # We add a sleep here to give the web app time to react to the update. Otherwise,
100
- # we might run into issues where the dialog cannot be opened again after closing
101
- time.sleep(0.05)
102
99
  return dialog
103
100
 
104
101
  def __init__(
@@ -124,12 +121,8 @@ class Dialog(DeltaGenerator):
124
121
  msg.metadata.delta_path[:] = self._delta_path
125
122
  msg.delta.add_block.CopyFrom(self._current_proto)
126
123
  msg.delta.add_block.dialog.is_open = should_open
127
-
128
124
  self._current_proto = msg.delta.add_block
129
125
 
130
- # We add a sleep here to give the web app time to react to the update. Otherwise,
131
- # we might run into issues where the dialog cannot be opened again after closing
132
- time.sleep(0.05)
133
126
  enqueue_message(msg)
134
127
 
135
128
  def open(self) -> None:
@@ -206,6 +206,12 @@ class StreamlitPage:
206
206
  self._page: Path | Callable[[], None] = page
207
207
  self._title: str = title or inferred_name.replace("_", " ")
208
208
  self._icon: str = icon or inferred_icon
209
+
210
+ if self._title.strip() == "":
211
+ raise StreamlitAPIException(
212
+ "The title of the page cannot be empty or consist of underscores/spaces only"
213
+ )
214
+
209
215
  if url_path is not None and url_path.strip() == "" and not default:
210
216
  raise StreamlitAPIException(
211
217
  "The URL path cannot be an empty string unless the page is the default page."
@@ -578,6 +578,13 @@ class AppSession:
578
578
  page_script_hash is not None
579
579
  ), "page_script_hash must be set for the SCRIPT_STARTED event"
580
580
 
581
+ # Update the client state with the new page_script_hash if
582
+ # necessary. This handles an edge case where a script is never
583
+ # finishes (eg. by calling st.rerun()), but the page has changed
584
+ # via st.navigation()
585
+ if page_script_hash != self._client_state.page_script_hash:
586
+ self._client_state.page_script_hash = page_script_hash
587
+
581
588
  if clear_forward_msg_queue:
582
589
  self._clear_queue()
583
590
 
@@ -560,7 +560,7 @@ class Runtime:
560
560
  uploaded_file_manager=self._uploaded_file_mgr,
561
561
  script_cache=self._script_cache,
562
562
  message_enqueued_callback=self._enqueued_some_message,
563
- user_info={"email": "test@test.com"},
563
+ user_info={"email": "test@example.com"},
564
564
  )
565
565
 
566
566
  try:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.5513bd04.css",
4
- "main.js": "./static/js/main.ba0d2afb.js",
4
+ "main.js": "./static/js/main.7feaefcb.js",
5
5
  "static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
6
6
  "static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
7
7
  "static/js/9077.e0a8db2a.chunk.js": "./static/js/9077.e0a8db2a.chunk.js",
@@ -153,6 +153,6 @@
153
153
  },
154
154
  "entrypoints": [
155
155
  "static/css/main.5513bd04.css",
156
- "static/js/main.ba0d2afb.js"
156
+ "static/js/main.7feaefcb.js"
157
157
  ]
158
158
  }
@@ -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.ba0d2afb.js"></script><link href="./static/css/main.5513bd04.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.7feaefcb.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>