streamlit-nightly 1.43.2.dev20250307__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 +306 -0
- streamlit/__main__.py +20 -0
- streamlit/auth_util.py +218 -0
- streamlit/cli_util.py +105 -0
- streamlit/column_config.py +56 -0
- streamlit/commands/__init__.py +13 -0
- streamlit/commands/echo.py +126 -0
- streamlit/commands/execution_control.py +238 -0
- streamlit/commands/experimental_query_params.py +169 -0
- streamlit/commands/logo.py +189 -0
- streamlit/commands/navigation.py +385 -0
- streamlit/commands/page_config.py +311 -0
- streamlit/components/__init__.py +13 -0
- streamlit/components/lib/__init__.py +13 -0
- streamlit/components/lib/local_component_registry.py +84 -0
- streamlit/components/types/__init__.py +13 -0
- streamlit/components/types/base_component_registry.py +99 -0
- streamlit/components/types/base_custom_component.py +150 -0
- streamlit/components/v1/__init__.py +31 -0
- streamlit/components/v1/component_arrow.py +141 -0
- streamlit/components/v1/component_registry.py +130 -0
- streamlit/components/v1/components.py +38 -0
- streamlit/components/v1/custom_component.py +243 -0
- streamlit/config.py +1513 -0
- streamlit/config_option.py +311 -0
- streamlit/config_util.py +177 -0
- streamlit/connections/__init__.py +28 -0
- streamlit/connections/base_connection.py +174 -0
- streamlit/connections/snowflake_connection.py +562 -0
- streamlit/connections/snowpark_connection.py +213 -0
- streamlit/connections/sql_connection.py +425 -0
- streamlit/connections/util.py +97 -0
- streamlit/cursor.py +210 -0
- streamlit/dataframe_util.py +1416 -0
- streamlit/delta_generator.py +602 -0
- streamlit/delta_generator_singletons.py +204 -0
- streamlit/deprecation_util.py +209 -0
- streamlit/development.py +21 -0
- streamlit/elements/__init__.py +13 -0
- streamlit/elements/alert.py +234 -0
- streamlit/elements/arrow.py +962 -0
- streamlit/elements/balloons.py +47 -0
- streamlit/elements/bokeh_chart.py +133 -0
- streamlit/elements/code.py +114 -0
- streamlit/elements/deck_gl_json_chart.py +546 -0
- streamlit/elements/dialog_decorator.py +267 -0
- streamlit/elements/doc_string.py +558 -0
- streamlit/elements/empty.py +130 -0
- streamlit/elements/exception.py +331 -0
- streamlit/elements/form.py +354 -0
- streamlit/elements/graphviz_chart.py +150 -0
- streamlit/elements/heading.py +302 -0
- streamlit/elements/html.py +105 -0
- streamlit/elements/iframe.py +191 -0
- streamlit/elements/image.py +196 -0
- streamlit/elements/json.py +139 -0
- streamlit/elements/layouts.py +879 -0
- streamlit/elements/lib/__init__.py +13 -0
- streamlit/elements/lib/built_in_chart_utils.py +1157 -0
- streamlit/elements/lib/color_util.py +263 -0
- streamlit/elements/lib/column_config_utils.py +542 -0
- streamlit/elements/lib/column_types.py +2188 -0
- streamlit/elements/lib/dialog.py +147 -0
- streamlit/elements/lib/dicttools.py +154 -0
- streamlit/elements/lib/event_utils.py +37 -0
- streamlit/elements/lib/file_uploader_utils.py +66 -0
- streamlit/elements/lib/form_utils.py +77 -0
- streamlit/elements/lib/image_utils.py +441 -0
- streamlit/elements/lib/js_number.py +105 -0
- streamlit/elements/lib/mutable_status_container.py +183 -0
- streamlit/elements/lib/options_selector_utils.py +250 -0
- streamlit/elements/lib/pandas_styler_utils.py +274 -0
- streamlit/elements/lib/policies.py +194 -0
- streamlit/elements/lib/streamlit_plotly_theme.py +207 -0
- streamlit/elements/lib/subtitle_utils.py +176 -0
- streamlit/elements/lib/utils.py +250 -0
- streamlit/elements/map.py +508 -0
- streamlit/elements/markdown.py +277 -0
- streamlit/elements/media.py +793 -0
- streamlit/elements/metric.py +301 -0
- streamlit/elements/plotly_chart.py +546 -0
- streamlit/elements/progress.py +156 -0
- streamlit/elements/pyplot.py +194 -0
- streamlit/elements/snow.py +47 -0
- streamlit/elements/spinner.py +113 -0
- streamlit/elements/text.py +76 -0
- streamlit/elements/toast.py +98 -0
- streamlit/elements/vega_charts.py +1984 -0
- streamlit/elements/widgets/__init__.py +13 -0
- streamlit/elements/widgets/audio_input.py +310 -0
- streamlit/elements/widgets/button.py +1123 -0
- streamlit/elements/widgets/button_group.py +1008 -0
- streamlit/elements/widgets/camera_input.py +263 -0
- streamlit/elements/widgets/chat.py +647 -0
- streamlit/elements/widgets/checkbox.py +352 -0
- streamlit/elements/widgets/color_picker.py +265 -0
- streamlit/elements/widgets/data_editor.py +983 -0
- streamlit/elements/widgets/file_uploader.py +486 -0
- streamlit/elements/widgets/multiselect.py +338 -0
- streamlit/elements/widgets/number_input.py +545 -0
- streamlit/elements/widgets/radio.py +407 -0
- streamlit/elements/widgets/select_slider.py +437 -0
- streamlit/elements/widgets/selectbox.py +366 -0
- streamlit/elements/widgets/slider.py +880 -0
- streamlit/elements/widgets/text_widgets.py +628 -0
- streamlit/elements/widgets/time_widgets.py +970 -0
- streamlit/elements/write.py +574 -0
- streamlit/emojis.py +34 -0
- streamlit/env_util.py +61 -0
- streamlit/error_util.py +105 -0
- streamlit/errors.py +452 -0
- streamlit/external/__init__.py +13 -0
- streamlit/external/langchain/__init__.py +23 -0
- streamlit/external/langchain/streamlit_callback_handler.py +406 -0
- streamlit/file_util.py +247 -0
- streamlit/git_util.py +173 -0
- streamlit/hello/__init__.py +13 -0
- streamlit/hello/animation_demo.py +82 -0
- streamlit/hello/dataframe_demo.py +71 -0
- streamlit/hello/hello.py +37 -0
- streamlit/hello/mapping_demo.py +114 -0
- streamlit/hello/plotting_demo.py +55 -0
- streamlit/hello/streamlit_app.py +55 -0
- streamlit/hello/utils.py +28 -0
- streamlit/logger.py +130 -0
- streamlit/material_icon_names.py +25 -0
- streamlit/navigation/__init__.py +13 -0
- streamlit/navigation/page.py +302 -0
- streamlit/net_util.py +125 -0
- streamlit/platform.py +33 -0
- streamlit/proto/Alert_pb2.py +29 -0
- streamlit/proto/Alert_pb2.pyi +90 -0
- streamlit/proto/AppPage_pb2.py +27 -0
- streamlit/proto/AppPage_pb2.pyi +64 -0
- streamlit/proto/ArrowNamedDataSet_pb2.py +28 -0
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +57 -0
- streamlit/proto/ArrowVegaLiteChart_pb2.py +29 -0
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +84 -0
- streamlit/proto/Arrow_pb2.py +33 -0
- streamlit/proto/Arrow_pb2.pyi +188 -0
- streamlit/proto/AudioInput_pb2.py +28 -0
- streamlit/proto/AudioInput_pb2.pyi +58 -0
- streamlit/proto/Audio_pb2.py +27 -0
- streamlit/proto/Audio_pb2.pyi +58 -0
- streamlit/proto/AuthRedirect_pb2.py +27 -0
- streamlit/proto/AuthRedirect_pb2.pyi +41 -0
- streamlit/proto/AutoRerun_pb2.py +27 -0
- streamlit/proto/AutoRerun_pb2.pyi +45 -0
- streamlit/proto/BackMsg_pb2.py +29 -0
- streamlit/proto/BackMsg_pb2.pyi +105 -0
- streamlit/proto/Balloons_pb2.py +27 -0
- streamlit/proto/Balloons_pb2.pyi +43 -0
- streamlit/proto/Block_pb2.py +53 -0
- streamlit/proto/Block_pb2.pyi +322 -0
- streamlit/proto/BokehChart_pb2.py +27 -0
- streamlit/proto/BokehChart_pb2.pyi +49 -0
- streamlit/proto/ButtonGroup_pb2.py +36 -0
- streamlit/proto/ButtonGroup_pb2.pyi +169 -0
- streamlit/proto/Button_pb2.py +27 -0
- streamlit/proto/Button_pb2.pyi +71 -0
- streamlit/proto/CameraInput_pb2.py +28 -0
- streamlit/proto/CameraInput_pb2.pyi +58 -0
- streamlit/proto/ChatInput_pb2.py +31 -0
- streamlit/proto/ChatInput_pb2.pyi +111 -0
- streamlit/proto/Checkbox_pb2.py +30 -0
- streamlit/proto/Checkbox_pb2.pyi +90 -0
- streamlit/proto/ClientState_pb2.py +30 -0
- streamlit/proto/ClientState_pb2.pyi +90 -0
- streamlit/proto/Code_pb2.py +27 -0
- streamlit/proto/Code_pb2.pyi +55 -0
- streamlit/proto/ColorPicker_pb2.py +28 -0
- streamlit/proto/ColorPicker_pb2.pyi +67 -0
- streamlit/proto/Common_pb2.py +51 -0
- streamlit/proto/Common_pb2.pyi +293 -0
- streamlit/proto/Components_pb2.py +35 -0
- streamlit/proto/Components_pb2.pyi +172 -0
- streamlit/proto/DataFrame_pb2.py +56 -0
- streamlit/proto/DataFrame_pb2.pyi +397 -0
- streamlit/proto/DateInput_pb2.py +28 -0
- streamlit/proto/DateInput_pb2.pyi +83 -0
- streamlit/proto/DeckGlJsonChart_pb2.py +29 -0
- streamlit/proto/DeckGlJsonChart_pb2.pyi +102 -0
- streamlit/proto/Delta_pb2.py +31 -0
- streamlit/proto/Delta_pb2.pyi +74 -0
- streamlit/proto/DocString_pb2.py +29 -0
- streamlit/proto/DocString_pb2.pyi +93 -0
- streamlit/proto/DownloadButton_pb2.py +27 -0
- streamlit/proto/DownloadButton_pb2.pyi +70 -0
- streamlit/proto/Element_pb2.py +78 -0
- streamlit/proto/Element_pb2.pyi +312 -0
- streamlit/proto/Empty_pb2.py +27 -0
- streamlit/proto/Empty_pb2.pyi +36 -0
- streamlit/proto/Exception_pb2.py +27 -0
- streamlit/proto/Exception_pb2.pyi +72 -0
- streamlit/proto/Favicon_pb2.py +27 -0
- streamlit/proto/Favicon_pb2.pyi +40 -0
- streamlit/proto/FileUploader_pb2.py +28 -0
- streamlit/proto/FileUploader_pb2.pyi +78 -0
- streamlit/proto/ForwardMsg_pb2.py +53 -0
- streamlit/proto/ForwardMsg_pb2.pyi +293 -0
- streamlit/proto/GitInfo_pb2.py +29 -0
- streamlit/proto/GitInfo_pb2.pyi +83 -0
- streamlit/proto/GraphVizChart_pb2.py +27 -0
- streamlit/proto/GraphVizChart_pb2.pyi +53 -0
- streamlit/proto/Heading_pb2.py +27 -0
- streamlit/proto/Heading_pb2.pyi +56 -0
- streamlit/proto/Html_pb2.py +27 -0
- streamlit/proto/Html_pb2.pyi +42 -0
- streamlit/proto/IFrame_pb2.py +27 -0
- streamlit/proto/IFrame_pb2.pyi +59 -0
- streamlit/proto/Image_pb2.py +29 -0
- streamlit/proto/Image_pb2.pyi +84 -0
- streamlit/proto/Json_pb2.py +27 -0
- streamlit/proto/Json_pb2.pyi +53 -0
- streamlit/proto/LabelVisibilityMessage_pb2.py +29 -0
- streamlit/proto/LabelVisibilityMessage_pb2.pyi +68 -0
- streamlit/proto/LinkButton_pb2.py +27 -0
- streamlit/proto/LinkButton_pb2.pyi +58 -0
- streamlit/proto/Logo_pb2.py +27 -0
- streamlit/proto/Logo_pb2.pyi +51 -0
- streamlit/proto/Markdown_pb2.py +29 -0
- streamlit/proto/Markdown_pb2.pyi +86 -0
- streamlit/proto/Metric_pb2.py +32 -0
- streamlit/proto/Metric_pb2.pyi +101 -0
- streamlit/proto/MetricsEvent_pb2.py +30 -0
- streamlit/proto/MetricsEvent_pb2.pyi +200 -0
- streamlit/proto/MultiSelect_pb2.py +28 -0
- streamlit/proto/MultiSelect_pb2.pyi +81 -0
- streamlit/proto/NamedDataSet_pb2.py +28 -0
- streamlit/proto/NamedDataSet_pb2.pyi +59 -0
- streamlit/proto/Navigation_pb2.py +30 -0
- streamlit/proto/Navigation_pb2.pyi +84 -0
- streamlit/proto/NewSession_pb2.py +51 -0
- streamlit/proto/NewSession_pb2.pyi +481 -0
- streamlit/proto/NumberInput_pb2.py +30 -0
- streamlit/proto/NumberInput_pb2.pyi +121 -0
- streamlit/proto/PageConfig_pb2.py +33 -0
- streamlit/proto/PageConfig_pb2.pyi +126 -0
- streamlit/proto/PageInfo_pb2.py +27 -0
- streamlit/proto/PageInfo_pb2.pyi +43 -0
- streamlit/proto/PageLink_pb2.py +27 -0
- streamlit/proto/PageLink_pb2.pyi +63 -0
- streamlit/proto/PageNotFound_pb2.py +27 -0
- streamlit/proto/PageNotFound_pb2.pyi +42 -0
- streamlit/proto/PageProfile_pb2.py +31 -0
- streamlit/proto/PageProfile_pb2.pyi +127 -0
- streamlit/proto/PagesChanged_pb2.py +28 -0
- streamlit/proto/PagesChanged_pb2.pyi +48 -0
- streamlit/proto/ParentMessage_pb2.py +27 -0
- streamlit/proto/ParentMessage_pb2.pyi +46 -0
- streamlit/proto/PlotlyChart_pb2.py +31 -0
- streamlit/proto/PlotlyChart_pb2.pyi +131 -0
- streamlit/proto/Progress_pb2.py +27 -0
- streamlit/proto/Progress_pb2.pyi +43 -0
- streamlit/proto/Radio_pb2.py +28 -0
- streamlit/proto/Radio_pb2.pyi +84 -0
- streamlit/proto/RootContainer_pb2.py +27 -0
- streamlit/proto/RootContainer_pb2.pyi +56 -0
- streamlit/proto/Selectbox_pb2.py +28 -0
- streamlit/proto/Selectbox_pb2.pyi +80 -0
- streamlit/proto/SessionEvent_pb2.py +28 -0
- streamlit/proto/SessionEvent_pb2.pyi +62 -0
- streamlit/proto/SessionStatus_pb2.py +27 -0
- streamlit/proto/SessionStatus_pb2.pyi +57 -0
- streamlit/proto/Skeleton_pb2.py +29 -0
- streamlit/proto/Skeleton_pb2.pyi +71 -0
- streamlit/proto/Slider_pb2.py +32 -0
- streamlit/proto/Slider_pb2.pyi +142 -0
- streamlit/proto/Snow_pb2.py +27 -0
- streamlit/proto/Snow_pb2.pyi +43 -0
- streamlit/proto/Spinner_pb2.py +27 -0
- streamlit/proto/Spinner_pb2.pyi +49 -0
- streamlit/proto/TextArea_pb2.py +28 -0
- streamlit/proto/TextArea_pb2.pyi +80 -0
- streamlit/proto/TextInput_pb2.py +30 -0
- streamlit/proto/TextInput_pb2.pyi +107 -0
- streamlit/proto/Text_pb2.py +27 -0
- streamlit/proto/Text_pb2.pyi +46 -0
- streamlit/proto/TimeInput_pb2.py +28 -0
- streamlit/proto/TimeInput_pb2.pyi +74 -0
- streamlit/proto/Toast_pb2.py +27 -0
- streamlit/proto/Toast_pb2.pyi +45 -0
- streamlit/proto/VegaLiteChart_pb2.py +29 -0
- streamlit/proto/VegaLiteChart_pb2.pyi +71 -0
- streamlit/proto/Video_pb2.py +31 -0
- streamlit/proto/Video_pb2.pyi +117 -0
- streamlit/proto/WidgetStates_pb2.py +31 -0
- streamlit/proto/WidgetStates_pb2.pyi +126 -0
- streamlit/proto/__init__.py +15 -0
- streamlit/proto/openmetrics_data_model_pb2.py +60 -0
- streamlit/proto/openmetrics_data_model_pb2.pyi +522 -0
- streamlit/py.typed +0 -0
- streamlit/runtime/__init__.py +50 -0
- streamlit/runtime/app_session.py +982 -0
- streamlit/runtime/caching/__init__.py +98 -0
- streamlit/runtime/caching/cache_data_api.py +665 -0
- streamlit/runtime/caching/cache_errors.py +142 -0
- streamlit/runtime/caching/cache_resource_api.py +527 -0
- streamlit/runtime/caching/cache_type.py +33 -0
- streamlit/runtime/caching/cache_utils.py +523 -0
- streamlit/runtime/caching/cached_message_replay.py +290 -0
- streamlit/runtime/caching/hashing.py +637 -0
- streamlit/runtime/caching/legacy_cache_api.py +169 -0
- streamlit/runtime/caching/storage/__init__.py +29 -0
- streamlit/runtime/caching/storage/cache_storage_protocol.py +239 -0
- streamlit/runtime/caching/storage/dummy_cache_storage.py +60 -0
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +145 -0
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +223 -0
- streamlit/runtime/connection_factory.py +436 -0
- streamlit/runtime/context.py +280 -0
- streamlit/runtime/credentials.py +364 -0
- streamlit/runtime/forward_msg_cache.py +296 -0
- streamlit/runtime/forward_msg_queue.py +240 -0
- streamlit/runtime/fragment.py +477 -0
- streamlit/runtime/media_file_manager.py +234 -0
- streamlit/runtime/media_file_storage.py +143 -0
- streamlit/runtime/memory_media_file_storage.py +181 -0
- streamlit/runtime/memory_session_storage.py +77 -0
- streamlit/runtime/memory_uploaded_file_manager.py +138 -0
- streamlit/runtime/metrics_util.py +486 -0
- streamlit/runtime/pages_manager.py +165 -0
- streamlit/runtime/runtime.py +792 -0
- streamlit/runtime/runtime_util.py +106 -0
- streamlit/runtime/script_data.py +46 -0
- streamlit/runtime/scriptrunner/__init__.py +38 -0
- streamlit/runtime/scriptrunner/exec_code.py +159 -0
- streamlit/runtime/scriptrunner/magic.py +273 -0
- streamlit/runtime/scriptrunner/magic_funcs.py +32 -0
- streamlit/runtime/scriptrunner/script_cache.py +89 -0
- streamlit/runtime/scriptrunner/script_runner.py +756 -0
- streamlit/runtime/scriptrunner_utils/__init__.py +19 -0
- streamlit/runtime/scriptrunner_utils/exceptions.py +48 -0
- streamlit/runtime/scriptrunner_utils/script_requests.py +307 -0
- streamlit/runtime/scriptrunner_utils/script_run_context.py +287 -0
- streamlit/runtime/secrets.py +534 -0
- streamlit/runtime/session_manager.py +394 -0
- streamlit/runtime/state/__init__.py +41 -0
- streamlit/runtime/state/common.py +191 -0
- streamlit/runtime/state/query_params.py +205 -0
- streamlit/runtime/state/query_params_proxy.py +218 -0
- streamlit/runtime/state/safe_session_state.py +138 -0
- streamlit/runtime/state/session_state.py +772 -0
- streamlit/runtime/state/session_state_proxy.py +153 -0
- streamlit/runtime/state/widgets.py +135 -0
- streamlit/runtime/stats.py +109 -0
- streamlit/runtime/uploaded_file_manager.py +148 -0
- streamlit/runtime/websocket_session_manager.py +167 -0
- streamlit/source_util.py +98 -0
- streamlit/static/favicon.png +0 -0
- streamlit/static/index.html +61 -0
- streamlit/static/static/css/index.Bmkmz40k.css +1 -0
- streamlit/static/static/css/index.DpJG_94W.css +1 -0
- streamlit/static/static/css/index.DzuxGC_t.css +1 -0
- streamlit/static/static/js/FileDownload.esm.Bp9m5jrx.js +1 -0
- streamlit/static/static/js/FileHelper.D_3pbilj.js +5 -0
- streamlit/static/static/js/FormClearHelper.Ct2rwLXo.js +1 -0
- streamlit/static/static/js/Hooks.BKdzj5MJ.js +1 -0
- streamlit/static/static/js/InputInstructions.DB3QGNJP.js +1 -0
- streamlit/static/static/js/ProgressBar.D40A5xc2.js +2 -0
- streamlit/static/static/js/RenderInPortalIfExists.DLUCooTN.js +1 -0
- streamlit/static/static/js/Toolbar.BiGGIQun.js +1 -0
- streamlit/static/static/js/UploadFileInfo.C-jY39rj.js +1 -0
- streamlit/static/static/js/base-input.CQBQT24M.js +4 -0
- streamlit/static/static/js/checkbox.Buj8gd_M.js +9 -0
- streamlit/static/static/js/createDownloadLinkElement.DZMwyjvU.js +1 -0
- streamlit/static/static/js/createSuper.CesK3I23.js +1 -0
- streamlit/static/static/js/data-grid-overlay-editor.B69OOFM4.js +1 -0
- streamlit/static/static/js/downloader.BZQhlBNT.js +1 -0
- streamlit/static/static/js/es6.D9Zhqujy.js +2 -0
- streamlit/static/static/js/iframeResizer.contentWindow.CAzcBpCC.js +1 -0
- streamlit/static/static/js/index.08vcOOvb.js +1 -0
- streamlit/static/static/js/index.0uqKfJUS.js +1 -0
- streamlit/static/static/js/index.B02M5u69.js +203 -0
- streamlit/static/static/js/index.B7mcZKMx.js +1 -0
- streamlit/static/static/js/index.BAQDHFA_.js +1 -0
- streamlit/static/static/js/index.BI60cMVr.js +2 -0
- streamlit/static/static/js/index.BLug2inK.js +1 -0
- streamlit/static/static/js/index.BM6TMY8g.js +2 -0
- streamlit/static/static/js/index.BZ9p1t7G.js +1 -0
- streamlit/static/static/js/index.BZqa87a1.js +2 -0
- streamlit/static/static/js/index.BcsRUzZZ.js +1 -0
- streamlit/static/static/js/index.BgVMiY_P.js +197 -0
- streamlit/static/static/js/index.BtuGy7By.js +6 -0
- streamlit/static/static/js/index.BuDuBmrs.js +1 -0
- streamlit/static/static/js/index.BvXU2oKV.js +1 -0
- streamlit/static/static/js/index.BxcwPacT.js +73 -0
- streamlit/static/static/js/index.CWX8KB81.js +1 -0
- streamlit/static/static/js/index.CXzZTo_q.js +1 -0
- streamlit/static/static/js/index.CcRWp_KL.js +1 -0
- streamlit/static/static/js/index.Cd-_xe55.js +3 -0
- streamlit/static/static/js/index.CdG2PXln.js +4537 -0
- streamlit/static/static/js/index.CjXvXmcP.js +1 -0
- streamlit/static/static/js/index.D1HZENZx.js +776 -0
- streamlit/static/static/js/index.D21Efo64.js +1617 -0
- streamlit/static/static/js/index.D9WgGVBx.js +7 -0
- streamlit/static/static/js/index.DEcsHtvb.js +12 -0
- streamlit/static/static/js/index.DFeMfr_K.js +1 -0
- streamlit/static/static/js/index.DHFBoItz.js +1 -0
- streamlit/static/static/js/index.D_PrBKnJ.js +3 -0
- streamlit/static/static/js/index.DmuRkekN.js +3855 -0
- streamlit/static/static/js/index.Do6eY8sf.js +1 -0
- streamlit/static/static/js/index.Dz3lP2P-.js +1 -0
- streamlit/static/static/js/index.Dz_UqF-s.js +1 -0
- streamlit/static/static/js/index.GkSUsPhJ.js +1 -0
- streamlit/static/static/js/index.H1U1IC_d.js +3 -0
- streamlit/static/static/js/index.g6p_4DPr.js +1 -0
- streamlit/static/static/js/index.g9x_GKss.js +1 -0
- streamlit/static/static/js/index.zo9jm08y.js +1 -0
- streamlit/static/static/js/input.DnaFglHq.js +2 -0
- streamlit/static/static/js/inputUtils.CQWz5UKz.js +1 -0
- streamlit/static/static/js/memory.Crb9x4-F.js +1 -0
- streamlit/static/static/js/mergeWith.ouAz0sK3.js +1 -0
- streamlit/static/static/js/number-overlay-editor._UaN-O48.js +9 -0
- streamlit/static/static/js/possibleConstructorReturn.CtGjGFHz.js +1 -0
- streamlit/static/static/js/sandbox.CBybYOhV.js +1 -0
- streamlit/static/static/js/sprintf.D7DtBTRn.js +1 -0
- streamlit/static/static/js/textarea.Cb_uJt5U.js +2 -0
- streamlit/static/static/js/threshold.DjX0wlsa.js +1 -0
- streamlit/static/static/js/timepicker.DKT7pfoF.js +4 -0
- streamlit/static/static/js/timer.CAwTRJ_g.js +1 -0
- streamlit/static/static/js/toConsumableArray.05Ikp13-.js +3 -0
- streamlit/static/static/js/uniqueId.D2FMWUEI.js +1 -0
- streamlit/static/static/js/useBasicWidgetState.urnZLANY.js +1 -0
- streamlit/static/static/js/useOnInputChange.BOKIIdJ1.js +1 -0
- streamlit/static/static/js/value.CgPGBV_l.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.C_N8J0Xx.js +1 -0
- streamlit/static/static/media/KaTeX_AMS-Regular.BQhdFMY1.woff2 +0 -0
- streamlit/static/static/media/KaTeX_AMS-Regular.DMm9YOAa.woff +0 -0
- streamlit/static/static/media/KaTeX_AMS-Regular.DRggAlZN.ttf +0 -0
- streamlit/static/static/media/KaTeX_Caligraphic-Bold.ATXxdsX0.ttf +0 -0
- streamlit/static/static/media/KaTeX_Caligraphic-Bold.BEiXGLvX.woff +0 -0
- streamlit/static/static/media/KaTeX_Caligraphic-Bold.Dq_IR9rO.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Caligraphic-Regular.CTRA-rTL.woff +0 -0
- streamlit/static/static/media/KaTeX_Caligraphic-Regular.Di6jR-x-.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Caligraphic-Regular.wX97UBjC.ttf +0 -0
- streamlit/static/static/media/KaTeX_Fraktur-Bold.BdnERNNW.ttf +0 -0
- streamlit/static/static/media/KaTeX_Fraktur-Bold.BsDP51OF.woff +0 -0
- streamlit/static/static/media/KaTeX_Fraktur-Bold.CL6g_b3V.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Fraktur-Regular.CB_wures.ttf +0 -0
- streamlit/static/static/media/KaTeX_Fraktur-Regular.CTYiF6lA.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Fraktur-Regular.Dxdc4cR9.woff +0 -0
- streamlit/static/static/media/KaTeX_Main-Bold.Cx986IdX.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Main-Bold.Jm3AIy58.woff +0 -0
- streamlit/static/static/media/KaTeX_Main-Bold.waoOVXN0.ttf +0 -0
- streamlit/static/static/media/KaTeX_Main-BoldItalic.DxDJ3AOS.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Main-BoldItalic.DzxPMmG6.ttf +0 -0
- streamlit/static/static/media/KaTeX_Main-BoldItalic.SpSLRI95.woff +0 -0
- streamlit/static/static/media/KaTeX_Main-Italic.3WenGoN9.ttf +0 -0
- streamlit/static/static/media/KaTeX_Main-Italic.BMLOBm91.woff +0 -0
- streamlit/static/static/media/KaTeX_Main-Italic.NWA7e6Wa.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Main-Regular.B22Nviop.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Main-Regular.Dr94JaBh.woff +0 -0
- streamlit/static/static/media/KaTeX_Main-Regular.ypZvNtVU.ttf +0 -0
- streamlit/static/static/media/KaTeX_Math-BoldItalic.B3XSjfu4.ttf +0 -0
- streamlit/static/static/media/KaTeX_Math-BoldItalic.CZnvNsCZ.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Math-BoldItalic.iY-2wyZ7.woff +0 -0
- streamlit/static/static/media/KaTeX_Math-Italic.DA0__PXp.woff +0 -0
- streamlit/static/static/media/KaTeX_Math-Italic.flOr_0UB.ttf +0 -0
- streamlit/static/static/media/KaTeX_Math-Italic.t53AETM-.woff2 +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Bold.CFMepnvq.ttf +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Bold.D1sUS0GD.woff2 +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Bold.DbIhKOiC.woff +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Italic.C3H0VqGB.woff2 +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Italic.DN2j7dab.woff +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Italic.YYjJ1zSn.ttf +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Regular.BNo7hRIc.ttf +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Regular.CS6fqUqJ.woff +0 -0
- streamlit/static/static/media/KaTeX_SansSerif-Regular.DDBCnlJ7.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Script-Regular.C5JkGWo-.ttf +0 -0
- streamlit/static/static/media/KaTeX_Script-Regular.D3wIWfF6.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Script-Regular.D5yQViql.woff +0 -0
- streamlit/static/static/media/KaTeX_Size1-Regular.C195tn64.woff +0 -0
- streamlit/static/static/media/KaTeX_Size1-Regular.Dbsnue_I.ttf +0 -0
- streamlit/static/static/media/KaTeX_Size1-Regular.mCD8mA8B.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Size2-Regular.B7gKUWhC.ttf +0 -0
- streamlit/static/static/media/KaTeX_Size2-Regular.Dy4dx90m.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Size2-Regular.oD1tc_U0.woff +0 -0
- streamlit/static/static/media/KaTeX_Size3-Regular.CTq5MqoE.woff +0 -0
- streamlit/static/static/media/KaTeX_Size3-Regular.DgpXs0kz.ttf +0 -0
- streamlit/static/static/media/KaTeX_Size4-Regular.BF-4gkZK.woff +0 -0
- streamlit/static/static/media/KaTeX_Size4-Regular.DWFBv043.ttf +0 -0
- streamlit/static/static/media/KaTeX_Size4-Regular.Dl5lxZxV.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Typewriter-Regular.C0xS9mPB.woff +0 -0
- streamlit/static/static/media/KaTeX_Typewriter-Regular.CO6r4hn1.woff2 +0 -0
- streamlit/static/static/media/KaTeX_Typewriter-Regular.D3Ib7_Hf.ttf +0 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.DcZbplWk.woff2 +0 -0
- 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/static/static/media/balloon-0.Czj7AKwE.png +0 -0
- streamlit/static/static/media/balloon-1.CNvFFrND.png +0 -0
- streamlit/static/static/media/balloon-2.DTvC6B1t.png +0 -0
- streamlit/static/static/media/balloon-3.CgSk4tbL.png +0 -0
- streamlit/static/static/media/balloon-4.mbtFrzxf.png +0 -0
- streamlit/static/static/media/balloon-5.CSwkUfRA.png +0 -0
- streamlit/static/static/media/fireworks.B4d-_KUe.gif +0 -0
- streamlit/static/static/media/flake-0.DgWaVvm5.png +0 -0
- streamlit/static/static/media/flake-1.B2r5AHMK.png +0 -0
- streamlit/static/static/media/flake-2.BnWSExPC.png +0 -0
- streamlit/static/static/media/snowflake.JU2jBHL8.svg +11 -0
- streamlit/string_util.py +203 -0
- streamlit/temporary_directory.py +56 -0
- streamlit/testing/__init__.py +13 -0
- streamlit/testing/v1/__init__.py +17 -0
- streamlit/testing/v1/app_test.py +1050 -0
- streamlit/testing/v1/element_tree.py +2083 -0
- streamlit/testing/v1/local_script_runner.py +180 -0
- streamlit/testing/v1/util.py +53 -0
- streamlit/time_util.py +75 -0
- streamlit/type_util.py +460 -0
- streamlit/url_util.py +122 -0
- streamlit/user_info.py +519 -0
- streamlit/util.py +72 -0
- streamlit/vendor/__init__.py +0 -0
- streamlit/vendor/pympler/__init__.py +0 -0
- streamlit/vendor/pympler/asizeof.py +2869 -0
- streamlit/version.py +18 -0
- streamlit/watcher/__init__.py +28 -0
- streamlit/watcher/event_based_path_watcher.py +406 -0
- streamlit/watcher/folder_black_list.py +82 -0
- streamlit/watcher/local_sources_watcher.py +233 -0
- streamlit/watcher/path_watcher.py +185 -0
- streamlit/watcher/polling_path_watcher.py +124 -0
- streamlit/watcher/util.py +207 -0
- streamlit/web/__init__.py +13 -0
- streamlit/web/bootstrap.py +353 -0
- streamlit/web/cache_storage_manager_config.py +38 -0
- streamlit/web/cli.py +369 -0
- streamlit/web/server/__init__.py +26 -0
- streamlit/web/server/app_static_file_handler.py +93 -0
- streamlit/web/server/authlib_tornado_integration.py +60 -0
- streamlit/web/server/browser_websocket_handler.py +246 -0
- streamlit/web/server/component_request_handler.py +116 -0
- streamlit/web/server/media_file_handler.py +141 -0
- streamlit/web/server/oauth_authlib_routes.py +176 -0
- streamlit/web/server/oidc_mixin.py +108 -0
- streamlit/web/server/routes.py +295 -0
- streamlit/web/server/server.py +479 -0
- streamlit/web/server/server_util.py +161 -0
- streamlit/web/server/stats_request_handler.py +95 -0
- streamlit/web/server/upload_file_request_handler.py +137 -0
- streamlit/web/server/websocket_headers.py +56 -0
- streamlit_nightly-1.43.2.dev20250307.data/scripts/streamlit.cmd +16 -0
- streamlit_nightly-1.43.2.dev20250307.dist-info/METADATA +207 -0
- streamlit_nightly-1.43.2.dev20250307.dist-info/RECORD +563 -0
- streamlit_nightly-1.43.2.dev20250307.dist-info/WHEEL +5 -0
- streamlit_nightly-1.43.2.dev20250307.dist-info/entry_points.txt +2 -0
- streamlit_nightly-1.43.2.dev20250307.dist-info/top_level.txt +1 -0
@@ -0,0 +1,879 @@
|
|
1
|
+
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
17
|
+
from collections.abc import Sequence
|
18
|
+
from typing import TYPE_CHECKING, Literal, Union, cast
|
19
|
+
|
20
|
+
from typing_extensions import TypeAlias
|
21
|
+
|
22
|
+
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
23
|
+
from streamlit.elements.lib.utils import Key, compute_and_register_element_id, to_key
|
24
|
+
from streamlit.errors import (
|
25
|
+
StreamlitAPIException,
|
26
|
+
StreamlitInvalidColumnGapError,
|
27
|
+
StreamlitInvalidColumnSpecError,
|
28
|
+
StreamlitInvalidVerticalAlignmentError,
|
29
|
+
)
|
30
|
+
from streamlit.proto.Block_pb2 import Block as BlockProto
|
31
|
+
from streamlit.runtime.metrics_util import gather_metrics
|
32
|
+
from streamlit.string_util import validate_icon_or_emoji
|
33
|
+
|
34
|
+
if TYPE_CHECKING:
|
35
|
+
from streamlit.delta_generator import DeltaGenerator
|
36
|
+
from streamlit.elements.lib.dialog import Dialog
|
37
|
+
from streamlit.elements.lib.mutable_status_container import StatusContainer
|
38
|
+
|
39
|
+
SpecType: TypeAlias = Union[int, Sequence[Union[int, float]]]
|
40
|
+
|
41
|
+
|
42
|
+
class LayoutsMixin:
|
43
|
+
@gather_metrics("container")
|
44
|
+
def container(
|
45
|
+
self,
|
46
|
+
*,
|
47
|
+
height: int | None = None,
|
48
|
+
border: bool | None = None,
|
49
|
+
key: Key | None = None,
|
50
|
+
) -> DeltaGenerator:
|
51
|
+
"""Insert a multi-element container.
|
52
|
+
|
53
|
+
Inserts an invisible container into your app that can be used to hold
|
54
|
+
multiple elements. This allows you to, for example, insert multiple
|
55
|
+
elements into your app out of order.
|
56
|
+
|
57
|
+
To add elements to the returned container, you can use the ``with`` notation
|
58
|
+
(preferred) or just call methods directly on the returned object. See
|
59
|
+
examples below.
|
60
|
+
|
61
|
+
Parameters
|
62
|
+
----------
|
63
|
+
|
64
|
+
height : int or None
|
65
|
+
Desired height of the container expressed in pixels. If ``None`` (default)
|
66
|
+
the container grows to fit its content. If a fixed height, scrolling is
|
67
|
+
enabled for large content and a grey border is shown around the container
|
68
|
+
to visually separate its scroll surface from the rest of the app.
|
69
|
+
|
70
|
+
.. note::
|
71
|
+
Use containers with scroll sparingly. If you do, try to keep
|
72
|
+
the height small (below 500 pixels). Otherwise, the scroll
|
73
|
+
surface of the container might cover the majority of the screen
|
74
|
+
on mobile devices, which makes it hard to scroll the rest of the app.
|
75
|
+
|
76
|
+
border : bool or None
|
77
|
+
Whether to show a border around the container. If ``None`` (default), a
|
78
|
+
border is shown if the container is set to a fixed height and not
|
79
|
+
shown otherwise.
|
80
|
+
|
81
|
+
key : str or None
|
82
|
+
An optional string to give this container a stable identity.
|
83
|
+
|
84
|
+
Additionally, if ``key`` is provided, it will be used as CSS
|
85
|
+
class name prefixed with ``st-key-``.
|
86
|
+
|
87
|
+
|
88
|
+
Examples
|
89
|
+
--------
|
90
|
+
Inserting elements using ``with`` notation:
|
91
|
+
|
92
|
+
>>> import streamlit as st
|
93
|
+
>>>
|
94
|
+
>>> with st.container():
|
95
|
+
... st.write("This is inside the container")
|
96
|
+
...
|
97
|
+
... # You can call any Streamlit command, including custom components:
|
98
|
+
... st.bar_chart(np.random.randn(50, 3))
|
99
|
+
>>>
|
100
|
+
>>> st.write("This is outside the container")
|
101
|
+
|
102
|
+
.. output ::
|
103
|
+
https://doc-container1.streamlit.app/
|
104
|
+
height: 520px
|
105
|
+
|
106
|
+
Inserting elements out of order:
|
107
|
+
|
108
|
+
>>> import streamlit as st
|
109
|
+
>>>
|
110
|
+
>>> container = st.container(border=True)
|
111
|
+
>>> container.write("This is inside the container")
|
112
|
+
>>> st.write("This is outside the container")
|
113
|
+
>>>
|
114
|
+
>>> # Now insert some more in the container
|
115
|
+
>>> container.write("This is inside too")
|
116
|
+
|
117
|
+
.. output ::
|
118
|
+
https://doc-container2.streamlit.app/
|
119
|
+
height: 300px
|
120
|
+
|
121
|
+
Using ``height`` to make a grid:
|
122
|
+
|
123
|
+
>>> import streamlit as st
|
124
|
+
>>>
|
125
|
+
>>> row1 = st.columns(3)
|
126
|
+
>>> row2 = st.columns(3)
|
127
|
+
>>>
|
128
|
+
>>> for col in row1 + row2:
|
129
|
+
>>> tile = col.container(height=120)
|
130
|
+
>>> tile.title(":balloon:")
|
131
|
+
|
132
|
+
.. output ::
|
133
|
+
https://doc-container3.streamlit.app/
|
134
|
+
height: 350px
|
135
|
+
|
136
|
+
Using ``height`` to create a scrolling container for long content:
|
137
|
+
|
138
|
+
>>> import streamlit as st
|
139
|
+
>>>
|
140
|
+
>>> long_text = "Lorem ipsum. " * 1000
|
141
|
+
>>>
|
142
|
+
>>> with st.container(height=300):
|
143
|
+
>>> st.markdown(long_text)
|
144
|
+
|
145
|
+
.. output ::
|
146
|
+
https://doc-container4.streamlit.app/
|
147
|
+
height: 400px
|
148
|
+
|
149
|
+
"""
|
150
|
+
key = to_key(key)
|
151
|
+
block_proto = BlockProto()
|
152
|
+
block_proto.allow_empty = False
|
153
|
+
block_proto.vertical.border = border or False
|
154
|
+
|
155
|
+
if height:
|
156
|
+
# Activate scrolling container behavior:
|
157
|
+
block_proto.allow_empty = True
|
158
|
+
block_proto.vertical.height = height
|
159
|
+
if border is None:
|
160
|
+
# If border is None, we activated the
|
161
|
+
# border as default setting for scrolling
|
162
|
+
# containers.
|
163
|
+
block_proto.vertical.border = True
|
164
|
+
|
165
|
+
if key:
|
166
|
+
# At the moment, the ID is only used for extracting the
|
167
|
+
# key on the frontend and setting it as CSS class.
|
168
|
+
# There are plans to use the ID for other container features
|
169
|
+
# in the future. This might require including more container
|
170
|
+
# parameters in the ID calculation.
|
171
|
+
block_proto.id = compute_and_register_element_id(
|
172
|
+
"container", user_key=key, form_id=None
|
173
|
+
)
|
174
|
+
|
175
|
+
return self.dg._block(block_proto)
|
176
|
+
|
177
|
+
@gather_metrics("columns")
|
178
|
+
def columns(
|
179
|
+
self,
|
180
|
+
spec: SpecType,
|
181
|
+
*,
|
182
|
+
gap: Literal["small", "medium", "large"] = "small",
|
183
|
+
vertical_alignment: Literal["top", "center", "bottom"] = "top",
|
184
|
+
border: bool = False,
|
185
|
+
) -> list[DeltaGenerator]:
|
186
|
+
"""Insert containers laid out as side-by-side columns.
|
187
|
+
|
188
|
+
Inserts a number of multi-element containers laid out side-by-side and
|
189
|
+
returns a list of container objects.
|
190
|
+
|
191
|
+
To add elements to the returned containers, you can use the ``with`` notation
|
192
|
+
(preferred) or just call methods directly on the returned object. See
|
193
|
+
examples below.
|
194
|
+
|
195
|
+
Columns can only be placed inside other columns up to one level of nesting.
|
196
|
+
|
197
|
+
.. warning::
|
198
|
+
Columns cannot be placed inside other columns in the sidebar. This
|
199
|
+
is only possible in the main area of the app.
|
200
|
+
|
201
|
+
Parameters
|
202
|
+
----------
|
203
|
+
spec : int or Iterable of numbers
|
204
|
+
Controls the number and width of columns to insert. Can be one of:
|
205
|
+
|
206
|
+
- An integer that specifies the number of columns. All columns have equal
|
207
|
+
width in this case.
|
208
|
+
- An Iterable of numbers (int or float) that specify the relative width of
|
209
|
+
each column. E.g. ``[0.7, 0.3]`` creates two columns where the first
|
210
|
+
one takes up 70% of the available with and the second one takes up 30%.
|
211
|
+
Or ``[1, 2, 3]`` creates three columns where the second one is two times
|
212
|
+
the width of the first one, and the third one is three times that width.
|
213
|
+
|
214
|
+
gap : "small", "medium", or "large"
|
215
|
+
The size of the gap between the columns. The default is ``"small"``.
|
216
|
+
|
217
|
+
vertical_alignment : "top", "center", or "bottom"
|
218
|
+
The vertical alignment of the content inside the columns. The
|
219
|
+
default is ``"top"``.
|
220
|
+
|
221
|
+
border : bool
|
222
|
+
Whether to show a border around the column containers. If this is
|
223
|
+
``False`` (default), no border is shown. If this is ``True``, a
|
224
|
+
border is shown around each column.
|
225
|
+
|
226
|
+
Returns
|
227
|
+
-------
|
228
|
+
list of containers
|
229
|
+
A list of container objects.
|
230
|
+
|
231
|
+
Examples
|
232
|
+
--------
|
233
|
+
|
234
|
+
**Example 1: Use context management**
|
235
|
+
|
236
|
+
You can use the ``with`` statement to insert any element into a column:
|
237
|
+
|
238
|
+
>>> import streamlit as st
|
239
|
+
>>>
|
240
|
+
>>> col1, col2, col3 = st.columns(3)
|
241
|
+
>>>
|
242
|
+
>>> with col1:
|
243
|
+
... st.header("A cat")
|
244
|
+
... st.image("https://static.streamlit.io/examples/cat.jpg")
|
245
|
+
>>>
|
246
|
+
>>> with col2:
|
247
|
+
... st.header("A dog")
|
248
|
+
... st.image("https://static.streamlit.io/examples/dog.jpg")
|
249
|
+
>>>
|
250
|
+
>>> with col3:
|
251
|
+
... st.header("An owl")
|
252
|
+
... st.image("https://static.streamlit.io/examples/owl.jpg")
|
253
|
+
|
254
|
+
.. output ::
|
255
|
+
https://doc-columns1.streamlit.app/
|
256
|
+
height: 620px
|
257
|
+
|
258
|
+
|
259
|
+
**Example 2: Use commands as container methods**
|
260
|
+
|
261
|
+
You can just call methods directly on the returned objects:
|
262
|
+
|
263
|
+
>>> import streamlit as st
|
264
|
+
>>> import numpy as np
|
265
|
+
>>>
|
266
|
+
>>> col1, col2 = st.columns([3, 1])
|
267
|
+
>>> data = np.random.randn(10, 1)
|
268
|
+
>>>
|
269
|
+
>>> col1.subheader("A wide column with a chart")
|
270
|
+
>>> col1.line_chart(data)
|
271
|
+
>>>
|
272
|
+
>>> col2.subheader("A narrow column with the data")
|
273
|
+
>>> col2.write(data)
|
274
|
+
|
275
|
+
.. output ::
|
276
|
+
https://doc-columns2.streamlit.app/
|
277
|
+
height: 550px
|
278
|
+
|
279
|
+
**Example 3: Align widgets**
|
280
|
+
|
281
|
+
Use ``vertical_alignment="bottom"`` to align widgets.
|
282
|
+
|
283
|
+
>>> import streamlit as st
|
284
|
+
>>>
|
285
|
+
>>> left, middle, right = st.columns(3, vertical_alignment="bottom")
|
286
|
+
>>>
|
287
|
+
>>> left.text_input("Write something")
|
288
|
+
>>> middle.button("Click me", use_container_width=True)
|
289
|
+
>>> right.checkbox("Check me")
|
290
|
+
|
291
|
+
.. output ::
|
292
|
+
https://doc-columns-bottom-widgets.streamlit.app/
|
293
|
+
height: 200px
|
294
|
+
|
295
|
+
**Example 4: Use vertical alignment to create grids**
|
296
|
+
|
297
|
+
Adjust vertical alignment to customize your grid layouts.
|
298
|
+
|
299
|
+
>>> import streamlit as st
|
300
|
+
>>> import numpy as np
|
301
|
+
>>>
|
302
|
+
>>> vertical_alignment = st.selectbox(
|
303
|
+
>>> "Vertical alignment", ["top", "center", "bottom"], index=2
|
304
|
+
>>> )
|
305
|
+
>>>
|
306
|
+
>>> left, middle, right = st.columns(3, vertical_alignment=vertical_alignment)
|
307
|
+
>>> left.image("https://static.streamlit.io/examples/cat.jpg")
|
308
|
+
>>> middle.image("https://static.streamlit.io/examples/dog.jpg")
|
309
|
+
>>> right.image("https://static.streamlit.io/examples/owl.jpg")
|
310
|
+
|
311
|
+
.. output ::
|
312
|
+
https://doc-columns-vertical-alignment.streamlit.app/
|
313
|
+
height: 600px
|
314
|
+
|
315
|
+
**Example 5: Add borders**
|
316
|
+
|
317
|
+
Add borders to your columns instead of nested containers for consistent
|
318
|
+
heights.
|
319
|
+
|
320
|
+
>>> import streamlit as st
|
321
|
+
>>>
|
322
|
+
>>> left, middle, right = st.columns(3, border=True)
|
323
|
+
>>>
|
324
|
+
>>> left.markdown("Lorem ipsum " * 10)
|
325
|
+
>>> middle.markdown("Lorem ipsum " * 5)
|
326
|
+
>>> right.markdown("Lorem ipsum ")
|
327
|
+
|
328
|
+
.. output ::
|
329
|
+
https://doc-columns-borders.streamlit.app/
|
330
|
+
height: 250px
|
331
|
+
|
332
|
+
"""
|
333
|
+
weights = spec
|
334
|
+
if isinstance(weights, int):
|
335
|
+
# If the user provided a single number, expand into equal weights.
|
336
|
+
# E.g. (1,) * 3 => (1, 1, 1)
|
337
|
+
# NOTE: A negative/zero spec will expand into an empty tuple.
|
338
|
+
weights = (1,) * weights
|
339
|
+
|
340
|
+
if len(weights) == 0 or any(weight <= 0 for weight in weights):
|
341
|
+
raise StreamlitInvalidColumnSpecError()
|
342
|
+
|
343
|
+
vertical_alignment_mapping: dict[
|
344
|
+
str, BlockProto.Column.VerticalAlignment.ValueType
|
345
|
+
] = {
|
346
|
+
"top": BlockProto.Column.VerticalAlignment.TOP,
|
347
|
+
"center": BlockProto.Column.VerticalAlignment.CENTER,
|
348
|
+
"bottom": BlockProto.Column.VerticalAlignment.BOTTOM,
|
349
|
+
}
|
350
|
+
|
351
|
+
if vertical_alignment not in vertical_alignment_mapping:
|
352
|
+
raise StreamlitInvalidVerticalAlignmentError(
|
353
|
+
vertical_alignment=vertical_alignment
|
354
|
+
)
|
355
|
+
|
356
|
+
def column_gap(gap):
|
357
|
+
if isinstance(gap, str):
|
358
|
+
gap_size = gap.lower()
|
359
|
+
valid_sizes = ["small", "medium", "large"]
|
360
|
+
|
361
|
+
if gap_size in valid_sizes:
|
362
|
+
return gap_size
|
363
|
+
|
364
|
+
raise StreamlitInvalidColumnGapError(gap=gap)
|
365
|
+
|
366
|
+
gap_size = column_gap(gap)
|
367
|
+
|
368
|
+
def column_proto(normalized_weight: float) -> BlockProto:
|
369
|
+
col_proto = BlockProto()
|
370
|
+
col_proto.column.weight = normalized_weight
|
371
|
+
col_proto.column.gap = gap_size
|
372
|
+
col_proto.column.vertical_alignment = vertical_alignment_mapping[
|
373
|
+
vertical_alignment
|
374
|
+
]
|
375
|
+
col_proto.column.show_border = border
|
376
|
+
col_proto.allow_empty = True
|
377
|
+
return col_proto
|
378
|
+
|
379
|
+
block_proto = BlockProto()
|
380
|
+
block_proto.horizontal.gap = gap_size
|
381
|
+
row = self.dg._block(block_proto)
|
382
|
+
total_weight = sum(weights)
|
383
|
+
return [row._block(column_proto(w / total_weight)) for w in weights]
|
384
|
+
|
385
|
+
@gather_metrics("tabs")
|
386
|
+
def tabs(self, tabs: Sequence[str]) -> Sequence[DeltaGenerator]:
|
387
|
+
r"""Insert containers separated into tabs.
|
388
|
+
|
389
|
+
Inserts a number of multi-element containers as tabs.
|
390
|
+
Tabs are a navigational element that allows users to easily
|
391
|
+
move between groups of related content.
|
392
|
+
|
393
|
+
To add elements to the returned containers, you can use the ``with`` notation
|
394
|
+
(preferred) or just call methods directly on the returned object. See
|
395
|
+
examples below.
|
396
|
+
|
397
|
+
.. warning::
|
398
|
+
All the content of every tab is always sent to and rendered on the frontend.
|
399
|
+
Conditional rendering is currently not supported.
|
400
|
+
|
401
|
+
Parameters
|
402
|
+
----------
|
403
|
+
tabs : list of str
|
404
|
+
Creates a tab for each string in the list. The first tab is selected
|
405
|
+
by default. The string is used as the name of the tab and can
|
406
|
+
optionally contain GitHub-flavored Markdown of the following types:
|
407
|
+
Bold, Italics, Strikethroughs, Inline Code, Links, and Images.
|
408
|
+
Images display like icons, with a max height equal to the font
|
409
|
+
height.
|
410
|
+
|
411
|
+
Unsupported Markdown elements are unwrapped so only their children
|
412
|
+
(text contents) render. Display unsupported elements as literal
|
413
|
+
characters by backslash-escaping them. E.g.,
|
414
|
+
``"1\. Not an ordered list"``.
|
415
|
+
|
416
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
417
|
+
supported Markdown directives.
|
418
|
+
|
419
|
+
.. |st.markdown| replace:: ``st.markdown``
|
420
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
421
|
+
|
422
|
+
Returns
|
423
|
+
-------
|
424
|
+
list of containers
|
425
|
+
A list of container objects.
|
426
|
+
|
427
|
+
Examples
|
428
|
+
--------
|
429
|
+
You can use the ``with`` notation to insert any element into a tab:
|
430
|
+
|
431
|
+
>>> import streamlit as st
|
432
|
+
>>>
|
433
|
+
>>> tab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])
|
434
|
+
>>>
|
435
|
+
>>> with tab1:
|
436
|
+
... st.header("A cat")
|
437
|
+
... st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
|
438
|
+
>>> with tab2:
|
439
|
+
... st.header("A dog")
|
440
|
+
... st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
|
441
|
+
>>> with tab3:
|
442
|
+
... st.header("An owl")
|
443
|
+
... st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
|
444
|
+
|
445
|
+
.. output ::
|
446
|
+
https://doc-tabs1.streamlit.app/
|
447
|
+
height: 620px
|
448
|
+
|
449
|
+
Or you can just call methods directly on the returned objects:
|
450
|
+
|
451
|
+
>>> import streamlit as st
|
452
|
+
>>> import numpy as np
|
453
|
+
>>>
|
454
|
+
>>> tab1, tab2 = st.tabs(["📈 Chart", "🗃 Data"])
|
455
|
+
>>> data = np.random.randn(10, 1)
|
456
|
+
>>>
|
457
|
+
>>> tab1.subheader("A tab with a chart")
|
458
|
+
>>> tab1.line_chart(data)
|
459
|
+
>>>
|
460
|
+
>>> tab2.subheader("A tab with the data")
|
461
|
+
>>> tab2.write(data)
|
462
|
+
|
463
|
+
|
464
|
+
.. output ::
|
465
|
+
https://doc-tabs2.streamlit.app/
|
466
|
+
height: 700px
|
467
|
+
|
468
|
+
"""
|
469
|
+
if not tabs:
|
470
|
+
raise StreamlitAPIException(
|
471
|
+
"The input argument to st.tabs must contain at least one tab label."
|
472
|
+
)
|
473
|
+
|
474
|
+
if any(not isinstance(tab, str) for tab in tabs):
|
475
|
+
raise StreamlitAPIException(
|
476
|
+
"The tabs input list to st.tabs is only allowed to contain strings."
|
477
|
+
)
|
478
|
+
|
479
|
+
def tab_proto(label: str) -> BlockProto:
|
480
|
+
tab_proto = BlockProto()
|
481
|
+
tab_proto.tab.label = label
|
482
|
+
tab_proto.allow_empty = True
|
483
|
+
return tab_proto
|
484
|
+
|
485
|
+
block_proto = BlockProto()
|
486
|
+
block_proto.tab_container.SetInParent()
|
487
|
+
tab_container = self.dg._block(block_proto)
|
488
|
+
return tuple(tab_container._block(tab_proto(tab_label)) for tab_label in tabs)
|
489
|
+
|
490
|
+
@gather_metrics("expander")
|
491
|
+
def expander(
|
492
|
+
self,
|
493
|
+
label: str,
|
494
|
+
expanded: bool = False,
|
495
|
+
*,
|
496
|
+
icon: str | None = None,
|
497
|
+
) -> DeltaGenerator:
|
498
|
+
r"""Insert a multi-element container that can be expanded/collapsed.
|
499
|
+
|
500
|
+
Inserts a container into your app that can be used to hold multiple elements
|
501
|
+
and can be expanded or collapsed by the user. When collapsed, all that is
|
502
|
+
visible is the provided label.
|
503
|
+
|
504
|
+
To add elements to the returned container, you can use the ``with`` notation
|
505
|
+
(preferred) or just call methods directly on the returned object. See
|
506
|
+
examples below.
|
507
|
+
|
508
|
+
.. warning::
|
509
|
+
Currently, you may not put expanders inside another expander.
|
510
|
+
|
511
|
+
Parameters
|
512
|
+
----------
|
513
|
+
label : str
|
514
|
+
A string to use as the header for the expander. The label can optionally
|
515
|
+
contain GitHub-flavored Markdown of the following types: Bold, Italics,
|
516
|
+
Strikethroughs, Inline Code, Links, and Images. Images display like
|
517
|
+
icons, with a max height equal to the font height.
|
518
|
+
|
519
|
+
Unsupported Markdown elements are unwrapped so only their children
|
520
|
+
(text contents) render. Display unsupported elements as literal
|
521
|
+
characters by backslash-escaping them. E.g.,
|
522
|
+
``"1\. Not an ordered list"``.
|
523
|
+
|
524
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
525
|
+
supported Markdown directives.
|
526
|
+
|
527
|
+
.. |st.markdown| replace:: ``st.markdown``
|
528
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
529
|
+
|
530
|
+
expanded : bool
|
531
|
+
If True, initializes the expander in "expanded" state. Defaults to
|
532
|
+
False (collapsed).
|
533
|
+
|
534
|
+
icon : str, None
|
535
|
+
An optional emoji or icon to display next to the expander label. If ``icon``
|
536
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
537
|
+
string, the following options are valid:
|
538
|
+
|
539
|
+
- A single-character emoji. For example, you can set ``icon="🚨"``
|
540
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
541
|
+
|
542
|
+
- An icon from the Material Symbols library (rounded style) in the
|
543
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
544
|
+
of the icon in snake case.
|
545
|
+
|
546
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
547
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
548
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
549
|
+
font library.
|
550
|
+
|
551
|
+
Examples
|
552
|
+
--------
|
553
|
+
You can use the ``with`` notation to insert any element into an expander
|
554
|
+
|
555
|
+
>>> import streamlit as st
|
556
|
+
>>>
|
557
|
+
>>> st.bar_chart({"data": [1, 5, 2, 6, 2, 1]})
|
558
|
+
>>>
|
559
|
+
>>> with st.expander("See explanation"):
|
560
|
+
... st.write('''
|
561
|
+
... The chart above shows some numbers I picked for you.
|
562
|
+
... I rolled actual dice for these, so they're *guaranteed* to
|
563
|
+
... be random.
|
564
|
+
... ''')
|
565
|
+
... st.image("https://static.streamlit.io/examples/dice.jpg")
|
566
|
+
|
567
|
+
.. output ::
|
568
|
+
https://doc-expander.streamlit.app/
|
569
|
+
height: 750px
|
570
|
+
|
571
|
+
Or you can just call methods directly on the returned objects:
|
572
|
+
|
573
|
+
>>> import streamlit as st
|
574
|
+
>>>
|
575
|
+
>>> st.bar_chart({"data": [1, 5, 2, 6, 2, 1]})
|
576
|
+
>>>
|
577
|
+
>>> expander = st.expander("See explanation")
|
578
|
+
>>> expander.write('''
|
579
|
+
... The chart above shows some numbers I picked for you.
|
580
|
+
... I rolled actual dice for these, so they're *guaranteed* to
|
581
|
+
... be random.
|
582
|
+
... ''')
|
583
|
+
>>> expander.image("https://static.streamlit.io/examples/dice.jpg")
|
584
|
+
|
585
|
+
.. output ::
|
586
|
+
https://doc-expander.streamlit.app/
|
587
|
+
height: 750px
|
588
|
+
|
589
|
+
"""
|
590
|
+
if label is None:
|
591
|
+
raise StreamlitAPIException("A label is required for an expander")
|
592
|
+
|
593
|
+
expandable_proto = BlockProto.Expandable()
|
594
|
+
expandable_proto.expanded = expanded
|
595
|
+
expandable_proto.label = label
|
596
|
+
if icon is not None:
|
597
|
+
expandable_proto.icon = validate_icon_or_emoji(icon)
|
598
|
+
|
599
|
+
block_proto = BlockProto()
|
600
|
+
block_proto.allow_empty = False
|
601
|
+
block_proto.expandable.CopyFrom(expandable_proto)
|
602
|
+
|
603
|
+
return self.dg._block(block_proto=block_proto)
|
604
|
+
|
605
|
+
@gather_metrics("popover")
|
606
|
+
def popover(
|
607
|
+
self,
|
608
|
+
label: str,
|
609
|
+
*,
|
610
|
+
help: str | None = None,
|
611
|
+
icon: str | None = None,
|
612
|
+
disabled: bool = False,
|
613
|
+
use_container_width: bool = False,
|
614
|
+
) -> DeltaGenerator:
|
615
|
+
r"""Insert a popover container.
|
616
|
+
|
617
|
+
Inserts a multi-element container as a popover. It consists of a button-like
|
618
|
+
element and a container that opens when the button is clicked.
|
619
|
+
|
620
|
+
Opening and closing the popover will not trigger a rerun. Interacting
|
621
|
+
with widgets inside of an open popover will rerun the app while keeping
|
622
|
+
the popover open. Clicking outside of the popover will close it.
|
623
|
+
|
624
|
+
To add elements to the returned container, you can use the "with"
|
625
|
+
notation (preferred) or just call methods directly on the returned object.
|
626
|
+
See examples below.
|
627
|
+
|
628
|
+
.. warning::
|
629
|
+
You may not put a popover inside another popover.
|
630
|
+
|
631
|
+
Parameters
|
632
|
+
----------
|
633
|
+
label : str
|
634
|
+
The label of the button that opens the popover container.
|
635
|
+
The label can optionally contain GitHub-flavored Markdown of the
|
636
|
+
following types: Bold, Italics, Strikethroughs, Inline Code, Links,
|
637
|
+
and Images. Images display like icons, with a max height equal to
|
638
|
+
the font height.
|
639
|
+
|
640
|
+
Unsupported Markdown elements are unwrapped so only their children
|
641
|
+
(text contents) render. Display unsupported elements as literal
|
642
|
+
characters by backslash-escaping them. E.g.,
|
643
|
+
``"1\. Not an ordered list"``.
|
644
|
+
|
645
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
646
|
+
supported Markdown directives.
|
647
|
+
|
648
|
+
.. |st.markdown| replace:: ``st.markdown``
|
649
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
650
|
+
|
651
|
+
help : str or None
|
652
|
+
A tooltip that gets displayed when the popover button is hovered
|
653
|
+
over. If this is ``None`` (default), no tooltip is displayed.
|
654
|
+
|
655
|
+
The tooltip can optionally contain GitHub-flavored Markdown,
|
656
|
+
including the Markdown directives described in the ``body``
|
657
|
+
parameter of ``st.markdown``.
|
658
|
+
|
659
|
+
icon : str
|
660
|
+
An optional emoji or icon to display next to the button label. If ``icon``
|
661
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
662
|
+
string, the following options are valid:
|
663
|
+
|
664
|
+
- A single-character emoji. For example, you can set ``icon="🚨"``
|
665
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
666
|
+
|
667
|
+
- An icon from the Material Symbols library (rounded style) in the
|
668
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
669
|
+
of the icon in snake case.
|
670
|
+
|
671
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
672
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
673
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
674
|
+
font library.
|
675
|
+
|
676
|
+
disabled : bool
|
677
|
+
An optional boolean that disables the popover button if set to
|
678
|
+
``True``. The default is ``False``.
|
679
|
+
|
680
|
+
use_container_width : bool
|
681
|
+
Whether to expand the button's width to fill its parent container.
|
682
|
+
If ``use_container_width`` is ``False`` (default), Streamlit sizes
|
683
|
+
the button to fit its contents. If ``use_container_width`` is
|
684
|
+
``True``, the width of the button matches its parent container.
|
685
|
+
|
686
|
+
In both cases, if the contents of the button are wider than the
|
687
|
+
parent container, the contents will line wrap.
|
688
|
+
|
689
|
+
The popover containter's minimimun width matches the width of its
|
690
|
+
button. The popover container may be wider than its button to fit
|
691
|
+
the container's contents.
|
692
|
+
|
693
|
+
Examples
|
694
|
+
--------
|
695
|
+
You can use the ``with`` notation to insert any element into a popover:
|
696
|
+
|
697
|
+
>>> import streamlit as st
|
698
|
+
>>>
|
699
|
+
>>> with st.popover("Open popover"):
|
700
|
+
>>> st.markdown("Hello World 👋")
|
701
|
+
>>> name = st.text_input("What's your name?")
|
702
|
+
>>>
|
703
|
+
>>> st.write("Your name:", name)
|
704
|
+
|
705
|
+
.. output ::
|
706
|
+
https://doc-popover.streamlit.app/
|
707
|
+
height: 400px
|
708
|
+
|
709
|
+
Or you can just call methods directly on the returned objects:
|
710
|
+
|
711
|
+
>>> import streamlit as st
|
712
|
+
>>>
|
713
|
+
>>> popover = st.popover("Filter items")
|
714
|
+
>>> red = popover.checkbox("Show red items.", True)
|
715
|
+
>>> blue = popover.checkbox("Show blue items.", True)
|
716
|
+
>>>
|
717
|
+
>>> if red:
|
718
|
+
... st.write(":red[This is a red item.]")
|
719
|
+
>>> if blue:
|
720
|
+
... st.write(":blue[This is a blue item.]")
|
721
|
+
|
722
|
+
.. output ::
|
723
|
+
https://doc-popover2.streamlit.app/
|
724
|
+
height: 400px
|
725
|
+
|
726
|
+
"""
|
727
|
+
if label is None:
|
728
|
+
raise StreamlitAPIException("A label is required for a popover")
|
729
|
+
|
730
|
+
popover_proto = BlockProto.Popover()
|
731
|
+
popover_proto.label = label
|
732
|
+
popover_proto.use_container_width = use_container_width
|
733
|
+
popover_proto.disabled = disabled
|
734
|
+
if help:
|
735
|
+
popover_proto.help = str(help)
|
736
|
+
if icon is not None:
|
737
|
+
popover_proto.icon = validate_icon_or_emoji(icon)
|
738
|
+
|
739
|
+
block_proto = BlockProto()
|
740
|
+
block_proto.allow_empty = True
|
741
|
+
block_proto.popover.CopyFrom(popover_proto)
|
742
|
+
|
743
|
+
return self.dg._block(block_proto=block_proto)
|
744
|
+
|
745
|
+
@gather_metrics("status")
|
746
|
+
def status(
|
747
|
+
self,
|
748
|
+
label: str,
|
749
|
+
*,
|
750
|
+
expanded: bool = False,
|
751
|
+
state: Literal["running", "complete", "error"] = "running",
|
752
|
+
) -> StatusContainer:
|
753
|
+
r"""Insert a status container to display output from long-running tasks.
|
754
|
+
|
755
|
+
Inserts a container into your app that is typically used to show the status and
|
756
|
+
details of a process or task. The container can hold multiple elements and can
|
757
|
+
be expanded or collapsed by the user similar to ``st.expander``.
|
758
|
+
When collapsed, all that is visible is the status icon and label.
|
759
|
+
|
760
|
+
The label, state, and expanded state can all be updated by calling ``.update()``
|
761
|
+
on the returned object. To add elements to the returned container, you can
|
762
|
+
use ``with`` notation (preferred) or just call methods directly on the returned
|
763
|
+
object.
|
764
|
+
|
765
|
+
By default, ``st.status()`` initializes in the "running" state. When called using
|
766
|
+
``with`` notation, it automatically updates to the "complete" state at the end
|
767
|
+
of the "with" block. See examples below for more details.
|
768
|
+
|
769
|
+
Parameters
|
770
|
+
----------
|
771
|
+
|
772
|
+
label : str
|
773
|
+
The initial label of the status container. The label can optionally
|
774
|
+
contain GitHub-flavored Markdown of the following types: Bold, Italics,
|
775
|
+
Strikethroughs, Inline Code, Links, and Images. Images display like
|
776
|
+
icons, with a max height equal to the font height.
|
777
|
+
|
778
|
+
Unsupported Markdown elements are unwrapped so only their children
|
779
|
+
(text contents) render. Display unsupported elements as literal
|
780
|
+
characters by backslash-escaping them. E.g.,
|
781
|
+
``"1\. Not an ordered list"``.
|
782
|
+
|
783
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
784
|
+
supported Markdown directives.
|
785
|
+
|
786
|
+
.. |st.markdown| replace:: ``st.markdown``
|
787
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
788
|
+
|
789
|
+
expanded : bool
|
790
|
+
If True, initializes the status container in "expanded" state. Defaults to
|
791
|
+
False (collapsed).
|
792
|
+
|
793
|
+
state : "running", "complete", or "error"
|
794
|
+
The initial state of the status container which determines which icon is
|
795
|
+
shown:
|
796
|
+
|
797
|
+
- ``running`` (default): A spinner icon is shown.
|
798
|
+
|
799
|
+
- ``complete``: A checkmark icon is shown.
|
800
|
+
|
801
|
+
- ``error``: An error icon is shown.
|
802
|
+
|
803
|
+
Returns
|
804
|
+
-------
|
805
|
+
|
806
|
+
StatusContainer
|
807
|
+
A mutable status container that can hold multiple elements. The label, state,
|
808
|
+
and expanded state can be updated after creation via ``.update()``.
|
809
|
+
|
810
|
+
Examples
|
811
|
+
--------
|
812
|
+
|
813
|
+
You can use the ``with`` notation to insert any element into an status container:
|
814
|
+
|
815
|
+
>>> import time
|
816
|
+
>>> import streamlit as st
|
817
|
+
>>>
|
818
|
+
>>> with st.status("Downloading data..."):
|
819
|
+
... st.write("Searching for data...")
|
820
|
+
... time.sleep(2)
|
821
|
+
... st.write("Found URL.")
|
822
|
+
... time.sleep(1)
|
823
|
+
... st.write("Downloading data...")
|
824
|
+
... time.sleep(1)
|
825
|
+
>>>
|
826
|
+
>>> st.button("Rerun")
|
827
|
+
|
828
|
+
.. output ::
|
829
|
+
https://doc-status.streamlit.app/
|
830
|
+
height: 300px
|
831
|
+
|
832
|
+
You can also use ``.update()`` on the container to change the label, state,
|
833
|
+
or expanded state:
|
834
|
+
|
835
|
+
>>> import time
|
836
|
+
>>> import streamlit as st
|
837
|
+
>>>
|
838
|
+
>>> with st.status("Downloading data...", expanded=True) as status:
|
839
|
+
... st.write("Searching for data...")
|
840
|
+
... time.sleep(2)
|
841
|
+
... st.write("Found URL.")
|
842
|
+
... time.sleep(1)
|
843
|
+
... st.write("Downloading data...")
|
844
|
+
... time.sleep(1)
|
845
|
+
... status.update(
|
846
|
+
... label="Download complete!", state="complete", expanded=False
|
847
|
+
... )
|
848
|
+
>>>
|
849
|
+
>>> st.button("Rerun")
|
850
|
+
|
851
|
+
.. output ::
|
852
|
+
https://doc-status-update.streamlit.app/
|
853
|
+
height: 300px
|
854
|
+
|
855
|
+
"""
|
856
|
+
return get_dg_singleton_instance().status_container_cls._create(
|
857
|
+
self.dg, label, expanded=expanded, state=state
|
858
|
+
)
|
859
|
+
|
860
|
+
def _dialog(
|
861
|
+
self,
|
862
|
+
title: str,
|
863
|
+
*,
|
864
|
+
dismissible: bool = True,
|
865
|
+
width: Literal["small", "large"] = "small",
|
866
|
+
) -> Dialog:
|
867
|
+
"""Inserts the dialog container.
|
868
|
+
|
869
|
+
Marked as internal because it is used by the dialog_decorator and is not supposed to be used directly.
|
870
|
+
The dialog_decorator also has a more descriptive docstring since it is user-facing.
|
871
|
+
"""
|
872
|
+
return get_dg_singleton_instance().dialog_container_cls._create(
|
873
|
+
self.dg, title, dismissible=dismissible, width=width
|
874
|
+
)
|
875
|
+
|
876
|
+
@property
|
877
|
+
def dg(self) -> DeltaGenerator:
|
878
|
+
"""Get our DeltaGenerator."""
|
879
|
+
return cast("DeltaGenerator", self)
|