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
|
@@ -19,6 +19,11 @@ from textwrap import dedent
|
|
|
19
19
|
from typing import TYPE_CHECKING, Literal, cast, overload
|
|
20
20
|
|
|
21
21
|
from streamlit.elements.lib.form_utils import current_form_id
|
|
22
|
+
from streamlit.elements.lib.layout_utils import (
|
|
23
|
+
LayoutConfig,
|
|
24
|
+
WidthWithoutContent,
|
|
25
|
+
validate_width,
|
|
26
|
+
)
|
|
22
27
|
from streamlit.elements.lib.policies import (
|
|
23
28
|
check_widget_policies,
|
|
24
29
|
maybe_raise_label_warnings,
|
|
@@ -54,7 +59,7 @@ if TYPE_CHECKING:
|
|
|
54
59
|
class TextInputSerde:
|
|
55
60
|
value: str | None
|
|
56
61
|
|
|
57
|
-
def deserialize(self, ui_value: str | None
|
|
62
|
+
def deserialize(self, ui_value: str | None) -> str | None:
|
|
58
63
|
return ui_value if ui_value is not None else self.value
|
|
59
64
|
|
|
60
65
|
def serialize(self, v: str | None) -> str | None:
|
|
@@ -65,7 +70,7 @@ class TextInputSerde:
|
|
|
65
70
|
class TextAreaSerde:
|
|
66
71
|
value: str | None
|
|
67
72
|
|
|
68
|
-
def deserialize(self, ui_value: str | None
|
|
73
|
+
def deserialize(self, ui_value: str | None) -> str | None:
|
|
69
74
|
return ui_value if ui_value is not None else self.value
|
|
70
75
|
|
|
71
76
|
def serialize(self, v: str | None) -> str | None:
|
|
@@ -91,6 +96,7 @@ class TextWidgetsMixin:
|
|
|
91
96
|
disabled: bool = False,
|
|
92
97
|
label_visibility: LabelVisibility = "visible",
|
|
93
98
|
icon: str | None = None,
|
|
99
|
+
width: WidthWithoutContent = "stretch",
|
|
94
100
|
) -> str:
|
|
95
101
|
pass
|
|
96
102
|
|
|
@@ -112,6 +118,7 @@ class TextWidgetsMixin:
|
|
|
112
118
|
disabled: bool = False,
|
|
113
119
|
label_visibility: LabelVisibility = "visible",
|
|
114
120
|
icon: str | None = None,
|
|
121
|
+
width: WidthWithoutContent = "stretch",
|
|
115
122
|
) -> str | None:
|
|
116
123
|
pass
|
|
117
124
|
|
|
@@ -133,6 +140,7 @@ class TextWidgetsMixin:
|
|
|
133
140
|
disabled: bool = False,
|
|
134
141
|
label_visibility: LabelVisibility = "visible",
|
|
135
142
|
icon: str | None = None,
|
|
143
|
+
width: WidthWithoutContent = "stretch",
|
|
136
144
|
) -> str | None:
|
|
137
145
|
r"""Display a single-line text input widget.
|
|
138
146
|
|
|
@@ -213,7 +221,7 @@ class TextWidgetsMixin:
|
|
|
213
221
|
label_visibility : "visible", "hidden", or "collapsed"
|
|
214
222
|
The visibility of the label. The default is ``"visible"``. If this
|
|
215
223
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
|
216
|
-
label, which can help keep the widget
|
|
224
|
+
label, which can help keep the widget aligned with other widgets.
|
|
217
225
|
|
|
218
226
|
icon : str, None
|
|
219
227
|
An optional emoji or icon to display within the input field to the
|
|
@@ -233,6 +241,17 @@ class TextWidgetsMixin:
|
|
|
233
241
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
|
234
242
|
font library.
|
|
235
243
|
|
|
244
|
+
width : "stretch" or int
|
|
245
|
+
The width of the text input widget. This can be one of the
|
|
246
|
+
following:
|
|
247
|
+
|
|
248
|
+
- ``"stretch"`` (default): The width of the widget matches the
|
|
249
|
+
width of the parent container.
|
|
250
|
+
- An integer specifying the width in pixels: The widget has a
|
|
251
|
+
fixed width. If the specified width is greater than the width of
|
|
252
|
+
the parent container, the width of the widget matches the width
|
|
253
|
+
of the parent container.
|
|
254
|
+
|
|
236
255
|
Returns
|
|
237
256
|
-------
|
|
238
257
|
str or None
|
|
@@ -267,6 +286,7 @@ class TextWidgetsMixin:
|
|
|
267
286
|
disabled=disabled,
|
|
268
287
|
label_visibility=label_visibility,
|
|
269
288
|
icon=icon,
|
|
289
|
+
width=width,
|
|
270
290
|
ctx=ctx,
|
|
271
291
|
)
|
|
272
292
|
|
|
@@ -287,6 +307,7 @@ class TextWidgetsMixin:
|
|
|
287
307
|
disabled: bool = False,
|
|
288
308
|
label_visibility: LabelVisibility = "visible",
|
|
289
309
|
icon: str | None = None,
|
|
310
|
+
width: WidthWithoutContent = "stretch",
|
|
290
311
|
ctx: ScriptRunContext | None = None,
|
|
291
312
|
) -> str | None:
|
|
292
313
|
key = to_key(key)
|
|
@@ -306,6 +327,7 @@ class TextWidgetsMixin:
|
|
|
306
327
|
"text_input",
|
|
307
328
|
user_key=key,
|
|
308
329
|
form_id=current_form_id(self.dg),
|
|
330
|
+
dg=self.dg,
|
|
309
331
|
label=label,
|
|
310
332
|
value=value,
|
|
311
333
|
max_chars=max_chars,
|
|
@@ -314,6 +336,7 @@ class TextWidgetsMixin:
|
|
|
314
336
|
autocomplete=autocomplete,
|
|
315
337
|
placeholder=str(placeholder),
|
|
316
338
|
icon=icon,
|
|
339
|
+
width=width,
|
|
317
340
|
)
|
|
318
341
|
|
|
319
342
|
session_state = get_session_state().filtered_state
|
|
@@ -349,8 +372,7 @@ class TextWidgetsMixin:
|
|
|
349
372
|
text_input_proto.type = TextInputProto.PASSWORD
|
|
350
373
|
else:
|
|
351
374
|
raise StreamlitAPIException(
|
|
352
|
-
"'
|
|
353
|
-
% type
|
|
375
|
+
f"'{type}' is not a valid text_input type. Valid types are 'default' and 'password'."
|
|
354
376
|
)
|
|
355
377
|
|
|
356
378
|
# Marshall the autocomplete param. If unspecified, this will be
|
|
@@ -377,7 +399,10 @@ class TextWidgetsMixin:
|
|
|
377
399
|
text_input_proto.value = widget_state.value
|
|
378
400
|
text_input_proto.set_value = True
|
|
379
401
|
|
|
380
|
-
|
|
402
|
+
validate_width(width)
|
|
403
|
+
layout_config = LayoutConfig(width=width)
|
|
404
|
+
|
|
405
|
+
self.dg._enqueue("text_input", text_input_proto, layout_config=layout_config)
|
|
381
406
|
return widget_state.value
|
|
382
407
|
|
|
383
408
|
@overload
|
|
@@ -396,6 +421,7 @@ class TextWidgetsMixin:
|
|
|
396
421
|
placeholder: str | None = None,
|
|
397
422
|
disabled: bool = False,
|
|
398
423
|
label_visibility: LabelVisibility = "visible",
|
|
424
|
+
width: WidthWithoutContent = "stretch",
|
|
399
425
|
) -> str:
|
|
400
426
|
pass
|
|
401
427
|
|
|
@@ -415,6 +441,7 @@ class TextWidgetsMixin:
|
|
|
415
441
|
placeholder: str | None = None,
|
|
416
442
|
disabled: bool = False,
|
|
417
443
|
label_visibility: LabelVisibility = "visible",
|
|
444
|
+
width: WidthWithoutContent = "stretch",
|
|
418
445
|
) -> str | None:
|
|
419
446
|
pass
|
|
420
447
|
|
|
@@ -434,6 +461,7 @@ class TextWidgetsMixin:
|
|
|
434
461
|
placeholder: str | None = None,
|
|
435
462
|
disabled: bool = False,
|
|
436
463
|
label_visibility: LabelVisibility = "visible",
|
|
464
|
+
width: WidthWithoutContent = "stretch",
|
|
437
465
|
) -> str | None:
|
|
438
466
|
r"""Display a multi-line text input widget.
|
|
439
467
|
|
|
@@ -508,9 +536,20 @@ class TextWidgetsMixin:
|
|
|
508
536
|
label_visibility : "visible", "hidden", or "collapsed"
|
|
509
537
|
The visibility of the label. The default is ``"visible"``. If this
|
|
510
538
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
|
511
|
-
label, which can help keep the widget
|
|
539
|
+
label, which can help keep the widget aligned with other widgets.
|
|
512
540
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
|
513
541
|
|
|
542
|
+
width : "stretch" or int
|
|
543
|
+
The width of the text area widget. This can be one of the
|
|
544
|
+
following:
|
|
545
|
+
|
|
546
|
+
- ``"stretch"`` (default): The width of the widget matches the
|
|
547
|
+
width of the parent container.
|
|
548
|
+
- An integer specifying the width in pixels: The widget has a
|
|
549
|
+
fixed width. If the specified width is greater than the width of
|
|
550
|
+
the parent container, the width of the widget matches the width
|
|
551
|
+
of the parent container.
|
|
552
|
+
|
|
514
553
|
Returns
|
|
515
554
|
-------
|
|
516
555
|
str or None
|
|
@@ -557,6 +596,7 @@ class TextWidgetsMixin:
|
|
|
557
596
|
placeholder=placeholder,
|
|
558
597
|
disabled=disabled,
|
|
559
598
|
label_visibility=label_visibility,
|
|
599
|
+
width=width,
|
|
560
600
|
ctx=ctx,
|
|
561
601
|
)
|
|
562
602
|
|
|
@@ -575,6 +615,7 @@ class TextWidgetsMixin:
|
|
|
575
615
|
placeholder: str | None = None,
|
|
576
616
|
disabled: bool = False,
|
|
577
617
|
label_visibility: LabelVisibility = "visible",
|
|
618
|
+
width: WidthWithoutContent = "stretch",
|
|
578
619
|
ctx: ScriptRunContext | None = None,
|
|
579
620
|
) -> str | None:
|
|
580
621
|
key = to_key(key)
|
|
@@ -593,12 +634,14 @@ class TextWidgetsMixin:
|
|
|
593
634
|
"text_area",
|
|
594
635
|
user_key=key,
|
|
595
636
|
form_id=current_form_id(self.dg),
|
|
637
|
+
dg=self.dg,
|
|
596
638
|
label=label,
|
|
597
639
|
value=value,
|
|
598
640
|
height=height,
|
|
599
641
|
max_chars=max_chars,
|
|
600
642
|
help=help,
|
|
601
643
|
placeholder=str(placeholder),
|
|
644
|
+
width=width,
|
|
602
645
|
)
|
|
603
646
|
|
|
604
647
|
session_state = get_session_state().filtered_state
|
|
@@ -645,7 +688,10 @@ class TextWidgetsMixin:
|
|
|
645
688
|
text_area_proto.value = widget_state.value
|
|
646
689
|
text_area_proto.set_value = True
|
|
647
690
|
|
|
648
|
-
|
|
691
|
+
validate_width(width)
|
|
692
|
+
layout_config = LayoutConfig(width=width)
|
|
693
|
+
|
|
694
|
+
self.dg._enqueue("text_area", text_area_proto, layout_config=layout_config)
|
|
649
695
|
return widget_state.value
|
|
650
696
|
|
|
651
697
|
@property
|
|
@@ -31,6 +31,11 @@ from typing import (
|
|
|
31
31
|
from typing_extensions import TypeAlias
|
|
32
32
|
|
|
33
33
|
from streamlit.elements.lib.form_utils import current_form_id
|
|
34
|
+
from streamlit.elements.lib.layout_utils import (
|
|
35
|
+
LayoutConfig,
|
|
36
|
+
WidthWithoutContent,
|
|
37
|
+
validate_width,
|
|
38
|
+
)
|
|
34
39
|
from streamlit.elements.lib.policies import (
|
|
35
40
|
check_widget_policies,
|
|
36
41
|
maybe_raise_label_warnings,
|
|
@@ -263,7 +268,7 @@ class _DateInputValues:
|
|
|
263
268
|
class TimeInputSerde:
|
|
264
269
|
value: time | None
|
|
265
270
|
|
|
266
|
-
def deserialize(self, ui_value: str | None
|
|
271
|
+
def deserialize(self, ui_value: str | None) -> time | None:
|
|
267
272
|
return (
|
|
268
273
|
datetime.strptime(ui_value, "%H:%M").time()
|
|
269
274
|
if ui_value is not None
|
|
@@ -282,11 +287,7 @@ class TimeInputSerde:
|
|
|
282
287
|
class DateInputSerde:
|
|
283
288
|
value: _DateInputValues
|
|
284
289
|
|
|
285
|
-
def deserialize(
|
|
286
|
-
self,
|
|
287
|
-
ui_value: Any,
|
|
288
|
-
widget_id: str = "",
|
|
289
|
-
) -> DateWidgetReturn:
|
|
290
|
+
def deserialize(self, ui_value: Any) -> DateWidgetReturn:
|
|
290
291
|
return_value: Sequence[date] | None
|
|
291
292
|
if ui_value is not None:
|
|
292
293
|
return_value = tuple(
|
|
@@ -325,6 +326,7 @@ class TimeWidgetsMixin:
|
|
|
325
326
|
disabled: bool = False,
|
|
326
327
|
label_visibility: LabelVisibility = "visible",
|
|
327
328
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
|
329
|
+
width: WidthWithoutContent = "stretch",
|
|
328
330
|
) -> time:
|
|
329
331
|
pass
|
|
330
332
|
|
|
@@ -342,6 +344,7 @@ class TimeWidgetsMixin:
|
|
|
342
344
|
disabled: bool = False,
|
|
343
345
|
label_visibility: LabelVisibility = "visible",
|
|
344
346
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
|
347
|
+
width: WidthWithoutContent = "stretch",
|
|
345
348
|
) -> time | None:
|
|
346
349
|
pass
|
|
347
350
|
|
|
@@ -359,6 +362,7 @@ class TimeWidgetsMixin:
|
|
|
359
362
|
disabled: bool = False,
|
|
360
363
|
label_visibility: LabelVisibility = "visible",
|
|
361
364
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
|
365
|
+
width: WidthWithoutContent = "stretch",
|
|
362
366
|
) -> time | None:
|
|
363
367
|
r"""Display a time input widget.
|
|
364
368
|
|
|
@@ -429,13 +433,23 @@ class TimeWidgetsMixin:
|
|
|
429
433
|
label_visibility : "visible", "hidden", or "collapsed"
|
|
430
434
|
The visibility of the label. The default is ``"visible"``. If this
|
|
431
435
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
|
432
|
-
label, which can help keep the widget
|
|
436
|
+
label, which can help keep the widget aligned with other widgets.
|
|
433
437
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
|
434
438
|
|
|
435
439
|
step : int or timedelta
|
|
436
440
|
The stepping interval in seconds. Defaults to 900, i.e. 15 minutes.
|
|
437
441
|
You can also pass a datetime.timedelta object.
|
|
438
442
|
|
|
443
|
+
width : "stretch" or int
|
|
444
|
+
The width of the time input widget. This can be one of the following:
|
|
445
|
+
|
|
446
|
+
- ``"stretch"`` (default): The width of the widget matches the
|
|
447
|
+
width of the parent container.
|
|
448
|
+
- An integer specifying the width in pixels: The widget has a
|
|
449
|
+
fixed width. If the specified width is greater than the width of
|
|
450
|
+
the parent container, the width of the widget matches the width
|
|
451
|
+
of the parent container.
|
|
452
|
+
|
|
439
453
|
Returns
|
|
440
454
|
-------
|
|
441
455
|
datetime.time or None
|
|
@@ -479,6 +493,7 @@ class TimeWidgetsMixin:
|
|
|
479
493
|
disabled=disabled,
|
|
480
494
|
label_visibility=label_visibility,
|
|
481
495
|
step=step,
|
|
496
|
+
width=width,
|
|
482
497
|
ctx=ctx,
|
|
483
498
|
)
|
|
484
499
|
|
|
@@ -495,6 +510,7 @@ class TimeWidgetsMixin:
|
|
|
495
510
|
disabled: bool = False,
|
|
496
511
|
label_visibility: LabelVisibility = "visible",
|
|
497
512
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
|
513
|
+
width: WidthWithoutContent = "stretch",
|
|
498
514
|
ctx: ScriptRunContext | None = None,
|
|
499
515
|
) -> time | None:
|
|
500
516
|
key = to_key(key)
|
|
@@ -508,19 +524,18 @@ class TimeWidgetsMixin:
|
|
|
508
524
|
maybe_raise_label_warnings(label, label_visibility)
|
|
509
525
|
|
|
510
526
|
parsed_time: time | None
|
|
511
|
-
if value is None
|
|
512
|
-
parsed_time = None
|
|
513
|
-
else:
|
|
514
|
-
parsed_time = _convert_timelike_to_time(value)
|
|
527
|
+
parsed_time = None if value is None else _convert_timelike_to_time(value)
|
|
515
528
|
|
|
516
529
|
element_id = compute_and_register_element_id(
|
|
517
530
|
"time_input",
|
|
518
531
|
user_key=key,
|
|
519
532
|
form_id=current_form_id(self.dg),
|
|
533
|
+
dg=self.dg,
|
|
520
534
|
label=label,
|
|
521
535
|
value=parsed_time if isinstance(value, (datetime, time)) else value,
|
|
522
536
|
help=help,
|
|
523
537
|
step=step,
|
|
538
|
+
width=width,
|
|
524
539
|
)
|
|
525
540
|
del value
|
|
526
541
|
|
|
@@ -570,7 +585,10 @@ class TimeWidgetsMixin:
|
|
|
570
585
|
time_input_proto.value = serialized_value
|
|
571
586
|
time_input_proto.set_value = True
|
|
572
587
|
|
|
573
|
-
|
|
588
|
+
validate_width(width)
|
|
589
|
+
layout_config = LayoutConfig(width=width)
|
|
590
|
+
|
|
591
|
+
self.dg._enqueue("time_input", time_input_proto, layout_config=layout_config)
|
|
574
592
|
return widget_state.value
|
|
575
593
|
|
|
576
594
|
@overload
|
|
@@ -589,6 +607,7 @@ class TimeWidgetsMixin:
|
|
|
589
607
|
format: str = "YYYY/MM/DD",
|
|
590
608
|
disabled: bool = False,
|
|
591
609
|
label_visibility: LabelVisibility = "visible",
|
|
610
|
+
width: WidthWithoutContent = "stretch",
|
|
592
611
|
) -> date: ...
|
|
593
612
|
|
|
594
613
|
@overload
|
|
@@ -607,6 +626,7 @@ class TimeWidgetsMixin:
|
|
|
607
626
|
format: str = "YYYY/MM/DD",
|
|
608
627
|
disabled: bool = False,
|
|
609
628
|
label_visibility: LabelVisibility = "visible",
|
|
629
|
+
width: WidthWithoutContent = "stretch",
|
|
610
630
|
) -> date | None: ...
|
|
611
631
|
|
|
612
632
|
@overload
|
|
@@ -627,6 +647,7 @@ class TimeWidgetsMixin:
|
|
|
627
647
|
format: str = "YYYY/MM/DD",
|
|
628
648
|
disabled: bool = False,
|
|
629
649
|
label_visibility: LabelVisibility = "visible",
|
|
650
|
+
width: WidthWithoutContent = "stretch",
|
|
630
651
|
) -> DateWidgetRangeReturn: ...
|
|
631
652
|
|
|
632
653
|
@gather_metrics("date_input")
|
|
@@ -645,6 +666,7 @@ class TimeWidgetsMixin:
|
|
|
645
666
|
format: str = "YYYY/MM/DD",
|
|
646
667
|
disabled: bool = False,
|
|
647
668
|
label_visibility: LabelVisibility = "visible",
|
|
669
|
+
width: WidthWithoutContent = "stretch",
|
|
648
670
|
) -> DateWidgetReturn:
|
|
649
671
|
r"""Display a date input widget.
|
|
650
672
|
|
|
@@ -749,9 +771,19 @@ class TimeWidgetsMixin:
|
|
|
749
771
|
label_visibility : "visible", "hidden", or "collapsed"
|
|
750
772
|
The visibility of the label. The default is ``"visible"``. If this
|
|
751
773
|
is ``"hidden"``, Streamlit displays an empty spacer instead of the
|
|
752
|
-
label, which can help keep the widget
|
|
774
|
+
label, which can help keep the widget aligned with other widgets.
|
|
753
775
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
|
754
776
|
|
|
777
|
+
width : "stretch" or int
|
|
778
|
+
The width of the date input widget. This can be one of the following:
|
|
779
|
+
|
|
780
|
+
- ``"stretch"`` (default): The width of the widget matches the
|
|
781
|
+
width of the parent container.
|
|
782
|
+
- An integer specifying the width in pixels: The widget has a
|
|
783
|
+
fixed width. If the specified width is greater than the width of
|
|
784
|
+
the parent container, the width of the widget matches the width
|
|
785
|
+
of the parent container.
|
|
786
|
+
|
|
755
787
|
Returns
|
|
756
788
|
-------
|
|
757
789
|
datetime.date or a tuple with 0-2 dates or None
|
|
@@ -818,6 +850,7 @@ class TimeWidgetsMixin:
|
|
|
818
850
|
disabled=disabled,
|
|
819
851
|
label_visibility=label_visibility,
|
|
820
852
|
format=format,
|
|
853
|
+
width=width,
|
|
821
854
|
ctx=ctx,
|
|
822
855
|
)
|
|
823
856
|
|
|
@@ -836,6 +869,7 @@ class TimeWidgetsMixin:
|
|
|
836
869
|
format: str = "YYYY/MM/DD",
|
|
837
870
|
disabled: bool = False,
|
|
838
871
|
label_visibility: LabelVisibility = "visible",
|
|
872
|
+
width: WidthWithoutContent = "stretch",
|
|
839
873
|
ctx: ScriptRunContext | None = None,
|
|
840
874
|
) -> DateWidgetReturn:
|
|
841
875
|
key = to_key(key)
|
|
@@ -882,12 +916,14 @@ class TimeWidgetsMixin:
|
|
|
882
916
|
"date_input",
|
|
883
917
|
user_key=key,
|
|
884
918
|
form_id=current_form_id(self.dg),
|
|
919
|
+
dg=self.dg,
|
|
885
920
|
label=label,
|
|
886
921
|
value=parsed,
|
|
887
922
|
min_value=parsed_min_date,
|
|
888
923
|
max_value=parsed_max_date,
|
|
889
924
|
help=help,
|
|
890
925
|
format=format,
|
|
926
|
+
width=width,
|
|
891
927
|
)
|
|
892
928
|
if not bool(ALLOWED_DATE_FORMATS.match(format)):
|
|
893
929
|
raise StreamlitAPIException(
|
|
@@ -962,7 +998,10 @@ class TimeWidgetsMixin:
|
|
|
962
998
|
date_input_proto.value[:] = serde.serialize(widget_state.value)
|
|
963
999
|
date_input_proto.set_value = True
|
|
964
1000
|
|
|
965
|
-
|
|
1001
|
+
validate_width(width)
|
|
1002
|
+
layout_config = LayoutConfig(width=width)
|
|
1003
|
+
|
|
1004
|
+
self.dg._enqueue("date_input", date_input_proto, layout_config=layout_config)
|
|
966
1005
|
return widget_state.value
|
|
967
1006
|
|
|
968
1007
|
@property
|
streamlit/elements/write.py
CHANGED
|
@@ -156,7 +156,7 @@ class WriteMixin:
|
|
|
156
156
|
streamed_response: str = ""
|
|
157
157
|
written_content: list[Any] = StreamingOutput()
|
|
158
158
|
|
|
159
|
-
def flush_stream_response():
|
|
159
|
+
def flush_stream_response() -> None:
|
|
160
160
|
"""Write the full response to the app."""
|
|
161
161
|
nonlocal streamed_response
|
|
162
162
|
nonlocal stream_container
|
|
@@ -245,7 +245,7 @@ class WriteMixin:
|
|
|
245
245
|
if not written_content:
|
|
246
246
|
# If nothing was streamed, return an empty string.
|
|
247
247
|
return ""
|
|
248
|
-
|
|
248
|
+
if len(written_content) == 1 and isinstance(written_content[0], str):
|
|
249
249
|
# If the output only contains a single string, return it as a string
|
|
250
250
|
return written_content[0]
|
|
251
251
|
|
|
@@ -253,7 +253,7 @@ class WriteMixin:
|
|
|
253
253
|
return written_content
|
|
254
254
|
|
|
255
255
|
@gather_metrics("write")
|
|
256
|
-
def write(self, *args: Any, unsafe_allow_html: bool = False, **kwargs) -> None:
|
|
256
|
+
def write(self, *args: Any, unsafe_allow_html: bool = False, **kwargs: Any) -> None:
|
|
257
257
|
"""Displays arguments in the app.
|
|
258
258
|
|
|
259
259
|
This is the Swiss Army knife of Streamlit commands: it does different
|
|
@@ -428,7 +428,7 @@ class WriteMixin:
|
|
|
428
428
|
"when called as `st.write()` or `st.sidebar.write()`."
|
|
429
429
|
)
|
|
430
430
|
|
|
431
|
-
def flush_buffer():
|
|
431
|
+
def flush_buffer() -> None:
|
|
432
432
|
if string_buffer:
|
|
433
433
|
text_content = " ".join(string_buffer)
|
|
434
434
|
# The usage of empty here prevents
|
|
@@ -528,10 +528,7 @@ class WriteMixin:
|
|
|
528
528
|
):
|
|
529
529
|
flush_buffer()
|
|
530
530
|
self.write_stream(arg)
|
|
531
|
-
elif isinstance(arg, HELP_TYPES):
|
|
532
|
-
flush_buffer()
|
|
533
|
-
self.dg.help(arg)
|
|
534
|
-
elif dataclasses.is_dataclass(arg):
|
|
531
|
+
elif isinstance(arg, HELP_TYPES) or dataclasses.is_dataclass(arg):
|
|
535
532
|
flush_buffer()
|
|
536
533
|
self.dg.help(arg)
|
|
537
534
|
elif inspect.isclass(arg):
|
streamlit/env_util.py
CHANGED
|
@@ -31,9 +31,7 @@ def is_pex() -> bool:
|
|
|
31
31
|
Pex modifies sys.path so the pex file is the first path and that's
|
|
32
32
|
how we determine we're running in the pex file.
|
|
33
33
|
"""
|
|
34
|
-
|
|
35
|
-
return True
|
|
36
|
-
return False
|
|
34
|
+
return bool(re.match(r".*pex$", sys.path[0]))
|
|
37
35
|
|
|
38
36
|
|
|
39
37
|
def is_repl() -> bool:
|
|
@@ -48,10 +46,7 @@ def is_repl() -> bool:
|
|
|
48
46
|
|
|
49
47
|
# <stdin> is what the basic Python REPL calls the root frame's
|
|
50
48
|
# filename, and <string> is what iPython sometimes calls it.
|
|
51
|
-
|
|
52
|
-
return True
|
|
53
|
-
|
|
54
|
-
return False
|
|
49
|
+
return filename in ("<stdin>", "<string>")
|
|
55
50
|
|
|
56
51
|
|
|
57
52
|
def is_executable_in_path(name: str) -> bool:
|
streamlit/error_util.py
CHANGED
|
@@ -14,29 +14,36 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
-
from typing import Final
|
|
17
|
+
from typing import Any, Final
|
|
18
18
|
|
|
19
19
|
import streamlit
|
|
20
|
-
import streamlit.elements.exception as exception
|
|
21
20
|
from streamlit import config
|
|
22
21
|
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
|
22
|
+
from streamlit.elements import exception
|
|
23
23
|
from streamlit.logger import get_logger
|
|
24
24
|
|
|
25
25
|
_LOGGER: Final = get_logger(__name__)
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def _print_rich_exception(e: BaseException) -> None:
|
|
29
|
-
from rich import
|
|
29
|
+
from rich.box import Box
|
|
30
|
+
from rich.panel import Panel
|
|
30
31
|
|
|
31
32
|
# Monkey patch the panel to use our custom box style
|
|
32
|
-
class ConfigurablePanel(
|
|
33
|
+
class ConfigurablePanel(Panel):
|
|
33
34
|
def __init__(
|
|
34
35
|
self,
|
|
35
|
-
renderable,
|
|
36
|
-
box=
|
|
37
|
-
**kwargs,
|
|
38
|
-
):
|
|
39
|
-
super().__init__(
|
|
36
|
+
renderable: Any,
|
|
37
|
+
box: Box | None = None,
|
|
38
|
+
**kwargs: Any,
|
|
39
|
+
) -> None:
|
|
40
|
+
super().__init__(
|
|
41
|
+
renderable,
|
|
42
|
+
box
|
|
43
|
+
if box is not None
|
|
44
|
+
else Box("────\n \n────\n \n────\n────\n \n────\n"),
|
|
45
|
+
**kwargs,
|
|
46
|
+
)
|
|
40
47
|
|
|
41
48
|
from rich import traceback as rich_traceback
|
|
42
49
|
|