streamlit-nightly 1.44.2.dev20250428__py3-none-any.whl → 1.45.1.dev20250429__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/commands/experimental_query_params.py +1 -1
- streamlit/config.py +2 -2
- streamlit/elements/arrow.py +5 -5
- streamlit/elements/deck_gl_json_chart.py +3 -3
- streamlit/elements/dialog_decorator.py +0 -1
- streamlit/elements/image.py +8 -9
- streamlit/elements/lib/image_utils.py +20 -21
- streamlit/elements/map.py +1 -1
- streamlit/elements/plotly_chart.py +4 -4
- streamlit/elements/vega_charts.py +1 -1
- streamlit/elements/widgets/button.py +6 -5
- streamlit/elements/widgets/file_uploader.py +5 -4
- streamlit/elements/widgets/number_input.py +9 -10
- streamlit/elements/widgets/slider.py +1 -1
- streamlit/error_util.py +1 -1
- streamlit/logger.py +5 -5
- streamlit/runtime/app_session.py +9 -9
- streamlit/runtime/caching/hashing.py +3 -4
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +2 -2
- streamlit/runtime/connection_factory.py +8 -8
- streamlit/runtime/context.py +1 -1
- streamlit/runtime/forward_msg_queue.py +2 -2
- streamlit/runtime/metrics_util.py +2 -2
- streamlit/runtime/runtime_util.py +1 -1
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.BXGjCB7E.js → ErrorOutline.esm.BJh3F07v.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.sOCqSnDy.js → FileDownload.esm.BpUJskrZ.js} +1 -1
- streamlit/static/static/js/{FileHelper.DuN7B5ko.js → FileHelper.DKXMFthp.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.mBqxy6fp.js → FormClearHelper.CcbGU8qM.js} +1 -1
- streamlit/static/static/js/{Hooks.B8RCaOU-.js → Hooks.CyZIh6nK.js} +1 -1
- streamlit/static/static/js/{InputInstructions.CgQJAdmY.js → InputInstructions.nbkV1h_d.js} +1 -1
- streamlit/static/static/js/{ProgressBar.o46iipVl.js → ProgressBar.DeCaMWV9.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.CZifGklq.js → RenderInPortalIfExists.D_SwWwav.js} +1 -1
- streamlit/static/static/js/{Toolbar.CKRoYZWM.js → Toolbar.BAN-49vk.js} +1 -1
- streamlit/static/static/js/{base-input.Me5gYF5B.js → base-input.BGFZMByD.js} +1 -1
- streamlit/static/static/js/{checkbox.CWWogItI.js → checkbox.B_-BK4qi.js} +1 -1
- streamlit/static/static/js/{createSuper.Bsmy7vnu.js → createSuper.BxyEvip2.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CgAv1I8N.js → data-grid-overlay-editor.DmJscfNY.js} +1 -1
- streamlit/static/static/js/{downloader.BbuyvUmM.js → downloader.Cv_h08Sg.js} +1 -1
- streamlit/static/static/js/{es6.cFKClVYr.js → es6.BEoJ6t5B.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.D00awOKx.js → iframeResizer.contentWindow.DnBVl60m.js} +1 -1
- streamlit/static/static/js/{index.By8gv4Ay.js → index.0QGnttRw.js} +1 -1
- streamlit/static/static/js/{index.BKz9YyeL.js → index.7LZxcVw4.js} +1 -1
- streamlit/static/static/js/{index.BtTvTjVr.js → index.BBlDwZ3d.js} +5 -5
- streamlit/static/static/js/{index.Cg3APxPS.js → index.BCUsUBov.js} +1 -1
- streamlit/static/static/js/{index.BtCmnwwO.js → index.BDoHOUEu.js} +1 -1
- streamlit/static/static/js/{index.HOc29Qsj.js → index.BJrY61fW.js} +1 -1
- streamlit/static/static/js/{index.CC6pozcl.js → index.Bk2dieuB.js} +1 -1
- streamlit/static/static/js/{index.B6NqnBxa.js → index.BlpcPmc8.js} +1 -1
- streamlit/static/static/js/{index.VrX7AJMW.js → index.Bnv2GQ1f.js} +1 -1
- streamlit/static/static/js/{index.ZMXLPc9m.js → index.BooesbgI.js} +1 -1
- streamlit/static/static/js/{index.DnnK1XX4.js → index.Bp2P-ne7.js} +1 -1
- streamlit/static/static/js/{index.djYQBt-8.js → index.BpqJCHW4.js} +1 -1
- streamlit/static/static/js/{index.BY-1pChC.js → index.BsajPDiD.js} +1 -1
- streamlit/static/static/js/{index.v9S4U7E0.js → index.BzbL2a8R.js} +1 -1
- streamlit/static/static/js/{index.CZT8t1KG.js → index.C7tk-BaI.js} +1 -1
- streamlit/static/static/js/{index.CtsvxUli.js → index.CA2NGDaW.js} +1 -1
- streamlit/static/static/js/{index.CEFfPwWA.js → index.CRdGuqu3.js} +1 -1
- streamlit/static/static/js/{index.Zbagu1xh.js → index.CT0nwqsw.js} +1 -1
- streamlit/static/static/js/{index.BfEtVe_N.js → index.CWwqcOXB.js} +1 -1
- streamlit/static/static/js/{index.CSZNuohX.js → index.CeEGQX9i.js} +1 -1
- streamlit/static/static/js/{index.B0eFd777.js → index.CmBGzoYB.js} +1 -1
- streamlit/static/static/js/{index.Dn4hsDID.js → index.CzaH4EJh.js} +1 -1
- streamlit/static/static/js/{index.DUVjoXrp.js → index.D39reA1n.js} +1 -1
- streamlit/static/static/js/{index.bliAXvPp.js → index.DKS3g4Ws.js} +1 -1
- streamlit/static/static/js/{index.DZSznc3f.js → index.D_Z8_2ei.js} +1 -1
- streamlit/static/static/js/{index.GIpP3S4h.js → index.DbVBJOze.js} +1 -1
- streamlit/static/static/js/{index.DkQYsEGq.js → index.DewKSDBK.js} +3 -3
- streamlit/static/static/js/{index.D67skAdZ.js → index.DipBpxzK.js} +1 -1
- streamlit/static/static/js/{index.B_FepcMP.js → index.DoNPe-YW.js} +1 -1
- streamlit/static/static/js/{index.Bo5OoJ1E.js → index.DwTevPv_.js} +1 -1
- streamlit/static/static/js/{index.zbOUPreQ.js → index.Dw_iEQ1s.js} +1 -1
- streamlit/static/static/js/{index.B5KSWyCG.js → index.Dz3G_3mZ.js} +1 -1
- streamlit/static/static/js/{index.eVt4urZS.js → index.WP3FKPhV.js} +1 -1
- streamlit/static/static/js/{index.C8S8FJep.js → index.iV6t3ri-.js} +1 -1
- streamlit/static/static/js/{index.Db4G4s87.js → index.t3xwOrU9.js} +1 -1
- streamlit/static/static/js/{index.BMizE8Sq.js → index.tbMYLMrS.js} +1 -1
- streamlit/static/static/js/{index.ew1fqjzv.js → index.z-3XVs6d.js} +1 -1
- streamlit/static/static/js/{input.E-TEQSd2.js → input.B2MDikVk.js} +1 -1
- streamlit/static/static/js/{memory.C47SiSLX.js → memory.BCb625DQ.js} +1 -1
- streamlit/static/static/js/{mergeWith.CuOPq9Xx.js → mergeWith.COIRyAFl.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.oJywx_AR.js → number-overlay-editor.2CkzyF3w.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DezSYWQP.js → possibleConstructorReturn.3T2FklLD.js} +1 -1
- streamlit/static/static/js/{sandbox.CpLGEYsx.js → sandbox.Cc6yBPvx.js} +1 -1
- streamlit/static/static/js/{textarea.CF2OGnSF.js → textarea.C7jOKez6.js} +1 -1
- streamlit/static/static/js/{timepicker.CckJhoGD.js → timepicker.BjMKxgZK.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DrtLgJ_5.js → toConsumableArray.BQ7m3eYw.js} +1 -1
- streamlit/static/static/js/{uniqueId.kgGoKER7.js → uniqueId.CJ7dn8nU.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.CHBqT0_O.js → useBasicWidgetState.QdMR1Kj8.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.A8V2n4e2.js → useOnInputChange.DppkR64F.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.Bh5OZGIu.js → withFullScreenWrapper.C2Ah-iZc.js} +1 -1
- streamlit/testing/v1/app_test.py +2 -2
- streamlit/testing/v1/element_tree.py +7 -7
- streamlit/user_info.py +3 -3
- streamlit/web/cli.py +3 -3
- {streamlit_nightly-1.44.2.dev20250428.dist-info → streamlit_nightly-1.45.1.dev20250429.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.44.2.dev20250428.dist-info → streamlit_nightly-1.45.1.dev20250429.dist-info}/RECORD +101 -101
- {streamlit_nightly-1.44.2.dev20250428.dist-info → streamlit_nightly-1.45.1.dev20250429.dist-info}/WHEEL +1 -1
- {streamlit_nightly-1.44.2.dev20250428.data → streamlit_nightly-1.45.1.dev20250429.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.44.2.dev20250428.dist-info → streamlit_nightly-1.45.1.dev20250429.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.44.2.dev20250428.dist-info → streamlit_nightly-1.45.1.dev20250429.dist-info}/top_level.txt +0 -0
streamlit/config.py
CHANGED
@@ -1544,8 +1544,8 @@ def get_config_options(
|
|
1544
1544
|
if not os.path.exists(filename):
|
1545
1545
|
continue
|
1546
1546
|
|
1547
|
-
with open(filename, encoding="utf-8") as
|
1548
|
-
file_contents =
|
1547
|
+
with open(filename, encoding="utf-8") as file:
|
1548
|
+
file_contents = file.read()
|
1549
1549
|
|
1550
1550
|
_update_config_with_toml(file_contents, filename)
|
1551
1551
|
|
streamlit/elements/arrow.py
CHANGED
@@ -208,14 +208,14 @@ def parse_selection_mode(
|
|
208
208
|
)
|
209
209
|
|
210
210
|
parsed_selection_modes = []
|
211
|
-
for
|
212
|
-
if
|
211
|
+
for mode in selection_mode_set:
|
212
|
+
if mode == "single-row":
|
213
213
|
parsed_selection_modes.append(ArrowProto.SelectionMode.SINGLE_ROW)
|
214
|
-
elif
|
214
|
+
elif mode == "multi-row":
|
215
215
|
parsed_selection_modes.append(ArrowProto.SelectionMode.MULTI_ROW)
|
216
|
-
elif
|
216
|
+
elif mode == "single-column":
|
217
217
|
parsed_selection_modes.append(ArrowProto.SelectionMode.SINGLE_COLUMN)
|
218
|
-
elif
|
218
|
+
elif mode == "multi-column":
|
219
219
|
parsed_selection_modes.append(ArrowProto.SelectionMode.MULTI_COLUMN)
|
220
220
|
return set(parsed_selection_modes)
|
221
221
|
|
@@ -91,10 +91,10 @@ def parse_selection_mode(
|
|
91
91
|
)
|
92
92
|
|
93
93
|
parsed_selection_modes = []
|
94
|
-
for
|
95
|
-
if
|
94
|
+
for mode in selection_mode_set:
|
95
|
+
if mode == "single-object":
|
96
96
|
parsed_selection_modes.append(PydeckProto.SelectionMode.SINGLE_OBJECT)
|
97
|
-
elif
|
97
|
+
elif mode == "multi-object":
|
98
98
|
parsed_selection_modes.append(PydeckProto.SelectionMode.MULTI_OBJECT)
|
99
99
|
return set(parsed_selection_modes)
|
100
100
|
|
@@ -97,7 +97,6 @@ def _dialog_decorator(
|
|
97
97
|
# if the dialog should be closed, st.rerun() has to be called
|
98
98
|
# (same behavior as with st.fragment)
|
99
99
|
_ = non_optional_func(*args, **kwargs)
|
100
|
-
return None
|
101
100
|
|
102
101
|
# the fragment decorator has multiple return types so that you can pass
|
103
102
|
# arguments to it. Here we know the return type, so we cast
|
streamlit/elements/image.py
CHANGED
@@ -167,15 +167,14 @@ class ImageMixin:
|
|
167
167
|
elif use_column_width == "never" or use_column_width is False:
|
168
168
|
image_width = WidthBehavior.ORIGINAL
|
169
169
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
image_width = WidthBehavior.MIN_IMAGE_OR_CONTAINER
|
170
|
+
elif use_container_width is True:
|
171
|
+
image_width = WidthBehavior.MAX_IMAGE_OR_CONTAINER
|
172
|
+
elif image_width is not None and image_width > 0:
|
173
|
+
# Use the given width. It will be capped on the frontend if it
|
174
|
+
# exceeds the container width.
|
175
|
+
pass
|
176
|
+
elif use_container_width is False:
|
177
|
+
image_width = WidthBehavior.MIN_IMAGE_OR_CONTAINER
|
179
178
|
|
180
179
|
image_list_proto = ImageListProto()
|
181
180
|
marshall_images(
|
@@ -97,12 +97,12 @@ def _validate_image_format_string(
|
|
97
97
|
- For all other strings, return "PNG" if the image has an alpha channel,
|
98
98
|
"GIF" if the image is a GIF, and "JPEG" otherwise.
|
99
99
|
"""
|
100
|
-
|
101
|
-
if
|
102
|
-
return cast("ImageFormat",
|
100
|
+
img_format = format.upper()
|
101
|
+
if img_format in {"JPEG", "PNG"}:
|
102
|
+
return cast("ImageFormat", img_format)
|
103
103
|
|
104
104
|
# We are forgiving on the spelling of JPEG
|
105
|
-
if
|
105
|
+
if img_format == "JPG":
|
106
106
|
return "JPEG"
|
107
107
|
|
108
108
|
pil_image: PILImage
|
@@ -149,9 +149,9 @@ def _np_array_to_bytes(array: npt.NDArray[Any], output_format: str = "JPEG") ->
|
|
149
149
|
from PIL import Image
|
150
150
|
|
151
151
|
img = Image.fromarray(array.astype(np.uint8))
|
152
|
-
|
152
|
+
img_format = _validate_image_format_string(img, output_format)
|
153
153
|
|
154
|
-
return _pil_to_bytes(img,
|
154
|
+
return _pil_to_bytes(img, img_format)
|
155
155
|
|
156
156
|
|
157
157
|
def _verify_np_shape(array: npt.NDArray[Any]) -> npt.NDArray[Any]:
|
@@ -216,16 +216,13 @@ def _clip_image(image: npt.NDArray[Any], clamp: bool) -> npt.NDArray[Any]:
|
|
216
216
|
if issubclass(image.dtype.type, np.floating):
|
217
217
|
if clamp:
|
218
218
|
data = np.clip(image, 0, 1.0)
|
219
|
-
|
220
|
-
|
221
|
-
raise RuntimeError("Data is outside [0.0, 1.0] and clamp is not set.")
|
219
|
+
elif np.amin(image) < 0.0 or np.amax(image) > 1.0:
|
220
|
+
raise RuntimeError("Data is outside [0.0, 1.0] and clamp is not set.")
|
222
221
|
data = data * 255
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
if np.amin(image) < 0 or np.amax(image) > 255:
|
228
|
-
raise RuntimeError("Data is outside [0, 255] and clamp is not set.")
|
222
|
+
elif clamp:
|
223
|
+
data = np.clip(image, 0, 255)
|
224
|
+
elif np.amin(image) < 0 or np.amax(image) > 255:
|
225
|
+
raise RuntimeError("Data is outside [0, 255] and clamp is not set.")
|
229
226
|
return data
|
230
227
|
|
231
228
|
|
@@ -301,8 +298,8 @@ def image_to_url(
|
|
301
298
|
|
302
299
|
# PIL Images
|
303
300
|
elif isinstance(image, (ImageFile.ImageFile, Image.Image)):
|
304
|
-
|
305
|
-
image_data = _pil_to_bytes(image,
|
301
|
+
img_format = _validate_image_format_string(image, output_format)
|
302
|
+
image_data = _pil_to_bytes(image, img_format)
|
306
303
|
|
307
304
|
# BytesIO
|
308
305
|
# Note: This doesn't support SVG. We could convert to png (cairosvg.svg2png)
|
@@ -430,15 +427,17 @@ def marshall_images(
|
|
430
427
|
|
431
428
|
proto_imgs.width = int(width)
|
432
429
|
# Each image in an image list needs to be kept track of at its own coordinates.
|
433
|
-
for coord_suffix, (
|
430
|
+
for coord_suffix, (single_image, single_caption) in enumerate(
|
431
|
+
zip(images, captions)
|
432
|
+
):
|
434
433
|
proto_img = proto_imgs.imgs.add()
|
435
|
-
if
|
436
|
-
proto_img.caption = str(
|
434
|
+
if single_caption is not None:
|
435
|
+
proto_img.caption = str(single_caption)
|
437
436
|
|
438
437
|
# We use the index of the image in the input image list to identify this image inside
|
439
438
|
# MediaFileManager. For this, we just add the index to the image's "coordinates".
|
440
439
|
image_id = "%s-%i" % (coordinates, coord_suffix)
|
441
440
|
|
442
441
|
proto_img.url = image_to_url(
|
443
|
-
|
442
|
+
single_image, width, clamp, channels, output_format, image_id
|
444
443
|
)
|
streamlit/elements/map.py
CHANGED
@@ -20,8 +20,8 @@ import copy
|
|
20
20
|
import json
|
21
21
|
from typing import TYPE_CHECKING, Any, Final, cast
|
22
22
|
|
23
|
-
import streamlit.elements.deck_gl_json_chart as deck_gl_json_chart
|
24
23
|
from streamlit import config, dataframe_util
|
24
|
+
from streamlit.elements import deck_gl_json_chart
|
25
25
|
from streamlit.elements.lib.color_util import (
|
26
26
|
Color,
|
27
27
|
IntColorTuple,
|
@@ -257,12 +257,12 @@ def parse_selection_mode(
|
|
257
257
|
)
|
258
258
|
|
259
259
|
parsed_selection_modes = []
|
260
|
-
for
|
261
|
-
if
|
260
|
+
for mode in selection_mode_set:
|
261
|
+
if mode == "points":
|
262
262
|
parsed_selection_modes.append(PlotlyChartProto.SelectionMode.POINTS)
|
263
|
-
elif
|
263
|
+
elif mode == "lasso":
|
264
264
|
parsed_selection_modes.append(PlotlyChartProto.SelectionMode.LASSO)
|
265
|
-
elif
|
265
|
+
elif mode == "box":
|
266
266
|
parsed_selection_modes.append(PlotlyChartProto.SelectionMode.BOX)
|
267
267
|
return set(parsed_selection_modes)
|
268
268
|
|
@@ -33,8 +33,8 @@ from typing import (
|
|
33
33
|
|
34
34
|
from typing_extensions import TypeAlias
|
35
35
|
|
36
|
-
import streamlit.elements.lib.dicttools as dicttools
|
37
36
|
from streamlit import dataframe_util, type_util
|
37
|
+
from streamlit.elements.lib import dicttools
|
38
38
|
from streamlit.elements.lib.built_in_chart_utils import (
|
39
39
|
AddRowsMetadata,
|
40
40
|
ChartStackType,
|
@@ -799,15 +799,16 @@ class ButtonMixin:
|
|
799
799
|
) -> bool:
|
800
800
|
key = to_key(key)
|
801
801
|
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
802
|
+
on_click_callback: WidgetCallback | None = (
|
803
|
+
None
|
804
|
+
if on_click is None or on_click in {"ignore", "rerun"}
|
805
|
+
else cast("WidgetCallback", on_click)
|
806
|
+
)
|
806
807
|
|
807
808
|
check_widget_policies(
|
808
809
|
self.dg,
|
809
810
|
key,
|
810
|
-
on_click_callback,
|
811
|
+
on_change=on_click_callback,
|
811
812
|
default_value=None,
|
812
813
|
writes_allowed=False,
|
813
814
|
)
|
@@ -433,13 +433,14 @@ class FileUploaderMixin:
|
|
433
433
|
help=help,
|
434
434
|
)
|
435
435
|
|
436
|
-
if type
|
437
|
-
type = normalize_upload_file_type(type)
|
436
|
+
normalized_type = normalize_upload_file_type(type) if type else None
|
438
437
|
|
439
438
|
file_uploader_proto = FileUploaderProto()
|
440
439
|
file_uploader_proto.id = element_id
|
441
440
|
file_uploader_proto.label = label
|
442
|
-
file_uploader_proto.type[:] =
|
441
|
+
file_uploader_proto.type[:] = (
|
442
|
+
normalized_type if normalized_type is not None else []
|
443
|
+
)
|
443
444
|
file_uploader_proto.max_upload_size_mb = config.get_option(
|
444
445
|
"server.maxUploadSize"
|
445
446
|
)
|
@@ -453,7 +454,7 @@ class FileUploaderMixin:
|
|
453
454
|
if help is not None:
|
454
455
|
file_uploader_proto.help = dedent(help)
|
455
456
|
|
456
|
-
serde = FileUploaderSerde(accept_multiple_files, allowed_types=
|
457
|
+
serde = FileUploaderSerde(accept_multiple_files, allowed_types=normalized_type)
|
457
458
|
|
458
459
|
# FileUploader's widget value is a list of file IDs
|
459
460
|
# representing the current set of files that this uploader should
|
@@ -443,32 +443,32 @@ class NumberInputMixin:
|
|
443
443
|
# Otherwise, defaults to float:
|
444
444
|
float_value = True
|
445
445
|
|
446
|
-
if format
|
447
|
-
|
446
|
+
# Use default format depending on value type if format was not provided:
|
447
|
+
number_format = ("%d" if int_value else "%0.2f") if format is None else format
|
448
448
|
|
449
449
|
# Warn user if they format an int type as a float or vice versa.
|
450
|
-
if
|
450
|
+
if number_format in ["%d", "%u", "%i"] and float_value:
|
451
451
|
import streamlit as st
|
452
452
|
|
453
453
|
st.warning(
|
454
454
|
"Warning: NumberInput value below has type float,"
|
455
|
-
f" but format {
|
455
|
+
f" but format {number_format} displays as integer."
|
456
456
|
)
|
457
|
-
elif
|
457
|
+
elif number_format[-1] == "f" and int_value:
|
458
458
|
import streamlit as st
|
459
459
|
|
460
460
|
st.warning(
|
461
461
|
"Warning: NumberInput value below has type int so is"
|
462
|
-
f" displayed as int despite format string {
|
462
|
+
f" displayed as int despite format string {number_format}."
|
463
463
|
)
|
464
464
|
|
465
465
|
if step is None:
|
466
466
|
step = 1 if int_value else 0.01
|
467
467
|
|
468
468
|
try:
|
469
|
-
float(
|
469
|
+
float(number_format % 2)
|
470
470
|
except (TypeError, ValueError):
|
471
|
-
raise StreamlitInvalidNumberFormatError(
|
471
|
+
raise StreamlitInvalidNumberFormatError(number_format)
|
472
472
|
|
473
473
|
|
474
474
|
# Ensure that the value matches arguments' types.
|
@@ -547,8 +547,7 @@ class NumberInputMixin:
|
|
547
547
|
if step is not None:
|
548
548
|
number_input_proto.step = step
|
549
549
|
|
550
|
-
|
551
|
-
number_input_proto.format = format
|
550
|
+
number_input_proto.format = number_format
|
552
551
|
|
553
552
|
if icon is not None:
|
554
553
|
number_input_proto.icon = validate_icon_or_emoji(icon)
|
@@ -705,7 +705,7 @@ class SliderMixin:
|
|
705
705
|
) and max_value - min_value < timedelta(days=1):
|
706
706
|
step = timedelta(minutes=15)
|
707
707
|
if format is None:
|
708
|
-
format = cast("str", DEFAULTS[data_type]["format"])
|
708
|
+
format = cast("str", DEFAULTS[data_type]["format"]) # noqa: A001
|
709
709
|
|
710
710
|
if step == 0:
|
711
711
|
raise StreamlitAPIException(
|
streamlit/error_util.py
CHANGED
@@ -17,9 +17,9 @@ from __future__ import annotations
|
|
17
17
|
from typing import Final
|
18
18
|
|
19
19
|
import streamlit
|
20
|
-
import streamlit.elements.exception as exception
|
21
20
|
from streamlit import config
|
22
21
|
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
22
|
+
from streamlit.elements import exception
|
23
23
|
from streamlit.logger import get_logger
|
24
24
|
|
25
25
|
_LOGGER: Final = get_logger(__name__)
|
streamlit/logger.py
CHANGED
@@ -35,15 +35,15 @@ def set_log_level(level: str | int) -> None:
|
|
35
35
|
|
36
36
|
if isinstance(level, str):
|
37
37
|
level = level.upper()
|
38
|
-
if level
|
38
|
+
if level in {"CRITICAL", logging.CRITICAL}:
|
39
39
|
log_level = logging.CRITICAL
|
40
|
-
elif level
|
40
|
+
elif level in {"ERROR", logging.ERROR}:
|
41
41
|
log_level = logging.ERROR
|
42
|
-
elif level
|
42
|
+
elif level in {"WARNING", logging.WARNING}:
|
43
43
|
log_level = logging.WARNING
|
44
|
-
elif level
|
44
|
+
elif level in {"INFO", logging.INFO}:
|
45
45
|
log_level = logging.INFO
|
46
|
-
elif level
|
46
|
+
elif level in {"DEBUG", logging.DEBUG}:
|
47
47
|
log_level = logging.DEBUG
|
48
48
|
else:
|
49
49
|
msg = 'undefined log level "%s"' % level
|
streamlit/runtime/app_session.py
CHANGED
@@ -615,11 +615,11 @@ class AppSession:
|
|
615
615
|
|
616
616
|
self._enqueue_forward_msg(msg)
|
617
617
|
|
618
|
-
elif
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
618
|
+
elif event in {
|
619
|
+
ScriptRunnerEvent.SCRIPT_STOPPED_WITH_SUCCESS,
|
620
|
+
ScriptRunnerEvent.SCRIPT_STOPPED_WITH_COMPILE_ERROR,
|
621
|
+
ScriptRunnerEvent.FRAGMENT_STOPPED_WITH_SUCCESS,
|
622
|
+
}:
|
623
623
|
if self._state != AppSessionState.SHUTDOWN_REQUESTED:
|
624
624
|
self._state = AppSessionState.APP_NOT_RUNNING
|
625
625
|
|
@@ -633,10 +633,10 @@ class AppSession:
|
|
633
633
|
self._enqueue_forward_msg(self._create_script_finished_message(status))
|
634
634
|
self._debug_last_backmsg_id = None
|
635
635
|
|
636
|
-
if
|
637
|
-
|
638
|
-
|
639
|
-
|
636
|
+
if event in {
|
637
|
+
ScriptRunnerEvent.SCRIPT_STOPPED_WITH_SUCCESS,
|
638
|
+
ScriptRunnerEvent.FRAGMENT_STOPPED_WITH_SUCCESS,
|
639
|
+
}:
|
640
640
|
# The script completed successfully: update our
|
641
641
|
# LocalSourcesWatcher to account for any source code changes
|
642
642
|
# that change which modules should be watched.
|
@@ -117,11 +117,10 @@ If you think this is actually a Streamlit bug, please
|
|
117
117
|
|
118
118
|
if hash_source is None:
|
119
119
|
object_desc = "something"
|
120
|
+
elif hasattr(hash_source, "__name__"):
|
121
|
+
object_desc = f"`{hash_source.__name__}()`"
|
120
122
|
else:
|
121
|
-
|
122
|
-
object_desc = f"`{hash_source.__name__}()`"
|
123
|
-
else:
|
124
|
-
object_desc = "a function"
|
123
|
+
object_desc = "a function"
|
125
124
|
|
126
125
|
decorator_name = ""
|
127
126
|
if self.cache_type is CacheType.RESOURCE:
|
@@ -143,8 +143,8 @@ class LocalDiskCacheStorage(CacheStorage):
|
|
143
143
|
if self.persist == "disk":
|
144
144
|
path = self._get_cache_file_path(key)
|
145
145
|
try:
|
146
|
-
with streamlit_read(path, binary=True) as
|
147
|
-
value =
|
146
|
+
with streamlit_read(path, binary=True) as file:
|
147
|
+
value = file.read()
|
148
148
|
_LOGGER.debug("Disk cache HIT: %s", key)
|
149
149
|
return bytes(value)
|
150
150
|
except FileNotFoundError:
|
@@ -374,11 +374,16 @@ def connection_factory(
|
|
374
374
|
envvar_name = name[len(USE_ENV_PREFIX) :]
|
375
375
|
name = os.environ[envvar_name]
|
376
376
|
|
377
|
-
|
377
|
+
# type is a nice kwarg name for the st.connection user but is annoying to work with
|
378
|
+
# since it conflicts with the builtin function name and thus gets syntax
|
379
|
+
# highlighted.
|
380
|
+
connection_class = type
|
381
|
+
|
382
|
+
if connection_class is None:
|
378
383
|
if name in FIRST_PARTY_CONNECTIONS:
|
379
384
|
# We allow users to simply write `st.connection("sql")` instead of
|
380
385
|
# `st.connection("sql", type="sql")`.
|
381
|
-
|
386
|
+
connection_class = _get_first_party_connection(name)
|
382
387
|
else:
|
383
388
|
# The user didn't specify a type, so we try to pull it out from their
|
384
389
|
# secrets.toml file. NOTE: we're okay with any of the dict lookups below
|
@@ -386,12 +391,7 @@ def connection_factory(
|
|
386
391
|
# it must be the case that it's defined in secrets.toml and should raise an
|
387
392
|
# Exception otherwise.
|
388
393
|
secrets_singleton.load_if_toml_exists()
|
389
|
-
|
390
|
-
|
391
|
-
# type is a nice kwarg name for the st.connection user but is annoying to work with
|
392
|
-
# since it conflicts with the builtin function name and thus gets syntax
|
393
|
-
# highlighted.
|
394
|
-
connection_class = type
|
394
|
+
connection_class = secrets_singleton["connections"][name]["type"]
|
395
395
|
|
396
396
|
if isinstance(connection_class, str):
|
397
397
|
# We assume that a connection_class specified via string is either the fully
|
streamlit/runtime/context.py
CHANGED
@@ -367,7 +367,7 @@ class ContextProxy:
|
|
367
367
|
session_client_request = _get_request()
|
368
368
|
if session_client_request is not None:
|
369
369
|
remote_ip = session_client_request.remote_ip
|
370
|
-
if remote_ip
|
370
|
+
if remote_ip in {"::1", "127.0.0.1"}:
|
371
371
|
return None
|
372
372
|
return remote_ip
|
373
373
|
return None
|
@@ -184,7 +184,7 @@ def _is_composable_message(msg: ForwardMsg) -> bool:
|
|
184
184
|
# operation can raise errors, and we don't have a good way of handling
|
185
185
|
# those errors in the message queue.
|
186
186
|
delta_type = msg.delta.WhichOneof("type")
|
187
|
-
return delta_type
|
187
|
+
return delta_type not in {"add_rows", "arrow_add_rows"}
|
188
188
|
|
189
189
|
|
190
190
|
def _maybe_compose_delta_msgs(
|
@@ -222,7 +222,7 @@ def _maybe_compose_delta_msgs(
|
|
222
222
|
return new_msg
|
223
223
|
|
224
224
|
new_delta_type = new_msg.delta.WhichOneof("type")
|
225
|
-
if new_delta_type
|
225
|
+
if new_delta_type in {"new_element", "add_block"}:
|
226
226
|
return new_msg
|
227
227
|
|
228
228
|
return None
|
@@ -201,8 +201,8 @@ def _get_machine_id_v4() -> str:
|
|
201
201
|
stable_id = None
|
202
202
|
|
203
203
|
if os.path.exists(filepath):
|
204
|
-
with file_util.streamlit_read(filepath) as
|
205
|
-
stable_id =
|
204
|
+
with file_util.streamlit_read(filepath) as file:
|
205
|
+
stable_id = file.read()
|
206
206
|
|
207
207
|
if not stable_id:
|
208
208
|
stable_id = str(uuid.uuid4())
|
@@ -74,7 +74,7 @@ def serialize_forward_msg(msg: ForwardMsg) -> bytes:
|
|
74
74
|
if len(msg_str) > get_max_message_size_bytes():
|
75
75
|
# Overwrite the offending ForwardMsg.delta with an error to display.
|
76
76
|
# This assumes that the size limit wasn't exceeded due to metadata.
|
77
|
-
|
77
|
+
from streamlit.elements import exception
|
78
78
|
|
79
79
|
msg_size_error = MessageSizeError(msg_str)
|
80
80
|
_LOGGER.warning(
|
streamlit/static/index.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
<script>
|
52
52
|
window.prerenderReady = false
|
53
53
|
</script>
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
54
|
+
<script type="module" crossorigin src="./static/js/index.DewKSDBK.js"></script>
|
55
55
|
<link rel="stylesheet" crossorigin href="./static/css/index.C6rq3aMZ.css">
|
56
56
|
</head>
|
57
57
|
<body>
|
@@ -1 +1 @@
|
|
1
|
-
import{r,E as a,_ as n}from"./index.
|
1
|
+
import{r,E as a,_ as n}from"./index.DewKSDBK.js";var i=r.forwardRef(function(e,t){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(a,n({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),r.createElement("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))});i.displayName="ErrorOutline";export{i as E};
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,E as n,_ as a}from"./index.
|
1
|
+
import{r as e,E as n,_ as a}from"./index.DewKSDBK.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
|