streamlit-nightly 1.46.2.dev20250626__py3-none-any.whl → 1.46.2.dev20250627__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 +1 -1
- streamlit/runtime/caching/cache_data_api.py +29 -10
- streamlit/runtime/caching/cache_resource_api.py +40 -13
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +218 -218
- streamlit/static/static/js/{ErrorOutline.esm.CJg-nD07.js → ErrorOutline.esm.Cks_iIQ-.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Bqu9hYVK.js → FileDownload.esm.BgAcJaBJ.js} +1 -1
- streamlit/static/static/js/{FileHelper.BTD8--nH.js → FileHelper.BnEW9df2.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DwQzHDKa.js → FormClearHelper.D7ijm88e.js} +1 -1
- streamlit/static/static/js/{Hooks.CkgvOw3a.js → Hooks.BX9mvLIz.js} +1 -1
- streamlit/static/static/js/{InputInstructions.A_59uy0m.js → InputInstructions.B061yGr2.js} +1 -1
- streamlit/static/static/js/{ProgressBar.B8wHlmHP.js → ProgressBar.B8o6s3Fj.js} +1 -1
- streamlit/static/static/js/RenderInPortalIfExists.zrlVZ4c5.js +1 -0
- streamlit/static/static/js/{Toolbar.CTXCF-zE.js → Toolbar.BZVTYNtL.js} +1 -1
- streamlit/static/static/js/{base-input.DLahFrJX.js → base-input.CyVEPdgQ.js} +1 -1
- streamlit/static/static/js/{checkbox.BqH30Pie.js → checkbox.CRhx-utT.js} +1 -1
- streamlit/static/static/js/{createSuper.BR6dNcL_.js → createSuper.Bk9wC4ER.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DHD2lEOv.js → data-grid-overlay-editor.MrRy2pCu.js} +1 -1
- streamlit/static/static/js/{downloader.Cxz7Pmav.js → downloader.BYHNjIU7.js} +1 -1
- streamlit/static/static/js/{es6.CKIqaUkI.js → es6.C9naygo8.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.BUR39Ca8.js → iframeResizer.contentWindow.Cgux768F.js} +1 -1
- streamlit/static/static/js/index.3HBQ7wiY.js +1 -0
- streamlit/static/static/js/{index.C0sFxtmT.js → index.B3id1usU.js} +1 -1
- streamlit/static/static/js/{index.Du_GhChx.js → index.B6LxYHzZ.js} +26 -26
- streamlit/static/static/js/{index.DaVYWs29.js → index.B9spSuBT.js} +1 -1
- streamlit/static/static/js/index.BADE2QoA.js +1 -0
- streamlit/static/static/js/{index.C46vZAVk.js → index.C2UhBdvP.js} +1 -1
- streamlit/static/static/js/{index.5WfC2MKX.js → index.C3nUHooR.js} +1 -1
- streamlit/static/static/js/{index.Dpi_eA9w.js → index.CLaq4cdk.js} +1 -1
- streamlit/static/static/js/{index.5T0ZQUll.js → index.Cc4FAECZ.js} +1 -1
- streamlit/static/static/js/{index.Ched5ljK.js → index.Cd-LN-s-.js} +1 -1
- streamlit/static/static/js/{index.d0pgY8V8.js → index.CiWX70v4.js} +1 -1
- streamlit/static/static/js/{index.BEVVZtmO.js → index.Cwvx-QoM.js} +5 -5
- streamlit/static/static/js/{index.CxswEeN7.js → index.CzuG6mLu.js} +1 -1
- streamlit/static/static/js/{index.jk8Nloxj.js → index.D2ME4K6X.js} +1 -1
- streamlit/static/static/js/{index.BnPGYwJD.js → index.D8vt63yR.js} +1 -1
- streamlit/static/static/js/{index._udMrZfX.js → index.DDE_qn3B.js} +1 -1
- streamlit/static/static/js/{index.BJg-lqwR.js → index.DL_oa8C0.js} +1 -1
- streamlit/static/static/js/{index.0RieWGP-.js → index.DXfo01u0.js} +1 -1
- streamlit/static/static/js/index.DeT0wkqD.js +7 -0
- streamlit/static/static/js/{index.086fJkRW.js → index.DfztRPXA.js} +1 -1
- streamlit/static/static/js/index.Dg-jjU76.js +1 -0
- streamlit/static/static/js/{index.CJNu66g-.js → index.DhGfGsU3.js} +1 -1
- streamlit/static/static/js/{index.BydvTht8.js → index.DviG-qYx.js} +1 -1
- streamlit/static/static/js/{index.NIVZIka1.js → index.IIwl5O7d.js} +1 -1
- streamlit/static/static/js/{index.BvMYFCGi.js → index.KALUdsxF.js} +1 -1
- streamlit/static/static/js/{index.C8wAT-1P.js → index.M9A8egHW.js} +1 -1
- streamlit/static/static/js/{index.DFLLK5fQ.js → index.VifayNUS.js} +1 -1
- streamlit/static/static/js/{index.CF_0T827.js → index.WJ3tVQmL.js} +1 -1
- streamlit/static/static/js/{index.Cx9oo677.js → index.Z-4rNNaK.js} +1 -1
- streamlit/static/static/js/{index.D5Bi0_IY.js → index.ZAf2vwk7.js} +1 -1
- streamlit/static/static/js/{index.dRZ6j1EM.js → index._x4HsVMV.js} +2 -2
- streamlit/static/static/js/{index.YJxN7uL8.js → index.g2lYLp_A.js} +1 -1
- streamlit/static/static/js/index.j4w6sPCZ.js +1 -0
- streamlit/static/static/js/{index.DlQzdr4z.js → index.jfPujl89.js} +1 -1
- streamlit/static/static/js/{index.DoCkeB4S.js → index.k-bbYdd8.js} +1 -1
- streamlit/static/static/js/{index.Br9KoWfK.js → index.n0Ha_TOu.js} +1 -1
- streamlit/static/static/js/{index.B5TjHKHs.js → index.slS1KXaf.js} +1 -1
- streamlit/static/static/js/{input.CYwqmJUN.js → input.DfJ_j9Zd.js} +1 -1
- streamlit/static/static/js/{memory.CwoWYYJe.js → memory.CI4kaYtj.js} +1 -1
- streamlit/static/static/js/{mergeWith.CM4ZdUxz.js → mergeWith.DbOkulfP.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.App3Ir5h.js → number-overlay-editor.Cp9ebTmd.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DLN_CW-A.js → possibleConstructorReturn.BYPlFU5H.js} +1 -1
- streamlit/static/static/js/{sandbox.AnJN0uBk.js → sandbox.DExttQ30.js} +1 -1
- streamlit/static/static/js/{textarea.uAcwGUtc.js → textarea.C5Hyturk.js} +1 -1
- streamlit/static/static/js/{timepicker.DDp122zI.js → timepicker.CP7Wc6O3.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CXCskjcZ.js → toConsumableArray.BxDw_yrK.js} +1 -1
- streamlit/static/static/js/{uniqueId.DQ5uc9Dn.js → uniqueId.CyNBI7Dy.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.DFIfVHMH.js → useBasicWidgetState.DmazR4LK.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.qZzWT6UC.js → useOnInputChange.DdotEGIu.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.6Cdl0P_3.js → withFullScreenWrapper.C9oKRHHU.js} +1 -1
- {streamlit_nightly-1.46.2.dev20250626.dist-info → streamlit_nightly-1.46.2.dev20250627.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.46.2.dev20250626.dist-info → streamlit_nightly-1.46.2.dev20250627.dist-info}/RECORD +77 -77
- streamlit/static/static/js/RenderInPortalIfExists.DLkeeRK1.js +0 -1
- streamlit/static/static/js/index.39cFhVAB.js +0 -1
- streamlit/static/static/js/index.BBk99Mab.js +0 -1
- streamlit/static/static/js/index.Cp5DQ0Nk.js +0 -1
- streamlit/static/static/js/index.DbeUpiV0.js +0 -1
- streamlit/static/static/js/index.Dt6vo5Wt.js +0 -7
- {streamlit_nightly-1.46.2.dev20250626.data → streamlit_nightly-1.46.2.dev20250627.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.46.2.dev20250626.dist-info → streamlit_nightly-1.46.2.dev20250627.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.46.2.dev20250626.dist-info → streamlit_nightly-1.46.2.dev20250627.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.46.2.dev20250626.dist-info → streamlit_nightly-1.46.2.dev20250627.dist-info}/top_level.txt +0 -0
streamlit/__init__.py
CHANGED
@@ -24,13 +24,14 @@ from typing import (
|
|
24
24
|
Callable,
|
25
25
|
Final,
|
26
26
|
Literal,
|
27
|
+
Protocol,
|
27
28
|
TypeVar,
|
28
29
|
Union,
|
29
30
|
cast,
|
30
31
|
overload,
|
31
32
|
)
|
32
33
|
|
33
|
-
from typing_extensions import TypeAlias
|
34
|
+
from typing_extensions import ParamSpec, TypeAlias
|
34
35
|
|
35
36
|
import streamlit as st
|
36
37
|
from streamlit import runtime
|
@@ -318,7 +319,25 @@ def get_data_cache_stats_provider() -> CacheStatsProvider:
|
|
318
319
|
|
319
320
|
# Type-annotate the decorator function.
|
320
321
|
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
321
|
-
|
322
|
+
P = ParamSpec("P")
|
323
|
+
T_co = TypeVar("T_co", covariant=True)
|
324
|
+
|
325
|
+
|
326
|
+
class CachedFunc(Protocol[P, T_co]):
|
327
|
+
"""Protocol for cached functions that preserve the original function's signature and add a clear method."""
|
328
|
+
|
329
|
+
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T_co: ...
|
330
|
+
|
331
|
+
@overload
|
332
|
+
def clear(self) -> None: ...
|
333
|
+
|
334
|
+
@overload
|
335
|
+
def clear(self, *args: P.args, **kwargs: P.kwargs) -> None: ...
|
336
|
+
|
337
|
+
# Currently we can't define the "all-optional" argument overload with `P.args` and `P.kwargs` in Python.
|
338
|
+
# So we use `Any` as a fallback.
|
339
|
+
@overload
|
340
|
+
def clear(self, *args: Any, **kwargs: Any) -> None: ...
|
322
341
|
|
323
342
|
|
324
343
|
class CacheDataAPI:
|
@@ -343,7 +362,7 @@ class CacheDataAPI:
|
|
343
362
|
|
344
363
|
# Bare decorator usage
|
345
364
|
@overload
|
346
|
-
def __call__(self, func:
|
365
|
+
def __call__(self, func: Callable[P, T_co]) -> CachedFunc[P, T_co]: ...
|
347
366
|
|
348
367
|
# Decorator with arguments
|
349
368
|
@overload
|
@@ -356,11 +375,11 @@ class CacheDataAPI:
|
|
356
375
|
persist: CachePersistType | bool = None,
|
357
376
|
experimental_allow_widgets: bool = False,
|
358
377
|
hash_funcs: HashFuncsDict | None = None,
|
359
|
-
) -> Callable[[
|
378
|
+
) -> Callable[[Callable[P, T_co]], CachedFunc[P, T_co]]: ...
|
360
379
|
|
361
380
|
def __call__(
|
362
381
|
self,
|
363
|
-
func:
|
382
|
+
func: Callable[P, T_co] | None = None,
|
364
383
|
*,
|
365
384
|
ttl: float | timedelta | str | None = None,
|
366
385
|
max_entries: int | None = None,
|
@@ -368,7 +387,7 @@ class CacheDataAPI:
|
|
368
387
|
persist: CachePersistType | bool = None,
|
369
388
|
experimental_allow_widgets: bool = False,
|
370
389
|
hash_funcs: HashFuncsDict | None = None,
|
371
|
-
) ->
|
390
|
+
) -> CachedFunc[P, T_co] | Callable[[Callable[P, T_co]], CachedFunc[P, T_co]]:
|
372
391
|
return self._decorator(
|
373
392
|
func,
|
374
393
|
ttl=ttl,
|
@@ -381,7 +400,7 @@ class CacheDataAPI:
|
|
381
400
|
|
382
401
|
def _decorator(
|
383
402
|
self,
|
384
|
-
func:
|
403
|
+
func: Callable[P, T_co] | None = None,
|
385
404
|
*,
|
386
405
|
ttl: float | timedelta | str | None,
|
387
406
|
max_entries: int | None,
|
@@ -389,7 +408,7 @@ class CacheDataAPI:
|
|
389
408
|
persist: CachePersistType | bool,
|
390
409
|
experimental_allow_widgets: bool,
|
391
410
|
hash_funcs: HashFuncsDict | None = None,
|
392
|
-
) ->
|
411
|
+
) -> CachedFunc[P, T_co] | Callable[[Callable[P, T_co]], CachedFunc[P, T_co]]:
|
393
412
|
"""Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).
|
394
413
|
|
395
414
|
Cached objects are stored in "pickled" form, which means that the return
|
@@ -567,9 +586,9 @@ class CacheDataAPI:
|
|
567
586
|
if experimental_allow_widgets:
|
568
587
|
show_widget_replay_deprecation("cache_data")
|
569
588
|
|
570
|
-
def wrapper(f:
|
589
|
+
def wrapper(f: Callable[P, T_co]) -> CachedFunc[P, T_co]:
|
571
590
|
return cast(
|
572
|
-
"
|
591
|
+
"CachedFunc[P, T_co]",
|
573
592
|
make_cached_func_wrapper(
|
574
593
|
CachedDataFuncInfo(
|
575
594
|
func=f, # type: ignore
|
@@ -18,10 +18,19 @@ from __future__ import annotations
|
|
18
18
|
|
19
19
|
import math
|
20
20
|
import threading
|
21
|
-
from typing import
|
21
|
+
from typing import (
|
22
|
+
TYPE_CHECKING,
|
23
|
+
Any,
|
24
|
+
Callable,
|
25
|
+
Final,
|
26
|
+
Protocol,
|
27
|
+
TypeVar,
|
28
|
+
cast,
|
29
|
+
overload,
|
30
|
+
)
|
22
31
|
|
23
32
|
from cachetools import TTLCache
|
24
|
-
from typing_extensions import TypeAlias
|
33
|
+
from typing_extensions import ParamSpec, TypeAlias
|
25
34
|
|
26
35
|
import streamlit as st
|
27
36
|
from streamlit.logger import get_logger
|
@@ -184,6 +193,29 @@ class CachedResourceFuncInfo(CachedFuncInfo):
|
|
184
193
|
)
|
185
194
|
|
186
195
|
|
196
|
+
# Type-annotate the decorator function.
|
197
|
+
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
198
|
+
P = ParamSpec("P")
|
199
|
+
T_co = TypeVar("T_co", covariant=True)
|
200
|
+
|
201
|
+
|
202
|
+
class CachedFunc(Protocol[P, T_co]):
|
203
|
+
"""Protocol for cached functions that preserve the original function's signature and add a clear method."""
|
204
|
+
|
205
|
+
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T_co: ...
|
206
|
+
|
207
|
+
@overload
|
208
|
+
def clear(self) -> None: ...
|
209
|
+
|
210
|
+
@overload
|
211
|
+
def clear(self, *args: P.args, **kwargs: P.kwargs) -> None: ...
|
212
|
+
|
213
|
+
# Currently we can't define the "all-optional" argument overload with `P.args` and `P.kwargs` in Python.
|
214
|
+
# So we use `Any` as a fallback.
|
215
|
+
@overload
|
216
|
+
def clear(self, *args: Any, **kwargs: Any) -> None: ...
|
217
|
+
|
218
|
+
|
187
219
|
class CacheResourceAPI:
|
188
220
|
"""Implements the public st.cache_resource API: the @st.cache_resource decorator,
|
189
221
|
and st.cache_resource.clear().
|
@@ -202,14 +234,9 @@ class CacheResourceAPI:
|
|
202
234
|
# (Ignore spurious mypy complaints - https://github.com/python/mypy/issues/2427)
|
203
235
|
self._decorator = gather_metrics(decorator_metric_name, self._decorator) # type: ignore
|
204
236
|
|
205
|
-
# Type-annotate the decorator function.
|
206
|
-
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
207
|
-
|
208
|
-
F = TypeVar("F", bound=Callable[..., Any])
|
209
|
-
|
210
237
|
# Bare decorator usage
|
211
238
|
@overload
|
212
|
-
def __call__(self, func:
|
239
|
+
def __call__(self, func: Callable[P, T_co]) -> CachedFunc[P, T_co]: ...
|
213
240
|
|
214
241
|
# Decorator with arguments
|
215
242
|
@overload
|
@@ -222,11 +249,11 @@ class CacheResourceAPI:
|
|
222
249
|
validate: ValidateFunc | None = None,
|
223
250
|
experimental_allow_widgets: bool = False,
|
224
251
|
hash_funcs: HashFuncsDict | None = None,
|
225
|
-
) -> Callable[[
|
252
|
+
) -> Callable[[Callable[P, T_co]], CachedFunc[P, T_co]]: ...
|
226
253
|
|
227
254
|
def __call__(
|
228
255
|
self,
|
229
|
-
func:
|
256
|
+
func: Callable[P, T_co] | None = None,
|
230
257
|
*,
|
231
258
|
ttl: float | timedelta | str | None = None,
|
232
259
|
max_entries: int | None = None,
|
@@ -234,7 +261,7 @@ class CacheResourceAPI:
|
|
234
261
|
validate: ValidateFunc | None = None,
|
235
262
|
experimental_allow_widgets: bool = False,
|
236
263
|
hash_funcs: HashFuncsDict | None = None,
|
237
|
-
) ->
|
264
|
+
) -> CachedFunc[P, T_co] | Callable[[Callable[P, T_co]], CachedFunc[P, T_co]]:
|
238
265
|
return self._decorator(
|
239
266
|
func,
|
240
267
|
ttl=ttl,
|
@@ -247,7 +274,7 @@ class CacheResourceAPI:
|
|
247
274
|
|
248
275
|
def _decorator(
|
249
276
|
self,
|
250
|
-
func:
|
277
|
+
func: Callable[P, T_co] | None,
|
251
278
|
*,
|
252
279
|
ttl: float | timedelta | str | None,
|
253
280
|
max_entries: int | None,
|
@@ -255,7 +282,7 @@ class CacheResourceAPI:
|
|
255
282
|
validate: ValidateFunc | None,
|
256
283
|
experimental_allow_widgets: bool,
|
257
284
|
hash_funcs: HashFuncsDict | None = None,
|
258
|
-
) ->
|
285
|
+
) -> CachedFunc[P, T_co] | Callable[[Callable[P, T_co]], CachedFunc[P, T_co]]:
|
259
286
|
"""Decorator to cache functions that return global resources (e.g. database connections, ML models).
|
260
287
|
|
261
288
|
Cached objects are shared across all users, sessions, and reruns. They
|
streamlit/static/index.html
CHANGED
@@ -37,7 +37,7 @@
|
|
37
37
|
<script>
|
38
38
|
window.prerenderReady = false
|
39
39
|
</script>
|
40
|
-
<script type="module" crossorigin src="./static/js/index.
|
40
|
+
<script type="module" crossorigin src="./static/js/index.B6LxYHzZ.js"></script>
|
41
41
|
<link rel="stylesheet" crossorigin href="./static/css/index.CJVRHjQZ.css">
|
42
42
|
</head>
|
43
43
|
<body>
|