streamlit 1.51.0__py3-none-any.whl → 1.52.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 +1 -0
- streamlit/commands/execution_control.py +89 -14
- streamlit/components/v1/component_arrow.py +7 -7
- streamlit/components/v2/__init__.py +59 -3
- streamlit/components/v2/bidi_component/main.py +161 -13
- streamlit/components/v2/bidi_component/serialization.py +13 -6
- streamlit/components/v2/component_manager.py +11 -3
- streamlit/components/v2/component_registry.py +18 -1
- streamlit/components/v2/types.py +2 -2
- streamlit/connections/snowflake_connection.py +1 -1
- streamlit/connections/snowpark_connection.py +1 -1
- streamlit/dataframe_util.py +18 -18
- streamlit/delta_generator.py +7 -0
- streamlit/delta_generator_singletons.py +8 -14
- streamlit/elements/alert.py +16 -0
- streamlit/elements/arrow.py +36 -6
- streamlit/elements/bokeh_chart.py +10 -78
- streamlit/elements/code.py +2 -2
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/exception.py +1 -1
- streamlit/elements/form.py +27 -0
- streamlit/elements/heading.py +60 -5
- streamlit/elements/html.py +13 -2
- streamlit/elements/image.py +1 -1
- streamlit/elements/layouts.py +28 -22
- streamlit/elements/lib/built_in_chart_utils.py +49 -16
- streamlit/elements/lib/color_util.py +1 -1
- streamlit/elements/lib/column_config_utils.py +6 -5
- streamlit/elements/lib/layout_utils.py +50 -0
- streamlit/elements/lib/pandas_styler_utils.py +17 -9
- streamlit/elements/lib/shortcut_utils.py +152 -0
- streamlit/elements/markdown.py +50 -3
- streamlit/elements/metric.py +31 -1
- streamlit/elements/plotly_chart.py +75 -6
- streamlit/elements/spinner.py +1 -1
- streamlit/elements/text.py +20 -3
- streamlit/elements/toast.py +2 -0
- streamlit/elements/vega_charts.py +17 -1
- streamlit/elements/widgets/audio_input.py +8 -7
- streamlit/elements/widgets/button.py +279 -40
- streamlit/elements/widgets/button_group.py +27 -2
- streamlit/elements/widgets/camera_input.py +1 -1
- streamlit/elements/widgets/chat.py +300 -42
- streamlit/elements/widgets/color_picker.py +7 -0
- streamlit/elements/widgets/data_editor.py +68 -28
- streamlit/elements/widgets/file_uploader.py +4 -1
- streamlit/elements/widgets/number_input.py +2 -0
- streamlit/elements/widgets/text_widgets.py +2 -0
- streamlit/elements/widgets/time_widgets.py +581 -9
- streamlit/errors.py +22 -0
- streamlit/git_util.py +1 -1
- streamlit/navigation/page.py +7 -0
- streamlit/net_util.py +2 -2
- streamlit/proto/Alert_pb2.pyi +3 -3
- streamlit/proto/AppPage_pb2.pyi +7 -1
- streamlit/proto/ArrowData_pb2.pyi +7 -1
- streamlit/proto/ArrowNamedDataSet_pb2.pyi +7 -1
- streamlit/proto/ArrowVegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Arrow_pb2.py +10 -10
- streamlit/proto/Arrow_pb2.pyi +19 -12
- streamlit/proto/AudioInput_pb2.pyi +7 -1
- streamlit/proto/Audio_pb2.pyi +7 -1
- streamlit/proto/AuthRedirect_pb2.pyi +7 -1
- streamlit/proto/AutoRerun_pb2.pyi +7 -1
- streamlit/proto/BackMsg_pb2.py +4 -2
- streamlit/proto/BackMsg_pb2.pyi +34 -4
- streamlit/proto/Balloons_pb2.pyi +7 -1
- streamlit/proto/BidiComponent_pb2.pyi +10 -4
- streamlit/proto/Block_pb2.pyi +35 -35
- streamlit/proto/BokehChart_pb2.pyi +7 -1
- streamlit/proto/ButtonGroup_pb2.pyi +9 -9
- streamlit/proto/Button_pb2.py +2 -2
- streamlit/proto/Button_pb2.pyi +11 -2
- streamlit/proto/CameraInput_pb2.pyi +7 -1
- streamlit/proto/ChatInput_pb2.py +6 -6
- streamlit/proto/ChatInput_pb2.pyi +18 -6
- streamlit/proto/Checkbox_pb2.pyi +3 -3
- streamlit/proto/ClientState_pb2.pyi +10 -4
- streamlit/proto/Code_pb2.pyi +7 -1
- streamlit/proto/ColorPicker_pb2.pyi +7 -1
- streamlit/proto/Common_pb2.py +3 -3
- streamlit/proto/Common_pb2.pyi +35 -23
- streamlit/proto/Components_pb2.pyi +19 -13
- streamlit/proto/DataFrame_pb2.pyi +55 -49
- streamlit/proto/DateInput_pb2.pyi +7 -1
- streamlit/proto/DateTimeInput_pb2.py +28 -0
- streamlit/proto/DateTimeInput_pb2.pyi +92 -0
- streamlit/proto/DeckGlJsonChart_pb2.pyi +3 -3
- streamlit/proto/Delta_pb2.pyi +7 -1
- streamlit/proto/DocString_pb2.pyi +10 -4
- streamlit/proto/DownloadButton_pb2.py +2 -2
- streamlit/proto/DownloadButton_pb2.pyi +16 -2
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +23 -5
- streamlit/proto/Empty_pb2.pyi +7 -1
- streamlit/proto/Exception_pb2.pyi +7 -1
- streamlit/proto/Favicon_pb2.pyi +7 -1
- streamlit/proto/FileUploader_pb2.pyi +7 -1
- streamlit/proto/ForwardMsg_pb2.py +12 -10
- streamlit/proto/ForwardMsg_pb2.pyi +42 -15
- streamlit/proto/GapSize_pb2.pyi +4 -4
- streamlit/proto/GitInfo_pb2.pyi +3 -3
- streamlit/proto/GraphVizChart_pb2.pyi +7 -1
- streamlit/proto/Heading_pb2.pyi +7 -1
- streamlit/proto/HeightConfig_pb2.pyi +7 -1
- streamlit/proto/Html_pb2.py +2 -2
- streamlit/proto/Html_pb2.pyi +11 -2
- streamlit/proto/IFrame_pb2.pyi +7 -1
- streamlit/proto/Image_pb2.pyi +10 -4
- streamlit/proto/Json_pb2.pyi +7 -1
- streamlit/proto/LabelVisibilityMessage_pb2.pyi +3 -3
- streamlit/proto/LinkButton_pb2.py +2 -2
- streamlit/proto/LinkButton_pb2.pyi +15 -2
- streamlit/proto/Logo_pb2.pyi +7 -1
- streamlit/proto/Markdown_pb2.pyi +3 -3
- streamlit/proto/Metric_pb2.pyi +7 -7
- streamlit/proto/MetricsEvent_pb2.pyi +10 -4
- streamlit/proto/MultiSelect_pb2.pyi +7 -1
- streamlit/proto/NamedDataSet_pb2.pyi +7 -1
- streamlit/proto/Navigation_pb2.pyi +3 -3
- streamlit/proto/NewSession_pb2.pyi +40 -40
- streamlit/proto/NumberInput_pb2.pyi +3 -3
- streamlit/proto/PageConfig_pb2.pyi +7 -7
- streamlit/proto/PageInfo_pb2.pyi +7 -1
- streamlit/proto/PageLink_pb2.py +2 -2
- streamlit/proto/PageLink_pb2.pyi +11 -2
- streamlit/proto/PageNotFound_pb2.pyi +7 -1
- streamlit/proto/PageProfile_pb2.pyi +13 -7
- streamlit/proto/PagesChanged_pb2.pyi +7 -1
- streamlit/proto/ParentMessage_pb2.pyi +7 -1
- streamlit/proto/PlotlyChart_pb2.pyi +6 -6
- streamlit/proto/Progress_pb2.pyi +7 -1
- streamlit/proto/Radio_pb2.pyi +7 -1
- streamlit/proto/RootContainer_pb2.pyi +1 -1
- streamlit/proto/Selectbox_pb2.pyi +7 -1
- streamlit/proto/SessionEvent_pb2.pyi +7 -1
- streamlit/proto/SessionStatus_pb2.pyi +7 -1
- streamlit/proto/Skeleton_pb2.pyi +3 -3
- streamlit/proto/Slider_pb2.pyi +5 -5
- streamlit/proto/Snow_pb2.pyi +7 -1
- streamlit/proto/Space_pb2.pyi +7 -1
- streamlit/proto/Spinner_pb2.pyi +7 -1
- streamlit/proto/TextAlignmentConfig_pb2.py +29 -0
- streamlit/proto/TextAlignmentConfig_pb2.pyi +68 -0
- streamlit/proto/TextArea_pb2.pyi +7 -1
- streamlit/proto/TextInput_pb2.pyi +3 -3
- streamlit/proto/Text_pb2.pyi +7 -1
- streamlit/proto/TimeInput_pb2.pyi +7 -1
- streamlit/proto/Toast_pb2.pyi +7 -1
- streamlit/proto/VegaLiteChart_pb2.pyi +7 -1
- streamlit/proto/Video_pb2.pyi +6 -6
- streamlit/proto/WidgetStates_pb2.pyi +10 -4
- streamlit/proto/WidthConfig_pb2.pyi +7 -1
- streamlit/proto/openmetrics_data_model_pb2.pyi +52 -52
- streamlit/runtime/app_session.py +38 -1
- streamlit/runtime/caching/cache_data_api.py +1 -1
- streamlit/runtime/caching/cache_resource_api.py +2 -2
- streamlit/runtime/caching/cache_utils.py +1 -1
- streamlit/runtime/caching/hashing.py +1 -1
- streamlit/runtime/download_data_util.py +53 -0
- streamlit/runtime/forward_msg_queue.py +1 -0
- streamlit/runtime/media_file_manager.py +178 -2
- streamlit/runtime/metrics_util.py +87 -3
- streamlit/runtime/scriptrunner/script_runner.py +3 -1
- streamlit/runtime/state/query_params.py +80 -29
- streamlit/runtime/state/session_state.py +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +530 -229
- streamlit/static/static/js/{ErrorOutline.esm.YoJdlW1p.js → ErrorOutline.esm.sMJdFExW.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Ddx8VEYy.js → FileDownload.esm.CV-WYqBn.js} +1 -1
- streamlit/static/static/js/{FileHelper.90EtOmj9.js → FileHelper.5nCh9KDY.js} +3 -3
- streamlit/static/static/js/{FormClearHelper.BB1Km6eP.js → FormClearHelper.-9RbsnV0.js} +1 -1
- streamlit/static/static/js/IFrameUtil.DefezniK.js +1 -0
- streamlit/static/static/js/InputInstructions.2R3tBtW9.js +1 -0
- streamlit/static/static/js/Particles.DDHoXFxh.js +1 -0
- streamlit/static/static/js/{ProgressBar.DLY8H6nE.js → ProgressBar.BxmfHxKu.js} +2 -2
- streamlit/static/static/js/StreamlitSyntaxHighlighter.BFWV0oqR.js +20 -0
- streamlit/static/static/js/{Toolbar.D8nHCkuz.js → Toolbar.DMgU0Vgw.js} +1 -1
- streamlit/static/static/js/_arrayIncludes.B19Iyn2B.js +1 -0
- streamlit/static/static/js/_baseIndexOf.BTknn6Gb.js +1 -0
- streamlit/static/static/js/{base-input.CJGiNqed.js → base-input.BXTqYbyG.js} +4 -4
- streamlit/static/static/js/{checkbox.Cpdd482O.js → checkbox.5xWaqPqm.js} +1 -1
- streamlit/static/static/js/{createSuper.CuQIogbW.js → createSuper.OIgV8wc-.js} +1 -1
- streamlit/static/static/js/data-grid-overlay-editor.B4RIu9cw.js +1 -0
- streamlit/static/static/js/{downloader.CN0K7xlu.js → downloader.DwCJck8O.js} +1 -1
- streamlit/static/static/js/embed.HKcgTiLB.js +195 -0
- streamlit/static/static/js/{es6.BJcsVXQ0.js → es6.4AP97RGk.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.XzUvQqcZ.js → iframeResizer.contentWindow.BZAsvL9q.js} +1 -1
- streamlit/static/static/js/index.-3selq_5.js +2 -0
- streamlit/static/static/js/index.1ylynMAS.js +7 -0
- streamlit/static/static/js/{index.CxIUUfab.js → index.6UunrySF.js} +53 -122
- streamlit/static/static/js/index.8HslT92O.js +14 -0
- streamlit/static/static/js/index.B0TPxAZ1.js +1 -0
- streamlit/static/static/js/index.B0yp3bM1.js +6 -0
- streamlit/static/static/js/index.BHWBaOWH.js +1 -0
- streamlit/static/static/js/index.BJas6XzW.js +1 -0
- streamlit/static/static/js/index.BKIlG7Ng.js +3 -0
- streamlit/static/static/js/index.BMU6zZRk.js +1 -0
- streamlit/static/static/js/index.BNMLO-0p.js +2 -0
- streamlit/static/static/js/index.BPmBNTel.js +1 -0
- streamlit/static/static/js/index.BVuohWM1.js +1 -0
- streamlit/static/static/js/index.B_AvdOKC.js +1 -0
- streamlit/static/static/js/index.BjQIH-3U.js +1 -0
- streamlit/static/static/js/index.BrqtKtSu.js +2 -0
- streamlit/static/static/js/index.Buc7XrOl.js +188 -0
- streamlit/static/static/js/index.CIC9pLsG.js +2 -0
- streamlit/static/static/js/index.CP2YZ73v.js +1 -0
- streamlit/static/static/js/index.CSbah0y4.js +27 -0
- streamlit/static/static/js/index.CbiYVMT1.js +1 -0
- streamlit/static/static/js/index.CbxllBj8.js +1 -0
- streamlit/static/static/js/index.Cd1D2eGF.js +263 -0
- streamlit/static/static/js/index.Ckcqwai8.js +2 -0
- streamlit/static/static/js/index.CqTPbV5Y.js +151 -0
- streamlit/static/static/js/index.CxXo5UKy.js +1 -0
- streamlit/static/static/js/index.CxbL5FgL.js +1 -0
- streamlit/static/static/js/index.D52dMvK5.js +1 -0
- streamlit/static/static/js/index.DBUdji-9.js +3 -0
- streamlit/static/static/js/index.DMU3coc2.js +1 -0
- streamlit/static/static/js/index.DN4sfQLP.js +1 -0
- streamlit/static/static/js/{index.DPUXkcQL.js → index.DRDE9rnx.js} +1 -1
- streamlit/static/static/js/{index.B_dWA3vd.js → index.DY9Ac89e.js} +2 -2
- streamlit/static/static/js/index.DYKCsDvl.js +1 -0
- streamlit/static/static/js/index.Da9gznCC.js +1 -0
- streamlit/static/static/js/index.DfIRibXG.js +1 -0
- streamlit/static/static/js/{index.D3GPA5k4.js → index.Dg5zbEp2.js} +9 -40
- streamlit/static/static/js/index.Di9I2cid.js +1 -0
- streamlit/static/static/js/index.DkpEv0uV.js +1 -0
- streamlit/static/static/js/index.DwJ9Vhsl.js +1 -0
- streamlit/static/static/js/index.L7erTnMm.js +1 -0
- streamlit/static/static/js/{index.DOFlg3dS.js → index.NaDyAN1s.js} +1 -1
- streamlit/static/static/js/index.RNTPpVde.js +1 -0
- streamlit/static/static/js/index.VFDFuf_7.js +1 -0
- streamlit/static/static/js/index.W-bl3NDo.js +1 -0
- streamlit/static/static/js/index.XYozEjwK.js +1 -0
- streamlit/static/static/js/index.oyLQ4pue.js +1 -0
- streamlit/static/static/js/index.q4fLUQtC.js +11 -0
- streamlit/static/static/js/index.q9puCQgK.js +2 -0
- streamlit/static/static/js/index.xZBTXGNC.js +1 -0
- streamlit/static/static/js/{input.D4MN_FzN.js → input.CcvrgErO.js} +2 -2
- streamlit/static/static/js/main.eVHOp4Th.js +13 -0
- streamlit/static/static/js/{memory.DrZjtdGT.js → memory.Ck_sLv5Y.js} +1 -1
- streamlit/static/static/js/moment.C3j7ZXd7.js +4 -0
- streamlit/static/static/js/number-overlay-editor.DgcLMWOy.js +9 -0
- streamlit/static/static/js/pandasStylerUtils.DqP0h70z.js +1 -0
- streamlit/static/static/js/{possibleConstructorReturn.exeeJQEP.js → possibleConstructorReturn.C_51n46K.js} +1 -1
- streamlit/static/static/js/{sandbox.ClO3IuUr.js → sandbox.Q-g3QIZJ.js} +1 -1
- streamlit/static/static/js/styled-components.e0V96rJw.js +1 -0
- streamlit/static/static/js/threshold.Q1mXg5rX.js +1 -0
- streamlit/static/static/js/throttle.D3b5WILl.js +1 -0
- streamlit/static/static/js/{timepicker.DAhu-vcF.js → timepicker.Bpn70xGc.js} +1 -1
- streamlit/static/static/js/timer.C2hYhUse.js +1 -0
- streamlit/static/static/js/{toConsumableArray.DNbljYEC.js → toConsumableArray.DIN_ys1J.js} +1 -1
- streamlit/static/static/js/uniqueId.B27POWT6.js +1 -0
- streamlit/static/static/js/urls.BwSlolu9.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.D6sOH6oI.js → useBasicWidgetState.DA3_qaXD.js} +1 -1
- streamlit/static/static/js/useIntlLocale.BSq6SANa.js +12 -0
- streamlit/static/static/js/{useTextInputAutoExpand.4u3_GcuN.js → useTextInputAutoExpand.ytEW5QmA.js} +1 -1
- streamlit/static/static/js/useUpdateUiValue.DOxWBNiI.js +1 -0
- streamlit/static/static/js/useWaveformController.BCmk6WLk.js +1 -0
- streamlit/static/static/js/value.B4vHRSi7.js +1 -0
- streamlit/static/static/js/withCalculatedWidth.ChdrMItN.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.7j_lzlaF.js +1 -0
- streamlit/string_util.py +8 -1
- streamlit/testing/v1/app_test.py +15 -0
- streamlit/testing/v1/element_tree.py +62 -0
- streamlit/web/bootstrap.py +24 -0
- streamlit/web/server/oauth_authlib_routes.py +5 -2
- streamlit/web/server/upload_file_request_handler.py +16 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/METADATA +9 -5
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/RECORD +274 -239
- streamlit/static/static/js/InputInstructions.jhH15PqV.js +0 -1
- streamlit/static/static/js/Particles.DUsputn1.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +0 -1
- streamlit/static/static/js/index.B1ZQh4P1.js +0 -1
- streamlit/static/static/js/index.BKstZk0M.js +0 -27
- streamlit/static/static/js/index.BMcFsUee.js +0 -1
- streamlit/static/static/js/index.BR-IdcTb.js +0 -2
- streamlit/static/static/js/index.BgnZEMVh.js +0 -1
- streamlit/static/static/js/index.BohqXifI.js +0 -1
- streamlit/static/static/js/index.Br5nxKNj.js +0 -2
- streamlit/static/static/js/index.BrIKVbNc.js +0 -3
- streamlit/static/static/js/index.BtWUPzle.js +0 -1
- streamlit/static/static/js/index.C0RLraek.js +0 -1
- streamlit/static/static/js/index.CAIjskgG.js +0 -1
- streamlit/static/static/js/index.CAj-7vWz.js +0 -949
- streamlit/static/static/js/index.CMtEit2O.js +0 -1
- streamlit/static/static/js/index.CkRlykEE.js +0 -12
- streamlit/static/static/js/index.CmN3FXfI.js +0 -1617
- streamlit/static/static/js/index.CwbFI1_-.js +0 -1
- streamlit/static/static/js/index.D2KPNy7e.js +0 -1
- streamlit/static/static/js/index.DGAh7DMq.js +0 -1
- streamlit/static/static/js/index.DKb_NvmG.js +0 -197
- streamlit/static/static/js/index.DMqgUYKq.js +0 -1
- streamlit/static/static/js/index.DX1xY89g.js +0 -1
- streamlit/static/static/js/index.DYATBCsq.js +0 -2
- streamlit/static/static/js/index.DaSmGJ76.js +0 -3
- streamlit/static/static/js/index.Dd7bMeLP.js +0 -1
- streamlit/static/static/js/index.DjmmgI5U.js +0 -1
- streamlit/static/static/js/index.Dq56CyM2.js +0 -1
- streamlit/static/static/js/index.DuiXaS5_.js +0 -7
- streamlit/static/static/js/index.DvFidMLe.js +0 -2
- streamlit/static/static/js/index.DwkhC5Pc.js +0 -1
- streamlit/static/static/js/index.Q-3sFn1v.js +0 -1
- streamlit/static/static/js/index.QJ5QO9sJ.js +0 -1
- streamlit/static/static/js/index.VwTaeety.js +0 -1
- streamlit/static/static/js/index.YOqQbeX8.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DRwAw1In.js +0 -9
- streamlit/static/static/js/uniqueId.oG4Gvj1v.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.F2R3eTeR.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +0 -1
- {streamlit-1.51.0.data → streamlit-1.52.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/WHEEL +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.51.0.dist-info → streamlit-1.52.1.dist-info}/top_level.txt +0 -0
|
@@ -30,6 +30,8 @@ from typing import (
|
|
|
30
30
|
overload,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
+
from typing_extensions import Required
|
|
34
|
+
|
|
33
35
|
from streamlit import dataframe_util
|
|
34
36
|
from streamlit import logger as _logger
|
|
35
37
|
from streamlit.deprecation_util import (
|
|
@@ -51,7 +53,7 @@ from streamlit.elements.lib.column_config_utils import (
|
|
|
51
53
|
)
|
|
52
54
|
from streamlit.elements.lib.form_utils import current_form_id
|
|
53
55
|
from streamlit.elements.lib.layout_utils import (
|
|
54
|
-
|
|
56
|
+
Height,
|
|
55
57
|
LayoutConfig,
|
|
56
58
|
Width,
|
|
57
59
|
validate_height,
|
|
@@ -100,8 +102,8 @@ EditableData = TypeVar(
|
|
|
100
102
|
# All data types supported by the data editor.
|
|
101
103
|
DataTypes: TypeAlias = Union[
|
|
102
104
|
"pd.DataFrame",
|
|
103
|
-
"pd.Series",
|
|
104
|
-
"pd.Index",
|
|
105
|
+
"pd.Series[Any]",
|
|
106
|
+
"pd.Index[Any]",
|
|
105
107
|
"Styler",
|
|
106
108
|
"pa.Table",
|
|
107
109
|
"np.ndarray[Any, np.dtype[np.float64]]",
|
|
@@ -131,9 +133,9 @@ class EditingState(TypedDict, total=False):
|
|
|
131
133
|
the deleted row.
|
|
132
134
|
"""
|
|
133
135
|
|
|
134
|
-
edited_rows: dict[int, dict[str, str | int | float | bool | None]]
|
|
135
|
-
added_rows: list[dict[str, str | int | float | bool | None]]
|
|
136
|
-
deleted_rows: list[int]
|
|
136
|
+
edited_rows: Required[dict[int, dict[str, str | int | float | bool | None]]]
|
|
137
|
+
added_rows: Required[list[dict[str, str | int | float | bool | None]]]
|
|
138
|
+
deleted_rows: Required[list[int]]
|
|
137
139
|
|
|
138
140
|
|
|
139
141
|
@dataclass
|
|
@@ -141,25 +143,26 @@ class DataEditorSerde:
|
|
|
141
143
|
"""DataEditorSerde is used to serialize and deserialize the data editor state."""
|
|
142
144
|
|
|
143
145
|
def deserialize(self, ui_value: str | None) -> EditingState:
|
|
144
|
-
data_editor_state: EditingState = (
|
|
146
|
+
data_editor_state: EditingState = cast(
|
|
147
|
+
"EditingState",
|
|
145
148
|
{
|
|
146
149
|
"edited_rows": {},
|
|
147
150
|
"added_rows": [],
|
|
148
151
|
"deleted_rows": [],
|
|
149
152
|
}
|
|
150
153
|
if ui_value is None
|
|
151
|
-
else json.loads(ui_value)
|
|
154
|
+
else json.loads(ui_value),
|
|
152
155
|
)
|
|
153
156
|
|
|
154
157
|
# Make sure that all editing state keys are present:
|
|
155
158
|
if "edited_rows" not in data_editor_state:
|
|
156
|
-
data_editor_state["edited_rows"] = {}
|
|
159
|
+
data_editor_state["edited_rows"] = {} # type: ignore[unreachable]
|
|
157
160
|
|
|
158
161
|
if "deleted_rows" not in data_editor_state:
|
|
159
|
-
data_editor_state["deleted_rows"] = []
|
|
162
|
+
data_editor_state["deleted_rows"] = [] # type: ignore[unreachable]
|
|
160
163
|
|
|
161
164
|
if "added_rows" not in data_editor_state:
|
|
162
|
-
data_editor_state["added_rows"] = []
|
|
165
|
+
data_editor_state["added_rows"] = [] # type: ignore[unreachable]
|
|
163
166
|
|
|
164
167
|
# Convert the keys (numerical row positions) to integers.
|
|
165
168
|
# The keys are strings because they are serialized to JSON.
|
|
@@ -198,7 +201,7 @@ def _parse_value(
|
|
|
198
201
|
import pandas as pd
|
|
199
202
|
|
|
200
203
|
try:
|
|
201
|
-
if column_data_kind
|
|
204
|
+
if column_data_kind in (ColumnDataKind.LIST, ColumnDataKind.EMPTY):
|
|
202
205
|
return list(value) if is_list_like(value) else [value] # ty: ignore
|
|
203
206
|
|
|
204
207
|
if column_data_kind == ColumnDataKind.STRING:
|
|
@@ -209,7 +212,7 @@ def _parse_value(
|
|
|
209
212
|
# This isn't expected to happen.
|
|
210
213
|
if isinstance(value, list):
|
|
211
214
|
raise TypeError( # noqa: TRY301
|
|
212
|
-
"List values are only supported by list and
|
|
215
|
+
"List values are only supported by list, string and empty columns."
|
|
213
216
|
)
|
|
214
217
|
|
|
215
218
|
if column_data_kind == ColumnDataKind.INTEGER:
|
|
@@ -237,8 +240,8 @@ def _parse_value(
|
|
|
237
240
|
]:
|
|
238
241
|
datetime_value = pd.Timestamp(value) # ty: ignore
|
|
239
242
|
|
|
240
|
-
if
|
|
241
|
-
return None
|
|
243
|
+
if pd.isna(datetime_value):
|
|
244
|
+
return None # type: ignore[unreachable]
|
|
242
245
|
|
|
243
246
|
if column_data_kind == ColumnDataKind.DATETIME:
|
|
244
247
|
return datetime_value
|
|
@@ -295,7 +298,7 @@ def _apply_cell_edits(
|
|
|
295
298
|
)
|
|
296
299
|
else:
|
|
297
300
|
col_pos = df.columns.get_loc(col_name)
|
|
298
|
-
df.iat[row_pos, col_pos] = _parse_value(
|
|
301
|
+
df.iat[row_pos, col_pos] = _parse_value( # type: ignore
|
|
299
302
|
value, dataframe_schema[col_name]
|
|
300
303
|
)
|
|
301
304
|
|
|
@@ -320,6 +323,20 @@ def _parse_added_row(
|
|
|
320
323
|
return index_value, new_row
|
|
321
324
|
|
|
322
325
|
|
|
326
|
+
def _assign_row_values(
|
|
327
|
+
df: pd.DataFrame,
|
|
328
|
+
row_label: Any,
|
|
329
|
+
row_values: list[Any],
|
|
330
|
+
) -> None:
|
|
331
|
+
"""Assign values to a dataframe row via a mapping.
|
|
332
|
+
|
|
333
|
+
This avoids numpy attempting to coerce nested sequences (e.g. lists) into
|
|
334
|
+
multi-dimensional arrays when a column legitimately stores list values.
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
df.loc[row_label] = dict(zip(df.columns, row_values, strict=True))
|
|
338
|
+
|
|
339
|
+
|
|
323
340
|
def _apply_row_additions(
|
|
324
341
|
df: pd.DataFrame,
|
|
325
342
|
added_rows: list[dict[str, Any]],
|
|
@@ -376,13 +393,13 @@ def _apply_row_additions(
|
|
|
376
393
|
# already exists. In the future, it would be better to
|
|
377
394
|
# require users to provide unique non-None values for the index with
|
|
378
395
|
# some kind of visual indications.
|
|
379
|
-
df
|
|
396
|
+
_assign_row_values(df, index_value, new_row)
|
|
380
397
|
continue
|
|
381
398
|
|
|
382
399
|
if index_stop is not None and index_step is not None:
|
|
383
400
|
# Case 2: Range or integer index that can be auto incremented.
|
|
384
401
|
# Add row using the next value in the sequence
|
|
385
|
-
df
|
|
402
|
+
_assign_row_values(df, index_stop, new_row)
|
|
386
403
|
# Increment to the next range index value
|
|
387
404
|
index_stop += index_step
|
|
388
405
|
continue
|
|
@@ -442,7 +459,7 @@ def _apply_dataframe_edits(
|
|
|
442
459
|
_apply_row_additions(df, data_editor_state["added_rows"], dataframe_schema)
|
|
443
460
|
|
|
444
461
|
|
|
445
|
-
def _is_supported_index(df_index: pd.Index) -> bool:
|
|
462
|
+
def _is_supported_index(df_index: pd.Index[Any]) -> bool:
|
|
446
463
|
"""Check if the index is supported by the data editor component.
|
|
447
464
|
|
|
448
465
|
Parameters
|
|
@@ -558,7 +575,7 @@ def _check_type_compatibilities(
|
|
|
558
575
|
indices = [(INDEX_IDENTIFIER, data_df.index)]
|
|
559
576
|
|
|
560
577
|
for column in indices + list(data_df.items()):
|
|
561
|
-
column_name
|
|
578
|
+
column_name = str(column[0])
|
|
562
579
|
column_data_kind = dataframe_schema[column_name]
|
|
563
580
|
|
|
564
581
|
# TODO(lukasmasuch): support column config via numerical index here?
|
|
@@ -596,7 +613,7 @@ class DataEditorMixin:
|
|
|
596
613
|
data: EditableData,
|
|
597
614
|
*,
|
|
598
615
|
width: Width = "stretch",
|
|
599
|
-
height:
|
|
616
|
+
height: Height | Literal["auto"] = "auto",
|
|
600
617
|
use_container_width: bool | None = None,
|
|
601
618
|
hide_index: bool | None = None,
|
|
602
619
|
column_order: Iterable[str] | None = None,
|
|
@@ -608,6 +625,7 @@ class DataEditorMixin:
|
|
|
608
625
|
args: WidgetArgs | None = None,
|
|
609
626
|
kwargs: WidgetKwargs | None = None,
|
|
610
627
|
row_height: int | None = None,
|
|
628
|
+
placeholder: str | None = None,
|
|
611
629
|
) -> EditableData:
|
|
612
630
|
pass
|
|
613
631
|
|
|
@@ -617,7 +635,7 @@ class DataEditorMixin:
|
|
|
617
635
|
data: Any,
|
|
618
636
|
*,
|
|
619
637
|
width: Width = "stretch",
|
|
620
|
-
height:
|
|
638
|
+
height: Height | Literal["auto"] = "auto",
|
|
621
639
|
use_container_width: bool | None = None,
|
|
622
640
|
hide_index: bool | None = None,
|
|
623
641
|
column_order: Iterable[str] | None = None,
|
|
@@ -629,6 +647,7 @@ class DataEditorMixin:
|
|
|
629
647
|
args: WidgetArgs | None = None,
|
|
630
648
|
kwargs: WidgetKwargs | None = None,
|
|
631
649
|
row_height: int | None = None,
|
|
650
|
+
placeholder: str | None = None,
|
|
632
651
|
) -> pd.DataFrame:
|
|
633
652
|
pass
|
|
634
653
|
|
|
@@ -638,7 +657,7 @@ class DataEditorMixin:
|
|
|
638
657
|
data: DataTypes,
|
|
639
658
|
*,
|
|
640
659
|
width: Width = "stretch",
|
|
641
|
-
height:
|
|
660
|
+
height: Height | Literal["auto"] = "auto",
|
|
642
661
|
use_container_width: bool | None = None,
|
|
643
662
|
hide_index: bool | None = None,
|
|
644
663
|
column_order: Iterable[str] | None = None,
|
|
@@ -650,6 +669,7 @@ class DataEditorMixin:
|
|
|
650
669
|
args: WidgetArgs | None = None,
|
|
651
670
|
kwargs: WidgetKwargs | None = None,
|
|
652
671
|
row_height: int | None = None,
|
|
672
|
+
placeholder: str | None = None,
|
|
653
673
|
) -> DataTypes:
|
|
654
674
|
"""Display a data editor widget.
|
|
655
675
|
|
|
@@ -690,11 +710,14 @@ class DataEditorMixin:
|
|
|
690
710
|
the parent container, the width of the editor matches the width
|
|
691
711
|
of the parent container.
|
|
692
712
|
|
|
693
|
-
height :
|
|
694
|
-
The height of the editor. This can be one of the following:
|
|
713
|
+
height : "auto", "content", "stretch", or int
|
|
714
|
+
The height of the data editor. This can be one of the following:
|
|
695
715
|
|
|
696
716
|
- ``"auto"`` (default): Streamlit sets the height to show at most
|
|
697
717
|
ten rows.
|
|
718
|
+
- ``"content"``: The height of the editor matches the height of
|
|
719
|
+
its content. The height is capped at 10,000 pixels to prevent
|
|
720
|
+
performance issues with very large dataframes.
|
|
698
721
|
- ``"stretch"``: The height of the editor expands to fill the
|
|
699
722
|
available vertical space in its parent container. When multiple
|
|
700
723
|
elements with stretch height are in the same container, they
|
|
@@ -802,6 +825,12 @@ class DataEditorMixin:
|
|
|
802
825
|
is ``None`` (default), Streamlit will use a default row height,
|
|
803
826
|
which fits one line of text.
|
|
804
827
|
|
|
828
|
+
placeholder : str or None
|
|
829
|
+
The text that should be shown for missing values. If this is
|
|
830
|
+
``None`` (default), missing values are displayed as "None". To
|
|
831
|
+
leave a cell empty, use an empty string (``""``). Other common
|
|
832
|
+
values are ``"null"``, ``"NaN"`` and ``"-"``.
|
|
833
|
+
|
|
805
834
|
Returns
|
|
806
835
|
-------
|
|
807
836
|
pandas.DataFrame, pandas.Series, pyarrow.Table, numpy.ndarray, list, set, tuple, or dict.
|
|
@@ -907,7 +936,7 @@ class DataEditorMixin:
|
|
|
907
936
|
validate_width(width, allow_content=True)
|
|
908
937
|
validate_height(
|
|
909
938
|
height,
|
|
910
|
-
allow_content=
|
|
939
|
+
allow_content=True,
|
|
911
940
|
allow_stretch=True,
|
|
912
941
|
additional_allowed=["auto"],
|
|
913
942
|
)
|
|
@@ -971,10 +1000,10 @@ class DataEditorMixin:
|
|
|
971
1000
|
for column_name, column_data in data_df.items():
|
|
972
1001
|
if dataframe_util.is_colum_type_arrow_incompatible(column_data):
|
|
973
1002
|
update_column_config(
|
|
974
|
-
column_config_mapping, column_name, {"disabled": True}
|
|
1003
|
+
column_config_mapping, str(column_name), {"disabled": True}
|
|
975
1004
|
)
|
|
976
1005
|
# Convert incompatible type to string
|
|
977
|
-
data_df[column_name] = column_data.astype("string")
|
|
1006
|
+
data_df[cast("Any", column_name)] = column_data.astype("string")
|
|
978
1007
|
|
|
979
1008
|
apply_data_specific_configs(column_config_mapping, data_format)
|
|
980
1009
|
|
|
@@ -989,6 +1018,13 @@ class DataEditorMixin:
|
|
|
989
1018
|
update_column_config(
|
|
990
1019
|
column_config_mapping, INDEX_IDENTIFIER, {"required": True}
|
|
991
1020
|
)
|
|
1021
|
+
if num_rows == "dynamic" and hide_index is True:
|
|
1022
|
+
_LOGGER.warning(
|
|
1023
|
+
"Setting `hide_index=True` in data editor with a non-range index will not have any effect "
|
|
1024
|
+
"when `num_rows='dynamic'`. It is required for the user to fill in index values for "
|
|
1025
|
+
"adding new rows. To hide the index, make sure to set the DataFrame "
|
|
1026
|
+
"index to a range index."
|
|
1027
|
+
)
|
|
992
1028
|
|
|
993
1029
|
if hide_index is None and has_range_index and num_rows == "dynamic":
|
|
994
1030
|
# Temporary workaround:
|
|
@@ -1042,6 +1078,7 @@ class DataEditorMixin:
|
|
|
1042
1078
|
column_config_mapping=str(column_config_mapping),
|
|
1043
1079
|
num_rows=num_rows,
|
|
1044
1080
|
row_height=row_height,
|
|
1081
|
+
placeholder=placeholder,
|
|
1045
1082
|
)
|
|
1046
1083
|
|
|
1047
1084
|
proto = ArrowProto()
|
|
@@ -1053,6 +1090,9 @@ class DataEditorMixin:
|
|
|
1053
1090
|
if column_order:
|
|
1054
1091
|
proto.column_order[:] = column_order
|
|
1055
1092
|
|
|
1093
|
+
if placeholder is not None:
|
|
1094
|
+
proto.placeholder = placeholder
|
|
1095
|
+
|
|
1056
1096
|
# Only set disabled to true if it is actually true
|
|
1057
1097
|
# It can also be a list of columns, which should result in false here.
|
|
1058
1098
|
proto.disabled = disabled is True
|
|
@@ -483,7 +483,10 @@ class FileUploaderMixin:
|
|
|
483
483
|
element_id = compute_and_register_element_id(
|
|
484
484
|
"file_uploader",
|
|
485
485
|
user_key=key,
|
|
486
|
-
|
|
486
|
+
# Treat the provided key as the main identity; only include
|
|
487
|
+
# changes to the type and accept_multiple_files parameters in
|
|
488
|
+
# the identity computation as those can invalidate the current value.
|
|
489
|
+
key_as_main_identity={"type", "accept_multiple_files"},
|
|
487
490
|
dg=self.dg,
|
|
488
491
|
label=label,
|
|
489
492
|
type=type,
|
|
@@ -353,6 +353,8 @@ class NumberInputMixin:
|
|
|
353
353
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
|
354
354
|
font library.
|
|
355
355
|
|
|
356
|
+
- ``"spinner"``: Displays a spinner as an icon.
|
|
357
|
+
|
|
356
358
|
width : "stretch" or int
|
|
357
359
|
The width of the number input widget. This can be one of the
|
|
358
360
|
following:
|
|
@@ -243,6 +243,8 @@ class TextWidgetsMixin:
|
|
|
243
243
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
|
244
244
|
font library.
|
|
245
245
|
|
|
246
|
+
- ``"spinner"``: Displays a spinner as an icon.
|
|
247
|
+
|
|
246
248
|
width : "stretch" or int
|
|
247
249
|
The width of the text input widget. This can be one of the
|
|
248
250
|
following:
|