streamlit 1.45.1__py3-none-any.whl → 1.46.1__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 +5 -1
- streamlit/auth_util.py +12 -12
- streamlit/cli_util.py +4 -3
- streamlit/column_config.py +11 -9
- streamlit/commands/echo.py +6 -4
- streamlit/commands/execution_control.py +33 -32
- streamlit/commands/experimental_query_params.py +2 -2
- streamlit/commands/logo.py +9 -4
- streamlit/commands/navigation.py +61 -18
- streamlit/commands/page_config.py +57 -47
- streamlit/components/types/base_custom_component.py +7 -7
- streamlit/components/v1/component_registry.py +7 -3
- streamlit/components/v1/components.py +1 -1
- streamlit/components/v1/custom_component.py +8 -8
- streamlit/config.py +289 -144
- streamlit/config_option.py +19 -15
- streamlit/config_util.py +29 -23
- streamlit/connections/__init__.py +2 -2
- streamlit/connections/base_connection.py +5 -5
- streamlit/connections/snowflake_connection.py +13 -11
- streamlit/connections/snowpark_connection.py +3 -3
- streamlit/connections/sql_connection.py +20 -18
- streamlit/connections/util.py +2 -2
- streamlit/cursor.py +6 -6
- streamlit/dataframe_util.py +52 -52
- streamlit/delta_generator.py +46 -48
- streamlit/delta_generator_singletons.py +3 -3
- streamlit/deprecation_util.py +6 -6
- streamlit/elements/alert.py +37 -29
- streamlit/elements/arrow.py +40 -22
- streamlit/elements/code.py +46 -13
- streamlit/elements/deck_gl_json_chart.py +38 -27
- streamlit/elements/dialog_decorator.py +3 -4
- streamlit/elements/doc_string.py +64 -58
- streamlit/elements/exception.py +23 -27
- streamlit/elements/form.py +41 -0
- streamlit/elements/graphviz_chart.py +1 -1
- streamlit/elements/heading.py +60 -9
- streamlit/elements/html.py +3 -4
- streamlit/elements/image.py +8 -9
- streamlit/elements/json.py +21 -2
- streamlit/elements/layouts.py +120 -31
- streamlit/elements/lib/built_in_chart_utils.py +96 -73
- streamlit/elements/lib/color_util.py +3 -3
- streamlit/elements/lib/column_config_utils.py +2 -4
- streamlit/elements/lib/column_types.py +14 -8
- streamlit/elements/lib/dialog.py +9 -5
- streamlit/elements/lib/image_utils.py +39 -40
- streamlit/elements/lib/js_number.py +4 -4
- streamlit/elements/lib/layout_utils.py +65 -1
- streamlit/elements/lib/mutable_status_container.py +14 -3
- streamlit/elements/lib/options_selector_utils.py +22 -12
- streamlit/elements/lib/pandas_styler_utils.py +25 -21
- streamlit/elements/lib/policies.py +6 -5
- streamlit/elements/lib/streamlit_plotly_theme.py +54 -53
- streamlit/elements/lib/subtitle_utils.py +6 -9
- streamlit/elements/lib/utils.py +20 -5
- streamlit/elements/map.py +32 -56
- streamlit/elements/markdown.py +101 -12
- streamlit/elements/media.py +78 -21
- streamlit/elements/metric.py +32 -16
- streamlit/elements/plotly_chart.py +15 -15
- streamlit/elements/progress.py +33 -15
- streamlit/elements/spinner.py +31 -6
- streamlit/elements/text.py +21 -1
- streamlit/elements/toast.py +1 -2
- streamlit/elements/vega_charts.py +54 -23
- streamlit/elements/widgets/audio_input.py +24 -7
- streamlit/elements/widgets/button.py +26 -19
- streamlit/elements/widgets/button_group.py +10 -15
- streamlit/elements/widgets/camera_input.py +27 -7
- streamlit/elements/widgets/chat.py +91 -38
- streamlit/elements/widgets/checkbox.py +45 -4
- streamlit/elements/widgets/color_picker.py +40 -17
- streamlit/elements/widgets/data_editor.py +76 -37
- streamlit/elements/widgets/file_uploader.py +42 -13
- streamlit/elements/widgets/multiselect.py +7 -10
- streamlit/elements/widgets/number_input.py +123 -47
- streamlit/elements/widgets/radio.py +59 -13
- streamlit/elements/widgets/select_slider.py +35 -30
- streamlit/elements/widgets/selectbox.py +56 -9
- streamlit/elements/widgets/slider.py +190 -99
- streamlit/elements/widgets/text_widgets.py +54 -8
- streamlit/elements/widgets/time_widgets.py +53 -14
- streamlit/elements/write.py +5 -8
- streamlit/env_util.py +2 -7
- streamlit/error_util.py +16 -9
- streamlit/errors.py +69 -48
- streamlit/external/langchain/streamlit_callback_handler.py +10 -5
- streamlit/file_util.py +27 -10
- streamlit/git_util.py +29 -24
- streamlit/hello/animation_demo.py +9 -9
- streamlit/hello/dataframe_demo.py +5 -5
- streamlit/hello/hello.py +1 -0
- streamlit/hello/mapping_demo.py +7 -8
- streamlit/hello/plotting_demo.py +3 -3
- streamlit/hello/streamlit_app.py +28 -26
- streamlit/hello/utils.py +2 -1
- streamlit/logger.py +10 -11
- streamlit/navigation/page.py +11 -8
- streamlit/proto/Audio_pb2.py +4 -3
- streamlit/proto/Audio_pb2.pyi +8 -1
- streamlit/proto/Block_pb2.py +38 -29
- streamlit/proto/Block_pb2.pyi +72 -4
- streamlit/proto/ClientState_pb2.py +4 -4
- streamlit/proto/ClientState_pb2.pyi +7 -2
- streamlit/proto/Code_pb2.py +4 -2
- streamlit/proto/Code_pb2.pyi +1 -0
- streamlit/proto/DataFrame_pb2.pyi +1 -1
- streamlit/proto/DeckGlJsonChart_pb2.pyi +1 -1
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +20 -3
- 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/NamedDataSet_pb2.pyi +1 -1
- streamlit/proto/Navigation_pb2.py +3 -3
- streamlit/proto/Navigation_pb2.pyi +4 -0
- streamlit/proto/NewSession_pb2.py +18 -16
- streamlit/proto/NewSession_pb2.pyi +29 -3
- streamlit/proto/PageConfig_pb2.py +7 -7
- streamlit/proto/PageConfig_pb2.pyi +21 -1
- streamlit/proto/Video_pb2.py +8 -7
- streamlit/proto/Video_pb2.pyi +8 -1
- streamlit/proto/WidthConfig_pb2.py +2 -2
- streamlit/proto/WidthConfig_pb2.pyi +15 -1
- streamlit/runtime/__init__.py +1 -1
- streamlit/runtime/app_session.py +53 -40
- streamlit/runtime/caching/__init__.py +9 -9
- streamlit/runtime/caching/cache_data_api.py +36 -30
- streamlit/runtime/caching/cache_errors.py +4 -4
- streamlit/runtime/caching/cache_resource_api.py +8 -8
- streamlit/runtime/caching/cache_utils.py +15 -14
- streamlit/runtime/caching/cached_message_replay.py +14 -8
- streamlit/runtime/caching/hashing.py +91 -97
- streamlit/runtime/caching/legacy_cache_api.py +2 -2
- streamlit/runtime/caching/storage/cache_storage_protocol.py +1 -1
- streamlit/runtime/caching/storage/dummy_cache_storage.py +1 -1
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +12 -14
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +6 -6
- streamlit/runtime/connection_factory.py +36 -36
- streamlit/runtime/context.py +58 -9
- streamlit/runtime/credentials.py +29 -40
- streamlit/runtime/forward_msg_queue.py +11 -11
- streamlit/runtime/fragment.py +7 -7
- streamlit/runtime/media_file_manager.py +3 -4
- streamlit/runtime/memory_media_file_storage.py +6 -5
- streamlit/runtime/memory_uploaded_file_manager.py +2 -2
- streamlit/runtime/metrics_util.py +11 -12
- streamlit/runtime/pages_manager.py +4 -6
- streamlit/runtime/runtime.py +8 -6
- streamlit/runtime/runtime_util.py +7 -6
- streamlit/runtime/scriptrunner/__init__.py +4 -4
- streamlit/runtime/scriptrunner/exec_code.py +12 -5
- streamlit/runtime/scriptrunner/magic.py +16 -12
- streamlit/runtime/scriptrunner/script_cache.py +1 -1
- streamlit/runtime/scriptrunner/script_runner.py +53 -29
- streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
- streamlit/runtime/scriptrunner_utils/script_requests.py +7 -4
- streamlit/runtime/scriptrunner_utils/script_run_context.py +10 -23
- streamlit/runtime/secrets.py +40 -35
- streamlit/runtime/session_manager.py +2 -1
- streamlit/runtime/state/__init__.py +5 -5
- streamlit/runtime/state/common.py +2 -2
- streamlit/runtime/state/query_params.py +13 -15
- streamlit/runtime/state/query_params_proxy.py +17 -13
- streamlit/runtime/state/safe_session_state.py +2 -2
- streamlit/runtime/state/session_state.py +52 -34
- streamlit/runtime/stats.py +2 -2
- streamlit/runtime/uploaded_file_manager.py +1 -1
- streamlit/runtime/websocket_session_manager.py +10 -6
- streamlit/source_util.py +8 -6
- streamlit/static/index.html +3 -17
- streamlit/static/manifest.json +1180 -0
- streamlit/static/static/css/{index.DqDwtg6_.css → index.CJVRHjQZ.css} +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.DU9IrB3M.js → ErrorOutline.esm.DitPpe1Y.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.P9rKwKo8.js → FileDownload.esm.AI3watX9.js} +1 -1
- streamlit/static/static/js/{FileHelper.D7RMkx0e.js → FileHelper.kt7mhnu8.js} +5 -5
- streamlit/static/static/js/{FormClearHelper.B67tgll0.js → FormClearHelper.D1M9GM_c.js} +1 -1
- streamlit/static/static/js/{Hooks.ncTJktu9.js → Hooks.BGwHKeUc.js} +1 -1
- streamlit/static/static/js/{InputInstructions.D-Y8geDN.js → InputInstructions.DaZ89mzH.js} +1 -1
- streamlit/static/static/js/{ProgressBar.B-kexwwD.js → ProgressBar.C0zPMe-p.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.BgaoZgep.js → RenderInPortalIfExists.Ox8gQvdz.js} +1 -1
- streamlit/static/static/js/Toolbar.KhlcEc0K.js +1 -0
- streamlit/static/static/js/UploadFileInfo.0DCkpDDf.js +6 -0
- streamlit/static/static/js/{base-input.BoAa1U94.js → base-input.BJ4qsfSq.js} +4 -4
- streamlit/static/static/js/{checkbox.Z6iSfe5F.js → checkbox.DSDh78Xz.js} +2 -2
- streamlit/static/static/js/{createSuper.B4oGDYRm.js → createSuper.wQ9SIXEJ.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.msYws2Ou.js → data-grid-overlay-editor.DvbdPJ15.js} +1 -1
- streamlit/static/static/js/{downloader.kc14n2Hv.js → downloader.CD9rzih5.js} +1 -1
- streamlit/static/static/js/{es6.CxQz807-.js → es6.48Q9Qjgb.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.B19u0ONI.js → iframeResizer.contentWindow.CKdem3Bn.js} +1 -1
- streamlit/static/static/js/{index.LaIasviC.js → index.6md5Qhod.js} +1 -1
- streamlit/static/static/js/index.7hy6AeJ1.js +1 -0
- streamlit/static/static/js/index.B4CGJiBW.js +1 -0
- streamlit/static/static/js/index.B8oW0ZTD.js +1 -0
- streamlit/static/static/js/index.BU6RnlHI.js +73 -0
- streamlit/static/static/js/index.BUq9Wcf8.js +197 -0
- streamlit/static/static/js/{index.BFz9U2y0.js → index.BXXo-Yoj.js} +1 -1
- streamlit/static/static/js/index.Bae9H0OS.js +1 -0
- streamlit/static/static/js/{index.-5ruC9At.js → index.BhTl2Uyb.js} +1 -1
- streamlit/static/static/js/{index.BpILzHf_.js → index.BiSaCB1o.js} +20 -20
- streamlit/static/static/js/{index.xNQq3Ei5.js → index.BulSAJ9z.js} +1 -1
- streamlit/static/static/js/{index.9V1KdxfP.js → index.Bv-EuTKR.js} +1 -1
- streamlit/static/static/js/index.BvMLYCHi.js +1 -0
- streamlit/static/static/js/index.C1NIn1Y2.js +783 -0
- streamlit/static/static/js/index.CP-fthOJ.js +2 -0
- streamlit/static/static/js/{index.BoigZiu7.js → index.CS9guO3p.js} +1 -1
- streamlit/static/static/js/index.CYTBHth8.js +1 -0
- streamlit/static/static/js/{index.CmTAF0dM.js → index.CcJufcuD.js} +1 -1
- streamlit/static/static/js/index.CnENU1yn.js +1 -0
- streamlit/static/static/js/index.Cns13qBb.js +1 -0
- streamlit/static/static/js/index.Ct_xXq7w.js +1 -0
- streamlit/static/static/js/{index.BqfdT8-Q.js → index.CxGSemHL.js} +1 -1
- streamlit/static/static/js/index.D5S0ldVb.js +1 -0
- streamlit/static/static/js/index.D72B_ksb.js +2 -0
- streamlit/static/static/js/index.DI4yZ27M.js +1 -0
- streamlit/static/static/js/index.DN51vLxR.js +1 -0
- streamlit/static/static/js/index.DRtq5dka.js +1 -0
- streamlit/static/static/js/{index.BHXxWdde.js → index.DX-oiXlb.js} +1 -1
- streamlit/static/static/js/index.DlFE4_Aq.js +12 -0
- streamlit/static/static/js/{index.BHGGDa8K.js → index.J7BJwXOi.js} +2 -2
- streamlit/static/static/js/index.Jg38kJPP.js +1 -0
- streamlit/static/static/js/index.JhIO6abf.js +3 -0
- streamlit/static/static/js/{index.DeB9iKFW.js → index.NkRcWwc5.js} +255 -255
- streamlit/static/static/js/{index.BGga-hcS.js → index.prekPLrm.js} +25 -25
- streamlit/static/static/js/{index.BRXmLIsC.js → index.wyzngKUE.js} +1 -1
- streamlit/static/static/js/index.xW7mVdI8.js +1 -0
- streamlit/static/static/js/index.yk07dYGx.js +1 -0
- streamlit/static/static/js/{input.DsCfafm0.js → input.CxKZ5Wrc.js} +2 -2
- streamlit/static/static/js/{memory.nY_lMTtu.js → memory.DeZ9VUvl.js} +1 -1
- streamlit/static/static/js/{mergeWith.B_7zmsM4.js → mergeWith.CVkhrWUb.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CSeVhHRU.js → number-overlay-editor.Bpkm3nTq.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.nNhsvgRd.js → possibleConstructorReturn.CIDCId52.js} +1 -1
- streamlit/static/static/js/{sandbox.Cgm3iuL6.js → sandbox.TrkMaokR.js} +1 -1
- streamlit/static/static/js/{textarea.BR8rlyih.js → textarea.QKjxR64N.js} +2 -2
- streamlit/static/static/js/{timepicker.w4XhAenH.js → timepicker.DJYmE1dK.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CgkEPBwD.js → toConsumableArray.BZoworE-.js} +1 -1
- streamlit/static/static/js/{uniqueId.j-1rlNNH.js → uniqueId.O0UbJ2Bu.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.zXY9CjFS.js → useBasicWidgetState.Ci89jaH5.js} +1 -1
- streamlit/static/static/js/useOnInputChange.Cxh6ExEn.js +1 -0
- streamlit/static/static/js/{withFullScreenWrapper.Ov13692o.js → withFullScreenWrapper.iW37lS8Z.js} +1 -1
- streamlit/static/static/media/SourceCodeVF-Italic.ttf.Ba1oaZG1.woff2 +0 -0
- streamlit/static/static/media/SourceCodeVF-Upright.ttf.BjWn63N-.woff2 +0 -0
- streamlit/static/static/media/SourceSansVF-Italic.ttf.Bt9VkdQ3.woff2 +0 -0
- streamlit/static/static/media/SourceSansVF-Upright.ttf.BsWL4Kly.woff2 +0 -0
- streamlit/static/static/media/SourceSerifVariable-Italic.ttf.CVdzAtxO.woff2 +0 -0
- streamlit/static/static/media/SourceSerifVariable-Roman.ttf.mdpVL9bi.woff2 +0 -0
- streamlit/string_util.py +14 -19
- streamlit/temporary_directory.py +13 -4
- streamlit/testing/v1/app_test.py +15 -10
- streamlit/testing/v1/element_tree.py +157 -178
- streamlit/testing/v1/local_script_runner.py +11 -15
- streamlit/testing/v1/util.py +11 -4
- streamlit/type_util.py +8 -12
- streamlit/url_util.py +1 -1
- streamlit/user_info.py +6 -5
- streamlit/util.py +25 -1
- streamlit/vendor/pympler/asizeof.py +3 -2
- streamlit/watcher/event_based_path_watcher.py +21 -2
- streamlit/watcher/folder_black_list.py +2 -2
- streamlit/watcher/local_sources_watcher.py +64 -18
- streamlit/watcher/path_watcher.py +6 -10
- streamlit/watcher/polling_path_watcher.py +8 -7
- streamlit/watcher/util.py +7 -6
- streamlit/web/bootstrap.py +16 -14
- streamlit/web/cli.py +52 -45
- streamlit/web/server/__init__.py +7 -3
- streamlit/web/server/app_static_file_handler.py +1 -1
- streamlit/web/server/authlib_tornado_integration.py +9 -4
- streamlit/web/server/browser_websocket_handler.py +8 -2
- streamlit/web/server/component_request_handler.py +14 -10
- streamlit/web/server/media_file_handler.py +14 -7
- streamlit/web/server/oauth_authlib_routes.py +41 -9
- streamlit/web/server/oidc_mixin.py +35 -17
- streamlit/web/server/routes.py +32 -22
- streamlit/web/server/server.py +13 -24
- streamlit/web/server/server_util.py +43 -9
- streamlit/web/server/stats_request_handler.py +7 -5
- streamlit/web/server/upload_file_request_handler.py +22 -19
- streamlit/web/server/websocket_headers.py +1 -1
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/METADATA +4 -4
- streamlit-1.46.1.dist-info/RECORD +559 -0
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/WHEEL +1 -1
- streamlit/elements/lib/event_utils.py +0 -39
- streamlit/static/static/js/Toolbar.D9RUZv9G.js +0 -1
- streamlit/static/static/js/UploadFileInfo.C-jY39rj.js +0 -1
- streamlit/static/static/js/index.8jhZBWF2.js +0 -3
- streamlit/static/static/js/index.BCx3C6e_.js +0 -1
- streamlit/static/static/js/index.BRuTz_S4.js +0 -1
- streamlit/static/static/js/index.Bcru_ti-.js +0 -1
- streamlit/static/static/js/index.Bl1FMJRd.js +0 -1
- streamlit/static/static/js/index.C1z8KpLA.js +0 -779
- streamlit/static/static/js/index.C32I2PUe.js +0 -2
- streamlit/static/static/js/index.C5GnDRB7.js +0 -1
- streamlit/static/static/js/index.CG4qPaaW.js +0 -2
- streamlit/static/static/js/index.C_msmT1u.js +0 -1
- streamlit/static/static/js/index.CbeNTdd6.js +0 -1
- streamlit/static/static/js/index.CnGQVJcw.js +0 -12
- streamlit/static/static/js/index.CopVVq4l.js +0 -1
- streamlit/static/static/js/index.CtXupx4d.js +0 -197
- streamlit/static/static/js/index.DGmCchO7.js +0 -1
- streamlit/static/static/js/index.DH6zBk0e.js +0 -1
- streamlit/static/static/js/index.DHVlVWsm.js +0 -1
- streamlit/static/static/js/index.DRKIVBoi.js +0 -1
- streamlit/static/static/js/index.DUd-lFXx.js +0 -73
- streamlit/static/static/js/index.D_uRBA4B.js +0 -1
- streamlit/static/static/js/index.QHNfgPJd.js +0 -1
- streamlit/static/static/js/index.a-RJocYL.js +0 -1
- streamlit/static/static/js/index.cvz4B1gy.js +0 -1
- streamlit/static/static/js/index.t--hEgTQ.js +0 -6
- streamlit/static/static/js/useOnInputChange.z04u96A8.js +0 -1
- streamlit/static/static/media/SourceCodePro-Bold.CFEfr7-q.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-BoldItalic.C-LkFXxa.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-Italic.CxFOx7N-.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-Regular.CBOlD63d.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-SemiBold.CFHwW3Wd.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-SemiBoldItalic.Cg2yRu82.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-Bold.-6c9oR8J.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-BoldItalic.DmM_grLY.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-Italic.I1ipWe7Q.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-Regular.DZLUzqI4.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-SemiBold.sKQIyTMz.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-SemiBoldItalic.C0wP0icr.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-Bold.8TUnKj4x.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-BoldItalic.CBVO7Ve7.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-Italic.DkFgL2HZ.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-Regular.CNJNET2S.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-SemiBold.CHyh9GC5.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-SemiBoldItalic.CBtz8sWN.woff2 +0 -0
- streamlit-1.45.1.dist-info/RECORD +0 -568
- {streamlit-1.45.1.data → streamlit-1.46.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/top_level.txt +0 -0
|
@@ -84,7 +84,7 @@ class WStates(MutableMapping[str, Any]):
|
|
|
84
84
|
states: dict[str, WState] = field(default_factory=dict)
|
|
85
85
|
widget_metadata: dict[str, WidgetMetadata[Any]] = field(default_factory=dict)
|
|
86
86
|
|
|
87
|
-
def __repr__(self):
|
|
87
|
+
def __repr__(self) -> str:
|
|
88
88
|
return util.repr_(self)
|
|
89
89
|
|
|
90
90
|
def __getitem__(self, k: str) -> Any:
|
|
@@ -123,9 +123,9 @@ class WStates(MutableMapping[str, Any]):
|
|
|
123
123
|
# Array types are messages with data in a `data` field
|
|
124
124
|
value = value.data
|
|
125
125
|
elif value_field_name == "json_value":
|
|
126
|
-
value = json.loads(value)
|
|
126
|
+
value = json.loads(cast("str", value))
|
|
127
127
|
|
|
128
|
-
deserialized = metadata.deserializer(value
|
|
128
|
+
deserialized = metadata.deserializer(value)
|
|
129
129
|
|
|
130
130
|
# Update metadata to reflect information from WidgetState proto
|
|
131
131
|
self.set_widget_metadata(
|
|
@@ -147,7 +147,7 @@ class WStates(MutableMapping[str, Any]):
|
|
|
147
147
|
def __len__(self) -> int:
|
|
148
148
|
return len(self.states)
|
|
149
149
|
|
|
150
|
-
def __iter__(self):
|
|
150
|
+
def __iter__(self) -> Iterator[str]:
|
|
151
151
|
# For this and many other methods, we can't simply delegate to the
|
|
152
152
|
# states field, because we need to invoke `__getitem__` for any
|
|
153
153
|
# values, to handle deserialization and unwrapping of values.
|
|
@@ -249,11 +249,10 @@ class WStates(MutableMapping[str, Any]):
|
|
|
249
249
|
"""Return a list of serialized widget values for each widget with a value."""
|
|
250
250
|
states = [
|
|
251
251
|
self.get_serialized(widget_id)
|
|
252
|
-
for widget_id in self.states
|
|
252
|
+
for widget_id in self.states
|
|
253
253
|
if self.get_serialized(widget_id)
|
|
254
254
|
]
|
|
255
|
-
|
|
256
|
-
return states
|
|
255
|
+
return cast("list[WidgetStateProto]", states)
|
|
257
256
|
|
|
258
257
|
def call_callback(self, widget_id: str) -> None:
|
|
259
258
|
"""Call the given widget's callback and return the callback's
|
|
@@ -262,14 +261,24 @@ class WStates(MutableMapping[str, Any]):
|
|
|
262
261
|
If the widget doesn't exist, raise an Exception.
|
|
263
262
|
"""
|
|
264
263
|
metadata = self.widget_metadata.get(widget_id)
|
|
265
|
-
|
|
264
|
+
|
|
265
|
+
if metadata is None:
|
|
266
|
+
raise RuntimeError(f"Widget {widget_id} not found.")
|
|
267
|
+
|
|
266
268
|
callback = metadata.callback
|
|
267
269
|
if callback is None:
|
|
268
270
|
return
|
|
269
271
|
|
|
270
272
|
args = metadata.callback_args or ()
|
|
271
273
|
kwargs = metadata.callback_kwargs or {}
|
|
272
|
-
|
|
274
|
+
|
|
275
|
+
ctx = get_script_run_ctx()
|
|
276
|
+
if ctx and metadata.fragment_id is not None:
|
|
277
|
+
ctx.in_fragment_callback = True
|
|
278
|
+
callback(*args, **kwargs)
|
|
279
|
+
ctx.in_fragment_callback = False
|
|
280
|
+
else:
|
|
281
|
+
callback(*args, **kwargs)
|
|
273
282
|
|
|
274
283
|
|
|
275
284
|
def _missing_key_error_message(key: str) -> str:
|
|
@@ -319,11 +328,11 @@ class KeyIdMapper:
|
|
|
319
328
|
self._key_id_mapping.update(other._key_id_mapping)
|
|
320
329
|
self._id_key_mapping.update(other._id_key_mapping)
|
|
321
330
|
|
|
322
|
-
def clear(self):
|
|
331
|
+
def clear(self) -> None:
|
|
323
332
|
self._key_id_mapping.clear()
|
|
324
333
|
self._id_key_mapping.clear()
|
|
325
334
|
|
|
326
|
-
def delete(self, key: str):
|
|
335
|
+
def delete(self, key: str) -> None:
|
|
327
336
|
widget_id = self._key_id_mapping[key]
|
|
328
337
|
del self._key_id_mapping[key]
|
|
329
338
|
del self._id_key_mapping[widget_id]
|
|
@@ -364,7 +373,7 @@ class SessionState:
|
|
|
364
373
|
# widget state at one point.
|
|
365
374
|
query_params: QueryParams = field(default_factory=QueryParams)
|
|
366
375
|
|
|
367
|
-
def __repr__(self):
|
|
376
|
+
def __repr__(self) -> str:
|
|
368
377
|
return util.repr_(self)
|
|
369
378
|
|
|
370
379
|
# is it possible for a value to get through this without being deserialized?
|
|
@@ -376,7 +385,7 @@ class SessionState:
|
|
|
376
385
|
for key_or_wid in self:
|
|
377
386
|
try:
|
|
378
387
|
self._old_state[key_or_wid] = self[key_or_wid]
|
|
379
|
-
except KeyError:
|
|
388
|
+
except KeyError: # noqa: PERF203
|
|
380
389
|
# handle key errors from widget state not having metadata gracefully
|
|
381
390
|
# https://github.com/streamlit/streamlit/issues/7206
|
|
382
391
|
pass
|
|
@@ -422,10 +431,10 @@ class SessionState:
|
|
|
422
431
|
for widgets that don't have user_keys defined, and which aren't
|
|
423
432
|
exposed to user code).
|
|
424
433
|
"""
|
|
425
|
-
old_keys = {self._get_widget_id(k) for k in self._old_state
|
|
434
|
+
old_keys = {self._get_widget_id(k) for k in self._old_state}
|
|
426
435
|
new_widget_keys = set(self._new_widget_state.keys())
|
|
427
436
|
new_session_state_keys = {
|
|
428
|
-
self._get_widget_id(k) for k in self._new_session_state
|
|
437
|
+
self._get_widget_id(k) for k in self._new_session_state
|
|
429
438
|
}
|
|
430
439
|
return old_keys | new_widget_keys | new_session_state_keys
|
|
431
440
|
|
|
@@ -462,7 +471,10 @@ class SessionState:
|
|
|
462
471
|
|
|
463
472
|
At least one of the arguments must have a value.
|
|
464
473
|
"""
|
|
465
|
-
|
|
474
|
+
if user_key is None and widget_id is None:
|
|
475
|
+
raise ValueError(
|
|
476
|
+
"user_key and widget_id cannot both be None. This should never happen."
|
|
477
|
+
)
|
|
466
478
|
|
|
467
479
|
if user_key is not None:
|
|
468
480
|
try:
|
|
@@ -569,7 +581,7 @@ class SessionState:
|
|
|
569
581
|
for wid in changed_widget_ids:
|
|
570
582
|
try:
|
|
571
583
|
self._new_widget_state.call_callback(wid)
|
|
572
|
-
except RerunException:
|
|
584
|
+
except RerunException: # noqa: PERF203
|
|
573
585
|
st.warning("Calling st.rerun() within a callback is a no-op.")
|
|
574
586
|
|
|
575
587
|
def _widget_changed(self, widget_id: str) -> bool:
|
|
@@ -602,9 +614,10 @@ class SessionState:
|
|
|
602
614
|
if metadata is not None:
|
|
603
615
|
if metadata.value_type == "trigger_value":
|
|
604
616
|
self._new_widget_state[state_id] = Value(False)
|
|
605
|
-
elif metadata.value_type
|
|
606
|
-
|
|
607
|
-
|
|
617
|
+
elif metadata.value_type in {
|
|
618
|
+
"string_trigger_value",
|
|
619
|
+
"chat_input_value",
|
|
620
|
+
}:
|
|
608
621
|
self._new_widget_state[state_id] = Value(None)
|
|
609
622
|
|
|
610
623
|
for state_id in self._old_state:
|
|
@@ -612,9 +625,10 @@ class SessionState:
|
|
|
612
625
|
if metadata is not None:
|
|
613
626
|
if metadata.value_type == "trigger_value":
|
|
614
627
|
self._old_state[state_id] = False
|
|
615
|
-
elif metadata.value_type
|
|
616
|
-
|
|
617
|
-
|
|
628
|
+
elif metadata.value_type in {
|
|
629
|
+
"string_trigger_value",
|
|
630
|
+
"chat_input_value",
|
|
631
|
+
}:
|
|
618
632
|
self._old_state[state_id] = None
|
|
619
633
|
|
|
620
634
|
def _remove_stale_widgets(self, active_widget_ids: set[str]) -> None:
|
|
@@ -683,7 +697,7 @@ class SessionState:
|
|
|
683
697
|
# This is the first time the widget is registered, so we save its
|
|
684
698
|
# value in widget state.
|
|
685
699
|
deserializer = metadata.deserializer
|
|
686
|
-
initial_widget_value = deepcopy(deserializer(None
|
|
700
|
+
initial_widget_value = deepcopy(deserializer(None))
|
|
687
701
|
self._new_widget_state.set_from_value(widget_id, initial_widget_value)
|
|
688
702
|
|
|
689
703
|
# Get the current value of the widget for use as its return value.
|
|
@@ -723,11 +737,15 @@ class SessionState:
|
|
|
723
737
|
for k in self:
|
|
724
738
|
try:
|
|
725
739
|
pickle.dumps(self[k])
|
|
726
|
-
except Exception as e:
|
|
727
|
-
err_msg =
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
740
|
+
except Exception as e: # noqa: PERF203
|
|
741
|
+
err_msg = (
|
|
742
|
+
f"Cannot serialize the value (of type `{type(self[k])}`) of '{k}' in "
|
|
743
|
+
"st.session_state. Streamlit has been configured to use "
|
|
744
|
+
"[pickle](https://docs.python.org/3/library/pickle.html) to "
|
|
745
|
+
"serialize session_state values. Please convert the value to a "
|
|
746
|
+
"pickle-serializable type. To learn more about this behavior, "
|
|
747
|
+
"see [our docs](https://docs.streamlit.io/knowledge-base/using-streamlit/serializable-session-state)."
|
|
748
|
+
)
|
|
731
749
|
raise UnserializableSessionStateError(err_msg) from e
|
|
732
750
|
|
|
733
751
|
def maybe_check_serializable(self) -> None:
|
|
@@ -751,14 +769,14 @@ def _is_stale_widget(
|
|
|
751
769
|
) -> bool:
|
|
752
770
|
if not metadata:
|
|
753
771
|
return True
|
|
754
|
-
|
|
755
|
-
return False
|
|
772
|
+
|
|
756
773
|
# If we're running 1 or more fragments, but this widget is unrelated to any of the
|
|
757
774
|
# fragments that we're running, then it should not be marked as stale as its value
|
|
758
775
|
# may still be needed for a future fragment run or full script run.
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
776
|
+
return not (
|
|
777
|
+
metadata.id in active_widget_ids
|
|
778
|
+
or (fragment_ids_this_run and metadata.fragment_id not in fragment_ids_this_run)
|
|
779
|
+
)
|
|
762
780
|
|
|
763
781
|
|
|
764
782
|
@dataclass
|
streamlit/runtime/stats.py
CHANGED
|
@@ -63,7 +63,7 @@ class CacheStat(NamedTuple):
|
|
|
63
63
|
def group_stats(stats: list[CacheStat]) -> list[CacheStat]:
|
|
64
64
|
"""Group a list of CacheStats by category_name and cache_name and sum byte_length."""
|
|
65
65
|
|
|
66
|
-
def key_function(individual_stat):
|
|
66
|
+
def key_function(individual_stat: CacheStat) -> tuple[str, str]:
|
|
67
67
|
return individual_stat.category_name, individual_stat.cache_name
|
|
68
68
|
|
|
69
69
|
result: list[CacheStat] = []
|
|
@@ -90,7 +90,7 @@ class CacheStatsProvider(Protocol):
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
class StatsManager:
|
|
93
|
-
def __init__(self):
|
|
93
|
+
def __init__(self) -> None:
|
|
94
94
|
self._cache_stats_providers: list[CacheStatsProvider] = []
|
|
95
95
|
|
|
96
96
|
def register_provider(self, provider: CacheStatsProvider) -> None:
|
|
@@ -65,7 +65,7 @@ class UploadedFile(io.BytesIO):
|
|
|
65
65
|
initialized with `bytes`.
|
|
66
66
|
"""
|
|
67
67
|
|
|
68
|
-
def __init__(self, record: UploadedFileRec, file_urls: FileURLsProto):
|
|
68
|
+
def __init__(self, record: UploadedFileRec, file_urls: FileURLsProto) -> None:
|
|
69
69
|
# BytesIO's copy-on-write semantics doesn't seem to be mentioned in
|
|
70
70
|
# the Python docs - possibly because it's a CPython-only optimization
|
|
71
71
|
# and not guaranteed to be in other Python runtimes. But it's detailed
|
|
@@ -67,9 +67,11 @@ class WebsocketSessionManager(SessionManager):
|
|
|
67
67
|
existing_session_id: str | None = None,
|
|
68
68
|
session_id_override: str | None = None,
|
|
69
69
|
) -> str:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if existing_session_id and session_id_override:
|
|
71
|
+
raise RuntimeError(
|
|
72
|
+
"Only one of existing_session_id and session_id_override should be truthy. "
|
|
73
|
+
"This should never happen."
|
|
74
|
+
)
|
|
73
75
|
|
|
74
76
|
if existing_session_id in self._active_session_info_by_id:
|
|
75
77
|
_LOGGER.warning(
|
|
@@ -109,9 +111,11 @@ class WebsocketSessionManager(SessionManager):
|
|
|
109
111
|
"Created new session for client %s. Session ID: %s", id(client), session.id
|
|
110
112
|
)
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
if session.id in self._active_session_info_by_id:
|
|
115
|
+
raise RuntimeError(
|
|
116
|
+
f"session.id '{session.id}' registered multiple times. "
|
|
117
|
+
"This should never happen."
|
|
118
|
+
)
|
|
115
119
|
|
|
116
120
|
self._active_session_info_by_id[session.id] = ActiveSessionInfo(client, session)
|
|
117
121
|
return session.id
|
streamlit/source_util.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import re
|
|
18
|
-
from typing import TYPE_CHECKING, TypedDict
|
|
18
|
+
from typing import TYPE_CHECKING, TextIO, TypedDict
|
|
19
19
|
|
|
20
20
|
from typing_extensions import NotRequired, TypeAlias
|
|
21
21
|
|
|
@@ -38,7 +38,7 @@ class PageInfo(TypedDict):
|
|
|
38
38
|
url_pathname: NotRequired[str]
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def open_python_file(filename: str):
|
|
41
|
+
def open_python_file(filename: str) -> TextIO:
|
|
42
42
|
"""Open a read-only Python file taking proper care of its encoding.
|
|
43
43
|
|
|
44
44
|
In Python 3, we would like all files to be opened with utf-8 encoding.
|
|
@@ -52,8 +52,7 @@ def open_python_file(filename: str):
|
|
|
52
52
|
# Open file respecting PEP263 encoding. If no encoding header is
|
|
53
53
|
# found, opens as utf-8.
|
|
54
54
|
return tokenize.open(filename)
|
|
55
|
-
|
|
56
|
-
return open(filename, encoding="utf-8")
|
|
55
|
+
return open(filename, encoding="utf-8")
|
|
57
56
|
|
|
58
57
|
|
|
59
58
|
PAGE_FILENAME_REGEX = re.compile(r"([0-9]*)[_ -]*(.*)\.py")
|
|
@@ -62,9 +61,12 @@ PAGE_FILENAME_REGEX = re.compile(r"([0-9]*)[_ -]*(.*)\.py")
|
|
|
62
61
|
def page_sort_key(script_path: Path) -> tuple[float, str]:
|
|
63
62
|
matches = re.findall(PAGE_FILENAME_REGEX, script_path.name)
|
|
64
63
|
|
|
65
|
-
# Failing this
|
|
64
|
+
# Failing this should only be possible if script_path isn't a Python
|
|
66
65
|
# file, which should never happen.
|
|
67
|
-
|
|
66
|
+
if len(matches) == 0:
|
|
67
|
+
raise ValueError(
|
|
68
|
+
f"{script_path} is not a Python file. This should never happen."
|
|
69
|
+
)
|
|
68
70
|
|
|
69
71
|
[(number, label)] = matches
|
|
70
72
|
label = label.lower()
|
streamlit/static/index.html
CHANGED
|
@@ -25,21 +25,7 @@
|
|
|
25
25
|
<link rel="shortcut icon" href="./favicon.png" />
|
|
26
26
|
<link
|
|
27
27
|
rel="preload"
|
|
28
|
-
href="./static/media/
|
|
29
|
-
as="font"
|
|
30
|
-
type="font/woff2"
|
|
31
|
-
crossorigin
|
|
32
|
-
/>
|
|
33
|
-
<link
|
|
34
|
-
rel="preload"
|
|
35
|
-
href="./static/media/SourceSansPro-SemiBold.sKQIyTMz.woff2"
|
|
36
|
-
as="font"
|
|
37
|
-
type="font/woff2"
|
|
38
|
-
crossorigin
|
|
39
|
-
/>
|
|
40
|
-
<link
|
|
41
|
-
rel="preload"
|
|
42
|
-
href="./static/media/SourceSansPro-Bold.-6c9oR8J.woff2"
|
|
28
|
+
href="./static/media/SourceSansVF-Upright.ttf.BsWL4Kly.woff2"
|
|
43
29
|
as="font"
|
|
44
30
|
type="font/woff2"
|
|
45
31
|
crossorigin
|
|
@@ -51,8 +37,8 @@
|
|
|
51
37
|
<script>
|
|
52
38
|
window.prerenderReady = false
|
|
53
39
|
</script>
|
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
|
55
|
-
<link rel="stylesheet" crossorigin href="./static/css/index.
|
|
40
|
+
<script type="module" crossorigin src="./static/js/index.C1NIn1Y2.js"></script>
|
|
41
|
+
<link rel="stylesheet" crossorigin href="./static/css/index.CJVRHjQZ.css">
|
|
56
42
|
</head>
|
|
57
43
|
<body>
|
|
58
44
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|