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
|
@@ -71,14 +71,31 @@ class AddRowsMetadata:
|
|
|
71
71
|
chart_command: str
|
|
72
72
|
last_index: Hashable | None
|
|
73
73
|
columns: PrepDataColumns
|
|
74
|
+
# Chart styling properties
|
|
75
|
+
color: str | Color | list[Color] | None = None
|
|
76
|
+
width: int | None = None
|
|
77
|
+
height: int | None = None
|
|
78
|
+
use_container_width: bool = True
|
|
79
|
+
# Only applicable for bar & area charts
|
|
80
|
+
stack: bool | ChartStackType | None = None
|
|
81
|
+
# Only applicable for bar charts
|
|
82
|
+
horizontal: bool = False
|
|
74
83
|
|
|
75
84
|
|
|
76
85
|
class ChartType(Enum):
|
|
77
|
-
AREA = {"mark_type": "area", "command": "area_chart"}
|
|
78
|
-
VERTICAL_BAR = {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
AREA: Final = {"mark_type": "area", "command": "area_chart"}
|
|
87
|
+
VERTICAL_BAR: Final = {
|
|
88
|
+
"mark_type": "bar",
|
|
89
|
+
"command": "bar_chart",
|
|
90
|
+
"horizontal": False,
|
|
91
|
+
}
|
|
92
|
+
HORIZONTAL_BAR: Final = {
|
|
93
|
+
"mark_type": "bar",
|
|
94
|
+
"command": "bar_chart",
|
|
95
|
+
"horizontal": True,
|
|
96
|
+
}
|
|
97
|
+
LINE: Final = {"mark_type": "line", "command": "line_chart"}
|
|
98
|
+
SCATTER: Final = {"mark_type": "circle", "command": "scatter_chart"}
|
|
82
99
|
|
|
83
100
|
|
|
84
101
|
# Color and size legends need different title paddings in order for them
|
|
@@ -118,7 +135,7 @@ _NON_EXISTENT_COLUMN_NAME: Final = "DOES_NOT_EXIST" + _PROTECTION_SUFFIX
|
|
|
118
135
|
|
|
119
136
|
def maybe_raise_stack_warning(
|
|
120
137
|
stack: bool | ChartStackType | None, command: str | None, docs_link: str
|
|
121
|
-
):
|
|
138
|
+
) -> None:
|
|
122
139
|
# Check that the stack parameter is valid, raise more informative error if not
|
|
123
140
|
if stack not in (None, True, False, "normalize", "center", "layered"):
|
|
124
141
|
raise StreamlitAPIException(
|
|
@@ -139,8 +156,11 @@ def generate_chart(
|
|
|
139
156
|
size_from_user: str | float | None = None,
|
|
140
157
|
width: int | None = None,
|
|
141
158
|
height: int | None = None,
|
|
159
|
+
use_container_width: bool = True,
|
|
142
160
|
# Bar & Area charts only:
|
|
143
161
|
stack: bool | ChartStackType | None = None,
|
|
162
|
+
# Bar charts only:
|
|
163
|
+
horizontal: bool = False,
|
|
144
164
|
) -> tuple[alt.Chart | alt.LayerChart, AddRowsMetadata]:
|
|
145
165
|
"""Function to use the chart's type, data columns and indices to figure out the
|
|
146
166
|
chart's spec.
|
|
@@ -178,6 +198,13 @@ def generate_chart(
|
|
|
178
198
|
"color_column": color_column,
|
|
179
199
|
"size_column": size_column,
|
|
180
200
|
},
|
|
201
|
+
# Chart styling properties
|
|
202
|
+
color=color_from_user,
|
|
203
|
+
width=width,
|
|
204
|
+
height=height,
|
|
205
|
+
use_container_width=use_container_width,
|
|
206
|
+
stack=stack,
|
|
207
|
+
horizontal=horizontal,
|
|
181
208
|
)
|
|
182
209
|
|
|
183
210
|
# At this point, all foo_column variables are either None/empty or contain actual
|
|
@@ -365,17 +392,17 @@ def _infer_vegalite_type(
|
|
|
365
392
|
]:
|
|
366
393
|
return "quantitative"
|
|
367
394
|
|
|
368
|
-
|
|
369
|
-
#
|
|
370
|
-
# return ("ordinal", data.cat.categories.tolist())
|
|
395
|
+
if typ == "categorical" and data.cat.ordered:
|
|
396
|
+
# The original code returns a tuple here:
|
|
397
|
+
# return ("ordinal", data.cat.categories.tolist()) # noqa: ERA001
|
|
371
398
|
# But returning the tuple here isn't compatible with our
|
|
372
399
|
# built-in chart implementation. And it also doesn't seem to be necessary.
|
|
373
400
|
# Altair already extracts the correct sort order somewhere else.
|
|
374
401
|
# More info about the issue here: https://github.com/streamlit/streamlit/issues/7776
|
|
375
402
|
return "ordinal"
|
|
376
|
-
|
|
403
|
+
if typ in ["string", "bytes", "categorical", "boolean", "mixed", "unicode"]:
|
|
377
404
|
return "nominal"
|
|
378
|
-
|
|
405
|
+
if typ in [
|
|
379
406
|
"datetime",
|
|
380
407
|
"datetime64",
|
|
381
408
|
"timedelta",
|
|
@@ -385,14 +412,13 @@ def _infer_vegalite_type(
|
|
|
385
412
|
"period",
|
|
386
413
|
]:
|
|
387
414
|
return "temporal"
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
return "nominal"
|
|
415
|
+
# STREAMLIT MOD: I commented this out since Streamlit doesn't use warnings.warn.
|
|
416
|
+
# > warnings.warn(
|
|
417
|
+
# > "I don't know how to infer vegalite type from '{}'. "
|
|
418
|
+
# > "Defaulting to nominal.".format(typ),
|
|
419
|
+
# > stacklevel=1,
|
|
420
|
+
# > )
|
|
421
|
+
return "nominal"
|
|
396
422
|
|
|
397
423
|
|
|
398
424
|
def _get_pandas_index_attr(
|
|
@@ -551,8 +577,8 @@ def _melt_data(
|
|
|
551
577
|
)
|
|
552
578
|
|
|
553
579
|
# Arrow has problems with object types after melting two different dtypes
|
|
554
|
-
# pyarrow.lib.ArrowTypeError: "Expected a <TYPE> object, got a object"
|
|
555
|
-
|
|
580
|
+
# > pyarrow.lib.ArrowTypeError: "Expected a <TYPE> object, got a object"
|
|
581
|
+
return dataframe_util.fix_arrow_incompatible_column_types(
|
|
556
582
|
melted_df,
|
|
557
583
|
selected_columns=[
|
|
558
584
|
*columns_to_leave_alone,
|
|
@@ -561,8 +587,6 @@ def _melt_data(
|
|
|
561
587
|
],
|
|
562
588
|
)
|
|
563
589
|
|
|
564
|
-
return fixed_df
|
|
565
|
-
|
|
566
590
|
|
|
567
591
|
def _maybe_reset_index_in_place(
|
|
568
592
|
df: pd.DataFrame, x_column: str | None, y_column_list: list[str]
|
|
@@ -602,7 +626,9 @@ def _drop_unused_columns(df: pd.DataFrame, *column_names: str | None) -> pd.Data
|
|
|
602
626
|
return df[keep]
|
|
603
627
|
|
|
604
628
|
|
|
605
|
-
def _maybe_convert_color_column_in_place(
|
|
629
|
+
def _maybe_convert_color_column_in_place(
|
|
630
|
+
df: pd.DataFrame, color_column: str | None
|
|
631
|
+
) -> None:
|
|
606
632
|
"""If needed, convert color column to a format Vega understands."""
|
|
607
633
|
if color_column is None or len(df[color_column]) == 0:
|
|
608
634
|
return
|
|
@@ -661,18 +687,17 @@ def _parse_x_column(df: pd.DataFrame, x_from_user: str | None) -> str | None:
|
|
|
661
687
|
if x_from_user is None:
|
|
662
688
|
return None
|
|
663
689
|
|
|
664
|
-
|
|
690
|
+
if isinstance(x_from_user, str):
|
|
665
691
|
if x_from_user not in df.columns:
|
|
666
692
|
raise StreamlitColumnNotFoundError(df, x_from_user)
|
|
667
693
|
|
|
668
694
|
return x_from_user
|
|
669
695
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
)
|
|
696
|
+
raise StreamlitAPIException(
|
|
697
|
+
"x parameter should be a column name (str) or None to use the "
|
|
698
|
+
f" dataframe's index. Value given: {x_from_user} "
|
|
699
|
+
f"(type {type(x_from_user)})"
|
|
700
|
+
)
|
|
676
701
|
|
|
677
702
|
|
|
678
703
|
def _parse_y_columns(
|
|
@@ -853,17 +878,14 @@ def _get_x_encoding(
|
|
|
853
878
|
# Only show a label in the x axis if the user passed a column explicitly. We
|
|
854
879
|
# could go either way here, but I'm keeping this to avoid breaking the existing
|
|
855
880
|
# behavior.
|
|
856
|
-
if x_from_user is None
|
|
857
|
-
x_title = ""
|
|
858
|
-
else:
|
|
859
|
-
x_title = x_column
|
|
881
|
+
x_title = "" if x_from_user is None else x_column
|
|
860
882
|
|
|
861
883
|
# User specified x-axis label takes precedence
|
|
862
884
|
if x_axis_label is not None:
|
|
863
885
|
x_title = x_axis_label
|
|
864
886
|
|
|
865
887
|
# grid lines on x axis for horizontal bar charts only
|
|
866
|
-
grid =
|
|
888
|
+
grid = chart_type == ChartType.HORIZONTAL_BAR
|
|
867
889
|
|
|
868
890
|
return alt.X(
|
|
869
891
|
x_field,
|
|
@@ -901,17 +923,14 @@ def _get_y_encoding(
|
|
|
901
923
|
# Only show a label in the y axis if the user passed a column explicitly. We
|
|
902
924
|
# could go either way here, but I'm keeping this to avoid breaking the existing
|
|
903
925
|
# behavior.
|
|
904
|
-
if y_from_user is None
|
|
905
|
-
y_title = ""
|
|
906
|
-
else:
|
|
907
|
-
y_title = y_column
|
|
926
|
+
y_title = "" if y_from_user is None else y_column
|
|
908
927
|
|
|
909
928
|
# User specified y-axis label takes precedence
|
|
910
929
|
if y_axis_label is not None:
|
|
911
930
|
y_title = y_axis_label
|
|
912
931
|
|
|
913
932
|
# grid lines on y axis for all charts except horizontal bar charts
|
|
914
|
-
grid =
|
|
933
|
+
grid = chart_type != ChartType.HORIZONTAL_BAR
|
|
915
934
|
|
|
916
935
|
return alt.Y(
|
|
917
936
|
field=y_field,
|
|
@@ -927,9 +946,9 @@ def _update_encoding_with_stack(
|
|
|
927
946
|
encoding: alt.X | alt.Y,
|
|
928
947
|
) -> None:
|
|
929
948
|
if stack is None:
|
|
930
|
-
return
|
|
949
|
+
return
|
|
931
950
|
# Our layered option maps to vega's stack=False option
|
|
932
|
-
|
|
951
|
+
if stack == "layered":
|
|
933
952
|
stack = False
|
|
934
953
|
|
|
935
954
|
encoding["stack"] = stack
|
|
@@ -952,12 +971,14 @@ def _get_color_encoding(
|
|
|
952
971
|
# If the color value is color-like, return that.
|
|
953
972
|
if is_color_like(cast("Any", color_value)):
|
|
954
973
|
if len(y_column_list) != 1:
|
|
955
|
-
raise StreamlitColorLengthError(
|
|
974
|
+
raise StreamlitColorLengthError(
|
|
975
|
+
[color_value] if color_value else [], y_column_list
|
|
976
|
+
)
|
|
956
977
|
|
|
957
978
|
return alt.ColorValue(to_css_color(cast("Any", color_value)))
|
|
958
979
|
|
|
959
|
-
# If the color value is a list of colors of
|
|
960
|
-
|
|
980
|
+
# If the color value is a list of colors of appropriate length, return that.
|
|
981
|
+
if isinstance(color_value, (list, tuple)):
|
|
961
982
|
color_values = cast("Collection[Color]", color_value)
|
|
962
983
|
|
|
963
984
|
if len(color_values) != len(y_column_list):
|
|
@@ -965,24 +986,24 @@ def _get_color_encoding(
|
|
|
965
986
|
|
|
966
987
|
if len(color_values) == 1:
|
|
967
988
|
return alt.ColorValue(to_css_color(cast("Any", color_value[0])))
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
)
|
|
989
|
+
return alt.Color(
|
|
990
|
+
field=color_column if color_column is not None else alt.Undefined,
|
|
991
|
+
scale=alt.Scale(range=[to_css_color(c) for c in color_values]),
|
|
992
|
+
legend=_COLOR_LEGEND_SETTINGS,
|
|
993
|
+
type="nominal",
|
|
994
|
+
title=" ",
|
|
995
|
+
)
|
|
976
996
|
|
|
977
|
-
raise StreamlitInvalidColorError(
|
|
997
|
+
raise StreamlitInvalidColorError(color_from_user)
|
|
978
998
|
|
|
979
|
-
|
|
999
|
+
if color_column is not None:
|
|
980
1000
|
column_type: VegaLiteType
|
|
981
1001
|
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1002
|
+
column_type = (
|
|
1003
|
+
"nominal"
|
|
1004
|
+
if color_column == _MELTED_COLOR_COLUMN_NAME
|
|
1005
|
+
else _infer_vegalite_type(df[color_column])
|
|
1006
|
+
)
|
|
986
1007
|
|
|
987
1008
|
color_enc = alt.Color(
|
|
988
1009
|
field=color_column, legend=_COLOR_LEGEND_SETTINGS, type=column_type
|
|
@@ -1029,16 +1050,15 @@ def _get_size_encoding(
|
|
|
1029
1050
|
legend=_SIZE_LEGEND_SETTINGS,
|
|
1030
1051
|
)
|
|
1031
1052
|
|
|
1032
|
-
|
|
1053
|
+
if isinstance(size_value, (float, int)):
|
|
1033
1054
|
return alt.SizeValue(size_value)
|
|
1034
|
-
|
|
1055
|
+
if size_value is None:
|
|
1035
1056
|
return alt.SizeValue(100)
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
)
|
|
1057
|
+
raise StreamlitAPIException(
|
|
1058
|
+
f"This does not look like a valid size: {size_value!r}"
|
|
1059
|
+
)
|
|
1040
1060
|
|
|
1041
|
-
|
|
1061
|
+
if size_column is not None or size_value is not None:
|
|
1042
1062
|
raise Error(
|
|
1043
1063
|
f"Chart type {chart_type.name} does not support size argument. "
|
|
1044
1064
|
"This should never happen!"
|
|
@@ -1131,7 +1151,7 @@ def _get_y_encoding_type(
|
|
|
1131
1151
|
|
|
1132
1152
|
|
|
1133
1153
|
class StreamlitColumnNotFoundError(StreamlitAPIException):
|
|
1134
|
-
def __init__(self, df, col_name, *args):
|
|
1154
|
+
def __init__(self, df: pd.DataFrame, col_name: str, *args: Any) -> None:
|
|
1135
1155
|
available_columns = ", ".join(str(c) for c in list(df.columns))
|
|
1136
1156
|
message = (
|
|
1137
1157
|
f'Data does not have a column named `"{col_name}"`. '
|
|
@@ -1141,8 +1161,7 @@ class StreamlitColumnNotFoundError(StreamlitAPIException):
|
|
|
1141
1161
|
|
|
1142
1162
|
|
|
1143
1163
|
class StreamlitInvalidColorError(StreamlitAPIException):
|
|
1144
|
-
def __init__(self,
|
|
1145
|
-
", ".join(str(c) for c in list(df.columns))
|
|
1164
|
+
def __init__(self, color_from_user: str | Color | list[Color] | None) -> None:
|
|
1146
1165
|
message = f"""
|
|
1147
1166
|
This does not look like a valid color argument: `{color_from_user}`.
|
|
1148
1167
|
|
|
@@ -1155,14 +1174,18 @@ The color argument can be:
|
|
|
1155
1174
|
* The name of a column.
|
|
1156
1175
|
* Or a list of colors, matching the number of y columns to draw.
|
|
1157
1176
|
"""
|
|
1158
|
-
super().__init__(message
|
|
1177
|
+
super().__init__(message)
|
|
1159
1178
|
|
|
1160
1179
|
|
|
1161
1180
|
class StreamlitColorLengthError(StreamlitAPIException):
|
|
1162
|
-
def __init__(
|
|
1181
|
+
def __init__(
|
|
1182
|
+
self,
|
|
1183
|
+
color_values: str | Color | Collection[Color] | None,
|
|
1184
|
+
y_column_list: list[str],
|
|
1185
|
+
) -> None:
|
|
1163
1186
|
message = (
|
|
1164
1187
|
f"The list of colors `{color_values}` must have the same "
|
|
1165
1188
|
"length as the list of columns to be colored "
|
|
1166
1189
|
f"`{y_column_list}`."
|
|
1167
1190
|
)
|
|
1168
|
-
super().__init__(message
|
|
1191
|
+
super().__init__(message)
|
|
@@ -83,7 +83,7 @@ def to_css_color(color: MaybeColor) -> Color:
|
|
|
83
83
|
ctuple = _normalize_tuple(ctuple, _int_formatter, _float_formatter)
|
|
84
84
|
if len(ctuple) == 3:
|
|
85
85
|
return f"rgb({ctuple[0]}, {ctuple[1]}, {ctuple[2]})"
|
|
86
|
-
|
|
86
|
+
if len(ctuple) == 4:
|
|
87
87
|
c4tuple = cast("MixedRGBAColorTuple", ctuple)
|
|
88
88
|
return f"rgba({c4tuple[0]}, {c4tuple[1]}, {c4tuple[2]}, {c4tuple[3]})"
|
|
89
89
|
|
|
@@ -155,7 +155,7 @@ def _to_color_tuple(
|
|
|
155
155
|
color: MaybeColor,
|
|
156
156
|
rgb_formatter: Callable[[float, MaybeColor], float],
|
|
157
157
|
alpha_formatter: Callable[[float, MaybeColor], float],
|
|
158
|
-
):
|
|
158
|
+
) -> ColorTuple:
|
|
159
159
|
"""Convert a potential color to a color tuple.
|
|
160
160
|
|
|
161
161
|
The exact type of color tuple this outputs is dictated by the formatter parameters.
|
|
@@ -224,7 +224,7 @@ def _normalize_tuple(
|
|
|
224
224
|
b = rgb_formatter(color[2], color)
|
|
225
225
|
return r, g, b
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
if len(color) == 4:
|
|
228
228
|
color_4tuple = cast("Color4Tuple", color)
|
|
229
229
|
r = rgb_formatter(color_4tuple[0], color_4tuple)
|
|
230
230
|
g = rgb_formatter(color_4tuple[1], color_4tuple)
|
|
@@ -188,7 +188,7 @@ def _determine_data_kind_via_arrow(field: pa.Field) -> ColumnDataKind:
|
|
|
188
188
|
|
|
189
189
|
# Interval does not seem to work correctly:
|
|
190
190
|
# if pa.types.is_interval(field_type):
|
|
191
|
-
# return ColumnDataKind.INTERVAL
|
|
191
|
+
# return ColumnDataKind.INTERVAL # noqa: ERA001
|
|
192
192
|
|
|
193
193
|
if pa.types.is_binary(field_type):
|
|
194
194
|
return ColumnDataKind.BYTES
|
|
@@ -509,9 +509,7 @@ def _convert_column_config_to_json(column_config_mapping: ColumnConfigMapping) -
|
|
|
509
509
|
# Ignore all None values and prefix columns specified by numerical index:
|
|
510
510
|
return json.dumps(
|
|
511
511
|
{
|
|
512
|
-
(
|
|
513
|
-
f"{_NUMERICAL_POSITION_PREFIX}{str(k)}" if isinstance(k, int) else k
|
|
514
|
-
): v
|
|
512
|
+
(f"{_NUMERICAL_POSITION_PREFIX}{k!s}" if isinstance(k, int) else k): v
|
|
515
513
|
for (k, v) in remove_none_values(column_config_mapping).items()
|
|
516
514
|
},
|
|
517
515
|
allow_nan=False,
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
# Allow function names with uppercase letters:
|
|
16
|
+
# ruff: noqa: N802
|
|
17
|
+
|
|
15
18
|
from __future__ import annotations
|
|
16
19
|
|
|
17
20
|
import datetime
|
|
@@ -29,6 +32,7 @@ NumberFormat: TypeAlias = Literal[
|
|
|
29
32
|
"localized",
|
|
30
33
|
"dollar",
|
|
31
34
|
"euro",
|
|
35
|
+
"yen",
|
|
32
36
|
"percent",
|
|
33
37
|
"compact",
|
|
34
38
|
"scientific",
|
|
@@ -413,7 +417,7 @@ def NumberColumn(
|
|
|
413
417
|
Specifies the default value in this column when a new row is added by
|
|
414
418
|
the user. This defaults to ``None``.
|
|
415
419
|
|
|
416
|
-
format: str, "plain", "localized", "percent", "dollar", "euro", "accounting", "compact", "scientific", "engineering", or None
|
|
420
|
+
format: str, "plain", "localized", "percent", "dollar", "euro", "yen", "accounting", "compact", "scientific", "engineering", or None
|
|
417
421
|
A format string controlling how numbers are displayed.
|
|
418
422
|
This can be one of the following values:
|
|
419
423
|
|
|
@@ -423,13 +427,14 @@ def NumberColumn(
|
|
|
423
427
|
- ``"percent"``: Show the number as a percentage (e.g. "123456.70%").
|
|
424
428
|
- ``"dollar"``: Show the number as a dollar amount (e.g. "$1,234.57").
|
|
425
429
|
- ``"euro"``: Show the number as a euro amount (e.g. "€1,234.57").
|
|
430
|
+
- ``"yen"``: Show the number as a yen amount (e.g. "¥1,235").
|
|
426
431
|
- ``"accounting"``: Show the number in an accounting format (e.g. "1,234.00").
|
|
427
432
|
- ``"compact"``: Show the number in a compact format (e.g. "1.2K").
|
|
428
433
|
- ``"scientific"``: Show the number in scientific notation (e.g. "1.235E3").
|
|
429
434
|
- ``"engineering"``: Show the number in engineering notation (e.g. "1.235E3").
|
|
430
435
|
- printf-style format string: Format the number with a printf
|
|
431
436
|
specifier, like ``"%d"`` to show a signed integer (e.g. "1234") or
|
|
432
|
-
``"%X"`` to show an unsigned
|
|
437
|
+
``"%X"`` to show an unsigned hexadecimal integer (e.g. "4D2"). You
|
|
433
438
|
can also add prefixes and suffixes. To show British pounds, use
|
|
434
439
|
``"£ %.2f"`` (e.g. "£ 1234.57"). For more information, see `sprint-js
|
|
435
440
|
<https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
|
|
@@ -482,7 +487,7 @@ def NumberColumn(
|
|
|
482
487
|
.. output::
|
|
483
488
|
https://doc-number-column.streamlit.app/
|
|
484
489
|
height: 300px
|
|
485
|
-
"""
|
|
490
|
+
""" # noqa: E501
|
|
486
491
|
|
|
487
492
|
return ColumnConfig(
|
|
488
493
|
label=label,
|
|
@@ -1310,7 +1315,7 @@ def ImageColumn(
|
|
|
1310
1315
|
width: ColumnWidth | None = None,
|
|
1311
1316
|
help: str | None = None,
|
|
1312
1317
|
pinned: bool | None = None,
|
|
1313
|
-
):
|
|
1318
|
+
) -> ColumnConfig:
|
|
1314
1319
|
"""Configure an image column in ``st.dataframe`` or ``st.data_editor``.
|
|
1315
1320
|
|
|
1316
1321
|
The cell values need to be one of:
|
|
@@ -1400,7 +1405,7 @@ def ListColumn(
|
|
|
1400
1405
|
width: ColumnWidth | None = None,
|
|
1401
1406
|
help: str | None = None,
|
|
1402
1407
|
pinned: bool | None = None,
|
|
1403
|
-
):
|
|
1408
|
+
) -> ColumnConfig:
|
|
1404
1409
|
"""Configure a list column in ``st.dataframe`` or ``st.data_editor``.
|
|
1405
1410
|
|
|
1406
1411
|
This is the default column type for list-like values. List columns are not editable
|
|
@@ -1988,7 +1993,7 @@ def ProgressColumn(
|
|
|
1988
1993
|
the Markdown directives described in the ``body`` parameter of
|
|
1989
1994
|
``st.markdown``.
|
|
1990
1995
|
|
|
1991
|
-
format: str, "plain", "localized", "percent", "dollar", "euro", "accounting", "compact", "scientific", "engineering", or None
|
|
1996
|
+
format: str, "plain", "localized", "percent", "dollar", "euro", "yen", "accounting", "compact", "scientific", "engineering", or None
|
|
1992
1997
|
A format string controlling how the numbers are displayed.
|
|
1993
1998
|
This can be one of the following values:
|
|
1994
1999
|
|
|
@@ -1998,13 +2003,14 @@ def ProgressColumn(
|
|
|
1998
2003
|
- ``"percent"``: Show the number as a percentage (e.g. "123456.70%").
|
|
1999
2004
|
- ``"dollar"``: Show the number as a dollar amount (e.g. "$1,234.57").
|
|
2000
2005
|
- ``"euro"``: Show the number as a euro amount (e.g. "€1,234.57").
|
|
2006
|
+
- ``"yen"``: Show the number as a yen amount (e.g. "¥1,235").
|
|
2001
2007
|
- ``"accounting"``: Show the number in an accounting format (e.g. "1,234.00").
|
|
2002
2008
|
- ``"compact"``: Show the number in a compact format (e.g. "1.2K").
|
|
2003
2009
|
- ``"scientific"``: Show the number in scientific notation (e.g. "1.235E3").
|
|
2004
2010
|
- ``"engineering"``: Show the number in engineering notation (e.g. "1.235E3").
|
|
2005
2011
|
- printf-style format string: Format the number with a printf
|
|
2006
2012
|
specifier, like ``"%d"`` to show a signed integer (e.g. "1234") or
|
|
2007
|
-
``"%X"`` to show an unsigned
|
|
2013
|
+
``"%X"`` to show an unsigned hexadecimal integer (e.g. "4D2"). You
|
|
2008
2014
|
can also add prefixes and suffixes. To show British pounds, use
|
|
2009
2015
|
``"£ %.2f"`` (e.g. "£ 1234.57"). For more information, see `sprint-js
|
|
2010
2016
|
<https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
|
|
@@ -2055,7 +2061,7 @@ def ProgressColumn(
|
|
|
2055
2061
|
.. output::
|
|
2056
2062
|
https://doc-progress-column.streamlit.app/
|
|
2057
2063
|
height: 300px
|
|
2058
|
-
"""
|
|
2064
|
+
""" # noqa: E501
|
|
2059
2065
|
|
|
2060
2066
|
return ColumnConfig(
|
|
2061
2067
|
label=label,
|
streamlit/elements/lib/dialog.py
CHANGED
|
@@ -67,7 +67,8 @@ def _assert_first_dialog_to_be_opened(should_open: bool) -> None:
|
|
|
67
67
|
if should_open and script_run_ctx:
|
|
68
68
|
if script_run_ctx.has_dialog_opened:
|
|
69
69
|
raise StreamlitAPIException(
|
|
70
|
-
"Only one dialog is allowed to be opened at the same time.
|
|
70
|
+
"Only one dialog is allowed to be opened at the same time. "
|
|
71
|
+
"Please make sure to not call a dialog-decorated function more than once in a script run."
|
|
71
72
|
)
|
|
72
73
|
script_run_ctx.has_dialog_opened = True
|
|
73
74
|
|
|
@@ -104,18 +105,21 @@ class Dialog(DeltaGenerator):
|
|
|
104
105
|
cursor: Cursor | None,
|
|
105
106
|
parent: DeltaGenerator | None,
|
|
106
107
|
block_type: str | None,
|
|
107
|
-
):
|
|
108
|
+
) -> None:
|
|
108
109
|
super().__init__(root_container, cursor, parent, block_type)
|
|
109
110
|
|
|
110
111
|
# Initialized in `_create()`:
|
|
111
112
|
self._current_proto: BlockProto | None = None
|
|
112
113
|
self._delta_path: list[int] | None = None
|
|
113
114
|
|
|
114
|
-
def _update(self, should_open: bool):
|
|
115
|
+
def _update(self, should_open: bool) -> None:
|
|
115
116
|
"""Send an updated proto message to indicate the open-status for the dialog."""
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
if self._current_proto is None or self._delta_path is None:
|
|
119
|
+
raise RuntimeError(
|
|
120
|
+
"Dialog not correctly initialized. This should never happen."
|
|
121
|
+
)
|
|
122
|
+
|
|
119
123
|
_assert_first_dialog_to_be_opened(should_open)
|
|
120
124
|
msg = ForwardMsg()
|
|
121
125
|
msg.metadata.delta_path[:] = self._delta_path
|