streamlit-nightly 1.43.3.dev20250311__py3-none-any.whl → 1.43.3.dev20250313__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 (159) hide show
  1. streamlit/__init__.py +1 -0
  2. streamlit/auth_util.py +2 -1
  3. streamlit/commands/experimental_query_params.py +1 -1
  4. streamlit/commands/logo.py +3 -3
  5. streamlit/components/v1/__init__.py +1 -3
  6. streamlit/config.py +3 -2
  7. streamlit/config_option.py +1 -3
  8. streamlit/connections/snowflake_connection.py +0 -1
  9. streamlit/connections/sql_connection.py +0 -1
  10. streamlit/dataframe_util.py +7 -6
  11. streamlit/delta_generator_singletons.py +2 -2
  12. streamlit/elements/arrow.py +0 -1
  13. streamlit/elements/exception.py +3 -1
  14. streamlit/elements/form.py +3 -3
  15. streamlit/elements/json.py +2 -2
  16. streamlit/elements/layouts.py +0 -5
  17. streamlit/elements/lib/built_in_chart_utils.py +1 -2
  18. streamlit/elements/lib/column_config_utils.py +0 -3
  19. streamlit/elements/lib/column_types.py +6 -39
  20. streamlit/elements/lib/image_utils.py +2 -1
  21. streamlit/elements/lib/options_selector_utils.py +6 -3
  22. streamlit/elements/lib/subtitle_utils.py +2 -0
  23. streamlit/elements/lib/utils.py +0 -2
  24. streamlit/elements/markdown.py +98 -2
  25. streamlit/elements/media.py +2 -1
  26. streamlit/elements/metric.py +0 -1
  27. streamlit/elements/progress.py +1 -1
  28. streamlit/elements/text.py +2 -2
  29. streamlit/elements/vega_charts.py +2 -1
  30. streamlit/elements/widgets/audio_input.py +2 -1
  31. streamlit/elements/widgets/button.py +0 -1
  32. streamlit/elements/widgets/button_group.py +2 -3
  33. streamlit/elements/widgets/data_editor.py +2 -3
  34. streamlit/elements/widgets/slider.py +1 -1
  35. streamlit/elements/widgets/text_widgets.py +1 -0
  36. streamlit/elements/write.py +0 -1
  37. streamlit/errors.py +11 -2
  38. streamlit/external/langchain/streamlit_callback_handler.py +1 -2
  39. streamlit/file_util.py +4 -2
  40. streamlit/navigation/page.py +0 -1
  41. streamlit/platform.py +1 -3
  42. streamlit/runtime/caching/cache_data_api.py +5 -5
  43. streamlit/runtime/caching/cache_errors.py +1 -1
  44. streamlit/runtime/caching/cache_resource_api.py +4 -4
  45. streamlit/runtime/caching/cache_utils.py +6 -4
  46. streamlit/runtime/caching/storage/cache_storage_protocol.py +6 -6
  47. streamlit/runtime/caching/storage/dummy_cache_storage.py +2 -2
  48. streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +6 -6
  49. streamlit/runtime/caching/storage/local_disk_cache_storage.py +6 -6
  50. streamlit/runtime/connection_factory.py +0 -1
  51. streamlit/runtime/context.py +1 -1
  52. streamlit/runtime/credentials.py +1 -1
  53. streamlit/runtime/forward_msg_cache.py +1 -1
  54. streamlit/runtime/forward_msg_queue.py +2 -1
  55. streamlit/runtime/fragment.py +2 -1
  56. streamlit/runtime/memory_media_file_storage.py +2 -2
  57. streamlit/runtime/metrics_util.py +2 -2
  58. streamlit/runtime/runtime_util.py +1 -1
  59. streamlit/runtime/scriptrunner/script_runner.py +1 -1
  60. streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
  61. streamlit/runtime/scriptrunner_utils/script_run_context.py +1 -0
  62. streamlit/runtime/secrets.py +28 -31
  63. streamlit/runtime/state/common.py +1 -1
  64. streamlit/runtime/state/safe_session_state.py +1 -1
  65. streamlit/runtime/state/session_state.py +4 -3
  66. streamlit/runtime/stats.py +1 -1
  67. streamlit/runtime/uploaded_file_manager.py +4 -3
  68. streamlit/static/index.html +1 -1
  69. streamlit/static/static/js/{FileDownload.esm.B-R2xJ_2.js → FileDownload.esm.imTamlxP.js} +1 -1
  70. streamlit/static/static/js/{FileHelper.Dpame4Yy.js → FileHelper.BwPSCUvG.js} +1 -1
  71. streamlit/static/static/js/{FormClearHelper.CJtgEcyv.js → FormClearHelper.DB5q2Avl.js} +1 -1
  72. streamlit/static/static/js/{Hooks.eMU4yP9C.js → Hooks.Cxijo2P7.js} +1 -1
  73. streamlit/static/static/js/{InputInstructions.Bt5nMAh-.js → InputInstructions.B3OvMrKL.js} +1 -1
  74. streamlit/static/static/js/{ProgressBar.CRfY498S.js → ProgressBar.DmTol130.js} +1 -1
  75. streamlit/static/static/js/{RenderInPortalIfExists.CjsBZs42.js → RenderInPortalIfExists.B8t62565.js} +1 -1
  76. streamlit/static/static/js/{Toolbar.CBmSHKas.js → Toolbar.CbG49UPG.js} +1 -1
  77. streamlit/static/static/js/{base-input.pwi2uHY4.js → base-input.D7sJ1S2g.js} +1 -1
  78. streamlit/static/static/js/{checkbox.BRMCIUrT.js → checkbox.0Qx7AQxA.js} +1 -1
  79. streamlit/static/static/js/{createSuper.BT2FfU2u.js → createSuper.DYiyAta_.js} +1 -1
  80. streamlit/static/static/js/{data-grid-overlay-editor.DR231PaH.js → data-grid-overlay-editor.DH61CZYo.js} +1 -1
  81. streamlit/static/static/js/{downloader.Cwh9Q8n3.js → downloader.ClUad3SK.js} +1 -1
  82. streamlit/static/static/js/{es6.DXFo1lzk.js → es6.oePMPTIo.js} +2 -2
  83. streamlit/static/static/js/{iframeResizer.contentWindow.BqHH3gN-.js → iframeResizer.contentWindow.DWkIX4K7.js} +1 -1
  84. streamlit/static/static/js/{index.SGdFItlP.js → index.1VrMb7Gq.js} +1 -1
  85. streamlit/static/static/js/index.62zz5frt.js +1 -0
  86. streamlit/static/static/js/index.BJRyQckV.js +1 -0
  87. streamlit/static/static/js/{index.C8ZQWk_P.js → index.BQVZQA1G.js} +1 -1
  88. streamlit/static/static/js/{index.-J5N3GRT.js → index.BSZRb65z.js} +1 -1
  89. streamlit/static/static/js/{index.oH2t20_d.js → index.BUJE3tb_.js} +1 -1
  90. streamlit/static/static/js/{index.DAIPHdqL.js → index.BWsaTYC-.js} +1 -1
  91. streamlit/static/static/js/{index.B9ftDzXT.js → index.BccrUqFL.js} +1 -1
  92. streamlit/static/static/js/index.BhzKPoO6.js +1 -0
  93. streamlit/static/static/js/{index._HJ2bgYb.js → index.BpNXx3zc.js} +6 -6
  94. streamlit/static/static/js/{index.DzJ-K9FH.js → index.BzEstIKX.js} +1 -1
  95. streamlit/static/static/js/{index.Cqy-AKUq.js → index.C-ilKj2l.js} +1 -1
  96. streamlit/static/static/js/{index.DBAW0l2y.js → index.CCAIkxXD.js} +2367 -1541
  97. streamlit/static/static/js/{index.DklFRDjI.js → index.CEXlj4h2.js} +1 -1
  98. streamlit/static/static/js/{index.E4BOW70b.js → index.CEtBn4Yo.js} +1 -1
  99. streamlit/static/static/js/{index.Y1Qnwm4b.js → index.CM7PC5PD.js} +1 -1
  100. streamlit/static/static/js/{index.BAQ_1jSz.js → index.CSLXWDcG.js} +1 -1
  101. streamlit/static/static/js/{index.7mbSZESp.js → index.CqywW5KK.js} +1 -1
  102. streamlit/static/static/js/{index.DGe1v1i2.js → index.CyRCgpSs.js} +1 -1
  103. streamlit/static/static/js/{index.BiPCWEUM.js → index.CzFs8nXc.js} +45 -45
  104. streamlit/static/static/js/{index.DTC2KQEB.js → index.Czxn5B2N.js} +1 -1
  105. streamlit/static/static/js/{index.BhhnIkTX.js → index.D0OLo5Dp.js} +1 -1
  106. streamlit/static/static/js/{index.DC7tm9ca.js → index.D2JlVfHE.js} +1 -1
  107. streamlit/static/static/js/{index.BtuGy7By.js → index.D8rVyQy1.js} +2 -2
  108. streamlit/static/static/js/{index.BN2fMHzp.js → index.DJRmF7dm.js} +1 -1
  109. streamlit/static/static/js/{index.eHde7unb.js → index.Dd9D963h.js} +1 -1
  110. streamlit/static/static/js/{index.CtDd3Kvg.js → index.DhcpqbOJ.js} +1 -1
  111. streamlit/static/static/js/{index.DJZrR-yh.js → index.DlEF0vUx.js} +1 -1
  112. streamlit/static/static/js/{index.pfdwKIIK.js → index.DnJimAdR.js} +1 -1
  113. streamlit/static/static/js/index.DoqMrowT.js +1 -0
  114. streamlit/static/static/js/{index.B71BDPil.js → index.DqsHy8ck.js} +1 -1
  115. streamlit/static/static/js/{index.DbtNEUBr.js → index.DtS10fdK.js} +1 -1
  116. streamlit/static/static/js/{index.BtaSeLy3.js → index.XZw2NTV4.js} +1 -1
  117. streamlit/static/static/js/index.YB9Oe71d.js +1 -0
  118. streamlit/static/static/js/{index.Bt4_I4Hr.js → index.axjxDsFs.js} +1 -1
  119. streamlit/static/static/js/{index.CKLHvpe_.js → index.kB2IGVOe.js} +1 -1
  120. streamlit/static/static/js/{index.ClCou1d2.js → index.tVO_vJdT.js} +1 -1
  121. streamlit/static/static/js/{index.DIxz2WrU.js → index.uPQFE7KD.js} +1 -1
  122. streamlit/static/static/js/{input.Rf6xGN5X.js → input.od7ufwko.js} +1 -1
  123. streamlit/static/static/js/{memory.D5NLCYdA.js → memory.B4tdC6o-.js} +1 -1
  124. streamlit/static/static/js/{mergeWith.Bcdwg8Ac.js → mergeWith.BIQlVIWW.js} +1 -1
  125. streamlit/static/static/js/{number-overlay-editor.CCjfRIEO.js → number-overlay-editor.yJDCpy9b.js} +1 -1
  126. streamlit/static/static/js/{possibleConstructorReturn.B8bXiVQj.js → possibleConstructorReturn.CarGSmuW.js} +1 -1
  127. streamlit/static/static/js/{sandbox.lrrkbqxh.js → sandbox.DMCKOK6i.js} +1 -1
  128. streamlit/static/static/js/{textarea.DCEYRe9D.js → textarea.CKKbJt6B.js} +1 -1
  129. streamlit/static/static/js/{timepicker.DpQ3WAC_.js → timepicker.BgsARtBm.js} +1 -1
  130. streamlit/static/static/js/{toConsumableArray.EduObuzm.js → toConsumableArray.DXHhbr1a.js} +1 -1
  131. streamlit/static/static/js/{uniqueId.qyd-2U_A.js → uniqueId.Cb5oTCCd.js} +1 -1
  132. streamlit/static/static/js/{useBasicWidgetState.B0zc_tpZ.js → useBasicWidgetState.8rZ80dWq.js} +1 -1
  133. streamlit/static/static/js/{useOnInputChange.tzktvOeD.js → useOnInputChange.Bc5KC47X.js} +1 -1
  134. streamlit/static/static/js/{withFullScreenWrapper.TezXOJ_z.js → withFullScreenWrapper.CSP3iCNz.js} +1 -1
  135. streamlit/string_util.py +3 -2
  136. streamlit/testing/v1/element_tree.py +30 -30
  137. streamlit/testing/v1/util.py +2 -1
  138. streamlit/time_util.py +1 -3
  139. streamlit/type_util.py +2 -1
  140. streamlit/user_info.py +0 -1
  141. streamlit/watcher/event_based_path_watcher.py +1 -1
  142. streamlit/web/bootstrap.py +3 -1
  143. streamlit/web/cache_storage_manager_config.py +1 -1
  144. streamlit/web/cli.py +44 -2
  145. streamlit/web/server/authlib_tornado_integration.py +1 -1
  146. streamlit/web/server/browser_websocket_handler.py +2 -1
  147. streamlit/web/server/routes.py +2 -2
  148. streamlit/web/server/server_util.py +2 -4
  149. {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/METADATA +1 -1
  150. {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/RECORD +154 -154
  151. streamlit/static/static/js/index.BMcgy3Eb.js +0 -1
  152. streamlit/static/static/js/index.COJ2HeaK.js +0 -1
  153. streamlit/static/static/js/index.D6iEZATu.js +0 -1
  154. streamlit/static/static/js/index.DuXQiNfC.js +0 -1
  155. streamlit/static/static/js/index.Fi_0UKZA.js +0 -1
  156. {streamlit_nightly-1.43.3.dev20250311.data → streamlit_nightly-1.43.3.dev20250313.data}/scripts/streamlit.cmd +0 -0
  157. {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/WHEEL +0 -0
  158. {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/entry_points.txt +0 -0
  159. {streamlit_nightly-1.43.3.dev20250311.dist-info → streamlit_nightly-1.43.3.dev20250313.dist-info}/top_level.txt +0 -0
@@ -91,7 +91,7 @@ _CACHED_FILE_EXTENSION: Final = "memo"
91
91
 
92
92
  class LocalDiskCacheStorageManager(CacheStorageManager):
93
93
  def create(self, context: CacheStorageContext) -> CacheStorage:
94
- """Creates a new cache storage instance wrapped with in-memory cache layer"""
94
+ """Creates a new cache storage instance wrapped with in-memory cache layer."""
95
95
  persist_storage = LocalDiskCacheStorage(context)
96
96
  return InMemoryCacheStorageWrapper(
97
97
  persist_storage=persist_storage, context=context
@@ -117,7 +117,7 @@ class LocalDiskCacheStorageManager(CacheStorageManager):
117
117
 
118
118
  class LocalDiskCacheStorage(CacheStorage):
119
119
  """Cache storage that persists data to disk
120
- This is the default cache persistence layer for `@st.cache_data`
120
+ This is the default cache persistence layer for `@st.cache_data`.
121
121
  """
122
122
 
123
123
  def __init__(self, context: CacheStorageContext):
@@ -138,7 +138,7 @@ class LocalDiskCacheStorage(CacheStorage):
138
138
  """
139
139
  Returns the stored value for the key if persisted,
140
140
  raise CacheStorageKeyNotFoundError if not found, or not configured
141
- with persist="disk"
141
+ with persist="disk".
142
142
  """
143
143
  if self.persist == "disk":
144
144
  path = self._get_cache_file_path(key)
@@ -158,7 +158,7 @@ class LocalDiskCacheStorage(CacheStorage):
158
158
  )
159
159
 
160
160
  def set(self, key: str, value: bytes) -> None:
161
- """Sets the value for a given key"""
161
+ """Sets the value for a given key."""
162
162
  if self.persist == "disk":
163
163
  path = self._get_cache_file_path(key)
164
164
  try:
@@ -191,7 +191,7 @@ class LocalDiskCacheStorage(CacheStorage):
191
191
  )
192
192
 
193
193
  def clear(self) -> None:
194
- """Delete all keys for the current storage"""
194
+ """Delete all keys for the current storage."""
195
195
  cache_dir = get_cache_folder_path()
196
196
 
197
197
  if os.path.isdir(cache_dir):
@@ -203,7 +203,7 @@ class LocalDiskCacheStorage(CacheStorage):
203
203
  os.remove(os.path.join(cache_dir, file_name))
204
204
 
205
205
  def close(self) -> None:
206
- """Dummy implementation of close, we don't need to actually "close" anything"""
206
+ """Dummy implementation of close, we don't need to actually "close" anything."""
207
207
 
208
208
  def _get_cache_file_path(self, value_key: str) -> str:
209
209
  """Return the path of the disk cache file for the given value."""
@@ -278,7 +278,6 @@ def connection_factory(
278
278
 
279
279
  Examples
280
280
  --------
281
-
282
281
  **Example 1: Inferred connection type**
283
282
 
284
283
  The easiest way to create a first-party (SQL, Snowflake, or Snowpark) connection is
@@ -273,7 +273,7 @@ class ContextProxy:
273
273
  @property
274
274
  @gather_metrics("context.locale")
275
275
  def locale(self) -> str | None:
276
- """The locale of the user browser, read-only"""
276
+ """The locale of the user browser, read-only."""
277
277
  ctx = get_script_run_ctx()
278
278
  if ctx is None or ctx.context_info is None:
279
279
  return None
@@ -66,7 +66,7 @@ Collecting usage statistics. To deactivate, set browser.gatherUsageStats to fals
66
66
 
67
67
 
68
68
  def _send_email(email: str) -> None:
69
- """Send the user's email for metrics, if submitted"""
69
+ """Send the user's email for metrics, if submitted."""
70
70
  import requests
71
71
 
72
72
  if email is None or "@" not in email:
@@ -281,7 +281,7 @@ class ForwardMsgCache(CacheStatsProvider):
281
281
  del self._entries[msg_hash]
282
282
 
283
283
  def clear(self) -> None:
284
- """Remove all entries from the cache"""
284
+ """Remove all entries from the cache."""
285
285
  self._entries.clear()
286
286
 
287
287
  def get_stats(self) -> list[CacheStat]:
@@ -40,7 +40,8 @@ class ForwardMsgQueue:
40
40
  before_enqueue_msg: Callable[[ForwardMsg], None] | None,
41
41
  ) -> None:
42
42
  """Set a callback to be called before a message is enqueued.
43
- Used in static streamlit app generation."""
43
+ Used in static streamlit app generation.
44
+ """
44
45
  ForwardMsgQueue._before_enqueue_msg = before_enqueue_msg
45
46
 
46
47
  def __init__(self):
@@ -61,7 +61,8 @@ class FragmentStorage(Protocol):
61
61
  @abstractmethod
62
62
  def clear(self, new_fragment_ids: set[str] | None = None) -> None:
63
63
  """Remove all fragments saved in this FragmentStorage unless listed in
64
- new_fragment_ids."""
64
+ new_fragment_ids.
65
+ """
65
66
  raise NotImplementedError
66
67
 
67
68
  @abstractmethod
@@ -90,7 +90,7 @@ class MemoryFile(NamedTuple):
90
90
 
91
91
  class MemoryMediaFileStorage(MediaFileStorage, CacheStatsProvider):
92
92
  def __init__(self, media_endpoint: str):
93
- """Create a new MemoryMediaFileStorage instance
93
+ """Create a new MemoryMediaFileStorage instance.
94
94
 
95
95
  Parameters
96
96
  ----------
@@ -130,7 +130,7 @@ class MemoryMediaFileStorage(MediaFileStorage, CacheStatsProvider):
130
130
  def get_file(self, filename: str) -> MemoryFile:
131
131
  """Return the MemoryFile with the given filename. Filenames are of the
132
132
  form "file_id.extension". (Note that this is *not* the optional
133
- user-specified filename for download files.)
133
+ user-specified filename for download files.).
134
134
 
135
135
  Raises a MediaFileStorageError if no such file exists.
136
136
  """
@@ -160,7 +160,7 @@ _DBUS_MACHINE_ID_PATH = "/var/lib/dbus/machine-id"
160
160
 
161
161
 
162
162
  def _get_machine_id_v3() -> str:
163
- """Get the machine ID
163
+ """Get the machine ID.
164
164
 
165
165
  This is a unique identifier for a user for tracking metrics,
166
166
  that is broken in different ways in some Linux distros and Docker images.
@@ -186,7 +186,7 @@ class Installation:
186
186
 
187
187
  @classmethod
188
188
  def instance(cls) -> Installation:
189
- """Returns the singleton Installation"""
189
+ """Returns the singleton Installation."""
190
190
  # We use a double-checked locking optimization to avoid the overhead
191
191
  # of acquiring the lock in the common case:
192
192
  # https://en.wikipedia.org/wiki/Double-checked_locking
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- """Runtime-related utility functions"""
15
+ """Runtime-related utility functions."""
16
16
 
17
17
  from __future__ import annotations
18
18
 
@@ -380,7 +380,7 @@ class ScriptRunner:
380
380
  )
381
381
 
382
382
  def _is_in_script_thread(self) -> bool:
383
- """True if the calling function is running in the script thread"""
383
+ """True if the calling function is running in the script thread."""
384
384
  return self._script_thread == threading.current_thread()
385
385
 
386
386
  def _enqueue_forward_msg(self, msg: ForwardMsg) -> None:
@@ -35,7 +35,7 @@ class RerunException(ScriptControlException):
35
35
  """Silently stop and rerun the user's script."""
36
36
 
37
37
  def __init__(self, rerun_data: RerunData):
38
- """Construct a RerunException
38
+ """Construct a RerunException.
39
39
 
40
40
  Parameters
41
41
  ----------
@@ -252,6 +252,7 @@ def get_script_run_ctx(suppress_warning: bool = False) -> ScriptRunContext | Non
252
252
  ----------
253
253
  suppress_warning : bool
254
254
  If True, don't log a warning if there's no ScriptRunContext.
255
+
255
256
  Returns
256
257
  -------
257
258
  ScriptRunContext | None
@@ -30,6 +30,7 @@ from blinker import Signal
30
30
  import streamlit as st
31
31
  import streamlit.watcher.path_watcher
32
32
  from streamlit import runtime
33
+ from streamlit.errors import StreamlitSecretNotFoundError
33
34
  from streamlit.logger import get_logger
34
35
 
35
36
  _LOGGER: Final = get_logger(__name__)
@@ -140,7 +141,7 @@ def _missing_key_error_message(key: str) -> str:
140
141
 
141
142
  class AttrDict(Mapping[str, Any]):
142
143
  """We use AttrDict to wrap up dictionary values from secrets
143
- to provide dot access to nested secrets
144
+ to provide dot access to nested secrets.
144
145
  """
145
146
 
146
147
  def __init__(self, value):
@@ -198,7 +199,6 @@ class Secrets(Mapping[str, Any]):
198
199
  self._secrets: Mapping[str, Any] | None = None
199
200
  self._lock = threading.RLock()
200
201
  self._file_watchers_installed = False
201
- self._suppress_print_error_on_exception = False
202
202
 
203
203
  self.file_change_listener = Signal(
204
204
  doc="Emitted when a `secrets.toml` file has been changed."
@@ -207,40 +207,27 @@ class Secrets(Mapping[str, Any]):
207
207
  def load_if_toml_exists(self) -> bool:
208
208
  """Load secrets.toml files from disk if they exists. If none exist,
209
209
  no exception will be raised. (If a file exists but is malformed,
210
- an exception *will* be raised.)
210
+ an exception *will* be raised.).
211
211
 
212
212
  Returns True if a secrets.toml file was successfully parsed, False otherwise.
213
213
 
214
214
  Thread-safe.
215
215
  """
216
- prev_suppress_print_error_on_exception = self._suppress_print_error_on_exception
217
216
  try:
218
- # temporarily suppress printing errors on exceptions, we don't want to print errors
219
- # in this method since it only loads secrets if they exist
220
-
221
- self._suppress_print_error_on_exception = True
222
217
  self._parse()
223
218
 
224
219
  return True
225
- except FileNotFoundError:
220
+ except StreamlitSecretNotFoundError:
226
221
  # No secrets.toml files exist. That's fine.
227
222
  return False
228
- finally:
229
- self._suppress_print_error_on_exception = (
230
- prev_suppress_print_error_on_exception
231
- )
232
223
 
233
224
  def set_suppress_print_error_on_exception(
234
225
  self, suppress_print_error_on_exception: bool
235
226
  ) -> None:
236
- """Set whether exceptions should be printed when accessing secrets.
237
- For internal use, may change in future releases without notice."""
238
- self._suppress_print_error_on_exception = suppress_print_error_on_exception
239
-
240
- def _print_exception_if_not_suppressed(self, error_msg: str) -> None:
241
- """Print the given error message if exceptions are not suppressed."""
242
- if not self._suppress_print_error_on_exception:
243
- st.error(str(error_msg))
227
+ """Left in place for compatibility with integrations until integration
228
+ code can be updated.
229
+ """
230
+ pass
244
231
 
245
232
  def _reset(self) -> None:
246
233
  """Clear the secrets dictionary and remove any secrets that were
@@ -275,13 +262,12 @@ class Secrets(Mapping[str, Any]):
275
262
 
276
263
  secrets.update(toml.loads(secrets_file_str))
277
264
  except (TypeError, toml.TomlDecodeError) as ex:
278
- error_msg = (
265
+ msg = (
279
266
  secret_error_messages_singleton.get_error_parsing_file_at_path_message(
280
267
  path, ex
281
268
  )
282
269
  )
283
- self._print_exception_if_not_suppressed(error_msg)
284
- raise
270
+ raise StreamlitSecretNotFoundError(msg) from ex
285
271
 
286
272
  return secrets, found_secrets_file
287
273
 
@@ -308,8 +294,7 @@ class Secrets(Mapping[str, Any]):
308
294
  error_msg = secret_error_messages_singleton.get_subfolder_path_is_not_a_folder_message(
309
295
  sub_folder_path
310
296
  )
311
- self._print_exception_if_not_suppressed(error_msg)
312
- raise ValueError(error_msg)
297
+ raise StreamlitSecretNotFoundError(error_msg)
313
298
  sub_secrets = {}
314
299
 
315
300
  for filename in os.listdir(sub_folder_path):
@@ -341,8 +326,7 @@ class Secrets(Mapping[str, Any]):
341
326
  error_msg = secret_error_messages_singleton.get_invalid_secret_path_message(
342
327
  path
343
328
  )
344
- self._print_exception_if_not_suppressed(error_msg)
345
- raise ValueError(error_msg)
329
+ raise StreamlitSecretNotFoundError(error_msg)
346
330
 
347
331
  def _parse(self) -> Mapping[str, Any]:
348
332
  """Parse our secrets.toml files if they're not already parsed.
@@ -356,7 +340,7 @@ class Secrets(Mapping[str, Any]):
356
340
 
357
341
  Raises
358
342
  ------
359
- FileNotFoundError
343
+ StreamlitSecretNotFoundError
360
344
  Raised if secrets.toml doesn't exist.
361
345
 
362
346
  """
@@ -385,8 +369,7 @@ class Secrets(Mapping[str, Any]):
385
369
  file_paths
386
370
  )
387
371
  )
388
- self._print_exception_if_not_suppressed(error_msg)
389
- raise FileNotFoundError(error_msg)
372
+ raise StreamlitSecretNotFoundError(error_msg)
390
373
 
391
374
  for k, v in secrets.items():
392
375
  self._maybe_set_environment_variable(k, v)
@@ -492,6 +475,20 @@ class Secrets(Mapping[str, Any]):
492
475
  except KeyError:
493
476
  raise KeyError(_missing_key_error_message(key))
494
477
 
478
+ def __setattr__(self, key: str, value: Any) -> None:
479
+ # Allow internal attributes to be set
480
+ if key in {
481
+ "_secrets",
482
+ "_lock",
483
+ "_file_watchers_installed",
484
+ "_suppress_print_error_on_exception",
485
+ "file_change_listener",
486
+ "load_if_toml_exists",
487
+ }:
488
+ super().__setattr__(key, value)
489
+ else:
490
+ raise TypeError("Secrets does not support attribute assignment.")
491
+
495
492
  def __repr__(self) -> str:
496
493
  # If the runtime is NOT initialized, it is a method call outside
497
494
  # the streamlit app, so we avoid reading the secrets file as it may not exist.
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- """Functions and data structures shared by session_state.py and widgets.py"""
15
+ """Functions and data structures shared by session_state.py and widgets.py."""
16
16
 
17
17
  from __future__ import annotations
18
18
 
@@ -126,7 +126,7 @@ class SafeSessionState:
126
126
  raise AttributeError(f"{key} not found in session_state.")
127
127
 
128
128
  def __repr__(self):
129
- """Presents itself as a simple dict of the underlying SessionState instance"""
129
+ """Presents itself as a simple dict of the underlying SessionState instance."""
130
130
  kv = ((k, self._state[k]) for k in self._state._keys())
131
131
  s = ", ".join(f"{k}: {v!r}" for k, v in kv)
132
132
  return f"{{{s}}}"
@@ -420,7 +420,7 @@ class SessionState:
420
420
  """All keys active in Session State, with widget keys converted
421
421
  to widget ids when one is known. (This includes autogenerated keys
422
422
  for widgets that don't have user_keys defined, and which aren't
423
- exposed to user code.)
423
+ exposed to user code).
424
424
  """
425
425
  old_keys = {self._get_widget_id(k) for k in self._old_state.keys()}
426
426
  new_widget_keys = set(self._new_widget_state.keys())
@@ -435,7 +435,7 @@ class SessionState:
435
435
 
436
436
  def __iter__(self) -> Iterator[Any]:
437
437
  """Return an iterator over the keys of the SessionState.
438
- This is a shortcut for `iter(self.keys())`
438
+ This is a shortcut for `iter(self.keys())`.
439
439
  """
440
440
  return iter(self._keys())
441
441
 
@@ -734,7 +734,8 @@ class SessionState:
734
734
  """Verify that session state can be serialized, if the relevant config
735
735
  option is set.
736
736
 
737
- See `_check_serializable` for details."""
737
+ See `_check_serializable` for details.
738
+ """
738
739
  if config.get_option("runner.enforceSerializableSessionState"):
739
740
  self._check_serializable()
740
741
 
@@ -61,7 +61,7 @@ class CacheStat(NamedTuple):
61
61
 
62
62
 
63
63
  def group_stats(stats: list[CacheStat]) -> list[CacheStat]:
64
- """Group a list of CacheStats by category_name and cache_name and sum byte_length"""
64
+ """Group a list of CacheStats by category_name and cache_name and sum byte_length."""
65
65
 
66
66
  def key_function(individual_stat):
67
67
  return individual_stat.category_name, individual_stat.cache_name
@@ -37,7 +37,7 @@ class UploadedFileRec(NamedTuple):
37
37
 
38
38
 
39
39
  class UploadFileUrlInfo(NamedTuple):
40
- """Information we provide for single file in get_upload_urls"""
40
+ """Information we provide for single file in get_upload_urls."""
41
41
 
42
42
  file_id: str
43
43
  upload_url: str
@@ -46,13 +46,14 @@ class UploadFileUrlInfo(NamedTuple):
46
46
 
47
47
  class DeletedFile(NamedTuple):
48
48
  """Represents a deleted file in deserialized values for st.file_uploader and
49
- st.camera_input
49
+ st.camera_input.
50
50
 
51
51
  Return this from st.file_uploader and st.camera_input deserialize (so they can
52
52
  be used in session_state), when widget value contains file record that is missing
53
53
  from the storage.
54
54
  DeleteFile instances filtered out before return final value to the user in script,
55
- or before sending to frontend."""
55
+ or before sending to frontend.
56
+ """
56
57
 
57
58
  file_id: str
58
59
 
@@ -51,7 +51,7 @@
51
51
  <script>
52
52
  window.prerenderReady = false
53
53
  </script>
54
- <script type="module" crossorigin src="./static/js/index.BiPCWEUM.js"></script>
54
+ <script type="module" crossorigin src="./static/js/index.CzFs8nXc.js"></script>
55
55
  <link rel="stylesheet" crossorigin href="./static/css/index.DQZt7VFg.css">
56
56
  </head>
57
57
  <body>
@@ -1 +1 @@
1
- import{r as e,E as n,_ as a}from"./index.BiPCWEUM.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
1
+ import{r as e,E as n,_ as a}from"./index.CzFs8nXc.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};