streamlit-nightly 1.45.1.dev20250504__py3-none-any.whl → 1.45.1.dev20250506__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 +4 -1
- streamlit/column_config.py +11 -9
- streamlit/commands/execution_control.py +5 -6
- streamlit/commands/logo.py +7 -2
- streamlit/components/v1/components.py +1 -1
- streamlit/connections/__init__.py +2 -2
- streamlit/connections/base_connection.py +2 -2
- streamlit/connections/snowflake_connection.py +4 -3
- streamlit/dataframe_util.py +2 -1
- streamlit/delta_generator.py +17 -37
- streamlit/elements/alert.py +1 -1
- streamlit/elements/arrow.py +3 -3
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/exception.py +5 -1
- streamlit/elements/json.py +1 -1
- streamlit/elements/layouts.py +3 -9
- streamlit/elements/lib/built_in_chart_utils.py +14 -6
- streamlit/elements/lib/column_config_utils.py +1 -3
- streamlit/elements/lib/column_types.py +2 -2
- streamlit/elements/lib/dialog.py +2 -1
- streamlit/elements/lib/file_uploader_utils.py +7 -2
- streamlit/elements/lib/js_number.py +4 -4
- streamlit/elements/lib/options_selector_utils.py +9 -6
- streamlit/elements/media.py +8 -7
- streamlit/elements/metric.py +4 -4
- streamlit/elements/progress.py +1 -1
- streamlit/elements/vega_charts.py +2 -2
- streamlit/elements/widgets/button.py +5 -6
- streamlit/elements/widgets/number_input.py +81 -28
- streamlit/elements/widgets/slider.py +87 -35
- streamlit/elements/widgets/time_widgets.py +43 -0
- streamlit/errors.py +9 -6
- streamlit/proto/DateInput_pb2.py +4 -3
- streamlit/proto/DateInput_pb2.pyi +8 -2
- streamlit/proto/TimeInput_pb2.py +4 -3
- streamlit/proto/TimeInput_pb2.pyi +9 -2
- streamlit/runtime/__init__.py +1 -1
- streamlit/runtime/caching/__init__.py +6 -6
- streamlit/runtime/caching/cache_data_api.py +7 -9
- streamlit/runtime/caching/hashing.py +1 -1
- streamlit/runtime/caching/storage/cache_storage_protocol.py +1 -1
- streamlit/runtime/connection_factory.py +1 -1
- streamlit/runtime/credentials.py +4 -4
- streamlit/runtime/fragment.py +2 -2
- streamlit/runtime/metrics_util.py +2 -2
- streamlit/runtime/runtime.py +1 -1
- streamlit/runtime/runtime_util.py +2 -1
- streamlit/runtime/scriptrunner/__init__.py +4 -4
- streamlit/runtime/scriptrunner/script_runner.py +6 -9
- streamlit/runtime/scriptrunner_utils/script_run_context.py +1 -0
- streamlit/runtime/secrets.py +15 -8
- streamlit/runtime/state/__init__.py +5 -5
- streamlit/runtime/state/query_params.py +8 -8
- streamlit/runtime/state/session_state.py +8 -1
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.Bp4VdNOc.js → ErrorOutline.esm.BgsGCsV4.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.hVzDDDNS.js → FileDownload.esm.CCKezPn5.js} +1 -1
- streamlit/static/static/js/{FileHelper.BGcyDQ_S.js → FileHelper.CprSF_kT.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.a0IiSXcn.js → FormClearHelper.DiwQ0EtT.js} +1 -1
- streamlit/static/static/js/{Hooks.C2dZkryw.js → Hooks.DDqhyZ1_.js} +1 -1
- streamlit/static/static/js/{InputInstructions.Cn0WICoN.js → InputInstructions.BCEZxme4.js} +1 -1
- streamlit/static/static/js/{ProgressBar.VRmRPHtW.js → ProgressBar.CGdY94g_.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CZa97lrw.js → RenderInPortalIfExists.uGJp_Q0v.js} +1 -1
- streamlit/static/static/js/{Toolbar.DJZBBDvl.js → Toolbar.hTlw0-K1.js} +1 -1
- streamlit/static/static/js/{base-input.CzerGAEH.js → base-input.mGTY3-qU.js} +1 -1
- streamlit/static/static/js/{checkbox.C6Sj4eVw.js → checkbox.Cg-5cKAh.js} +1 -1
- streamlit/static/static/js/{createSuper.C7yhRETi.js → createSuper.-HPb1oYT.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DAgcbVks.js → data-grid-overlay-editor.BpNYxiTp.js} +1 -1
- streamlit/static/static/js/{downloader.B8HL-u_1.js → downloader.DS9891pS.js} +1 -1
- streamlit/static/static/js/{es6.BxAW_jrO.js → es6.CU1PEL2w.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CS8fz-W7.js → iframeResizer.contentWindow.CgJE2bJN.js} +1 -1
- streamlit/static/static/js/{index.BwnckS8e.js → index.B209tswL.js} +1 -1
- streamlit/static/static/js/{index.C7t1-CQQ.js → index.BC0ueJ8H.js} +1 -1
- streamlit/static/static/js/{index.DWb5kgxt.js → index.BHVQ94t4.js} +1 -1
- streamlit/static/static/js/{index.DgOrPDFa.js → index.BT0p7gAu.js} +1 -1
- streamlit/static/static/js/{index.uOOdkOMl.js → index.BTTj6ld4.js} +1 -1
- streamlit/static/static/js/{index.CG2pASlR.js → index.BVjgrQ4R.js} +1 -1
- streamlit/static/static/js/{index.6jptdEp6.js → index.BXYstdPh.js} +1 -1
- streamlit/static/static/js/{index.Dt0FtS-M.js → index.BZ9mqzEJ.js} +1 -1
- streamlit/static/static/js/{index.CSAdYIt3.js → index.Bb-Ukg41.js} +1 -1
- streamlit/static/static/js/{index.B2tTSlE1.js → index.BhTok8vt.js} +1 -1
- streamlit/static/static/js/{index.DIZcktIN.js → index.Bph6ZoI5.js} +1 -1
- streamlit/static/static/js/{index.B7UKH_JX.js → index.CJPcdxPe.js} +1 -1
- streamlit/static/static/js/{index.D6KElXAI.js → index.CMOA-8Q2.js} +1 -1
- streamlit/static/static/js/{index.Cxp7siQJ.js → index.CN91oQMB.js} +5 -5
- streamlit/static/static/js/{index.Cr1JUXmf.js → index.CtoDsUtq.js} +1 -1
- streamlit/static/static/js/{index.C4KrRG3c.js → index.CvFsF3FD.js} +1 -1
- streamlit/static/static/js/{index.DDCep3pE.js → index.CyGuL4If.js} +1 -1
- streamlit/static/static/js/{index.ChOkUAuD.js → index.CzGUd4IN.js} +1 -1
- streamlit/static/static/js/{index.A_t8lw--.js → index.DAxf3_iz.js} +1 -1
- streamlit/static/static/js/{index.DG9Swsby.js → index.DJHUlWgy.js} +1 -1
- streamlit/static/static/js/{index.CHL4u91M.js → index.DLTqo4pp.js} +1 -1
- streamlit/static/static/js/{index.o12m2E2P.js → index.DPJBu2uZ.js} +1 -1
- streamlit/static/static/js/{index.CLFopaXS.js → index.DVpzZJNg.js} +1 -1
- streamlit/static/static/js/{index.vdE-PayY.js → index.DWV80Vyw.js} +1 -1
- streamlit/static/static/js/{index.DR2lTx8N.js → index.DZ6oX-v9.js} +5 -5
- streamlit/static/static/js/{index.DtY8dAVN.js → index.Dh4RKl-F.js} +1 -1
- streamlit/static/static/js/{index.BRtyx04t.js → index.Dn76KVNf.js} +1 -1
- streamlit/static/static/js/{index.qMnAjj-G.js → index.DtqvdV-p.js} +1 -1
- streamlit/static/static/js/{index.BwlA1Cf_.js → index.ErkF0SoX.js} +1 -1
- streamlit/static/static/js/{index.QdRaJV_a.js → index.GSYBrzVp.js} +1 -1
- streamlit/static/static/js/{index.CSPC2m_c.js → index.OngWTN39.js} +1 -1
- streamlit/static/static/js/{index.CGzwdjEF.js → index.PSwG8ayC.js} +1 -1
- streamlit/static/static/js/{index.D_0HKLRm.js → index.UTlCdasa.js} +1 -1
- streamlit/static/static/js/{index.aBgCjIEX.js → index.eR_vQpeg.js} +1 -1
- streamlit/static/static/js/{index.BBClg-gm.js → index.fLsU9uCJ.js} +1 -1
- streamlit/static/static/js/{index.BDzCUpOG.js → index.hPjr68pz.js} +1 -1
- streamlit/static/static/js/{index.CgzjjllY.js → index.kXOZCC_6.js} +1 -1
- streamlit/static/static/js/{input.qNZgmgfK.js → input.DY17i94N.js} +1 -1
- streamlit/static/static/js/{memory.DifcSUze.js → memory.DsIIcbSd.js} +1 -1
- streamlit/static/static/js/{mergeWith.Bykfc0n-.js → mergeWith.cRgGdgvI.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.D_L9PQiU.js → number-overlay-editor.B8Xi2dYq.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.Cyeph4pU.js → possibleConstructorReturn.BgDi5nUm.js} +1 -1
- streamlit/static/static/js/{sandbox.DT6zcSKI.js → sandbox.BH9emp13.js} +1 -1
- streamlit/static/static/js/{textarea.C46FrViu.js → textarea.DAyShsGG.js} +1 -1
- streamlit/static/static/js/{timepicker.N6lFakQJ.js → timepicker.CCH2R2Y0.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DwaNiLbv.js → toConsumableArray.CNffSDCu.js} +1 -1
- streamlit/static/static/js/{uniqueId.bNZuA9Mz.js → uniqueId.B49CstkV.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.qUuCVRZV.js → useBasicWidgetState.CkThOkF9.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CylEhpc7.js → useOnInputChange.BqEq0xFZ.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BQay_j7X.js → withFullScreenWrapper.UsvF_Jwr.js} +1 -1
- streamlit/string_util.py +8 -5
- streamlit/web/bootstrap.py +5 -4
- streamlit/web/cli.py +2 -1
- streamlit/web/server/__init__.py +2 -2
- streamlit/web/server/browser_websocket_handler.py +3 -2
- streamlit/web/server/component_request_handler.py +7 -7
- streamlit/web/server/media_file_handler.py +2 -2
- streamlit/web/server/oauth_authlib_routes.py +3 -3
- streamlit/web/server/routes.py +2 -2
- streamlit/web/server/server.py +4 -4
- streamlit/web/server/upload_file_request_handler.py +4 -3
- streamlit/web/server/websocket_headers.py +1 -1
- {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/RECORD +139 -139
- {streamlit_nightly-1.45.1.dev20250504.data → streamlit_nightly-1.45.1.dev20250506.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/top_level.txt +0 -0
@@ -940,10 +940,9 @@ class ButtonMixin:
|
|
940
940
|
if is_url(page):
|
941
941
|
if label is None or label == "":
|
942
942
|
raise StreamlitMissingPageLabelError()
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
return self.dg._enqueue("page_link", page_link_proto)
|
943
|
+
page_link_proto.page = page
|
944
|
+
page_link_proto.external = True
|
945
|
+
return self.dg._enqueue("page_link", page_link_proto)
|
947
946
|
|
948
947
|
ctx_main_script = ""
|
949
948
|
all_app_pages = {}
|
@@ -1028,7 +1027,7 @@ class ButtonMixin:
|
|
1028
1027
|
raise StreamlitAPIException(
|
1029
1028
|
f"`st.button()` can't be used in an `st.form()`.{FORM_DOCS_INFO}"
|
1030
1029
|
)
|
1031
|
-
|
1030
|
+
if not is_in_form(self.dg) and is_form_submitter:
|
1032
1031
|
raise StreamlitAPIException(
|
1033
1032
|
f"`st.form_submit_button()` must be used inside an `st.form()`.{FORM_DOCS_INFO}"
|
1034
1033
|
)
|
@@ -1106,7 +1105,7 @@ def marshall_file(
|
|
1106
1105
|
data_as_bytes = data.read() or b""
|
1107
1106
|
mimetype = mimetype or "application/octet-stream"
|
1108
1107
|
else:
|
1109
|
-
raise
|
1108
|
+
raise StreamlitAPIException("Invalid binary data format: %s" % type(data))
|
1110
1109
|
|
1111
1110
|
if runtime.exists():
|
1112
1111
|
file_url = runtime.get_instance().media_file_mgr.add(
|
@@ -82,10 +82,6 @@ class NumberInputSerde:
|
|
82
82
|
|
83
83
|
|
84
84
|
class NumberInputMixin:
|
85
|
-
# For easier readability, all the arguments with un-changing types across these overload signatures have been
|
86
|
-
# collapsed onto a single line.
|
87
|
-
|
88
|
-
# fmt: off
|
89
85
|
# If "min_value: int" is given and all other numerical inputs are
|
90
86
|
# "int"s or not provided (value optionally being "min"), return "int"
|
91
87
|
# If "min_value: int, value: None" is given and all other numerical inputs
|
@@ -98,9 +94,19 @@ class NumberInputMixin:
|
|
98
94
|
max_value: int | None = None,
|
99
95
|
value: IntOrNone | Literal["min"] = "min",
|
100
96
|
step: int | None = None,
|
101
|
-
format: str | None = None,
|
102
|
-
|
103
|
-
|
97
|
+
format: str | None = None,
|
98
|
+
key: Key | None = None,
|
99
|
+
help: str | None = None,
|
100
|
+
on_change: WidgetCallback | None = None,
|
101
|
+
args: WidgetArgs | None = None,
|
102
|
+
kwargs: WidgetKwargs | None = None,
|
103
|
+
*,
|
104
|
+
placeholder: str | None = None,
|
105
|
+
disabled: bool = False,
|
106
|
+
label_visibility: LabelVisibility = "visible",
|
107
|
+
icon: str | None = None,
|
108
|
+
width: WidthWithoutContent = "stretch",
|
109
|
+
) -> int | IntOrNone: ...
|
104
110
|
|
105
111
|
# If "max_value: int" is given and all other numerical inputs are
|
106
112
|
# "int"s or not provided (value optionally being "min"), return "int"
|
@@ -115,9 +121,18 @@ class NumberInputMixin:
|
|
115
121
|
max_value: int,
|
116
122
|
value: IntOrNone | Literal["min"] = "min",
|
117
123
|
step: int | None = None,
|
118
|
-
format: str | None = None,
|
119
|
-
|
120
|
-
|
124
|
+
format: str | None = None,
|
125
|
+
key: Key | None = None,
|
126
|
+
help: str | None = None,
|
127
|
+
on_change: WidgetCallback | None = None,
|
128
|
+
args: WidgetArgs | None = None,
|
129
|
+
kwargs: WidgetKwargs | None = None,
|
130
|
+
placeholder: str | None = None,
|
131
|
+
disabled: bool = False,
|
132
|
+
label_visibility: LabelVisibility = "visible",
|
133
|
+
icon: str | None = None,
|
134
|
+
width: WidthWithoutContent = "stretch",
|
135
|
+
) -> int | IntOrNone: ...
|
121
136
|
|
122
137
|
# If "value=int" is given and all other numerical inputs are "int"s
|
123
138
|
# or not provided, return "int"
|
@@ -130,9 +145,18 @@ class NumberInputMixin:
|
|
130
145
|
*,
|
131
146
|
value: int,
|
132
147
|
step: int | None = None,
|
133
|
-
format: str | None = None,
|
134
|
-
|
135
|
-
|
148
|
+
format: str | None = None,
|
149
|
+
key: Key | None = None,
|
150
|
+
help: str | None = None,
|
151
|
+
on_change: WidgetCallback | None = None,
|
152
|
+
args: WidgetArgs | None = None,
|
153
|
+
kwargs: WidgetKwargs | None = None,
|
154
|
+
placeholder: str | None = None,
|
155
|
+
disabled: bool = False,
|
156
|
+
label_visibility: LabelVisibility = "visible",
|
157
|
+
icon: str | None = None,
|
158
|
+
width: WidthWithoutContent = "stretch",
|
159
|
+
) -> int: ...
|
136
160
|
|
137
161
|
# If "step=int" is given and all other numerical inputs are "int"s
|
138
162
|
# or not provided (value optionally being "min"), return "int"
|
@@ -147,9 +171,18 @@ class NumberInputMixin:
|
|
147
171
|
value: IntOrNone | Literal["min"] = "min",
|
148
172
|
*,
|
149
173
|
step: int,
|
150
|
-
format: str | None = None,
|
151
|
-
|
152
|
-
|
174
|
+
format: str | None = None,
|
175
|
+
key: Key | None = None,
|
176
|
+
help: str | None = None,
|
177
|
+
on_change: WidgetCallback | None = None,
|
178
|
+
args: WidgetArgs | None = None,
|
179
|
+
kwargs: WidgetKwargs | None = None,
|
180
|
+
placeholder: str | None = None,
|
181
|
+
disabled: bool = False,
|
182
|
+
label_visibility: LabelVisibility = "visible",
|
183
|
+
icon: str | None = None,
|
184
|
+
width: WidthWithoutContent = "stretch",
|
185
|
+
) -> int | IntOrNone: ...
|
153
186
|
|
154
187
|
# If all numerical inputs are floats (with value optionally being "min")
|
155
188
|
# or are not provided, return "float"
|
@@ -163,10 +196,19 @@ class NumberInputMixin:
|
|
163
196
|
max_value: float | None = None,
|
164
197
|
value: FloatOrNone | Literal["min"] = "min",
|
165
198
|
step: float | None = None,
|
166
|
-
format: str | None = None,
|
167
|
-
|
168
|
-
|
169
|
-
|
199
|
+
format: str | None = None,
|
200
|
+
key: Key | None = None,
|
201
|
+
help: str | None = None,
|
202
|
+
on_change: WidgetCallback | None = None,
|
203
|
+
args: WidgetArgs | None = None,
|
204
|
+
kwargs: WidgetKwargs | None = None,
|
205
|
+
*,
|
206
|
+
placeholder: str | None = None,
|
207
|
+
disabled: bool = False,
|
208
|
+
label_visibility: LabelVisibility = "visible",
|
209
|
+
icon: str | None = None,
|
210
|
+
width: WidthWithoutContent = "stretch",
|
211
|
+
) -> float | FloatOrNone: ...
|
170
212
|
|
171
213
|
@gather_metrics("number_input")
|
172
214
|
def number_input(
|
@@ -426,7 +468,9 @@ class NumberInputMixin:
|
|
426
468
|
)
|
427
469
|
|
428
470
|
if not all_int_args and not all_float_args:
|
429
|
-
raise StreamlitMixedNumericTypesError(
|
471
|
+
raise StreamlitMixedNumericTypesError(
|
472
|
+
value=value, min_value=min_value, max_value=max_value, step=step
|
473
|
+
)
|
430
474
|
|
431
475
|
session_state = get_session_state().filtered_state
|
432
476
|
if key is not None and key in session_state and session_state[key] is None:
|
@@ -480,7 +524,6 @@ class NumberInputMixin:
|
|
480
524
|
except (TypeError, ValueError):
|
481
525
|
raise StreamlitInvalidNumberFormatError(number_format)
|
482
526
|
|
483
|
-
|
484
527
|
# Ensure that the value matches arguments' types.
|
485
528
|
all_ints = int_value and all_int_args
|
486
529
|
|
@@ -579,17 +622,27 @@ class NumberInputMixin:
|
|
579
622
|
deserializer=serde.deserialize,
|
580
623
|
serializer=serde.serialize,
|
581
624
|
ctx=ctx,
|
582
|
-
value_type="double_value"
|
625
|
+
value_type="double_value",
|
583
626
|
)
|
584
627
|
|
585
628
|
if widget_state.value_changed:
|
586
629
|
if widget_state.value is not None:
|
587
630
|
# Min/Max bounds checks when the value is updated.
|
588
|
-
if
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
raise
|
631
|
+
if (
|
632
|
+
number_input_proto.has_min
|
633
|
+
and widget_state.value < number_input_proto.min
|
634
|
+
):
|
635
|
+
raise StreamlitValueBelowMinError(
|
636
|
+
value=widget_state.value, min_value=number_input_proto.min
|
637
|
+
)
|
638
|
+
|
639
|
+
if (
|
640
|
+
number_input_proto.has_max
|
641
|
+
and widget_state.value > number_input_proto.max
|
642
|
+
):
|
643
|
+
raise StreamlitValueAboveMaxError(
|
644
|
+
value=widget_state.value, max_value=number_input_proto.max
|
645
|
+
)
|
593
646
|
|
594
647
|
number_input_proto.value = widget_state.value
|
595
648
|
number_input_proto.set_value = True
|
@@ -201,10 +201,6 @@ class SliderSerde:
|
|
201
201
|
|
202
202
|
|
203
203
|
class SliderMixin:
|
204
|
-
# For easier readability, all the arguments with un-changing types across these overload signatures have been
|
205
|
-
# collapsed onto a single line.
|
206
|
-
|
207
|
-
# fmt: off
|
208
204
|
# If min/max/value/step are not provided, then we return an int.
|
209
205
|
# if ONLY step is provided, then it must be an int and we return an int.
|
210
206
|
@overload
|
@@ -213,11 +209,18 @@ class SliderMixin:
|
|
213
209
|
label: str,
|
214
210
|
min_value: None = None,
|
215
211
|
max_value: None = None,
|
216
|
-
value:
|
212
|
+
value: None = None,
|
217
213
|
step: int | None = None,
|
218
|
-
format: str | None = None,
|
219
|
-
|
220
|
-
|
214
|
+
format: str | None = None,
|
215
|
+
key: Key | None = None,
|
216
|
+
help: str | None = None,
|
217
|
+
on_change: WidgetCallback | None = None,
|
218
|
+
args: WidgetArgs | None = None,
|
219
|
+
kwargs: WidgetKwargs | None = None,
|
220
|
+
*,
|
221
|
+
disabled: bool = False,
|
222
|
+
label_visibility: LabelVisibility = "visible",
|
223
|
+
) -> int: ...
|
221
224
|
|
222
225
|
# If min-value or max_value is provided and a numeric type, and value (if provided)
|
223
226
|
# is a singular numeric, return the same numeric type.
|
@@ -229,9 +232,16 @@ class SliderMixin:
|
|
229
232
|
max_value: SliderNumericT | None = None,
|
230
233
|
value: SliderNumericT | None = None,
|
231
234
|
step: StepNumericT[SliderNumericT] | None = None,
|
232
|
-
format: str | None = None,
|
233
|
-
|
234
|
-
|
235
|
+
format: str | None = None,
|
236
|
+
key: Key | None = None,
|
237
|
+
help: str | None = None,
|
238
|
+
on_change: WidgetCallback | None = None,
|
239
|
+
args: WidgetArgs | None = None,
|
240
|
+
kwargs: WidgetKwargs | None = None,
|
241
|
+
*,
|
242
|
+
disabled: bool = False,
|
243
|
+
label_visibility: LabelVisibility = "visible",
|
244
|
+
) -> SliderNumericT: ...
|
235
245
|
|
236
246
|
# If value is provided and a sequence of numeric type,
|
237
247
|
# return a tuple of the same numeric type.
|
@@ -244,9 +254,15 @@ class SliderMixin:
|
|
244
254
|
*,
|
245
255
|
value: SliderNumericSpanT[SliderNumericT],
|
246
256
|
step: StepNumericT[SliderNumericT] | None = None,
|
247
|
-
format: str | None = None,
|
248
|
-
|
249
|
-
|
257
|
+
format: str | None = None,
|
258
|
+
key: Key | None = None,
|
259
|
+
help: str | None = None,
|
260
|
+
on_change: WidgetCallback | None = None,
|
261
|
+
args: WidgetArgs | None = None,
|
262
|
+
kwargs: WidgetKwargs | None = None,
|
263
|
+
disabled: bool = False,
|
264
|
+
label_visibility: LabelVisibility = "visible",
|
265
|
+
) -> tuple[SliderNumericT, SliderNumericT]: ...
|
250
266
|
|
251
267
|
# If value is provided positionally and a sequence of numeric type,
|
252
268
|
# return a tuple of the same numeric type.
|
@@ -257,11 +273,17 @@ class SliderMixin:
|
|
257
273
|
min_value: SliderNumericT,
|
258
274
|
max_value: SliderNumericT,
|
259
275
|
value: SliderNumericSpanT[SliderNumericT],
|
260
|
-
/,
|
261
276
|
step: StepNumericT[SliderNumericT] | None = None,
|
262
|
-
format: str | None = None,
|
263
|
-
|
264
|
-
|
277
|
+
format: str | None = None,
|
278
|
+
key: Key | None = None,
|
279
|
+
help: str | None = None,
|
280
|
+
on_change: WidgetCallback | None = None,
|
281
|
+
args: WidgetArgs | None = None,
|
282
|
+
kwargs: WidgetKwargs | None = None,
|
283
|
+
*,
|
284
|
+
disabled: bool = False,
|
285
|
+
label_visibility: LabelVisibility = "visible",
|
286
|
+
) -> tuple[SliderNumericT, SliderNumericT]: ...
|
265
287
|
|
266
288
|
# If min-value is provided and a datelike type, and value (if provided)
|
267
289
|
# is a singular datelike, return the same datelike type.
|
@@ -273,9 +295,16 @@ class SliderMixin:
|
|
273
295
|
max_value: SliderDatelikeT | None = None,
|
274
296
|
value: SliderDatelikeT | None = None,
|
275
297
|
step: StepDatelikeT | None = None,
|
276
|
-
format: str | None = None,
|
277
|
-
|
278
|
-
|
298
|
+
format: str | None = None,
|
299
|
+
key: Key | None = None,
|
300
|
+
help: str | None = None,
|
301
|
+
on_change: WidgetCallback | None = None,
|
302
|
+
args: WidgetArgs | None = None,
|
303
|
+
kwargs: WidgetKwargs | None = None,
|
304
|
+
*,
|
305
|
+
disabled: bool = False,
|
306
|
+
label_visibility: LabelVisibility = "visible",
|
307
|
+
) -> SliderDatelikeT: ...
|
279
308
|
|
280
309
|
# If max-value is provided and a datelike type, and value (if provided)
|
281
310
|
# is a singular datelike, return the same datelike type.
|
@@ -288,9 +317,15 @@ class SliderMixin:
|
|
288
317
|
max_value: SliderDatelikeT,
|
289
318
|
value: SliderDatelikeT | None = None,
|
290
319
|
step: StepDatelikeT | None = None,
|
291
|
-
format: str | None = None,
|
292
|
-
|
293
|
-
|
320
|
+
format: str | None = None,
|
321
|
+
key: Key | None = None,
|
322
|
+
help: str | None = None,
|
323
|
+
on_change: WidgetCallback | None = None,
|
324
|
+
args: WidgetArgs | None = None,
|
325
|
+
kwargs: WidgetKwargs | None = None,
|
326
|
+
disabled: bool = False,
|
327
|
+
label_visibility: LabelVisibility = "visible",
|
328
|
+
) -> SliderDatelikeT: ...
|
294
329
|
|
295
330
|
# If value is provided and a datelike type, return the same datelike type.
|
296
331
|
@overload
|
@@ -302,9 +337,15 @@ class SliderMixin:
|
|
302
337
|
*,
|
303
338
|
value: SliderDatelikeT,
|
304
339
|
step: StepDatelikeT | None = None,
|
305
|
-
format: str | None = None,
|
306
|
-
|
307
|
-
|
340
|
+
format: str | None = None,
|
341
|
+
key: Key | None = None,
|
342
|
+
help: str | None = None,
|
343
|
+
on_change: WidgetCallback | None = None,
|
344
|
+
args: WidgetArgs | None = None,
|
345
|
+
kwargs: WidgetKwargs | None = None,
|
346
|
+
disabled: bool = False,
|
347
|
+
label_visibility: LabelVisibility = "visible",
|
348
|
+
) -> SliderDatelikeT: ...
|
308
349
|
|
309
350
|
# If value is provided and a sequence of datelike type,
|
310
351
|
# return a tuple of the same datelike type.
|
@@ -317,9 +358,15 @@ class SliderMixin:
|
|
317
358
|
*,
|
318
359
|
value: SliderDatelikeSpanT[SliderDatelikeT],
|
319
360
|
step: StepDatelikeT | None = None,
|
320
|
-
format: str | None = None,
|
321
|
-
|
322
|
-
|
361
|
+
format: str | None = None,
|
362
|
+
key: Key | None = None,
|
363
|
+
help: str | None = None,
|
364
|
+
on_change: WidgetCallback | None = None,
|
365
|
+
args: WidgetArgs | None = None,
|
366
|
+
kwargs: WidgetKwargs | None = None,
|
367
|
+
disabled: bool = False,
|
368
|
+
label_visibility: LabelVisibility = "visible",
|
369
|
+
) -> tuple[SliderDatelikeT, SliderDatelikeT]: ...
|
323
370
|
|
324
371
|
# If value is provided positionally and a sequence of datelike type,
|
325
372
|
# return a tuple of the same datelike type.
|
@@ -332,11 +379,16 @@ class SliderMixin:
|
|
332
379
|
value: SliderDatelikeSpanT[SliderDatelikeT],
|
333
380
|
/,
|
334
381
|
step: StepDatelikeT | None = None,
|
335
|
-
format: str | None = None,
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
382
|
+
format: str | None = None,
|
383
|
+
key: Key | None = None,
|
384
|
+
help: str | None = None,
|
385
|
+
on_change: WidgetCallback | None = None,
|
386
|
+
args: WidgetArgs | None = None,
|
387
|
+
kwargs: WidgetKwargs | None = None,
|
388
|
+
*,
|
389
|
+
disabled: bool = False,
|
390
|
+
label_visibility: LabelVisibility = "visible",
|
391
|
+
) -> tuple[SliderDatelikeT, SliderDatelikeT]: ...
|
340
392
|
|
341
393
|
# https://github.com/python/mypy/issues/17614
|
342
394
|
@gather_metrics("slider") # type: ignore[misc]
|
@@ -31,6 +31,7 @@ from typing import (
|
|
31
31
|
from typing_extensions import TypeAlias
|
32
32
|
|
33
33
|
from streamlit.elements.lib.form_utils import current_form_id
|
34
|
+
from streamlit.elements.lib.layout_utils import WidthWithoutContent, validate_width
|
34
35
|
from streamlit.elements.lib.policies import (
|
35
36
|
check_widget_policies,
|
36
37
|
maybe_raise_label_warnings,
|
@@ -45,6 +46,7 @@ from streamlit.elements.lib.utils import (
|
|
45
46
|
from streamlit.errors import StreamlitAPIException
|
46
47
|
from streamlit.proto.DateInput_pb2 import DateInput as DateInputProto
|
47
48
|
from streamlit.proto.TimeInput_pb2 import TimeInput as TimeInputProto
|
49
|
+
from streamlit.proto.WidthConfig_pb2 import WidthConfig
|
48
50
|
from streamlit.runtime.metrics_util import gather_metrics
|
49
51
|
from streamlit.runtime.scriptrunner import ScriptRunContext, get_script_run_ctx
|
50
52
|
from streamlit.runtime.state import (
|
@@ -321,6 +323,7 @@ class TimeWidgetsMixin:
|
|
321
323
|
disabled: bool = False,
|
322
324
|
label_visibility: LabelVisibility = "visible",
|
323
325
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
326
|
+
width: WidthWithoutContent = "stretch",
|
324
327
|
) -> time:
|
325
328
|
pass
|
326
329
|
|
@@ -338,6 +341,7 @@ class TimeWidgetsMixin:
|
|
338
341
|
disabled: bool = False,
|
339
342
|
label_visibility: LabelVisibility = "visible",
|
340
343
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
344
|
+
width: WidthWithoutContent = "stretch",
|
341
345
|
) -> time | None:
|
342
346
|
pass
|
343
347
|
|
@@ -355,6 +359,7 @@ class TimeWidgetsMixin:
|
|
355
359
|
disabled: bool = False,
|
356
360
|
label_visibility: LabelVisibility = "visible",
|
357
361
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
362
|
+
width: WidthWithoutContent = "stretch",
|
358
363
|
) -> time | None:
|
359
364
|
r"""Display a time input widget.
|
360
365
|
|
@@ -432,6 +437,11 @@ class TimeWidgetsMixin:
|
|
432
437
|
The stepping interval in seconds. Defaults to 900, i.e. 15 minutes.
|
433
438
|
You can also pass a datetime.timedelta object.
|
434
439
|
|
440
|
+
width : "stretch" or int
|
441
|
+
The width of the time input. If "stretch", the time input will stretch
|
442
|
+
to fill the available space. If a number, the time input will have a
|
443
|
+
fixed width of that many pixels. Defaults to "stretch".
|
444
|
+
|
435
445
|
Returns
|
436
446
|
-------
|
437
447
|
datetime.time or None
|
@@ -475,6 +485,7 @@ class TimeWidgetsMixin:
|
|
475
485
|
disabled=disabled,
|
476
486
|
label_visibility=label_visibility,
|
477
487
|
step=step,
|
488
|
+
width=width,
|
478
489
|
ctx=ctx,
|
479
490
|
)
|
480
491
|
|
@@ -491,6 +502,7 @@ class TimeWidgetsMixin:
|
|
491
502
|
disabled: bool = False,
|
492
503
|
label_visibility: LabelVisibility = "visible",
|
493
504
|
step: int | timedelta = timedelta(minutes=DEFAULT_STEP_MINUTES),
|
505
|
+
width: WidthWithoutContent = "stretch",
|
494
506
|
ctx: ScriptRunContext | None = None,
|
495
507
|
) -> time | None:
|
496
508
|
key = to_key(key)
|
@@ -502,6 +514,7 @@ class TimeWidgetsMixin:
|
|
502
514
|
default_value=value if value != "now" else None,
|
503
515
|
)
|
504
516
|
maybe_raise_label_warnings(label, label_visibility)
|
517
|
+
validate_width(width)
|
505
518
|
|
506
519
|
parsed_time: time | None
|
507
520
|
if value is None:
|
@@ -517,6 +530,7 @@ class TimeWidgetsMixin:
|
|
517
530
|
value=parsed_time if isinstance(value, (datetime, time)) else value,
|
518
531
|
help=help,
|
519
532
|
step=step,
|
533
|
+
width=width,
|
520
534
|
)
|
521
535
|
del value
|
522
536
|
|
@@ -549,6 +563,14 @@ class TimeWidgetsMixin:
|
|
549
563
|
if help is not None:
|
550
564
|
time_input_proto.help = dedent(help)
|
551
565
|
|
566
|
+
# Set up width configuration
|
567
|
+
width_config = WidthConfig()
|
568
|
+
if isinstance(width, int):
|
569
|
+
width_config.pixel_width = width
|
570
|
+
else:
|
571
|
+
width_config.use_stretch = True
|
572
|
+
time_input_proto.width_config.CopyFrom(width_config)
|
573
|
+
|
552
574
|
serde = TimeInputSerde(parsed_time)
|
553
575
|
widget_state = register_widget(
|
554
576
|
time_input_proto.id,
|
@@ -585,6 +607,7 @@ class TimeWidgetsMixin:
|
|
585
607
|
format: str = "YYYY/MM/DD",
|
586
608
|
disabled: bool = False,
|
587
609
|
label_visibility: LabelVisibility = "visible",
|
610
|
+
width: WidthWithoutContent = "stretch",
|
588
611
|
) -> date: ...
|
589
612
|
|
590
613
|
@overload
|
@@ -603,6 +626,7 @@ class TimeWidgetsMixin:
|
|
603
626
|
format: str = "YYYY/MM/DD",
|
604
627
|
disabled: bool = False,
|
605
628
|
label_visibility: LabelVisibility = "visible",
|
629
|
+
width: WidthWithoutContent = "stretch",
|
606
630
|
) -> date | None: ...
|
607
631
|
|
608
632
|
@overload
|
@@ -623,6 +647,7 @@ class TimeWidgetsMixin:
|
|
623
647
|
format: str = "YYYY/MM/DD",
|
624
648
|
disabled: bool = False,
|
625
649
|
label_visibility: LabelVisibility = "visible",
|
650
|
+
width: WidthWithoutContent = "stretch",
|
626
651
|
) -> DateWidgetRangeReturn: ...
|
627
652
|
|
628
653
|
@gather_metrics("date_input")
|
@@ -641,6 +666,7 @@ class TimeWidgetsMixin:
|
|
641
666
|
format: str = "YYYY/MM/DD",
|
642
667
|
disabled: bool = False,
|
643
668
|
label_visibility: LabelVisibility = "visible",
|
669
|
+
width: WidthWithoutContent = "stretch",
|
644
670
|
) -> DateWidgetReturn:
|
645
671
|
r"""Display a date input widget.
|
646
672
|
|
@@ -748,6 +774,11 @@ class TimeWidgetsMixin:
|
|
748
774
|
label, which can help keep the widget alligned with other widgets.
|
749
775
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
750
776
|
|
777
|
+
width : "stretch" or int
|
778
|
+
The width of the date input. If "stretch", the date input will stretch
|
779
|
+
to fill the available space. If a number, the date input will have a
|
780
|
+
fixed width of that many pixels. Defaults to "stretch".
|
781
|
+
|
751
782
|
Returns
|
752
783
|
-------
|
753
784
|
datetime.date or a tuple with 0-2 dates or None
|
@@ -814,6 +845,7 @@ class TimeWidgetsMixin:
|
|
814
845
|
disabled=disabled,
|
815
846
|
label_visibility=label_visibility,
|
816
847
|
format=format,
|
848
|
+
width=width,
|
817
849
|
ctx=ctx,
|
818
850
|
)
|
819
851
|
|
@@ -832,6 +864,7 @@ class TimeWidgetsMixin:
|
|
832
864
|
format: str = "YYYY/MM/DD",
|
833
865
|
disabled: bool = False,
|
834
866
|
label_visibility: LabelVisibility = "visible",
|
867
|
+
width: WidthWithoutContent = "stretch",
|
835
868
|
ctx: ScriptRunContext | None = None,
|
836
869
|
) -> DateWidgetReturn:
|
837
870
|
key = to_key(key)
|
@@ -843,6 +876,7 @@ class TimeWidgetsMixin:
|
|
843
876
|
default_value=value if value != "today" else None,
|
844
877
|
)
|
845
878
|
maybe_raise_label_warnings(label, label_visibility)
|
879
|
+
validate_width(width)
|
846
880
|
|
847
881
|
def parse_date_deterministic_for_id(v: NullableScalarDateValue) -> str | None:
|
848
882
|
if v == "today":
|
@@ -884,6 +918,7 @@ class TimeWidgetsMixin:
|
|
884
918
|
max_value=parsed_max_date,
|
885
919
|
help=help,
|
886
920
|
format=format,
|
921
|
+
width=width,
|
887
922
|
)
|
888
923
|
if not bool(ALLOWED_DATE_FORMATS.match(format)):
|
889
924
|
raise StreamlitAPIException(
|
@@ -941,6 +976,14 @@ class TimeWidgetsMixin:
|
|
941
976
|
if help is not None:
|
942
977
|
date_input_proto.help = dedent(help)
|
943
978
|
|
979
|
+
# Set up width configuration
|
980
|
+
width_config = WidthConfig()
|
981
|
+
if isinstance(width, int):
|
982
|
+
width_config.pixel_width = width
|
983
|
+
else:
|
984
|
+
width_config.use_stretch = True
|
985
|
+
date_input_proto.width_config.CopyFrom(width_config)
|
986
|
+
|
944
987
|
serde = DateInputSerde(parsed_values)
|
945
988
|
|
946
989
|
widget_state = register_widget(
|
streamlit/errors.py
CHANGED
@@ -49,7 +49,7 @@ class FragmentStorageKeyError(Error, KeyError):
|
|
49
49
|
pass
|
50
50
|
|
51
51
|
|
52
|
-
class FragmentHandledException(Exception):
|
52
|
+
class FragmentHandledException(Exception): # noqa: N818
|
53
53
|
"""An exception that is raised by the fragment
|
54
54
|
when it has handled the exception itself.
|
55
55
|
"""
|
@@ -57,15 +57,15 @@ class FragmentHandledException(Exception):
|
|
57
57
|
pass
|
58
58
|
|
59
59
|
|
60
|
-
class NoStaticFiles(Error):
|
60
|
+
class NoStaticFiles(Error): # noqa: N818
|
61
61
|
pass
|
62
62
|
|
63
63
|
|
64
|
-
class NoSessionContext(Error):
|
64
|
+
class NoSessionContext(Error): # noqa: N818
|
65
65
|
pass
|
66
66
|
|
67
67
|
|
68
|
-
class MarkdownFormattedException(Error):
|
68
|
+
class MarkdownFormattedException(Error): # noqa: N818
|
69
69
|
"""Exceptions with Markdown in their description.
|
70
70
|
|
71
71
|
Instances of this class can use markdown in their messages, which will get
|
@@ -199,7 +199,8 @@ class StreamlitInvalidSidebarStateError(LocalizableStreamlitException):
|
|
199
199
|
|
200
200
|
def __init__(self, initial_sidebar_state: str):
|
201
201
|
super().__init__(
|
202
|
-
'`initial_sidebar_state` must be `"auto"` or `"expanded"` or
|
202
|
+
'`initial_sidebar_state` must be `"auto"` or `"expanded"` or '
|
203
|
+
'`"collapsed"` (got `"{initial_sidebar_state}"`)',
|
203
204
|
initial_sidebar_state=initial_sidebar_state,
|
204
205
|
)
|
205
206
|
|
@@ -413,7 +414,9 @@ class StreamlitFragmentWidgetsNotAllowedOutsideError(LocalizableStreamlitExcepti
|
|
413
414
|
|
414
415
|
|
415
416
|
class StreamlitInvalidFormCallbackError(LocalizableStreamlitException):
|
416
|
-
"""Exception raised a `on_change` callback is set on any element in a form except for
|
417
|
+
"""Exception raised a `on_change` callback is set on any element in a form except for
|
418
|
+
the `st.form_submit_button`.
|
419
|
+
"""
|
417
420
|
|
418
421
|
def __init__(self):
|
419
422
|
super().__init__(
|
streamlit/proto/DateInput_pb2.py
CHANGED
@@ -13,9 +13,10 @@ _sym_db = _symbol_database.Default()
|
|
13
13
|
|
14
14
|
|
15
15
|
from streamlit.proto import LabelVisibilityMessage_pb2 as streamlit_dot_proto_dot_LabelVisibilityMessage__pb2
|
16
|
+
from streamlit.proto import WidthConfig_pb2 as streamlit_dot_proto_dot_WidthConfig__pb2
|
16
17
|
|
17
18
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/DateInput.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/DateInput.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\x1a!streamlit/proto/WidthConfig.proto\"\xbd\x02\n\tDateInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x03 \x03(\t\x12\x0b\n\x03min\x18\x04 \x01(\t\x12\x0b\n\x03max\x18\x05 \x01(\t\x12\x10\n\x08is_range\x18\x06 \x01(\x08\x12\x0c\n\x04help\x18\x07 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x08 \x01(\t\x12\r\n\x05value\x18\t \x03(\t\x12\x11\n\tset_value\x18\n \x01(\x08\x12\x10\n\x08\x64isabled\x18\x0b \x01(\x08\x12\x31\n\x10label_visibility\x18\x0c \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x0e\n\x06\x66ormat\x18\r \x01(\t\x12\x31\n\x0cwidth_config\x18\x0e \x01(\x0b\x32\x16.streamlit.WidthConfigH\x00\x88\x01\x01\x42\x0f\n\r_width_configB.\n\x1c\x63om.snowflake.apps.streamlitB\x0e\x44\x61teInputProtob\x06proto3')
|
19
20
|
|
20
21
|
_globals = globals()
|
21
22
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -23,6 +24,6 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.DateInput_p
|
|
23
24
|
if not _descriptor._USE_C_DESCRIPTORS:
|
24
25
|
_globals['DESCRIPTOR']._loaded_options = None
|
25
26
|
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\016DateInputProto'
|
26
|
-
_globals['_DATEINPUT']._serialized_start=
|
27
|
-
_globals['_DATEINPUT']._serialized_end=
|
27
|
+
_globals['_DATEINPUT']._serialized_start=117
|
28
|
+
_globals['_DATEINPUT']._serialized_end=434
|
28
29
|
# @@protoc_insertion_point(module_scope)
|