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
|
@@ -47,12 +47,20 @@ class PageConfig(google.protobuf.message.Message):
|
|
|
47
47
|
"""Render page elements in a centered block, roughly 730px wide."""
|
|
48
48
|
WIDE: PageConfig._Layout.ValueType # 1
|
|
49
49
|
"""Use the full browser width to render elements."""
|
|
50
|
+
LAYOUT_UNSET: PageConfig._Layout.ValueType # 2
|
|
51
|
+
"""Unset distinguishes that config was not provided - on initial call, will
|
|
52
|
+
set to centered as default. Otherwise, inherit value from previous call
|
|
53
|
+
"""
|
|
50
54
|
|
|
51
55
|
class Layout(_Layout, metaclass=_LayoutEnumTypeWrapper): ...
|
|
52
56
|
CENTERED: PageConfig.Layout.ValueType # 0
|
|
53
57
|
"""Render page elements in a centered block, roughly 730px wide."""
|
|
54
58
|
WIDE: PageConfig.Layout.ValueType # 1
|
|
55
59
|
"""Use the full browser width to render elements."""
|
|
60
|
+
LAYOUT_UNSET: PageConfig.Layout.ValueType # 2
|
|
61
|
+
"""Unset distinguishes that config was not provided - on initial call, will
|
|
62
|
+
set to centered as default. Otherwise, inherit value from previous call
|
|
63
|
+
"""
|
|
56
64
|
|
|
57
65
|
class _SidebarState:
|
|
58
66
|
ValueType = typing.NewType("ValueType", builtins.int)
|
|
@@ -66,6 +74,10 @@ class PageConfig(google.protobuf.message.Message):
|
|
|
66
74
|
"""Force the sidebar to be shown."""
|
|
67
75
|
COLLAPSED: PageConfig._SidebarState.ValueType # 2
|
|
68
76
|
"""Force the sidebar to be hidden."""
|
|
77
|
+
SIDEBAR_UNSET: PageConfig._SidebarState.ValueType # 3
|
|
78
|
+
"""Unset distinguishes that config was not provided - on initial call, will
|
|
79
|
+
set to auto as default. Otherwise, inherit value from previous call
|
|
80
|
+
"""
|
|
69
81
|
|
|
70
82
|
class SidebarState(_SidebarState, metaclass=_SidebarStateEnumTypeWrapper): ...
|
|
71
83
|
AUTO: PageConfig.SidebarState.ValueType # 0
|
|
@@ -74,6 +86,10 @@ class PageConfig(google.protobuf.message.Message):
|
|
|
74
86
|
"""Force the sidebar to be shown."""
|
|
75
87
|
COLLAPSED: PageConfig.SidebarState.ValueType # 2
|
|
76
88
|
"""Force the sidebar to be hidden."""
|
|
89
|
+
SIDEBAR_UNSET: PageConfig.SidebarState.ValueType # 3
|
|
90
|
+
"""Unset distinguishes that config was not provided - on initial call, will
|
|
91
|
+
set to auto as default. Otherwise, inherit value from previous call
|
|
92
|
+
"""
|
|
77
93
|
|
|
78
94
|
@typing.final
|
|
79
95
|
class MenuItems(google.protobuf.message.Message):
|
|
@@ -84,11 +100,14 @@ class PageConfig(google.protobuf.message.Message):
|
|
|
84
100
|
REPORT_A_BUG_URL_FIELD_NUMBER: builtins.int
|
|
85
101
|
HIDE_REPORT_A_BUG_FIELD_NUMBER: builtins.int
|
|
86
102
|
ABOUT_SECTION_MD_FIELD_NUMBER: builtins.int
|
|
103
|
+
CLEAR_ABOUT_MD_FIELD_NUMBER: builtins.int
|
|
87
104
|
get_help_url: builtins.str
|
|
88
105
|
hide_get_help: builtins.bool
|
|
89
106
|
report_a_bug_url: builtins.str
|
|
90
107
|
hide_report_a_bug: builtins.bool
|
|
91
108
|
about_section_md: builtins.str
|
|
109
|
+
clear_about_md: builtins.bool
|
|
110
|
+
"""For multiple calls to set_page_config, clears set about markdown"""
|
|
92
111
|
def __init__(
|
|
93
112
|
self,
|
|
94
113
|
*,
|
|
@@ -97,8 +116,9 @@ class PageConfig(google.protobuf.message.Message):
|
|
|
97
116
|
report_a_bug_url: builtins.str = ...,
|
|
98
117
|
hide_report_a_bug: builtins.bool = ...,
|
|
99
118
|
about_section_md: builtins.str = ...,
|
|
119
|
+
clear_about_md: builtins.bool = ...,
|
|
100
120
|
) -> None: ...
|
|
101
|
-
def ClearField(self, field_name: typing.Literal["about_section_md", b"about_section_md", "get_help_url", b"get_help_url", "hide_get_help", b"hide_get_help", "hide_report_a_bug", b"hide_report_a_bug", "report_a_bug_url", b"report_a_bug_url"]) -> None: ...
|
|
121
|
+
def ClearField(self, field_name: typing.Literal["about_section_md", b"about_section_md", "clear_about_md", b"clear_about_md", "get_help_url", b"get_help_url", "hide_get_help", b"hide_get_help", "hide_report_a_bug", b"hide_report_a_bug", "report_a_bug_url", b"report_a_bug_url"]) -> None: ...
|
|
102
122
|
|
|
103
123
|
TITLE_FIELD_NUMBER: builtins.int
|
|
104
124
|
FAVICON_FIELD_NUMBER: builtins.int
|
streamlit/proto/Video_pb2.py
CHANGED
|
@@ -12,9 +12,10 @@ from google.protobuf.internal import builder as _builder
|
|
|
12
12
|
_sym_db = _symbol_database.Default()
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
from streamlit.proto import WidthConfig_pb2 as streamlit_dot_proto_dot_WidthConfig__pb2
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Video.proto\"+\n\rSubtitleTrack\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\"\
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Video.proto\x1a!streamlit/proto/WidthConfig.proto\"+\n\rSubtitleTrack\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\"\xcb\x02\n\x05Video\x12\x0b\n\x03url\x18\x06 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x05\x12\x19\n\x04type\x18\x05 \x01(\x0e\x32\x0b.Video.Type\x12!\n\tsubtitles\x18\x07 \x03(\x0b\x32\x0e.SubtitleTrack\x12\x10\n\x08\x65nd_time\x18\x08 \x01(\x05\x12\x0c\n\x04loop\x18\t \x01(\x08\x12\x10\n\x08\x61utoplay\x18\n \x01(\x08\x12\r\n\x05muted\x18\x0b \x01(\x08\x12\n\n\x02id\x18\x0c \x01(\t\x12\x31\n\x0cwidth_config\x18\r \x01(\x0b\x32\x16.streamlit.WidthConfigH\x00\x88\x01\x01\"2\n\x04Type\x12\n\n\x06UNUSED\x10\x00\x12\n\n\x06NATIVE\x10\x01\x12\x12\n\x0eYOUTUBE_IFRAME\x10\x02\x42\x0f\n\r_width_configJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05R\x06\x66ormatR\x04\x64\x61taB*\n\x1c\x63om.snowflake.apps.streamlitB\nVideoProtob\x06proto3')
|
|
18
19
|
|
|
19
20
|
_globals = globals()
|
|
20
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -22,10 +23,10 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.Video_pb2',
|
|
|
22
23
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
23
24
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
24
25
|
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\nVideoProto'
|
|
25
|
-
_globals['_SUBTITLETRACK']._serialized_start=
|
|
26
|
-
_globals['_SUBTITLETRACK']._serialized_end=
|
|
27
|
-
_globals['_VIDEO']._serialized_start=
|
|
28
|
-
_globals['_VIDEO']._serialized_end=
|
|
29
|
-
_globals['_VIDEO_TYPE']._serialized_start=
|
|
30
|
-
_globals['_VIDEO_TYPE']._serialized_end=
|
|
26
|
+
_globals['_SUBTITLETRACK']._serialized_start=66
|
|
27
|
+
_globals['_SUBTITLETRACK']._serialized_end=109
|
|
28
|
+
_globals['_VIDEO']._serialized_start=112
|
|
29
|
+
_globals['_VIDEO']._serialized_end=443
|
|
30
|
+
_globals['_VIDEO_TYPE']._serialized_start=344
|
|
31
|
+
_globals['_VIDEO_TYPE']._serialized_end=394
|
|
31
32
|
# @@protoc_insertion_point(module_scope)
|
streamlit/proto/Video_pb2.pyi
CHANGED
|
@@ -23,6 +23,7 @@ import google.protobuf.descriptor
|
|
|
23
23
|
import google.protobuf.internal.containers
|
|
24
24
|
import google.protobuf.internal.enum_type_wrapper
|
|
25
25
|
import google.protobuf.message
|
|
26
|
+
import streamlit.proto.WidthConfig_pb2
|
|
26
27
|
import sys
|
|
27
28
|
import typing
|
|
28
29
|
|
|
@@ -82,6 +83,7 @@ class Video(google.protobuf.message.Message):
|
|
|
82
83
|
AUTOPLAY_FIELD_NUMBER: builtins.int
|
|
83
84
|
MUTED_FIELD_NUMBER: builtins.int
|
|
84
85
|
ID_FIELD_NUMBER: builtins.int
|
|
86
|
+
WIDTH_CONFIG_FIELD_NUMBER: builtins.int
|
|
85
87
|
url: builtins.str
|
|
86
88
|
"""A url pointing to a video file"""
|
|
87
89
|
start_time: builtins.int
|
|
@@ -99,6 +101,8 @@ class Video(google.protobuf.message.Message):
|
|
|
99
101
|
def subtitles(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SubtitleTrack]:
|
|
100
102
|
"""Repeated field for subtitle tracks"""
|
|
101
103
|
|
|
104
|
+
@property
|
|
105
|
+
def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig: ...
|
|
102
106
|
def __init__(
|
|
103
107
|
self,
|
|
104
108
|
*,
|
|
@@ -111,7 +115,10 @@ class Video(google.protobuf.message.Message):
|
|
|
111
115
|
autoplay: builtins.bool = ...,
|
|
112
116
|
muted: builtins.bool = ...,
|
|
113
117
|
id: builtins.str = ...,
|
|
118
|
+
width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
|
|
114
119
|
) -> None: ...
|
|
115
|
-
def
|
|
120
|
+
def HasField(self, field_name: typing.Literal["_width_config", b"_width_config", "width_config", b"width_config"]) -> builtins.bool: ...
|
|
121
|
+
def ClearField(self, field_name: typing.Literal["_width_config", b"_width_config", "autoplay", b"autoplay", "end_time", b"end_time", "id", b"id", "loop", b"loop", "muted", b"muted", "start_time", b"start_time", "subtitles", b"subtitles", "type", b"type", "url", b"url", "width_config", b"width_config"]) -> None: ...
|
|
122
|
+
def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
|
|
116
123
|
|
|
117
124
|
global___Video = Video
|
|
@@ -14,14 +14,14 @@ _sym_db = _symbol_database.Default()
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!streamlit/proto/WidthConfig.proto\x12\tstreamlit\"`\n\x0bWidthConfig\x12\x15\n\x0buse_stretch\x18\x01 \x01(\x08H\x00\x12\x15\n\x0buse_content\x18\x02 \x01(\x08H\x00\x12\x15\n\x0bpixel_width\x18\x03 \x01(\rH\x00\x42\x0c\n\
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!streamlit/proto/WidthConfig.proto\x12\tstreamlit\"`\n\x0bWidthConfig\x12\x15\n\x0buse_stretch\x18\x01 \x01(\x08H\x00\x12\x15\n\x0buse_content\x18\x02 \x01(\x08H\x00\x12\x15\n\x0bpixel_width\x18\x03 \x01(\rH\x00\x42\x0c\n\nwidth_specB0\n\x1c\x63om.snowflake.apps.streamlitB\x10WidthConfigProtob\x06proto3')
|
|
18
18
|
|
|
19
19
|
_globals = globals()
|
|
20
20
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
21
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.WidthConfig_pb2', _globals)
|
|
22
22
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
23
23
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
24
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\
|
|
24
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\020WidthConfigProto'
|
|
25
25
|
_globals['_WIDTHCONFIG']._serialized_start=48
|
|
26
26
|
_globals['_WIDTHCONFIG']._serialized_end=144
|
|
27
27
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
"""
|
|
2
2
|
@generated by mypy-protobuf. Do not edit manually!
|
|
3
3
|
isort:skip_file
|
|
4
|
-
|
|
4
|
+
*!
|
|
5
|
+
Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
"""
|
|
5
19
|
|
|
6
20
|
import builtins
|
|
7
21
|
import google.protobuf.descriptor
|
streamlit/runtime/__init__.py
CHANGED
streamlit/runtime/app_session.py
CHANGED
|
@@ -20,7 +20,7 @@ import os
|
|
|
20
20
|
import sys
|
|
21
21
|
import uuid
|
|
22
22
|
from enum import Enum
|
|
23
|
-
from typing import TYPE_CHECKING, Callable, Final
|
|
23
|
+
from typing import TYPE_CHECKING, Any, Callable, Final
|
|
24
24
|
|
|
25
25
|
from google.protobuf.json_format import ParseDict
|
|
26
26
|
|
|
@@ -151,7 +151,7 @@ class AppSession:
|
|
|
151
151
|
self._client_state = ClientState()
|
|
152
152
|
|
|
153
153
|
self._local_sources_watcher: LocalSourcesWatcher | None = None
|
|
154
|
-
self._stop_config_listener: Callable[[],
|
|
154
|
+
self._stop_config_listener: Callable[[], None] | None = None
|
|
155
155
|
self._stop_pages_listener: Callable[[], None] | None = None
|
|
156
156
|
|
|
157
157
|
if config.get_option("server.fileWatcherType") != "none":
|
|
@@ -375,8 +375,9 @@ class AppSession:
|
|
|
375
375
|
# sometimes stays open.
|
|
376
376
|
if fragment_id and not self._fragment_storage.contains(fragment_id):
|
|
377
377
|
_LOGGER.info(
|
|
378
|
-
|
|
379
|
-
"it might have been removed during a preceding full-app rerun."
|
|
378
|
+
"The fragment with id %s does not exist anymore - "
|
|
379
|
+
"it might have been removed during a preceding full-app rerun.",
|
|
380
|
+
fragment_id,
|
|
380
381
|
)
|
|
381
382
|
return
|
|
382
383
|
|
|
@@ -480,7 +481,7 @@ class AppSession:
|
|
|
480
481
|
else:
|
|
481
482
|
self._enqueue_forward_msg(self._create_file_change_message())
|
|
482
483
|
|
|
483
|
-
def _on_secrets_file_changed(self, _) -> None:
|
|
484
|
+
def _on_secrets_file_changed(self, _: Any) -> None:
|
|
484
485
|
"""Called when `secrets.file_change_listener` emits a Signal."""
|
|
485
486
|
|
|
486
487
|
# NOTE: At the time of writing, this function only calls
|
|
@@ -578,9 +579,11 @@ class AppSession:
|
|
|
578
579
|
browser. Set only for the SCRIPT_STARTED event.
|
|
579
580
|
"""
|
|
580
581
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
582
|
+
if self._event_loop != asyncio.get_running_loop():
|
|
583
|
+
raise RuntimeError(
|
|
584
|
+
"This function must only be called on the eventloop thread the AppSession was created on. "
|
|
585
|
+
"This should never happen."
|
|
586
|
+
)
|
|
584
587
|
|
|
585
588
|
if sender is not self._scriptrunner:
|
|
586
589
|
# This event was sent by a non-current ScriptRunner; ignore it.
|
|
@@ -596,9 +599,10 @@ class AppSession:
|
|
|
596
599
|
if event == ScriptRunnerEvent.SCRIPT_STARTED:
|
|
597
600
|
if self._state != AppSessionState.SHUTDOWN_REQUESTED:
|
|
598
601
|
self._state = AppSessionState.APP_IS_RUNNING
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
+
if page_script_hash is None:
|
|
603
|
+
raise RuntimeError(
|
|
604
|
+
"page_script_hash must be set for the SCRIPT_STARTED event. This should never happen."
|
|
605
|
+
)
|
|
602
606
|
|
|
603
607
|
# Update the client state with the new page_script_hash if
|
|
604
608
|
# necessary. This handles an edge case where a script is never
|
|
@@ -615,11 +619,11 @@ class AppSession:
|
|
|
615
619
|
|
|
616
620
|
self._enqueue_forward_msg(msg)
|
|
617
621
|
|
|
618
|
-
elif
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
622
|
+
elif event in {
|
|
623
|
+
ScriptRunnerEvent.SCRIPT_STOPPED_WITH_SUCCESS,
|
|
624
|
+
ScriptRunnerEvent.SCRIPT_STOPPED_WITH_COMPILE_ERROR,
|
|
625
|
+
ScriptRunnerEvent.FRAGMENT_STOPPED_WITH_SUCCESS,
|
|
626
|
+
}:
|
|
623
627
|
if self._state != AppSessionState.SHUTDOWN_REQUESTED:
|
|
624
628
|
self._state = AppSessionState.APP_NOT_RUNNING
|
|
625
629
|
|
|
@@ -633,10 +637,10 @@ class AppSession:
|
|
|
633
637
|
self._enqueue_forward_msg(self._create_script_finished_message(status))
|
|
634
638
|
self._debug_last_backmsg_id = None
|
|
635
639
|
|
|
636
|
-
if
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
+
if event in {
|
|
641
|
+
ScriptRunnerEvent.SCRIPT_STOPPED_WITH_SUCCESS,
|
|
642
|
+
ScriptRunnerEvent.FRAGMENT_STOPPED_WITH_SUCCESS,
|
|
643
|
+
}:
|
|
640
644
|
# The script completed successfully: update our
|
|
641
645
|
# LocalSourcesWatcher to account for any source code changes
|
|
642
646
|
# that change which modules should be watched.
|
|
@@ -646,9 +650,11 @@ class AppSession:
|
|
|
646
650
|
else:
|
|
647
651
|
# The script didn't complete successfully: send the exception
|
|
648
652
|
# to the frontend.
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
653
|
+
if exception is None:
|
|
654
|
+
raise RuntimeError(
|
|
655
|
+
"exception must be set for the SCRIPT_STOPPED_WITH_COMPILE_ERROR event. "
|
|
656
|
+
"This should never happen."
|
|
657
|
+
)
|
|
652
658
|
msg = ForwardMsg()
|
|
653
659
|
exception_utils.marshall(
|
|
654
660
|
msg.session_event.script_compilation_exception, exception
|
|
@@ -666,9 +672,10 @@ class AppSession:
|
|
|
666
672
|
self._local_sources_watcher.update_watched_modules()
|
|
667
673
|
|
|
668
674
|
elif event == ScriptRunnerEvent.SHUTDOWN:
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
675
|
+
if client_state is None:
|
|
676
|
+
raise RuntimeError(
|
|
677
|
+
"client_state must be set for the SHUTDOWN event. This should never happen."
|
|
678
|
+
)
|
|
672
679
|
|
|
673
680
|
if self._state == AppSessionState.SHUTDOWN_REQUESTED:
|
|
674
681
|
# Only clear media files if the script is done running AND the
|
|
@@ -679,9 +686,10 @@ class AppSession:
|
|
|
679
686
|
self._scriptrunner = None
|
|
680
687
|
|
|
681
688
|
elif event == ScriptRunnerEvent.ENQUEUE_FORWARD_MSG:
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
689
|
+
if forward_msg is None:
|
|
690
|
+
raise RuntimeError(
|
|
691
|
+
"null forward_msg in ENQUEUE_FORWARD_MSG event. This should never happen."
|
|
692
|
+
)
|
|
685
693
|
self._enqueue_forward_msg(forward_msg)
|
|
686
694
|
|
|
687
695
|
# Send a message if our run state changed
|
|
@@ -792,12 +800,12 @@ class AppSession:
|
|
|
792
800
|
msg.git_info_changed.branch = branch
|
|
793
801
|
msg.git_info_changed.module = module
|
|
794
802
|
|
|
795
|
-
msg.git_info_changed.untracked_files[:] = repo.untracked_files
|
|
796
|
-
msg.git_info_changed.uncommitted_files[:] = repo.uncommitted_files
|
|
803
|
+
msg.git_info_changed.untracked_files[:] = repo.untracked_files or []
|
|
804
|
+
msg.git_info_changed.uncommitted_files[:] = repo.uncommitted_files or []
|
|
797
805
|
|
|
798
806
|
if repo.is_head_detached:
|
|
799
807
|
msg.git_info_changed.state = GitInfo.GitStates.HEAD_DETACHED
|
|
800
|
-
elif len(repo.ahead_commits) > 0:
|
|
808
|
+
elif repo.ahead_commits and len(repo.ahead_commits) > 0:
|
|
801
809
|
msg.git_info_changed.state = GitInfo.GitStates.AHEAD_OF_REMOTE
|
|
802
810
|
else:
|
|
803
811
|
msg.git_info_changed.state = GitInfo.GitStates.DEFAULT
|
|
@@ -905,7 +913,7 @@ def _get_toolbar_mode() -> Config.ToolbarMode.ValueType:
|
|
|
905
913
|
Config.ToolbarMode, config_value.upper()
|
|
906
914
|
)
|
|
907
915
|
if enum_value is None:
|
|
908
|
-
allowed_values = ", ".join(k.lower() for k in Config.ToolbarMode.keys())
|
|
916
|
+
allowed_values = ", ".join(k.lower() for k in Config.ToolbarMode.keys()) # noqa: SIM118
|
|
909
917
|
raise ValueError(
|
|
910
918
|
f"Config {config_key!r} expects to have one of "
|
|
911
919
|
f"the following values: {allowed_values}. "
|
|
@@ -947,9 +955,10 @@ def _populate_theme_msg(msg: CustomThemeConfig, section: str = "theme") -> None:
|
|
|
947
955
|
if base is not None:
|
|
948
956
|
if base not in base_map:
|
|
949
957
|
_LOGGER.warning(
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
958
|
+
'"%s" is an invalid value for theme.base. Allowed values include %s. '
|
|
959
|
+
'Setting theme.base to "light".',
|
|
960
|
+
base,
|
|
961
|
+
list(base_map.keys()),
|
|
953
962
|
)
|
|
954
963
|
else:
|
|
955
964
|
msg.base = base_map[base]
|
|
@@ -969,8 +978,8 @@ def _populate_theme_msg(msg: CustomThemeConfig, section: str = "theme") -> None:
|
|
|
969
978
|
font_faces = json.loads(font_faces)
|
|
970
979
|
except Exception as e:
|
|
971
980
|
_LOGGER.warning(
|
|
972
|
-
"Failed to parse the theme.fontFaces config option with json.loads: "
|
|
973
|
-
|
|
981
|
+
"Failed to parse the theme.fontFaces config option with json.loads: %s.",
|
|
982
|
+
font_faces,
|
|
974
983
|
exc_info=e,
|
|
975
984
|
)
|
|
976
985
|
font_faces = None
|
|
@@ -978,10 +987,14 @@ def _populate_theme_msg(msg: CustomThemeConfig, section: str = "theme") -> None:
|
|
|
978
987
|
if font_faces is not None:
|
|
979
988
|
for font_face in font_faces:
|
|
980
989
|
try:
|
|
990
|
+
if "weight" in font_face:
|
|
991
|
+
font_face["weight_range"] = str(font_face["weight"])
|
|
992
|
+
del font_face["weight"]
|
|
981
993
|
msg.font_faces.append(ParseDict(font_face, FontFace()))
|
|
982
|
-
except Exception as e:
|
|
994
|
+
except Exception as e: # noqa: PERF203
|
|
983
995
|
_LOGGER.warning(
|
|
984
|
-
|
|
996
|
+
"Failed to parse the theme.fontFaces config option: %s.",
|
|
997
|
+
font_face,
|
|
985
998
|
exc_info=e,
|
|
986
999
|
)
|
|
987
1000
|
|
|
@@ -72,9 +72,9 @@ def save_block_message(
|
|
|
72
72
|
)
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
def save_media_data(
|
|
76
|
-
CACHE_DATA_MESSAGE_REPLAY_CTX.
|
|
77
|
-
CACHE_RESOURCE_MESSAGE_REPLAY_CTX.
|
|
75
|
+
def save_media_data(media_data: bytes | str, mimetype: str, media_id: str) -> None:
|
|
76
|
+
CACHE_DATA_MESSAGE_REPLAY_CTX.save_media_data(media_data, mimetype, media_id)
|
|
77
|
+
CACHE_RESOURCE_MESSAGE_REPLAY_CTX.save_media_data(media_data, mimetype, media_id)
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
# Create and export public API singletons.
|
|
@@ -86,13 +86,13 @@ cache = _cache
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
__all__ = [
|
|
89
|
-
"cache",
|
|
90
89
|
"CACHE_DOCS_URL",
|
|
91
|
-
"
|
|
92
|
-
"save_block_message",
|
|
93
|
-
"save_media_data",
|
|
94
|
-
"get_data_cache_stats_provider",
|
|
95
|
-
"get_resource_cache_stats_provider",
|
|
90
|
+
"cache",
|
|
96
91
|
"cache_data",
|
|
97
92
|
"cache_resource",
|
|
93
|
+
"get_data_cache_stats_provider",
|
|
94
|
+
"get_resource_cache_stats_provider",
|
|
95
|
+
"save_block_message",
|
|
96
|
+
"save_element_message",
|
|
97
|
+
"save_media_data",
|
|
98
98
|
]
|
|
@@ -57,7 +57,7 @@ from streamlit.runtime.caching.storage import (
|
|
|
57
57
|
CacheStorageManager,
|
|
58
58
|
)
|
|
59
59
|
from streamlit.runtime.caching.storage.cache_storage_protocol import (
|
|
60
|
-
|
|
60
|
+
InvalidCacheStorageContextError,
|
|
61
61
|
)
|
|
62
62
|
from streamlit.runtime.caching.storage.dummy_cache_storage import (
|
|
63
63
|
MemoryCacheStorageManager,
|
|
@@ -83,6 +83,10 @@ CachePersistType: TypeAlias = Union[Literal["disk"], None]
|
|
|
83
83
|
class CachedDataFuncInfo(CachedFuncInfo):
|
|
84
84
|
"""Implements the CachedFuncInfo interface for @st.cache_data."""
|
|
85
85
|
|
|
86
|
+
persist: CachePersistType
|
|
87
|
+
max_entries: int | None
|
|
88
|
+
ttl: float | timedelta | str | None
|
|
89
|
+
|
|
86
90
|
def __init__(
|
|
87
91
|
self,
|
|
88
92
|
func: types.FunctionType,
|
|
@@ -91,7 +95,7 @@ class CachedDataFuncInfo(CachedFuncInfo):
|
|
|
91
95
|
max_entries: int | None,
|
|
92
96
|
ttl: float | timedelta | str | None,
|
|
93
97
|
hash_funcs: HashFuncsDict | None = None,
|
|
94
|
-
):
|
|
98
|
+
) -> None:
|
|
95
99
|
super().__init__(
|
|
96
100
|
func,
|
|
97
101
|
show_spinner=show_spinner,
|
|
@@ -143,7 +147,7 @@ class CachedDataFuncInfo(CachedFuncInfo):
|
|
|
143
147
|
class DataCaches(CacheStatsProvider):
|
|
144
148
|
"""Manages all DataCache instances."""
|
|
145
149
|
|
|
146
|
-
def __init__(self):
|
|
150
|
+
def __init__(self) -> None:
|
|
147
151
|
self._caches_lock = threading.Lock()
|
|
148
152
|
self._function_caches: dict[str, DataCache] = {}
|
|
149
153
|
|
|
@@ -270,12 +274,11 @@ class DataCaches(CacheStatsProvider):
|
|
|
270
274
|
)
|
|
271
275
|
try:
|
|
272
276
|
self.get_storage_manager().check_context(cache_context)
|
|
273
|
-
except
|
|
274
|
-
_LOGGER.
|
|
277
|
+
except InvalidCacheStorageContextError:
|
|
278
|
+
_LOGGER.exception(
|
|
275
279
|
"Cache params for function %s are incompatible with current "
|
|
276
280
|
"cache storage manager.",
|
|
277
281
|
function_name,
|
|
278
|
-
exc_info=e,
|
|
279
282
|
)
|
|
280
283
|
raise
|
|
281
284
|
|
|
@@ -298,11 +301,10 @@ class DataCaches(CacheStatsProvider):
|
|
|
298
301
|
def get_storage_manager(self) -> CacheStorageManager:
|
|
299
302
|
if runtime.exists():
|
|
300
303
|
return runtime.get_instance().cache_storage_manager
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return MemoryCacheStorageManager()
|
|
304
|
+
# When running in "raw mode", we can't access the CacheStorageManager,
|
|
305
|
+
# so we're falling back to InMemoryCache.
|
|
306
|
+
_LOGGER.warning("No runtime found, using MemoryCacheStorageManager")
|
|
307
|
+
return MemoryCacheStorageManager()
|
|
306
308
|
|
|
307
309
|
|
|
308
310
|
# Singleton DataCaches instance
|
|
@@ -314,12 +316,17 @@ def get_data_cache_stats_provider() -> CacheStatsProvider:
|
|
|
314
316
|
return _data_caches
|
|
315
317
|
|
|
316
318
|
|
|
319
|
+
# Type-annotate the decorator function.
|
|
320
|
+
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
|
321
|
+
F = TypeVar("F", bound=Callable[..., Any])
|
|
322
|
+
|
|
323
|
+
|
|
317
324
|
class CacheDataAPI:
|
|
318
325
|
"""Implements the public st.cache_data API: the @st.cache_data decorator, and
|
|
319
326
|
st.cache_data.clear().
|
|
320
327
|
"""
|
|
321
328
|
|
|
322
|
-
def __init__(self, decorator_metric_name: str):
|
|
329
|
+
def __init__(self, decorator_metric_name: str) -> None:
|
|
323
330
|
"""Create a CacheDataAPI instance.
|
|
324
331
|
|
|
325
332
|
Parameters
|
|
@@ -334,10 +341,6 @@ class CacheDataAPI:
|
|
|
334
341
|
decorator_metric_name, self._decorator
|
|
335
342
|
)
|
|
336
343
|
|
|
337
|
-
# Type-annotate the decorator function.
|
|
338
|
-
# (See https://mypy.readthedocs.io/en/stable/generics.html#decorator-factories)
|
|
339
|
-
F = TypeVar("F", bound=Callable[..., Any])
|
|
340
|
-
|
|
341
344
|
# Bare decorator usage
|
|
342
345
|
@overload
|
|
343
346
|
def __call__(self, func: F) -> F: ...
|
|
@@ -365,7 +368,7 @@ class CacheDataAPI:
|
|
|
365
368
|
persist: CachePersistType | bool = None,
|
|
366
369
|
experimental_allow_widgets: bool = False,
|
|
367
370
|
hash_funcs: HashFuncsDict | None = None,
|
|
368
|
-
):
|
|
371
|
+
) -> F | Callable[[F], F]:
|
|
369
372
|
return self._decorator(
|
|
370
373
|
func,
|
|
371
374
|
ttl=ttl,
|
|
@@ -386,7 +389,7 @@ class CacheDataAPI:
|
|
|
386
389
|
persist: CachePersistType | bool,
|
|
387
390
|
experimental_allow_widgets: bool,
|
|
388
391
|
hash_funcs: HashFuncsDict | None = None,
|
|
389
|
-
):
|
|
392
|
+
) -> F | Callable[[F], F]:
|
|
390
393
|
"""Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).
|
|
391
394
|
|
|
392
395
|
Cached objects are stored in "pickled" form, which means that the return
|
|
@@ -564,16 +567,19 @@ class CacheDataAPI:
|
|
|
564
567
|
if experimental_allow_widgets:
|
|
565
568
|
show_widget_replay_deprecation("cache_data")
|
|
566
569
|
|
|
567
|
-
def wrapper(f):
|
|
568
|
-
return
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
570
|
+
def wrapper(f: F) -> F:
|
|
571
|
+
return cast(
|
|
572
|
+
"F",
|
|
573
|
+
make_cached_func_wrapper(
|
|
574
|
+
CachedDataFuncInfo(
|
|
575
|
+
func=f, # type: ignore
|
|
576
|
+
persist=persist_string,
|
|
577
|
+
show_spinner=show_spinner,
|
|
578
|
+
max_entries=max_entries,
|
|
579
|
+
ttl=ttl,
|
|
580
|
+
hash_funcs=hash_funcs,
|
|
581
|
+
)
|
|
582
|
+
),
|
|
577
583
|
)
|
|
578
584
|
|
|
579
585
|
if func is None:
|
|
@@ -607,7 +613,7 @@ class DataCache(Cache):
|
|
|
607
613
|
max_entries: int | None,
|
|
608
614
|
ttl_seconds: float | None,
|
|
609
615
|
display_name: str,
|
|
610
|
-
):
|
|
616
|
+
) -> None:
|
|
611
617
|
super().__init__()
|
|
612
618
|
self.key = key
|
|
613
619
|
self.display_name = display_name
|
|
@@ -634,7 +640,7 @@ class DataCache(Cache):
|
|
|
634
640
|
raise CacheError(str(e)) from e
|
|
635
641
|
|
|
636
642
|
try:
|
|
637
|
-
entry = pickle.loads(pickled_entry)
|
|
643
|
+
entry = pickle.loads(pickled_entry) # noqa: S301
|
|
638
644
|
if not isinstance(entry, CachedResult):
|
|
639
645
|
# Loaded an old cache file format, remove it and let the caller
|
|
640
646
|
# rerun the function.
|
|
@@ -30,7 +30,7 @@ def get_cached_func_name_md(func: Any) -> str:
|
|
|
30
30
|
"""Get markdown representation of the function name."""
|
|
31
31
|
if hasattr(func, "__name__"):
|
|
32
32
|
return f"`{func.__name__}()`"
|
|
33
|
-
|
|
33
|
+
if hasattr(type(func), "__name__"):
|
|
34
34
|
return f"`{type(func).__name__}`"
|
|
35
35
|
return f"`{type(func)}`"
|
|
36
36
|
|
|
@@ -53,7 +53,7 @@ class UnhashableParamError(StreamlitAPIException):
|
|
|
53
53
|
arg_name: str | None,
|
|
54
54
|
arg_value: Any,
|
|
55
55
|
orig_exc: BaseException,
|
|
56
|
-
):
|
|
56
|
+
) -> None:
|
|
57
57
|
msg = self._create_message(cache_type, func, arg_name, arg_value)
|
|
58
58
|
super().__init__(msg)
|
|
59
59
|
self.with_traceback(orig_exc.__traceback__)
|
|
@@ -99,7 +99,7 @@ class CacheReplayClosureError(StreamlitAPIException):
|
|
|
99
99
|
self,
|
|
100
100
|
cache_type: CacheType,
|
|
101
101
|
cached_func: FunctionType,
|
|
102
|
-
):
|
|
102
|
+
) -> None:
|
|
103
103
|
func_name = get_cached_func_name_md(cached_func)
|
|
104
104
|
decorator_name = get_decorator_api_name(cache_type)
|
|
105
105
|
|
|
@@ -121,7 +121,7 @@ How to fix this:
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
class UnserializableReturnValueError(MarkdownFormattedException):
|
|
124
|
-
def __init__(self, func: FunctionType, return_value: FunctionType):
|
|
124
|
+
def __init__(self, func: FunctionType, return_value: FunctionType) -> None:
|
|
125
125
|
MarkdownFormattedException.__init__(
|
|
126
126
|
self,
|
|
127
127
|
f"""
|