streamlit-nightly 1.45.1.dev20250508__py3-none-any.whl → 1.45.1.dev20250509__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/auth_util.py +3 -3
- streamlit/cli_util.py +3 -2
- streamlit/commands/logo.py +2 -2
- streamlit/commands/navigation.py +5 -4
- streamlit/commands/page_config.py +3 -1
- streamlit/components/types/base_custom_component.py +7 -7
- streamlit/components/v1/custom_component.py +6 -6
- streamlit/config.py +9 -9
- streamlit/config_option.py +2 -2
- streamlit/connections/base_connection.py +3 -3
- streamlit/connections/snowflake_connection.py +5 -5
- streamlit/connections/snowpark_connection.py +3 -3
- streamlit/connections/sql_connection.py +9 -10
- streamlit/cursor.py +6 -6
- streamlit/delta_generator.py +7 -6
- streamlit/delta_generator_singletons.py +2 -2
- streamlit/deprecation_util.py +1 -1
- streamlit/elements/arrow.py +2 -3
- streamlit/elements/dialog_decorator.py +3 -3
- streamlit/elements/doc_string.py +20 -20
- streamlit/elements/layouts.py +26 -7
- streamlit/elements/lib/built_in_chart_utils.py +37 -39
- streamlit/elements/lib/color_util.py +3 -3
- streamlit/elements/lib/column_types.py +2 -2
- streamlit/elements/lib/dialog.py +2 -2
- streamlit/elements/lib/event_utils.py +1 -1
- streamlit/elements/lib/mutable_status_container.py +1 -1
- streamlit/elements/lib/policies.py +3 -3
- streamlit/elements/lib/utils.py +5 -5
- streamlit/elements/progress.py +9 -12
- streamlit/elements/vega_charts.py +2 -2
- streamlit/elements/widgets/button_group.py +2 -2
- streamlit/elements/widgets/data_editor.py +2 -2
- streamlit/elements/widgets/multiselect.py +2 -2
- streamlit/elements/widgets/selectbox.py +1 -1
- streamlit/elements/widgets/slider.py +16 -14
- streamlit/elements/write.py +3 -6
- streamlit/errors.py +34 -21
- streamlit/external/langchain/streamlit_callback_handler.py +2 -2
- streamlit/file_util.py +8 -8
- streamlit/git_util.py +1 -1
- streamlit/hello/dataframe_demo.py +1 -1
- streamlit/hello/mapping_demo.py +1 -1
- streamlit/navigation/page.py +1 -1
- streamlit/proto/Block_pb2.py +38 -29
- streamlit/proto/Block_pb2.pyi +68 -4
- streamlit/proto/GapSize_pb2.py +29 -0
- streamlit/proto/GapSize_pb2.pyi +70 -0
- streamlit/proto/HeightConfig_pb2.py +27 -0
- streamlit/proto/HeightConfig_pb2.pyi +48 -0
- streamlit/proto/WidthConfig_pb2.py +2 -2
- streamlit/proto/WidthConfig_pb2.pyi +15 -1
- streamlit/runtime/app_session.py +2 -2
- streamlit/runtime/caching/cache_data_api.py +9 -5
- streamlit/runtime/caching/cache_errors.py +3 -3
- streamlit/runtime/caching/cache_resource_api.py +7 -7
- streamlit/runtime/caching/cache_utils.py +9 -9
- streamlit/runtime/caching/cached_message_replay.py +1 -1
- streamlit/runtime/caching/hashing.py +70 -74
- streamlit/runtime/caching/legacy_cache_api.py +1 -1
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +3 -1
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +1 -1
- streamlit/runtime/connection_factory.py +12 -12
- streamlit/runtime/context.py +2 -2
- streamlit/runtime/credentials.py +3 -3
- streamlit/runtime/fragment.py +3 -4
- streamlit/runtime/media_file_manager.py +2 -2
- streamlit/runtime/memory_media_file_storage.py +1 -1
- streamlit/runtime/memory_uploaded_file_manager.py +1 -1
- streamlit/runtime/metrics_util.py +5 -6
- streamlit/runtime/pages_manager.py +3 -3
- streamlit/runtime/runtime.py +1 -1
- streamlit/runtime/runtime_util.py +2 -2
- streamlit/runtime/scriptrunner/exec_code.py +10 -3
- streamlit/runtime/scriptrunner/magic.py +13 -8
- streamlit/runtime/scriptrunner/script_runner.py +2 -2
- streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
- streamlit/runtime/scriptrunner_utils/script_run_context.py +6 -5
- streamlit/runtime/secrets.py +8 -11
- streamlit/runtime/state/query_params.py +2 -2
- streamlit/runtime/state/safe_session_state.py +2 -2
- streamlit/runtime/state/session_state.py +17 -15
- streamlit/runtime/stats.py +1 -1
- streamlit/runtime/uploaded_file_manager.py +1 -1
- streamlit/source_util.py +3 -4
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.C9UoaGEN.js → ErrorOutline.esm.C-0hf1-k.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DoToR9q0.js → FileDownload.esm.B-fFGI-X.js} +1 -1
- streamlit/static/static/js/{FileHelper.Bt4VJ--Q.js → FileHelper.ACYo0OZo.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.D5PbW8FI.js → FormClearHelper.CVNTT-bJ.js} +1 -1
- streamlit/static/static/js/{Hooks.DgkQ2Xp9.js → Hooks.C3thlpd2.js} +1 -1
- streamlit/static/static/js/{InputInstructions.DLnLhwHI.js → InputInstructions.CwAxousX.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BtSgh_K-.js → ProgressBar.xh599Rum.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CjdyBvQX.js → RenderInPortalIfExists.CQLIsNPE.js} +1 -1
- streamlit/static/static/js/{Toolbar.CAYIzVZk.js → Toolbar.LKdyvP0u.js} +1 -1
- streamlit/static/static/js/{base-input.CD4xW4_9.js → base-input.D8OdS4WW.js} +1 -1
- streamlit/static/static/js/{checkbox.Ba4jj5dR.js → checkbox.DSdYKlOI.js} +1 -1
- streamlit/static/static/js/{createSuper.BBGT9Ijd.js → createSuper.B2pyCfWw.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CYuk1Aj7.js → data-grid-overlay-editor.DhO2r0ne.js} +1 -1
- streamlit/static/static/js/{downloader.DM9KEOCw.js → downloader.C24skoDM.js} +1 -1
- streamlit/static/static/js/{es6.FqM62T4b.js → es6.DHkvCKPh.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.s2B09mw2.js → iframeResizer.contentWindow.2ckQaC2c.js} +1 -1
- streamlit/static/static/js/index.0dGwl8CJ.js +1 -0
- streamlit/static/static/js/index.B5A28NpR.js +1 -0
- streamlit/static/static/js/{index.B9FiDQ3U.js → index.B5EFweZ4.js} +1 -1
- streamlit/static/static/js/{index.DkGCnTMe.js → index.BAafqHfB.js} +1 -1
- streamlit/static/static/js/{index.BMXmhMlZ.js → index.BHTbGZPQ.js} +1 -1
- streamlit/static/static/js/{index.CpDFZQ4Y.js → index.BNXtQAj4.js} +1 -1
- streamlit/static/static/js/index.BRhKaVdO.js +1 -0
- streamlit/static/static/js/index.BSOiJVQd.js +2 -0
- streamlit/static/static/js/{index.BoMRR3tN.js → index.BVgTQbOJ.js} +1 -1
- streamlit/static/static/js/{index.Cwtbhfaf.js → index.BflIniLm.js} +1 -1
- streamlit/static/static/js/{index.DMrO9G6A.js → index.BjeNtZIz.js} +1 -1
- streamlit/static/static/js/{index.C2qCX1Lh.js → index.By-NmdnB.js} +151 -151
- streamlit/static/static/js/{index.b9kK7Vzl.js → index.CIoOEhZ2.js} +1 -1
- streamlit/static/static/js/{index.CEKMSkSh.js → index.CRCdonis.js} +36 -36
- streamlit/static/static/js/{index.T5LKPcND.js → index.CRxaBCJ7.js} +1 -1
- streamlit/static/static/js/{index.CeiCniCg.js → index.CU-pbYVN.js} +1 -1
- streamlit/static/static/js/{index.BVA8TXNT.js → index.CUsk52t2.js} +1 -1
- streamlit/static/static/js/{index.CH9XN_-G.js → index.CVO14oQG.js} +2 -2
- streamlit/static/static/js/index.CXFuA6J-.js +1 -0
- streamlit/static/static/js/{index.DQi04JYE.js → index.C_dd5q7u.js} +1 -1
- streamlit/static/static/js/{index.DTi8Lw0k.js → index.CjWUnKIN.js} +1 -1
- streamlit/static/static/js/{index.DG8IxVeM.js → index.CkTL9bAR.js} +2 -2
- streamlit/static/static/js/{index.D9FvPPrI.js → index.CsbhsAPy.js} +1 -1
- streamlit/static/static/js/{index.R0peMEpV.js → index.CtCnBUtk.js} +1 -1
- streamlit/static/static/js/{index.CP2PmB93.js → index.CwuKadAX.js} +1 -1
- streamlit/static/static/js/{index.BFqpCk2P.js → index.D0R7Xh4Z.js} +1 -1
- streamlit/static/static/js/{index.DSDkXosb.js → index.D2D75EDw.js} +2 -2
- streamlit/static/static/js/{index.BsjuUMyW.js → index.D4eMiZ1F.js} +1 -1
- streamlit/static/static/js/{index.BDTYk2an.js → index.D7SCC3z9.js} +1 -1
- streamlit/static/static/js/{index.JTeVe9GQ.js → index.DZiilxEt.js} +1 -1
- streamlit/static/static/js/{index.BY7-qCf5.js → index.Dvr1cEJS.js} +1 -1
- streamlit/static/static/js/index.JtIlC6Uq.js +1 -0
- streamlit/static/static/js/index.fz_c3Xh_.js +1 -0
- streamlit/static/static/js/{index.CqaahZPf.js → index.gFjPlsMT.js} +1 -1
- streamlit/static/static/js/{index.0pkoyBcb.js → index.jCJYMVED.js} +1 -1
- streamlit/static/static/js/{index.DWaB7Scf.js → index.xldt56AE.js} +1 -1
- streamlit/static/static/js/{index.CyE1OdOj.js → index.yzoj_DuM.js} +1 -1
- streamlit/static/static/js/{input.DMOGBelK.js → input.BP6LX_Bg.js} +1 -1
- streamlit/static/static/js/{memory.DmCktBGW.js → memory.E9x2ZYJv.js} +1 -1
- streamlit/static/static/js/{mergeWith.DeWTsJ5h.js → mergeWith.CZP2AaVS.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DDFelcUP.js → number-overlay-editor.D-Kl79U_.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.CYJtAqB-.js → possibleConstructorReturn.P2ILVC_6.js} +1 -1
- streamlit/static/static/js/{sandbox.CfaU9Ih9.js → sandbox.DfzJIGMV.js} +1 -1
- streamlit/static/static/js/{textarea.7hWYKDw2.js → textarea.4PjzfDWF.js} +1 -1
- streamlit/static/static/js/{timepicker.DZsgZ9oE.js → timepicker.DMQdaNzO.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CqWB4Jry.js → toConsumableArray.BEdkbHYx.js} +1 -1
- streamlit/static/static/js/{uniqueId.DQ533D9O.js → uniqueId.CAs7ftHC.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.-99xbU_o.js → useBasicWidgetState.Cedp0V76.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.B4G2Q7Bu.js → useOnInputChange.CvRKHHKx.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BJQZ2aNc.js → withFullScreenWrapper.BbmjZAzW.js} +1 -1
- streamlit/string_util.py +6 -7
- streamlit/temporary_directory.py +12 -3
- streamlit/testing/v1/app_test.py +11 -6
- streamlit/testing/v1/element_tree.py +134 -158
- streamlit/testing/v1/local_script_runner.py +5 -5
- streamlit/testing/v1/util.py +11 -4
- streamlit/type_util.py +3 -4
- streamlit/user_info.py +3 -2
- streamlit/util.py +1 -1
- streamlit/watcher/event_based_path_watcher.py +1 -1
- streamlit/watcher/folder_black_list.py +1 -1
- streamlit/watcher/local_sources_watcher.py +5 -5
- streamlit/watcher/path_watcher.py +1 -1
- streamlit/web/cli.py +12 -11
- streamlit/web/server/browser_websocket_handler.py +1 -1
- streamlit/web/server/component_request_handler.py +1 -1
- streamlit/web/server/media_file_handler.py +2 -1
- streamlit/web/server/oauth_authlib_routes.py +2 -2
- streamlit/web/server/oidc_mixin.py +13 -6
- streamlit/web/server/routes.py +3 -3
- streamlit/web/server/server.py +1 -1
- streamlit/web/server/server_util.py +7 -6
- streamlit/web/server/upload_file_request_handler.py +5 -5
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/RECORD +181 -177
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/WHEEL +1 -1
- streamlit/static/static/js/index.CCD4LJ9Q.js +0 -1
- streamlit/static/static/js/index.CbLZDRQu.js +0 -1
- streamlit/static/static/js/index.D9qEk5xd.js +0 -1
- streamlit/static/static/js/index.DTXSsTgK.js +0 -1
- streamlit/static/static/js/index.DqVjOqxm.js +0 -1
- streamlit/static/static/js/index.RHbaxsqm.js +0 -1
- streamlit/static/static/js/index.hT9gkW3a.js +0 -2
- {streamlit_nightly-1.45.1.dev20250508.data → streamlit_nightly-1.45.1.dev20250509.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.1.dev20250508.dist-info → streamlit_nightly-1.45.1.dev20250509.dist-info}/top_level.txt +0 -0
streamlit/auth_util.py
CHANGED
@@ -126,7 +126,7 @@ def decode_provider_token(provider_token: str) -> ProviderTokenPayload:
|
|
126
126
|
return cast("ProviderTokenPayload", payload)
|
127
127
|
|
128
128
|
|
129
|
-
def generate_default_provider_section(auth_section) -> dict[str, Any]:
|
129
|
+
def generate_default_provider_section(auth_section: AttrDict) -> dict[str, Any]:
|
130
130
|
"""Generate a default provider section for the 'auth' section of secrets.toml."""
|
131
131
|
default_provider_section = {}
|
132
132
|
if auth_section.get("client_id"):
|
@@ -138,8 +138,8 @@ def generate_default_provider_section(auth_section) -> dict[str, Any]:
|
|
138
138
|
"server_metadata_url"
|
139
139
|
)
|
140
140
|
if auth_section.get("client_kwargs"):
|
141
|
-
default_provider_section["client_kwargs"] =
|
142
|
-
"client_kwargs"
|
141
|
+
default_provider_section["client_kwargs"] = cast(
|
142
|
+
"AttrDict", auth_section.get("client_kwargs", AttrDict({}))
|
143
143
|
).to_dict()
|
144
144
|
return default_provider_section
|
145
145
|
|
streamlit/cli_util.py
CHANGED
@@ -18,11 +18,12 @@ from __future__ import annotations
|
|
18
18
|
|
19
19
|
import os
|
20
20
|
import subprocess
|
21
|
+
from typing import Any
|
21
22
|
|
22
23
|
from streamlit import env_util, errors
|
23
24
|
|
24
25
|
|
25
|
-
def print_to_cli(message: str, **kwargs) -> None:
|
26
|
+
def print_to_cli(message: str, **kwargs: Any) -> None:
|
26
27
|
"""Print a message to the terminal using click if available, else print
|
27
28
|
using the built-in print function.
|
28
29
|
|
@@ -36,7 +37,7 @@ def print_to_cli(message: str, **kwargs) -> None:
|
|
36
37
|
print(message, flush=True) # noqa: T201
|
37
38
|
|
38
39
|
|
39
|
-
def style_for_cli(message: str, **kwargs) -> str:
|
40
|
+
def style_for_cli(message: str, **kwargs: Any) -> str:
|
40
41
|
"""Style a message using click if available, else return the message
|
41
42
|
unchanged.
|
42
43
|
|
streamlit/commands/logo.py
CHANGED
@@ -26,7 +26,7 @@ from streamlit.runtime.metrics_util import gather_metrics
|
|
26
26
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
27
27
|
|
28
28
|
|
29
|
-
def _invalid_logo_text(field_name: str):
|
29
|
+
def _invalid_logo_text(field_name: str) -> str:
|
30
30
|
return (
|
31
31
|
f"The {field_name} passed to st.logo is invalid - See "
|
32
32
|
"[documentation](https://docs.streamlit.io/develop/api-reference/media/st.logo) "
|
@@ -176,7 +176,7 @@ def logo(
|
|
176
176
|
except Exception as ex:
|
177
177
|
raise StreamlitAPIException(_invalid_logo_text("icon_image")) from ex
|
178
178
|
|
179
|
-
def validate_size(size):
|
179
|
+
def validate_size(size: str) -> str:
|
180
180
|
if isinstance(size, str):
|
181
181
|
image_size = size.lower()
|
182
182
|
valid_sizes = ["small", "medium", "large"]
|
streamlit/commands/navigation.py
CHANGED
@@ -73,7 +73,7 @@ def pages_from_nav_sections(
|
|
73
73
|
return page_list
|
74
74
|
|
75
75
|
|
76
|
-
def send_page_not_found(ctx: ScriptRunContext):
|
76
|
+
def send_page_not_found(ctx: ScriptRunContext) -> None:
|
77
77
|
msg = ForwardMsg()
|
78
78
|
msg.page_not_found.page_name = ""
|
79
79
|
ctx.enqueue(msg)
|
@@ -335,9 +335,10 @@ def _navigation(
|
|
335
335
|
}
|
336
336
|
|
337
337
|
msg = ForwardMsg()
|
338
|
-
if
|
339
|
-
|
340
|
-
|
338
|
+
if (
|
339
|
+
position == "hidden"
|
340
|
+
or config.get_option("client.showSidebarNavigation") is False
|
341
|
+
):
|
341
342
|
msg.navigation.position = NavigationProto.Position.HIDDEN
|
342
343
|
else:
|
343
344
|
msg.navigation.position = NavigationProto.Position.SIDEBAR
|
@@ -279,7 +279,9 @@ def get_random_emoji() -> str:
|
|
279
279
|
return random.choice(RANDOM_EMOJIS + 10 * ENG_EMOJIS) # noqa: S311
|
280
280
|
|
281
281
|
|
282
|
-
def set_menu_items_proto(
|
282
|
+
def set_menu_items_proto(
|
283
|
+
lowercase_menu_items: MenuItems, menu_items_proto: PageConfigProto.MenuItems
|
284
|
+
) -> None:
|
283
285
|
if GET_HELP_KEY in lowercase_menu_items:
|
284
286
|
if lowercase_menu_items[GET_HELP_KEY] is not None:
|
285
287
|
menu_items_proto.get_help_url = lowercase_menu_items[GET_HELP_KEY]
|
@@ -40,7 +40,7 @@ class BaseCustomComponent(ABC):
|
|
40
40
|
path: str | None = None,
|
41
41
|
url: str | None = None,
|
42
42
|
module_name: str | None = None,
|
43
|
-
):
|
43
|
+
) -> None:
|
44
44
|
if (path is None and url is None) or (path is not None and url is not None):
|
45
45
|
raise StreamlitAPIException(
|
46
46
|
"Either 'path' or 'url' must be set, but not both."
|
@@ -56,12 +56,12 @@ class BaseCustomComponent(ABC):
|
|
56
56
|
|
57
57
|
def __call__(
|
58
58
|
self,
|
59
|
-
*args,
|
59
|
+
*args: Any,
|
60
60
|
default: Any = None,
|
61
61
|
key: str | None = None,
|
62
62
|
on_change: WidgetCallback | None = None,
|
63
63
|
tab_index: int | None = None,
|
64
|
-
**kwargs,
|
64
|
+
**kwargs: Any,
|
65
65
|
) -> Any:
|
66
66
|
"""An alias for create_instance."""
|
67
67
|
return self.create_instance(
|
@@ -99,24 +99,24 @@ class BaseCustomComponent(ABC):
|
|
99
99
|
return f"'{self.name}': {self.path if self.path is not None else self.url}"
|
100
100
|
|
101
101
|
@abstractmethod
|
102
|
-
def __eq__(self, other) -> bool:
|
102
|
+
def __eq__(self, other: object) -> bool:
|
103
103
|
"""Equality operator."""
|
104
104
|
return NotImplemented
|
105
105
|
|
106
106
|
@abstractmethod
|
107
|
-
def __ne__(self, other) -> bool:
|
107
|
+
def __ne__(self, other: object) -> bool:
|
108
108
|
"""Inequality operator."""
|
109
109
|
return NotImplemented
|
110
110
|
|
111
111
|
@abstractmethod
|
112
112
|
def create_instance(
|
113
113
|
self,
|
114
|
-
*args,
|
114
|
+
*args: Any,
|
115
115
|
default: Any = None,
|
116
116
|
key: str | None = None,
|
117
117
|
on_change: WidgetCallback | None = None,
|
118
118
|
tab_index: int | None = None,
|
119
|
-
**kwargs,
|
119
|
+
**kwargs: Any,
|
120
120
|
) -> Any:
|
121
121
|
"""Create a new instance of the component.
|
122
122
|
|
@@ -48,12 +48,12 @@ class CustomComponent(BaseCustomComponent):
|
|
48
48
|
|
49
49
|
def __call__(
|
50
50
|
self,
|
51
|
-
*args,
|
51
|
+
*args: Any,
|
52
52
|
default: Any = None,
|
53
53
|
key: str | None = None,
|
54
54
|
on_change: WidgetCallback | None = None,
|
55
55
|
tab_index: int | None = None,
|
56
|
-
**kwargs,
|
56
|
+
**kwargs: Any,
|
57
57
|
) -> Any:
|
58
58
|
"""An alias for create_instance."""
|
59
59
|
return self.create_instance(
|
@@ -68,12 +68,12 @@ class CustomComponent(BaseCustomComponent):
|
|
68
68
|
@gather_metrics("create_instance")
|
69
69
|
def create_instance(
|
70
70
|
self,
|
71
|
-
*args,
|
71
|
+
*args: Any,
|
72
72
|
default: Any = None,
|
73
73
|
key: str | None = None,
|
74
74
|
on_change: WidgetCallback | None = None,
|
75
75
|
tab_index: int | None = None,
|
76
|
-
**kwargs,
|
76
|
+
**kwargs: Any,
|
77
77
|
) -> Any:
|
78
78
|
"""Create a new instance of the component.
|
79
79
|
|
@@ -243,7 +243,7 @@ And if you're using Streamlit Cloud, add "pyarrow" to your requirements.txt."""
|
|
243
243
|
dg._enqueue("component_instance", element.component_instance)
|
244
244
|
return return_value
|
245
245
|
|
246
|
-
def __eq__(self, other) -> bool:
|
246
|
+
def __eq__(self, other: object) -> bool:
|
247
247
|
"""Equality operator."""
|
248
248
|
return (
|
249
249
|
isinstance(other, CustomComponent)
|
@@ -253,7 +253,7 @@ And if you're using Streamlit Cloud, add "pyarrow" to your requirements.txt."""
|
|
253
253
|
and self.module_name == other.module_name
|
254
254
|
)
|
255
255
|
|
256
|
-
def __ne__(self, other) -> bool:
|
256
|
+
def __ne__(self, other: object) -> bool:
|
257
257
|
"""Inequality operator."""
|
258
258
|
|
259
259
|
# we have to use "not X == Y"" here because if we use "X != Y"
|
streamlit/config.py
CHANGED
@@ -77,11 +77,11 @@ class ShowErrorDetailsConfigOptions(str, Enum):
|
|
77
77
|
NONE = "none"
|
78
78
|
|
79
79
|
@staticmethod
|
80
|
-
def is_true_variation(val: str | bool):
|
80
|
+
def is_true_variation(val: str | bool) -> bool:
|
81
81
|
return val in ["true", "True", True]
|
82
82
|
|
83
83
|
@staticmethod
|
84
|
-
def is_false_variation(val: str | bool):
|
84
|
+
def is_false_variation(val: str | bool) -> bool:
|
85
85
|
return val in ["false", "False", False]
|
86
86
|
|
87
87
|
# Config options can be set from several places including the command-line and
|
@@ -466,8 +466,7 @@ def _logger_log_level() -> str:
|
|
466
466
|
"""
|
467
467
|
if get_option("global.developmentMode"):
|
468
468
|
return "debug"
|
469
|
-
|
470
|
-
return "info"
|
469
|
+
return "info"
|
471
470
|
|
472
471
|
|
473
472
|
@_create_option("logger.messageFormat", type_=str)
|
@@ -484,8 +483,7 @@ def _logger_message_format() -> str:
|
|
484
483
|
from streamlit.logger import DEFAULT_LOG_MESSAGE
|
485
484
|
|
486
485
|
return DEFAULT_LOG_MESSAGE
|
487
|
-
|
488
|
-
return "%(asctime)s %(message)s"
|
486
|
+
return "%(asctime)s %(message)s"
|
489
487
|
|
490
488
|
|
491
489
|
@_create_option(
|
@@ -1382,7 +1380,9 @@ def _set_option(key: str, value: Any, where_defined: str) -> None:
|
|
1382
1380
|
_config_options[key].set_value(value, where_defined)
|
1383
1381
|
|
1384
1382
|
|
1385
|
-
def _update_config_with_sensitive_env_var(
|
1383
|
+
def _update_config_with_sensitive_env_var(
|
1384
|
+
config_options: dict[str, ConfigOption],
|
1385
|
+
) -> None:
|
1386
1386
|
"""Update the config system by parsing the environment variable.
|
1387
1387
|
|
1388
1388
|
This should only be called from get_config_options.
|
@@ -1529,7 +1529,7 @@ CONFIG_FILENAMES = [
|
|
1529
1529
|
|
1530
1530
|
|
1531
1531
|
def get_config_options(
|
1532
|
-
force_reparse=False, options_from_flags: dict[str, Any] | None = None
|
1532
|
+
force_reparse: bool = False, options_from_flags: dict[str, Any] | None = None
|
1533
1533
|
) -> dict[str, ConfigOption]:
|
1534
1534
|
"""Create and return a dict mapping config option names to their values,
|
1535
1535
|
returning a cached dict if possible.
|
@@ -1652,7 +1652,7 @@ def _set_development_mode() -> None:
|
|
1652
1652
|
|
1653
1653
|
|
1654
1654
|
def on_config_parsed(
|
1655
|
-
func: Callable[[], None], force_connect=False, lock=False
|
1655
|
+
func: Callable[[], None], force_connect: bool = False, lock: bool = False
|
1656
1656
|
) -> Callable[[], bool]:
|
1657
1657
|
"""Wait for the config file to be parsed then call func.
|
1658
1658
|
|
streamlit/config_option.py
CHANGED
@@ -108,7 +108,7 @@ class ConfigOption:
|
|
108
108
|
replaced_by: str | None = None,
|
109
109
|
type_: type = str,
|
110
110
|
sensitive: bool = False,
|
111
|
-
):
|
111
|
+
) -> None:
|
112
112
|
"""Create a ConfigOption with the given name.
|
113
113
|
|
114
114
|
Parameters
|
@@ -301,7 +301,7 @@ class ConfigOption:
|
|
301
301
|
return now > expiration_date
|
302
302
|
|
303
303
|
@property
|
304
|
-
def env_var(self):
|
304
|
+
def env_var(self) -> str:
|
305
305
|
"""Get the name of the environment variable that can be used to set the option."""
|
306
306
|
name = self.key.replace(".", "_")
|
307
307
|
return f"STREAMLIT_{to_snake_case(name).upper()}"
|
@@ -43,7 +43,7 @@ class BaseConnection(ABC, Generic[RawConnectionT]):
|
|
43
43
|
reads and a ``session`` property for more complex operations.
|
44
44
|
"""
|
45
45
|
|
46
|
-
def __init__(self, connection_name: str, **kwargs) -> None:
|
46
|
+
def __init__(self, connection_name: str, **kwargs: Any) -> None:
|
47
47
|
"""Create a BaseConnection.
|
48
48
|
|
49
49
|
This constructor is called by the connection factory machinery when a user
|
@@ -87,7 +87,7 @@ class BaseConnection(ABC, Generic[RawConnectionT]):
|
|
87
87
|
|
88
88
|
# Methods with default implementations that we don't expect subclasses to want or
|
89
89
|
# need to overwrite.
|
90
|
-
def _on_secrets_changed(self, _) -> None:
|
90
|
+
def _on_secrets_changed(self, _: str) -> None:
|
91
91
|
"""Reset the raw connection object when this connection's secrets change.
|
92
92
|
|
93
93
|
We don't expect either user scripts or connection authors to have to use or
|
@@ -155,7 +155,7 @@ class BaseConnection(ABC, Generic[RawConnectionT]):
|
|
155
155
|
|
156
156
|
# Abstract fields/methods that subclasses of BaseConnection must implement
|
157
157
|
@abstractmethod
|
158
|
-
def _connect(self, **kwargs) -> RawConnectionT:
|
158
|
+
def _connect(self, **kwargs: Any) -> RawConnectionT:
|
159
159
|
"""Create an instance of an underlying connection object.
|
160
160
|
|
161
161
|
This abstract method is the one method that we require subclasses of
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
from __future__ import annotations
|
22
22
|
|
23
|
-
from typing import TYPE_CHECKING, Final, cast
|
23
|
+
from typing import TYPE_CHECKING, Any, Final, cast
|
24
24
|
|
25
25
|
from streamlit import logger
|
26
26
|
from streamlit.connections import BaseConnection
|
@@ -218,7 +218,7 @@ class SnowflakeConnection(BaseConnection["InternalSnowflakeConnection"]):
|
|
218
218
|
|
219
219
|
"""
|
220
220
|
|
221
|
-
def _connect(self, **kwargs) -> InternalSnowflakeConnection:
|
221
|
+
def _connect(self, **kwargs: Any) -> InternalSnowflakeConnection:
|
222
222
|
import snowflake.connector # type:ignore[import]
|
223
223
|
from snowflake.connector import Error as SnowflakeError # type:ignore[import]
|
224
224
|
|
@@ -281,8 +281,8 @@ class SnowflakeConnection(BaseConnection["InternalSnowflakeConnection"]):
|
|
281
281
|
*, # keyword-only arguments:
|
282
282
|
ttl: float | int | timedelta | None = None,
|
283
283
|
show_spinner: bool | str = "Running `snowflake.query(...)`.",
|
284
|
-
params=None,
|
285
|
-
**kwargs,
|
284
|
+
params: Any = None,
|
285
|
+
**kwargs: Any,
|
286
286
|
) -> DataFrame:
|
287
287
|
"""Run a read-only SQL query.
|
288
288
|
|
@@ -378,7 +378,7 @@ class SnowflakeConnection(BaseConnection["InternalSnowflakeConnection"]):
|
|
378
378
|
database: str | None = None,
|
379
379
|
schema: str | None = None,
|
380
380
|
chunk_size: int | None = None,
|
381
|
-
**kwargs,
|
381
|
+
**kwargs: Any,
|
382
382
|
) -> tuple[bool, int, int]:
|
383
383
|
"""Write a ``pandas.DataFrame`` to a table in a Snowflake database.
|
384
384
|
|
@@ -23,7 +23,7 @@ from __future__ import annotations
|
|
23
23
|
import threading
|
24
24
|
from collections import ChainMap
|
25
25
|
from contextlib import contextmanager
|
26
|
-
from typing import TYPE_CHECKING, cast
|
26
|
+
from typing import TYPE_CHECKING, Any, cast
|
27
27
|
|
28
28
|
from streamlit.connections import BaseConnection
|
29
29
|
from streamlit.connections.util import (
|
@@ -61,11 +61,11 @@ class SnowparkConnection(BaseConnection["Session"]):
|
|
61
61
|
over the single underlying Session object under high load.
|
62
62
|
"""
|
63
63
|
|
64
|
-
def __init__(self, connection_name: str, **kwargs) -> None:
|
64
|
+
def __init__(self, connection_name: str, **kwargs: Any) -> None:
|
65
65
|
self._lock = threading.RLock()
|
66
66
|
super().__init__(connection_name, **kwargs)
|
67
67
|
|
68
|
-
def _connect(self, **kwargs) -> Session:
|
68
|
+
def _connect(self, **kwargs: Any) -> Session:
|
69
69
|
from snowflake.snowpark.context import get_active_session # type:ignore[import]
|
70
70
|
from snowflake.snowpark.session import Session
|
71
71
|
|
@@ -21,7 +21,7 @@ from __future__ import annotations
|
|
21
21
|
|
22
22
|
from collections import ChainMap
|
23
23
|
from copy import deepcopy
|
24
|
-
from typing import TYPE_CHECKING, cast
|
24
|
+
from typing import TYPE_CHECKING, Any, cast
|
25
25
|
|
26
26
|
from streamlit.connections import BaseConnection
|
27
27
|
from streamlit.connections.util import extract_from_dict
|
@@ -176,7 +176,7 @@ class SQLConnection(BaseConnection["Engine"]):
|
|
176
176
|
|
177
177
|
"""
|
178
178
|
|
179
|
-
def _connect(self, autocommit: bool = False, **kwargs) -> Engine:
|
179
|
+
def _connect(self, autocommit: bool = False, **kwargs: Any) -> Engine:
|
180
180
|
import sqlalchemy
|
181
181
|
|
182
182
|
kwargs = deepcopy(kwargs)
|
@@ -217,8 +217,7 @@ class SQLConnection(BaseConnection["Engine"]):
|
|
217
217
|
|
218
218
|
if autocommit:
|
219
219
|
return cast("Engine", eng.execution_options(isolation_level="AUTOCOMMIT"))
|
220
|
-
|
221
|
-
return cast("Engine", eng)
|
220
|
+
return cast("Engine", eng)
|
222
221
|
|
223
222
|
def query(
|
224
223
|
self,
|
@@ -228,8 +227,8 @@ class SQLConnection(BaseConnection["Engine"]):
|
|
228
227
|
ttl: float | int | timedelta | None = None,
|
229
228
|
index_col: str | list[str] | None = None,
|
230
229
|
chunksize: int | None = None,
|
231
|
-
params=None,
|
232
|
-
**kwargs,
|
230
|
+
params: Any | None = None,
|
231
|
+
**kwargs: Any,
|
233
232
|
) -> DataFrame:
|
234
233
|
"""Run a read-only query.
|
235
234
|
|
@@ -312,10 +311,10 @@ class SQLConnection(BaseConnection["Engine"]):
|
|
312
311
|
)
|
313
312
|
def _query(
|
314
313
|
sql: str,
|
315
|
-
index_col=None,
|
316
|
-
chunksize=None,
|
317
|
-
params=None,
|
318
|
-
**kwargs,
|
314
|
+
index_col: str | list[str] | None = None,
|
315
|
+
chunksize: int | None = None,
|
316
|
+
params: Any | None = None,
|
317
|
+
**kwargs: Any,
|
319
318
|
) -> DataFrame:
|
320
319
|
import pandas as pd
|
321
320
|
|
streamlit/cursor.py
CHANGED
@@ -91,7 +91,7 @@ class Cursor:
|
|
91
91
|
def is_locked(self) -> bool:
|
92
92
|
raise NotImplementedError()
|
93
93
|
|
94
|
-
def get_locked_cursor(self, **props) -> LockedCursor:
|
94
|
+
def get_locked_cursor(self, **props: Any) -> LockedCursor:
|
95
95
|
raise NotImplementedError()
|
96
96
|
|
97
97
|
@property
|
@@ -105,7 +105,7 @@ class Cursor:
|
|
105
105
|
|
106
106
|
|
107
107
|
class RunningCursor(Cursor):
|
108
|
-
def __init__(self, root_container: int, parent_path: tuple[int, ...] = ()):
|
108
|
+
def __init__(self, root_container: int, parent_path: tuple[int, ...] = ()) -> None:
|
109
109
|
"""A moving pointer to a delta location in the app.
|
110
110
|
|
111
111
|
RunningCursors auto-increment to the next available location when you
|
@@ -140,7 +140,7 @@ class RunningCursor(Cursor):
|
|
140
140
|
def is_locked(self) -> bool:
|
141
141
|
return False
|
142
142
|
|
143
|
-
def get_locked_cursor(self, **props) -> LockedCursor:
|
143
|
+
def get_locked_cursor(self, **props: Any) -> LockedCursor:
|
144
144
|
locked_cursor = LockedCursor(
|
145
145
|
root_container=self._root_container,
|
146
146
|
parent_path=self._parent_path,
|
@@ -159,8 +159,8 @@ class LockedCursor(Cursor):
|
|
159
159
|
root_container: int,
|
160
160
|
parent_path: tuple[int, ...] = (),
|
161
161
|
index: int = 0,
|
162
|
-
**props,
|
163
|
-
):
|
162
|
+
**props: Any,
|
163
|
+
) -> None:
|
164
164
|
"""A locked pointer to a location in the app.
|
165
165
|
|
166
166
|
LockedCursors always point to the same location, even when you call
|
@@ -201,7 +201,7 @@ class LockedCursor(Cursor):
|
|
201
201
|
def is_locked(self) -> bool:
|
202
202
|
return True
|
203
203
|
|
204
|
-
def get_locked_cursor(self, **props) -> LockedCursor:
|
204
|
+
def get_locked_cursor(self, **props: Any) -> LockedCursor:
|
205
205
|
self._props = props
|
206
206
|
return self
|
207
207
|
|
streamlit/delta_generator.py
CHANGED
@@ -100,6 +100,8 @@ from streamlit.runtime.scriptrunner import enqueue_message as _enqueue_message
|
|
100
100
|
from streamlit.runtime.scriptrunner import get_script_run_ctx
|
101
101
|
|
102
102
|
if TYPE_CHECKING:
|
103
|
+
from types import TracebackType
|
104
|
+
|
103
105
|
from google.protobuf.message import Message
|
104
106
|
|
105
107
|
from streamlit.cursor import Cursor
|
@@ -301,9 +303,9 @@ class DeltaGenerator(
|
|
301
303
|
|
302
304
|
def __exit__(
|
303
305
|
self,
|
304
|
-
|
305
|
-
|
306
|
-
|
306
|
+
typ: type[BaseException] | None,
|
307
|
+
exc: BaseException | None,
|
308
|
+
tb: TracebackType | None,
|
307
309
|
) -> Literal[False]:
|
308
310
|
# with block ended
|
309
311
|
|
@@ -365,7 +367,7 @@ class DeltaGenerator(
|
|
365
367
|
|
366
368
|
return wrapper
|
367
369
|
|
368
|
-
def __deepcopy__(self, _memo):
|
370
|
+
def __deepcopy__(self, _memo: Any) -> DeltaGenerator:
|
369
371
|
dg = DeltaGenerator(
|
370
372
|
root_container=self._root_container,
|
371
373
|
cursor=deepcopy(self._cursor),
|
@@ -406,8 +408,7 @@ class DeltaGenerator(
|
|
406
408
|
"""
|
407
409
|
if self._provided_cursor is None:
|
408
410
|
return cursor.get_container_cursor(self._root_container)
|
409
|
-
|
410
|
-
return self._provided_cursor
|
411
|
+
return self._provided_cursor
|
411
412
|
|
412
413
|
@property
|
413
414
|
def _is_top_level(self) -> bool:
|
@@ -52,7 +52,7 @@ class DeltaGeneratorSingleton:
|
|
52
52
|
delta_generator_cls: type[DeltaGenerator],
|
53
53
|
status_container_cls: type[StatusContainer],
|
54
54
|
dialog_container_cls: type[Dialog],
|
55
|
-
):
|
55
|
+
) -> None:
|
56
56
|
"""Registers and initializes all delta-generator classes.
|
57
57
|
|
58
58
|
Parameters
|
@@ -138,7 +138,7 @@ class ContextVarWithLazyDefault(Generic[_T]):
|
|
138
138
|
the default dg (main_dg) might not exist yet when this module is imported.
|
139
139
|
"""
|
140
140
|
|
141
|
-
def __init__(self, name: str, *, default: Callable[[], _T]):
|
141
|
+
def __init__(self, name: str, *, default: Callable[[], _T]) -> None:
|
142
142
|
self._name = name
|
143
143
|
self._default = default
|
144
144
|
self._context_var: ContextVar[_T] | None = None
|
streamlit/deprecation_util.py
CHANGED
@@ -188,7 +188,7 @@ def _create_deprecated_obj_wrapper(obj: TObj, show_warning: Callable[[], Any]) -
|
|
188
188
|
return getattr(obj, attr)
|
189
189
|
|
190
190
|
@staticmethod
|
191
|
-
def _get_magic_functions(self_cls) -> list[str]:
|
191
|
+
def _get_magic_functions(self_cls: type[object]) -> list[str]:
|
192
192
|
# ignore the handful of magic functions we cannot override without
|
193
193
|
# breaking the Wrapper.
|
194
194
|
ignore = ("__class__", "__dict__", "__getattribute__", "__getattr__")
|
streamlit/elements/arrow.py
CHANGED
@@ -645,8 +645,7 @@ class ArrowMixin:
|
|
645
645
|
)
|
646
646
|
self.dg._enqueue("arrow_data_frame", proto)
|
647
647
|
return cast("DataframeState", widget_state.value)
|
648
|
-
|
649
|
-
return self.dg._enqueue("arrow_data_frame", proto)
|
648
|
+
return self.dg._enqueue("arrow_data_frame", proto)
|
650
649
|
|
651
650
|
@gather_metrics("table")
|
652
651
|
def table(self, data: Data = None) -> DeltaGenerator:
|
@@ -733,7 +732,7 @@ class ArrowMixin:
|
|
733
732
|
return self.dg._enqueue("arrow_table", proto)
|
734
733
|
|
735
734
|
@gather_metrics("add_rows")
|
736
|
-
def add_rows(self, data: Data = None, **kwargs) -> DeltaGenerator | None:
|
735
|
+
def add_rows(self, data: Data = None, **kwargs: Any) -> DeltaGenerator | None:
|
737
736
|
"""Concatenate a dataframe to the bottom of the current one.
|
738
737
|
|
739
738
|
Parameters
|
@@ -15,7 +15,7 @@
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
17
|
from functools import wraps
|
18
|
-
from typing import TYPE_CHECKING, Callable, TypeVar, cast, overload
|
18
|
+
from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast, overload
|
19
19
|
|
20
20
|
from streamlit.delta_generator_singletons import (
|
21
21
|
get_dg_singleton_instance,
|
@@ -74,7 +74,7 @@ def _dialog_decorator(
|
|
74
74
|
)
|
75
75
|
|
76
76
|
@wraps(non_optional_func)
|
77
|
-
def wrap(*args, **kwargs) -> None:
|
77
|
+
def wrap(*args: Any, **kwargs: Any) -> None:
|
78
78
|
_assert_no_nested_dialogs()
|
79
79
|
# Call the Dialog on the event_dg because it lives outside of the normal
|
80
80
|
# Streamlit UI flow. For example, if it is called from the sidebar, it should
|
@@ -109,7 +109,7 @@ def _dialog_decorator(
|
|
109
109
|
|
110
110
|
with dialog:
|
111
111
|
fragmented_dialog_content()
|
112
|
-
return
|
112
|
+
return
|
113
113
|
|
114
114
|
return cast("F", wrap)
|
115
115
|
|