streamlit-nightly 1.45.1.dev20250511__py3-none-any.whl → 1.45.2.dev20250512__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.
Files changed (122) hide show
  1. streamlit/commands/experimental_query_params.py +1 -1
  2. streamlit/commands/navigation.py +1 -4
  3. streamlit/config.py +9 -11
  4. streamlit/config_util.py +1 -1
  5. streamlit/connections/sql_connection.py +1 -1
  6. streamlit/dataframe_util.py +50 -51
  7. streamlit/elements/arrow.py +1 -1
  8. streamlit/elements/deck_gl_json_chart.py +1 -4
  9. streamlit/elements/doc_string.py +1 -4
  10. streamlit/elements/exception.py +5 -7
  11. streamlit/elements/layouts.py +4 -3
  12. streamlit/elements/lib/built_in_chart_utils.py +9 -14
  13. streamlit/elements/lib/pandas_styler_utils.py +6 -8
  14. streamlit/elements/map.py +2 -8
  15. streamlit/elements/markdown.py +1 -4
  16. streamlit/elements/media.py +50 -2
  17. streamlit/elements/metric.py +9 -10
  18. streamlit/elements/widgets/audio_input.py +1 -4
  19. streamlit/elements/widgets/camera_input.py +1 -4
  20. streamlit/elements/widgets/chat.py +52 -5
  21. streamlit/elements/widgets/data_editor.py +1 -1
  22. streamlit/elements/widgets/slider.py +3 -4
  23. streamlit/elements/widgets/time_widgets.py +1 -4
  24. streamlit/env_util.py +2 -7
  25. streamlit/errors.py +1 -1
  26. streamlit/logger.py +4 -5
  27. streamlit/proto/Audio_pb2.py +4 -3
  28. streamlit/proto/Audio_pb2.pyi +8 -1
  29. streamlit/proto/Block_pb2.py +5 -5
  30. streamlit/proto/Block_pb2.pyi +7 -1
  31. streamlit/proto/ChatInput_pb2.py +8 -7
  32. streamlit/proto/ChatInput_pb2.pyi +10 -1
  33. streamlit/proto/Video_pb2.py +8 -7
  34. streamlit/proto/Video_pb2.pyi +8 -1
  35. streamlit/runtime/app_session.py +1 -1
  36. streamlit/runtime/caching/hashing.py +8 -8
  37. streamlit/runtime/credentials.py +5 -4
  38. streamlit/runtime/memory_media_file_storage.py +5 -4
  39. streamlit/runtime/metrics_util.py +1 -1
  40. streamlit/runtime/scriptrunner/script_runner.py +1 -1
  41. streamlit/runtime/state/query_params.py +2 -4
  42. streamlit/runtime/state/session_state.py +15 -15
  43. streamlit/static/index.html +1 -1
  44. streamlit/static/static/js/{ErrorOutline.esm.B5LmzpSn.js → ErrorOutline.esm.Cfhrjz42.js} +1 -1
  45. streamlit/static/static/js/{FileDownload.esm.BgWveG3s.js → FileDownload.esm.BN5DkI-d.js} +1 -1
  46. streamlit/static/static/js/{FileHelper.DepIpP48.js → FileHelper.BWWhRdUs.js} +1 -1
  47. streamlit/static/static/js/{FormClearHelper.C_BjP_35.js → FormClearHelper.CHPGUkGG.js} +1 -1
  48. streamlit/static/static/js/{Hooks.BpH4YuRQ.js → Hooks.DjxyUmgD.js} +1 -1
  49. streamlit/static/static/js/{InputInstructions.CjdwGigq.js → InputInstructions.Bkai2tFZ.js} +1 -1
  50. streamlit/static/static/js/{ProgressBar.D1hXcW3N.js → ProgressBar.DFiqS51i.js} +1 -1
  51. streamlit/static/static/js/{RenderInPortalIfExists.A1T2s6z-.js → RenderInPortalIfExists.DWTzV71R.js} +1 -1
  52. streamlit/static/static/js/{Toolbar.y7vr7z0G.js → Toolbar.Dk2A3VxL.js} +1 -1
  53. streamlit/static/static/js/{base-input.BKhd-BLG.js → base-input.DfiT3r4p.js} +1 -1
  54. streamlit/static/static/js/{checkbox.DC-GFdrh.js → checkbox.DLXFjls2.js} +1 -1
  55. streamlit/static/static/js/{createSuper.D5WUtJEy.js → createSuper.n2DV0o-4.js} +1 -1
  56. streamlit/static/static/js/{data-grid-overlay-editor.BPJ38mWp.js → data-grid-overlay-editor.v1LF25Ml.js} +1 -1
  57. streamlit/static/static/js/{downloader.C6a4LRBw.js → downloader.CI8EFE9Y.js} +1 -1
  58. streamlit/static/static/js/{es6.DgMlYq8q.js → es6.CH6Tf3Uw.js} +2 -2
  59. streamlit/static/static/js/{iframeResizer.contentWindow.BpQxex73.js → iframeResizer.contentWindow.VCjyiSg6.js} +1 -1
  60. streamlit/static/static/js/{index.C2GjbQtf.js → index.7XN_jSTW.js} +1 -1
  61. streamlit/static/static/js/{index.D5PANKHd.js → index.9p279joF.js} +1 -1
  62. streamlit/static/static/js/{index.BydIp_VR.js → index.B-Q1qQil.js} +1 -1
  63. streamlit/static/static/js/{index.B8ca7fYO.js → index.B1j5m20t.js} +1 -1
  64. streamlit/static/static/js/{index.CiO2JPl_.js → index.BEE4v1Vc.js} +1 -1
  65. streamlit/static/static/js/{index.CkBnHCIQ.js → index.BFEA8ufN.js} +1 -1
  66. streamlit/static/static/js/{index.BLpDfH1w.js → index.BROoC18J.js} +1 -1
  67. streamlit/static/static/js/{index.49Q6A5_9.js → index.BWVpiUBA.js} +1 -1
  68. streamlit/static/static/js/{index.BRN41-Jy.js → index.BgY_Js0s.js} +1 -1
  69. streamlit/static/static/js/{index.D3tgBU6x.js → index.C1P3O0oI.js} +1 -1
  70. streamlit/static/static/js/index.C1TEsRV0.js +779 -0
  71. streamlit/static/static/js/{index.DPiBGVm8.js → index.C9ORVZvA.js} +1 -1
  72. streamlit/static/static/js/{index.CcvbHTJu.js → index.CR4eM0Q3.js} +1 -1
  73. streamlit/static/static/js/{index.DAO4Lj-D.js → index.CXpQxU0G.js} +1 -1
  74. streamlit/static/static/js/{index.BhGEwO_d.js → index.Cdsxte9t.js} +1 -1
  75. streamlit/static/static/js/{index.20fI9wQF.js → index.CmsMgepL.js} +1 -1
  76. streamlit/static/static/js/{index.Cqla7uBZ.js → index.D1An7GDs.js} +1 -1
  77. streamlit/static/static/js/{index.ryD8hMpi.js → index.D1DxKfIm.js} +1 -1
  78. streamlit/static/static/js/{index.DB42JCH0.js → index.DKsDSPTo.js} +1 -1
  79. streamlit/static/static/js/{index._oOkpIXS.js → index.DMDjQhhk.js} +1 -1
  80. streamlit/static/static/js/{index.4Gtr9egA.js → index.DM_jnlWC.js} +1 -1
  81. streamlit/static/static/js/{index.xIQLhQKv.js → index.DUU38l7N.js} +1 -1
  82. streamlit/static/static/js/{index.BbhQIRth.js → index.DXDmqevk.js} +1 -1
  83. streamlit/static/static/js/{index.Bo-z1JM2.js → index.D_Bv6KD1.js} +1 -1
  84. streamlit/static/static/js/{index.Cfi3u2-T.js → index.DcH46Eo2.js} +1 -1
  85. streamlit/static/static/js/{index.CHnID3dI.js → index.DgeyRl4J.js} +1 -1
  86. streamlit/static/static/js/{index.5k30-U6O.js → index.DoM9A12Z.js} +1 -1
  87. streamlit/static/static/js/{index.DT0CWGt3.js → index.LqvX_Kr6.js} +1 -1
  88. streamlit/static/static/js/{index.br6zwNIk.js → index.Ovig-AMR.js} +62 -62
  89. streamlit/static/static/js/{index.CY8tg9lY.js → index.SPkHHODG.js} +1 -1
  90. streamlit/static/static/js/{index.sKXwUANU.js → index.STF1QdPr.js} +1 -1
  91. streamlit/static/static/js/{index.DSPS70gp.js → index.ZuW7Olhm.js} +1 -1
  92. streamlit/static/static/js/{index.VPO2zcSN.js → index.hFB9saa3.js} +1 -1
  93. streamlit/static/static/js/{index.Du1Pbz0y.js → index.jZkr87Ly.js} +1 -1
  94. streamlit/static/static/js/{index.BcbB70bz.js → index.nmbrjghZ.js} +1 -1
  95. streamlit/static/static/js/{index.Bj81ZRkx.js → index.uN3TP5oq.js} +1 -1
  96. streamlit/static/static/js/{index.B3UoUwtN.js → index.uhNJX5pn.js} +1 -1
  97. streamlit/static/static/js/{input.CNjMviuo.js → input.BAfiLByr.js} +1 -1
  98. streamlit/static/static/js/{memory.f8X97LPt.js → memory.CvD1KGKJ.js} +1 -1
  99. streamlit/static/static/js/{mergeWith.DU9BO8BA.js → mergeWith.Dy4BuY-h.js} +1 -1
  100. streamlit/static/static/js/{number-overlay-editor.xJPBNdGQ.js → number-overlay-editor.Bl84FLfp.js} +1 -1
  101. streamlit/static/static/js/{possibleConstructorReturn.BjPX9m9m.js → possibleConstructorReturn.gffiKeDQ.js} +1 -1
  102. streamlit/static/static/js/{sandbox.B23JuuVd.js → sandbox.BXw8ya9t.js} +1 -1
  103. streamlit/static/static/js/{textarea.DodnI6GX.js → textarea.DNNNKi6n.js} +1 -1
  104. streamlit/static/static/js/{timepicker.ClHKNfP9.js → timepicker.CgHlrhoy.js} +1 -1
  105. streamlit/static/static/js/{toConsumableArray.CK6YGgcW.js → toConsumableArray.MtZ-3vir.js} +1 -1
  106. streamlit/static/static/js/{uniqueId.BAAVLIKj.js → uniqueId.CFcd6g0d.js} +1 -1
  107. streamlit/static/static/js/{useBasicWidgetState.B1oropKY.js → useBasicWidgetState.DadZUraL.js} +1 -1
  108. streamlit/static/static/js/{useOnInputChange.CHQJz2sf.js → useOnInputChange.V6d5TCFH.js} +1 -1
  109. streamlit/static/static/js/{withFullScreenWrapper.DZ1W8JUx.js → withFullScreenWrapper.8qpius26.js} +1 -1
  110. streamlit/string_util.py +1 -4
  111. streamlit/testing/v1/element_tree.py +5 -4
  112. streamlit/testing/v1/local_script_runner.py +1 -4
  113. streamlit/type_util.py +2 -5
  114. streamlit/watcher/path_watcher.py +2 -5
  115. streamlit/watcher/polling_path_watcher.py +7 -6
  116. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/METADATA +1 -1
  117. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/RECORD +121 -121
  118. streamlit/static/static/js/index.BgEbLy94.js +0 -779
  119. {streamlit_nightly-1.45.1.dev20250511.data → streamlit_nightly-1.45.2.dev20250512.data}/scripts/streamlit.cmd +0 -0
  120. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/WHEEL +0 -0
  121. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/entry_points.txt +0 -0
  122. {streamlit_nightly-1.45.1.dev20250511.dist-info → streamlit_nightly-1.45.2.dev20250512.dist-info}/top_level.txt +0 -0
@@ -24,11 +24,13 @@ from typing_extensions import TypeAlias
24
24
 
25
25
  from streamlit import runtime, type_util, url_util
26
26
  from streamlit.elements.lib.form_utils import current_form_id
27
+ from streamlit.elements.lib.layout_utils import WidthWithoutContent, validate_width
27
28
  from streamlit.elements.lib.subtitle_utils import process_subtitle_data
28
29
  from streamlit.elements.lib.utils import compute_and_register_element_id
29
30
  from streamlit.errors import StreamlitAPIException
30
31
  from streamlit.proto.Audio_pb2 import Audio as AudioProto
31
32
  from streamlit.proto.Video_pb2 import Video as VideoProto
33
+ from streamlit.proto.WidthConfig_pb2 import WidthConfig
32
34
  from streamlit.runtime import caching
33
35
  from streamlit.runtime.metrics_util import gather_metrics
34
36
  from streamlit.time_util import time_to_seconds
@@ -80,6 +82,7 @@ class MediaMixin:
80
82
  end_time: MediaTime | None = None,
81
83
  loop: bool = False,
82
84
  autoplay: bool = False,
85
+ width: WidthWithoutContent = "stretch",
83
86
  ) -> DeltaGenerator:
84
87
  """Display an audio player.
85
88
 
@@ -141,6 +144,12 @@ class MediaMixin:
141
144
  Whether the audio file should start playing automatically. This is
142
145
  ``False`` by default. Browsers will not autoplay audio files if the
143
146
  user has not interacted with the page by clicking somewhere.
147
+ width: int or "stretch"
148
+ The width of the audio player. This can be one of the following:
149
+
150
+ - An int: The width in pixels, e.g. ``200`` for a width of 200 pixels.
151
+ - ``"stretch"``: The default value. The audio player stretches to fill
152
+ available space in its container.
144
153
 
145
154
  Examples
146
155
  --------
@@ -181,6 +190,7 @@ class MediaMixin:
181
190
 
182
191
  """
183
192
  start_time, end_time = _parse_start_time_end_time(start_time, end_time)
193
+ validate_width(width)
184
194
 
185
195
  audio_proto = AudioProto()
186
196
 
@@ -207,6 +217,7 @@ class MediaMixin:
207
217
  loop,
208
218
  autoplay,
209
219
  form_id=current_form_id(self.dg),
220
+ width=width,
210
221
  )
211
222
  return self.dg._enqueue("audio", audio_proto)
212
223
 
@@ -222,6 +233,7 @@ class MediaMixin:
222
233
  loop: bool = False,
223
234
  autoplay: bool = False,
224
235
  muted: bool = False,
236
+ width: WidthWithoutContent = "stretch",
225
237
  ) -> DeltaGenerator:
226
238
  """Display a video player.
227
239
 
@@ -306,6 +318,12 @@ class MediaMixin:
306
318
  Whether the video should play with the audio silenced. This is
307
319
  ``False`` by default. Use this in conjunction with ``autoplay=True``
308
320
  to enable autoplay without user interaction.
321
+ width: int or "stretch"
322
+ The width of the video player. This can be one of the following:
323
+
324
+ - An int: The width in pixels, e.g. ``200`` for a width of 200 pixels.
325
+ - ``"stretch"``: The default value. The video player stretches to fill
326
+ available space in its container.
309
327
 
310
328
  Example
311
329
  -------
@@ -359,6 +377,7 @@ class MediaMixin:
359
377
 
360
378
  """
361
379
  start_time, end_time = _parse_start_time_end_time(start_time, end_time)
380
+ validate_width(width)
362
381
 
363
382
  video_proto = VideoProto()
364
383
  coordinates = self.dg._get_delta_path_str()
@@ -374,6 +393,7 @@ class MediaMixin:
374
393
  autoplay,
375
394
  muted,
376
395
  form_id=current_form_id(self.dg),
396
+ width=width,
377
397
  )
378
398
  return self.dg._enqueue("video", video_proto)
379
399
 
@@ -449,14 +469,14 @@ def _marshall_av_media(
449
469
  elif isinstance(data, io.BytesIO):
450
470
  data.seek(0)
451
471
  data_or_filename = data.getvalue()
452
- elif isinstance(data, io.RawIOBase) or isinstance(data, io.BufferedReader):
472
+ elif isinstance(data, (io.RawIOBase, io.BufferedReader)):
453
473
  data.seek(0)
454
474
  read_data = data.read()
455
475
  if read_data is None:
456
476
  return
457
477
  data_or_filename = read_data
458
478
  elif type_util.is_type(data, "numpy.ndarray"):
459
- data_or_filename = data.tobytes()
479
+ data_or_filename = cast("npt.NDArray[Any]", data).tobytes()
460
480
  else:
461
481
  raise RuntimeError("Invalid binary data format: %s" % type(data))
462
482
 
@@ -484,6 +504,7 @@ def marshall_video(
484
504
  autoplay: bool = False,
485
505
  muted: bool = False,
486
506
  form_id: str | None = None,
507
+ width: WidthWithoutContent = "stretch",
487
508
  ) -> None:
488
509
  """Marshalls a video proto, using url processors as needed.
489
510
 
@@ -530,6 +551,11 @@ def marshall_video(
530
551
  form_id: str | None
531
552
  The ID of the form that this element is placed in. Provide None if
532
553
  the element is not placed in a form.
554
+ width: int or "stretch"
555
+ The width of the video player. This can be one of the following:
556
+ - An int: The width in pixels, e.g. 200 for a width of 200 pixels.
557
+ - "stretch": The default value. The video player stretches to fill
558
+ available space in its container.
533
559
  """
534
560
 
535
561
  if start_time < 0 or (end_time is not None and end_time <= start_time):
@@ -542,6 +568,13 @@ def marshall_video(
542
568
  proto.end_time = end_time
543
569
  proto.loop = loop
544
570
 
571
+ width_config = WidthConfig()
572
+ if isinstance(width, int):
573
+ width_config.pixel_width = width
574
+ else:
575
+ width_config.use_stretch = True
576
+ proto.width_config.CopyFrom(width_config)
577
+
545
578
  # "type" distinguishes between YouTube and non-YouTube links
546
579
  proto.type = VideoProto.Type.NATIVE
547
580
 
@@ -611,6 +644,7 @@ def marshall_video(
611
644
  loop=loop,
612
645
  autoplay=autoplay,
613
646
  muted=muted,
647
+ width=width,
614
648
  )
615
649
 
616
650
 
@@ -732,6 +766,7 @@ def marshall_audio(
732
766
  loop: bool = False,
733
767
  autoplay: bool = False,
734
768
  form_id: str | None = None,
769
+ width: WidthWithoutContent = "stretch",
735
770
  ) -> None:
736
771
  """Marshalls an audio proto, using data and url processors as needed.
737
772
 
@@ -761,6 +796,11 @@ def marshall_audio(
761
796
  form_id: str | None
762
797
  The ID of the form that this element is placed in. Provide None if
763
798
  the element is not placed in a form.
799
+ width: int or "stretch"
800
+ The width of the audio player. This can be one of the following:
801
+ - An int: The width in pixels, e.g. 200 for a width of 200 pixels.
802
+ - "stretch": The default value. The audio player stretches to fill
803
+ available space in its container.
764
804
  """
765
805
 
766
806
  proto.start_time = start_time
@@ -768,6 +808,13 @@ def marshall_audio(
768
808
  proto.end_time = end_time
769
809
  proto.loop = loop
770
810
 
811
+ width_config = WidthConfig()
812
+ if isinstance(width, int):
813
+ width_config.pixel_width = width
814
+ else:
815
+ width_config.use_stretch = True
816
+ proto.width_config.CopyFrom(width_config)
817
+
771
818
  if isinstance(data, Path):
772
819
  data = str(data) # Convert Path to string
773
820
 
@@ -792,4 +839,5 @@ def marshall_audio(
792
839
  end_time=end_time,
793
840
  loop=loop,
794
841
  autoplay=autoplay,
842
+ width=width,
795
843
  )
@@ -223,13 +223,13 @@ def _parse_label(label: str) -> str:
223
223
  def _parse_value(value: Value) -> str:
224
224
  if value is None:
225
225
  return "—"
226
- if isinstance(value, int) or isinstance(value, float) or isinstance(value, str):
226
+ if isinstance(value, (int, float, str)):
227
227
  return str(value)
228
- elif hasattr(value, "item"):
228
+ if hasattr(value, "item"):
229
229
  # Add support for numpy values (e.g. int16, float64, etc.)
230
230
  try:
231
231
  # Item could also be just a variable, so we use try, except
232
- if isinstance(value.item(), float) or isinstance(value.item(), int):
232
+ if isinstance(value.item(), (float, int)):
233
233
  return str(value.item())
234
234
  except Exception: # noqa: S110
235
235
  # If the numpy item is not a valid value, the TypeError below will be raised.
@@ -247,14 +247,13 @@ def _parse_delta(delta: Delta) -> str:
247
247
  return ""
248
248
  if isinstance(delta, str):
249
249
  return dedent(delta)
250
- elif isinstance(delta, int) or isinstance(delta, float):
250
+ if isinstance(delta, (int, float)):
251
251
  return str(delta)
252
- else:
253
- raise TypeError(
254
- f"'{delta}' is of type {type(delta)}, which is not an accepted type."
255
- " delta only accepts: int, float, str, or None."
256
- " Please convert the value to an accepted type."
257
- )
252
+ raise TypeError(
253
+ f"'{delta}' is of type {type(delta)}, which is not an accepted type."
254
+ " delta only accepts: int, float, str, or None."
255
+ " Please convert the value to an accepted type."
256
+ )
258
257
 
259
258
 
260
259
  def _determine_delta_color_and_direction(
@@ -79,10 +79,7 @@ class AudioInputSerde:
79
79
  self, ui_value: FileUploaderStateProto | None
80
80
  ) -> SomeUploadedAudioFile:
81
81
  upload_files = _get_upload_files(ui_value)
82
- if len(upload_files) == 0:
83
- return_value = None
84
- else:
85
- return_value = upload_files[0]
82
+ return_value = None if len(upload_files) == 0 else upload_files[0]
86
83
  if return_value is not None and not isinstance(return_value, DeletedFile):
87
84
  enforce_filename_restriction(return_value.name, [".wav"])
88
85
  return return_value
@@ -79,10 +79,7 @@ class CameraInputSerde:
79
79
  self, ui_value: FileUploaderStateProto | None
80
80
  ) -> SomeUploadedSnapshotFile:
81
81
  upload_files = _get_upload_files(ui_value)
82
- if len(upload_files) == 0:
83
- return_value = None
84
- else:
85
- return_value = upload_files[0]
82
+ return_value = None if len(upload_files) == 0 else upload_files[0]
86
83
  if return_value is not None and not isinstance(return_value, DeletedFile):
87
84
  enforce_filename_restriction(return_value.name, [".jpg"])
88
85
  return return_value
@@ -33,6 +33,11 @@ from streamlit.elements.lib.file_uploader_utils import (
33
33
  )
34
34
  from streamlit.elements.lib.form_utils import is_in_form
35
35
  from streamlit.elements.lib.image_utils import AtomicImage, WidthBehavior, image_to_url
36
+ from streamlit.elements.lib.layout_utils import (
37
+ Width,
38
+ WidthWithoutContent,
39
+ validate_width,
40
+ )
36
41
  from streamlit.elements.lib.policies import check_widget_policies
37
42
  from streamlit.elements.lib.utils import (
38
43
  Key,
@@ -47,6 +52,7 @@ from streamlit.proto.ChatInput_pb2 import ChatInput as ChatInputProto
47
52
  from streamlit.proto.Common_pb2 import ChatInputValue as ChatInputValueProto
48
53
  from streamlit.proto.Common_pb2 import FileUploaderState as FileUploaderStateProto
49
54
  from streamlit.proto.RootContainer_pb2 import RootContainer
55
+ from streamlit.proto.WidthConfig_pb2 import WidthConfig
50
56
  from streamlit.runtime.metrics_util import gather_metrics
51
57
  from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
52
58
  from streamlit.runtime.state import (
@@ -224,6 +230,7 @@ class ChatMixin:
224
230
  name: Literal["user", "assistant", "ai", "human"] | str,
225
231
  *,
226
232
  avatar: Literal["user", "assistant"] | str | AtomicImage | None = None,
233
+ width: Width = "stretch",
227
234
  ) -> DeltaGenerator:
228
235
  """Insert a chat message container.
229
236
 
@@ -274,6 +281,14 @@ class ChatMixin:
274
281
  .. |st.image| replace:: ``st.image``
275
282
  .. _st.image: https://docs.streamlit.io/develop/api-reference/media/st.image
276
283
 
284
+ width: int, "auto", or "stretch"
285
+ The width of the chat message. This can be one of the following:
286
+
287
+ - An int: The width in pixels, e.g. ``200`` for a width of 200 pixels.
288
+ - ``"auto"``: Expands to fit the content.
289
+ - ``"stretch"``: The default value. The chat message stretches to fill
290
+ available space in its container.
291
+
277
292
  Returns
278
293
  -------
279
294
  Container
@@ -322,10 +337,23 @@ class ChatMixin:
322
337
  avatar, self.dg._get_delta_path_str()
323
338
  )
324
339
 
340
+ validate_width(width, allow_content=True)
341
+
325
342
  message_container_proto = BlockProto.ChatMessage()
326
343
  message_container_proto.name = name
327
344
  message_container_proto.avatar = converted_avatar
328
345
  message_container_proto.avatar_type = avatar_type
346
+
347
+ # Set up width configuration
348
+ width_config = WidthConfig()
349
+ if isinstance(width, int):
350
+ width_config.pixel_width = width
351
+ elif width == "content":
352
+ width_config.use_content = True
353
+ else:
354
+ width_config.use_stretch = True
355
+ message_container_proto.width_config.CopyFrom(width_config)
356
+
329
357
  block_proto = BlockProto()
330
358
  block_proto.allow_empty = True
331
359
  block_proto.chat_message.CopyFrom(message_container_proto)
@@ -345,6 +373,7 @@ class ChatMixin:
345
373
  on_submit: WidgetCallback | None = None,
346
374
  args: WidgetArgs | None = None,
347
375
  kwargs: WidgetKwargs | None = None,
376
+ width: WidthWithoutContent = "stretch",
348
377
  ) -> str | None: ...
349
378
 
350
379
  @overload
@@ -360,6 +389,7 @@ class ChatMixin:
360
389
  on_submit: WidgetCallback | None = None,
361
390
  args: WidgetArgs | None = None,
362
391
  kwargs: WidgetKwargs | None = None,
392
+ width: WidthWithoutContent = "stretch",
363
393
  ) -> ChatInputValue | None: ...
364
394
 
365
395
  @gather_metrics("chat_input")
@@ -375,6 +405,7 @@ class ChatMixin:
375
405
  on_submit: WidgetCallback | None = None,
376
406
  args: WidgetArgs | None = None,
377
407
  kwargs: WidgetKwargs | None = None,
408
+ width: WidthWithoutContent = "stretch",
378
409
  ) -> str | ChatInputValue | None:
379
410
  """Display a chat input widget.
380
411
 
@@ -439,6 +470,13 @@ class ChatMixin:
439
470
  kwargs : dict
440
471
  An optional dict of kwargs to pass to the callback.
441
472
 
473
+ width: int or "stretch"
474
+ The width of the chat input widget. This can be one of the following:
475
+
476
+ - An int: The width in pixels, e.g. ``200`` for a width of 200 pixels.
477
+ - ``"stretch"``: The default value. The chat input stretches to fill
478
+ available space in its container.
479
+
442
480
  Returns
443
481
  -------
444
482
  None, str, or dict-like
@@ -546,6 +584,8 @@ class ChatMixin:
546
584
  writes_allowed=False,
547
585
  )
548
586
 
587
+ validate_width(width)
588
+
549
589
  if accept_file not in {True, False, "multiple"}:
550
590
  raise StreamlitAPIException(
551
591
  "The `accept_file` parameter must be a boolean or 'multiple'."
@@ -562,6 +602,7 @@ class ChatMixin:
562
602
  max_chars=max_chars,
563
603
  accept_file=accept_file,
564
604
  file_type=file_type,
605
+ width=width,
565
606
  )
566
607
 
567
608
  if file_type:
@@ -571,11 +612,10 @@ class ChatMixin:
571
612
  # We throw an error to warn the user about this.
572
613
  # We omit this check for scripts running outside streamlit, because
573
614
  # they will have no script_run_ctx.
574
- if runtime.exists():
575
- if is_in_form(self.dg):
576
- raise StreamlitAPIException(
577
- "`st.chat_input()` can't be used in a `st.form()`."
578
- )
615
+ if runtime.exists() and is_in_form(self.dg):
616
+ raise StreamlitAPIException(
617
+ "`st.chat_input()` can't be used in a `st.form()`."
618
+ )
579
619
 
580
620
  # Determine the position of the chat input:
581
621
  # Use bottom position if chat input is within the main container
@@ -606,6 +646,13 @@ class ChatMixin:
606
646
  chat_input_proto.file_type[:] = file_type if file_type is not None else []
607
647
  chat_input_proto.max_upload_size_mb = config.get_option("server.maxUploadSize")
608
648
 
649
+ width_config = WidthConfig()
650
+ if isinstance(width, int):
651
+ width_config.pixel_width = width
652
+ else:
653
+ width_config.use_stretch = True
654
+ chat_input_proto.width_config.CopyFrom(width_config)
655
+
609
656
  serde = ChatInputSerde(
610
657
  accept_files=bool(accept_file),
611
658
  allowed_types=file_type,
@@ -949,7 +949,7 @@ class DataEditorMixin:
949
949
  if use_container_width is None:
950
950
  # If use_container_width was not explicitly set by the user, we set
951
951
  # it to True if width was not set explicitly, and False otherwise.
952
- use_container_width = True if width is None else False
952
+ use_container_width = width is None
953
953
 
954
954
  proto.use_container_width = use_container_width
955
955
 
@@ -708,10 +708,9 @@ class SliderMixin:
708
708
  f"But were: {list(map(type, value))}"
709
709
  )
710
710
 
711
- if len(value) == 0:
712
- data_type = SliderProto.INT
713
- else:
714
- data_type = value_to_generic_type(value[0])
711
+ data_type = (
712
+ SliderProto.INT if len(value) == 0 else value_to_generic_type(value[0])
713
+ )
715
714
 
716
715
  datetime_min = time.min
717
716
  datetime_max = time.max
@@ -517,10 +517,7 @@ class TimeWidgetsMixin:
517
517
  validate_width(width)
518
518
 
519
519
  parsed_time: time | None
520
- if value is None:
521
- parsed_time = None
522
- else:
523
- parsed_time = _convert_timelike_to_time(value)
520
+ parsed_time = None if value is None else _convert_timelike_to_time(value)
524
521
 
525
522
  element_id = compute_and_register_element_id(
526
523
  "time_input",
streamlit/env_util.py CHANGED
@@ -31,9 +31,7 @@ def is_pex() -> bool:
31
31
  Pex modifies sys.path so the pex file is the first path and that's
32
32
  how we determine we're running in the pex file.
33
33
  """
34
- if re.match(r".*pex$", sys.path[0]):
35
- return True
36
- return False
34
+ return bool(re.match(r".*pex$", sys.path[0]))
37
35
 
38
36
 
39
37
  def is_repl() -> bool:
@@ -48,10 +46,7 @@ def is_repl() -> bool:
48
46
 
49
47
  # <stdin> is what the basic Python REPL calls the root frame's
50
48
  # filename, and <string> is what iPython sometimes calls it.
51
- if filename in ("<stdin>", "<string>"):
52
- return True
53
-
54
- return False
49
+ return filename in ("<stdin>", "<string>")
55
50
 
56
51
 
57
52
  def is_executable_in_path(name: str) -> bool:
streamlit/errors.py CHANGED
@@ -245,7 +245,7 @@ class StreamlitInvalidColumnGapError(LocalizableStreamlitException):
245
245
 
246
246
  def __init__(self, gap: str) -> None:
247
247
  super().__init__(
248
- 'The `gap` argument to `st.columns` must be `"small"`, `"medium"`, or `"large"`. \n'
248
+ 'The `gap` argument to `st.columns` must be `"small"`, `"medium"`, `"large"`, or `"none"`. \n'
249
249
  "The argument passed was {gap}.",
250
250
  gap=gap,
251
251
  )
streamlit/logger.py CHANGED
@@ -113,13 +113,12 @@ def get_logger(name: str) -> logging.Logger:
113
113
  Logger
114
114
 
115
115
  """
116
- if name in _loggers.keys():
116
+ if name in _loggers:
117
117
  return _loggers[name]
118
118
 
119
- if name == "root":
120
- logger = logging.getLogger("streamlit")
121
- else:
122
- logger = logging.getLogger(name)
119
+ logger = (
120
+ logging.getLogger("streamlit") if name == "root" else logging.getLogger(name)
121
+ )
123
122
 
124
123
  logger.setLevel(_global_log_level)
125
124
  logger.propagate = False
@@ -12,9 +12,10 @@ from google.protobuf.internal import builder as _builder
12
12
  _sym_db = _symbol_database.Default()
13
13
 
14
14
 
15
+ from streamlit.proto import WidthConfig_pb2 as streamlit_dot_proto_dot_WidthConfig__pb2
15
16
 
16
17
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Audio.proto\"\x86\x01\n\x05\x41udio\x12\x0b\n\x03url\x18\x05 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x05\x12\x10\n\x08\x65nd_time\x18\x06 \x01(\x05\x12\x0c\n\x04loop\x18\x07 \x01(\x08\x12\x10\n\x08\x61utoplay\x18\x08 \x01(\x08\x12\n\n\x02id\x18\t \x01(\tJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05R\x04\x64\x61taR\x06\x66ormatB*\n\x1c\x63om.snowflake.apps.streamlitB\nAudioProtob\x06proto3')
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Audio.proto\x1a!streamlit/proto/WidthConfig.proto\"\xca\x01\n\x05\x41udio\x12\x0b\n\x03url\x18\x05 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x05\x12\x10\n\x08\x65nd_time\x18\x06 \x01(\x05\x12\x0c\n\x04loop\x18\x07 \x01(\x08\x12\x10\n\x08\x61utoplay\x18\x08 \x01(\x08\x12\n\n\x02id\x18\t \x01(\t\x12\x31\n\x0cwidth_config\x18\n \x01(\x0b\x32\x16.streamlit.WidthConfigH\x00\x88\x01\x01\x42\x0f\n\r_width_configJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05R\x04\x64\x61taR\x06\x66ormatB*\n\x1c\x63om.snowflake.apps.streamlitB\nAudioProtob\x06proto3')
18
19
 
19
20
  _globals = globals()
20
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -22,6 +23,6 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.Audio_pb2',
22
23
  if not _descriptor._USE_C_DESCRIPTORS:
23
24
  _globals['DESCRIPTOR']._loaded_options = None
24
25
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\nAudioProto'
25
- _globals['_AUDIO']._serialized_start=32
26
- _globals['_AUDIO']._serialized_end=166
26
+ _globals['_AUDIO']._serialized_start=67
27
+ _globals['_AUDIO']._serialized_end=269
27
28
  # @@protoc_insertion_point(module_scope)
@@ -20,6 +20,7 @@ limitations under the License.
20
20
  import builtins
21
21
  import google.protobuf.descriptor
22
22
  import google.protobuf.message
23
+ import streamlit.proto.WidthConfig_pb2
23
24
  import typing
24
25
 
25
26
  DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
@@ -34,6 +35,7 @@ class Audio(google.protobuf.message.Message):
34
35
  LOOP_FIELD_NUMBER: builtins.int
35
36
  AUTOPLAY_FIELD_NUMBER: builtins.int
36
37
  ID_FIELD_NUMBER: builtins.int
38
+ WIDTH_CONFIG_FIELD_NUMBER: builtins.int
37
39
  url: builtins.str
38
40
  start_time: builtins.int
39
41
  """The currentTime attribute of the HTML <audio> tag's <source> subtag."""
@@ -43,6 +45,8 @@ class Audio(google.protobuf.message.Message):
43
45
  """Indicates whether the audio should start over from the beginning once it ends."""
44
46
  autoplay: builtins.bool
45
47
  id: builtins.str
48
+ @property
49
+ def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig: ...
46
50
  def __init__(
47
51
  self,
48
52
  *,
@@ -52,7 +56,10 @@ class Audio(google.protobuf.message.Message):
52
56
  loop: builtins.bool = ...,
53
57
  autoplay: builtins.bool = ...,
54
58
  id: builtins.str = ...,
59
+ width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
55
60
  ) -> None: ...
56
- def ClearField(self, field_name: typing.Literal["autoplay", b"autoplay", "end_time", b"end_time", "id", b"id", "loop", b"loop", "start_time", b"start_time", "url", b"url"]) -> None: ...
61
+ def HasField(self, field_name: typing.Literal["_width_config", b"_width_config", "width_config", b"width_config"]) -> builtins.bool: ...
62
+ def ClearField(self, field_name: typing.Literal["_width_config", b"_width_config", "autoplay", b"autoplay", "end_time", b"end_time", "id", b"id", "loop", b"loop", "start_time", b"start_time", "url", b"url", "width_config", b"width_config"]) -> None: ...
63
+ def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
57
64
 
58
65
  global___Audio = Audio
@@ -17,7 +17,7 @@ from streamlit.proto import HeightConfig_pb2 as streamlit_dot_proto_dot_HeightCo
17
17
  from streamlit.proto import GapSize_pb2 as streamlit_dot_proto_dot_GapSize__pb2
18
18
 
19
19
 
20
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Block.proto\x1a!streamlit/proto/WidthConfig.proto\x1a\"streamlit/proto/HeightConfig.proto\x1a\x1dstreamlit/proto/GapSize.proto\"\xb6\r\n\x05\x42lock\x12#\n\x08vertical\x18\x01 \x01(\x0b\x32\x0f.Block.VerticalH\x00\x12\'\n\nhorizontal\x18\x02 \x01(\x0b\x32\x11.Block.HorizontalH\x00\x12\x1f\n\x06\x63olumn\x18\x03 \x01(\x0b\x32\r.Block.ColumnH\x00\x12\'\n\nexpandable\x18\x04 \x01(\x0b\x32\x11.Block.ExpandableH\x00\x12\x1b\n\x04\x66orm\x18\x05 \x01(\x0b\x32\x0b.Block.FormH\x00\x12,\n\rtab_container\x18\x06 \x01(\x0b\x32\x13.Block.TabContainerH\x00\x12\x19\n\x03tab\x18\x07 \x01(\x0b\x32\n.Block.TabH\x00\x12*\n\x0c\x63hat_message\x18\t \x01(\x0b\x32\x12.Block.ChatMessageH\x00\x12!\n\x07popover\x18\n \x01(\x0b\x32\x0e.Block.PopoverH\x00\x12\x1f\n\x06\x64ialog\x18\x0b \x01(\x0b\x32\r.Block.DialogH\x00\x12.\n\x0e\x66lex_container\x18\r \x01(\x0b\x32\x14.Block.FlexContainerH\x00\x12\x13\n\x0b\x61llow_empty\x18\x08 \x01(\x08\x12\x0f\n\x02id\x18\x0c \x01(\tH\x01\x88\x01\x01\x1a*\n\x08Vertical\x12\x0e\n\x06\x62order\x18\x01 \x01(\x08\x12\x0e\n\x06height\x18\x02 \x01(\r\x1a\x19\n\nHorizontal\x12\x0b\n\x03gap\x18\x01 \x01(\t\x1a\xbb\x02\n\rFlexContainer\x12\x0e\n\x06\x62order\x18\x01 \x01(\x08\x12.\n\rheight_config\x18\x02 \x01(\x0b\x32\x17.streamlit.HeightConfig\x12,\n\x0cwidth_config\x18\x03 \x01(\x0b\x32\x16.streamlit.WidthConfig\x12(\n\ngap_config\x18\x04 \x01(\x0b\x32\x14.streamlit.GapConfig\x12\r\n\x05scale\x18\x05 \x01(\x02\x12\x31\n\tdirection\x18\x06 \x01(\x0e\x32\x1e.Block.FlexContainer.Direction\x12\x0c\n\x04wrap\x18\x07 \x01(\x08\"B\n\tDirection\x12\x17\n\x13\x44IRECTION_UNDEFINED\x10\x00\x12\x0c\n\x08VERTICAL\x10\x01\x12\x0e\n\nHORIZONTAL\x10\x02\x1a\xef\x01\n\x06\x43olumn\x12\x0e\n\x06weight\x18\x01 \x01(\x01\x12\x0f\n\x03gap\x18\x02 \x01(\tB\x02\x18\x01\x12;\n\x12vertical_alignment\x18\x03 \x01(\x0e\x32\x1f.Block.Column.VerticalAlignment\x12\x13\n\x0bshow_border\x18\x04 \x01(\x08\x12-\n\ngap_config\x18\x05 \x01(\x0b\x32\x14.streamlit.GapConfigH\x00\x88\x01\x01\"4\n\x11VerticalAlignment\x12\x07\n\x03TOP\x10\x00\x12\n\n\x06\x43\x45NTER\x10\x01\x12\n\n\x06\x42OTTOM\x10\x02\x42\r\n\x0b_gap_config\x1aM\n\nExpandable\x12\r\n\x05label\x18\x01 \x01(\t\x12\x15\n\x08\x65xpanded\x18\x02 \x01(\x08H\x00\x88\x01\x01\x12\x0c\n\x04icon\x18\x03 \x01(\tB\x0b\n\t_expanded\x1a\x9d\x01\n\x06\x44ialog\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64ismissible\x18\x02 \x01(\x08\x12(\n\x05width\x18\x03 \x01(\x0e\x32\x19.Block.Dialog.DialogWidth\x12\x14\n\x07is_open\x18\x04 \x01(\x08H\x00\x88\x01\x01\"#\n\x0b\x44ialogWidth\x12\t\n\x05SMALL\x10\x00\x12\t\n\x05LARGE\x10\x01\x42\n\n\x08_is_open\x1aY\n\x04\x46orm\x12\x0f\n\x07\x66orm_id\x18\x01 \x01(\t\x12\x17\n\x0f\x63lear_on_submit\x18\x02 \x01(\x08\x12\x0e\n\x06\x62order\x18\x03 \x01(\x08\x12\x17\n\x0f\x65nter_to_submit\x18\x04 \x01(\x08\x1a\x0e\n\x0cTabContainer\x1a\x14\n\x03Tab\x12\r\n\x05label\x18\x01 \x01(\t\x1a\x63\n\x07Popover\x12\r\n\x05label\x18\x01 \x01(\t\x12\x1b\n\x13use_container_width\x18\x02 \x01(\x08\x12\x0c\n\x04help\x18\x03 \x01(\t\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\x0c\n\x04icon\x18\x05 \x01(\t\x1a\x8d\x01\n\x0b\x43hatMessage\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x61vatar\x18\x02 \x01(\t\x12\x32\n\x0b\x61vatar_type\x18\x03 \x01(\x0e\x32\x1d.Block.ChatMessage.AvatarType\",\n\nAvatarType\x12\t\n\x05IMAGE\x10\x00\x12\t\n\x05\x45MOJI\x10\x01\x12\x08\n\x04ICON\x10\x02\x42\x06\n\x04typeB\x05\n\x03_idB*\n\x1c\x63om.snowflake.apps.streamlitB\nBlockProtob\x06proto3')
20
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Block.proto\x1a!streamlit/proto/WidthConfig.proto\x1a\"streamlit/proto/HeightConfig.proto\x1a\x1dstreamlit/proto/GapSize.proto\"\xfa\r\n\x05\x42lock\x12#\n\x08vertical\x18\x01 \x01(\x0b\x32\x0f.Block.VerticalH\x00\x12\'\n\nhorizontal\x18\x02 \x01(\x0b\x32\x11.Block.HorizontalH\x00\x12\x1f\n\x06\x63olumn\x18\x03 \x01(\x0b\x32\r.Block.ColumnH\x00\x12\'\n\nexpandable\x18\x04 \x01(\x0b\x32\x11.Block.ExpandableH\x00\x12\x1b\n\x04\x66orm\x18\x05 \x01(\x0b\x32\x0b.Block.FormH\x00\x12,\n\rtab_container\x18\x06 \x01(\x0b\x32\x13.Block.TabContainerH\x00\x12\x19\n\x03tab\x18\x07 \x01(\x0b\x32\n.Block.TabH\x00\x12*\n\x0c\x63hat_message\x18\t \x01(\x0b\x32\x12.Block.ChatMessageH\x00\x12!\n\x07popover\x18\n \x01(\x0b\x32\x0e.Block.PopoverH\x00\x12\x1f\n\x06\x64ialog\x18\x0b \x01(\x0b\x32\r.Block.DialogH\x00\x12.\n\x0e\x66lex_container\x18\r \x01(\x0b\x32\x14.Block.FlexContainerH\x00\x12\x13\n\x0b\x61llow_empty\x18\x08 \x01(\x08\x12\x0f\n\x02id\x18\x0c \x01(\tH\x01\x88\x01\x01\x1a*\n\x08Vertical\x12\x0e\n\x06\x62order\x18\x01 \x01(\x08\x12\x0e\n\x06height\x18\x02 \x01(\r\x1a\x19\n\nHorizontal\x12\x0b\n\x03gap\x18\x01 \x01(\t\x1a\xbb\x02\n\rFlexContainer\x12\x0e\n\x06\x62order\x18\x01 \x01(\x08\x12.\n\rheight_config\x18\x02 \x01(\x0b\x32\x17.streamlit.HeightConfig\x12,\n\x0cwidth_config\x18\x03 \x01(\x0b\x32\x16.streamlit.WidthConfig\x12(\n\ngap_config\x18\x04 \x01(\x0b\x32\x14.streamlit.GapConfig\x12\r\n\x05scale\x18\x05 \x01(\x02\x12\x31\n\tdirection\x18\x06 \x01(\x0e\x32\x1e.Block.FlexContainer.Direction\x12\x0c\n\x04wrap\x18\x07 \x01(\x08\"B\n\tDirection\x12\x17\n\x13\x44IRECTION_UNDEFINED\x10\x00\x12\x0c\n\x08VERTICAL\x10\x01\x12\x0e\n\nHORIZONTAL\x10\x02\x1a\xef\x01\n\x06\x43olumn\x12\x0e\n\x06weight\x18\x01 \x01(\x01\x12\x0f\n\x03gap\x18\x02 \x01(\tB\x02\x18\x01\x12;\n\x12vertical_alignment\x18\x03 \x01(\x0e\x32\x1f.Block.Column.VerticalAlignment\x12\x13\n\x0bshow_border\x18\x04 \x01(\x08\x12-\n\ngap_config\x18\x05 \x01(\x0b\x32\x14.streamlit.GapConfigH\x00\x88\x01\x01\"4\n\x11VerticalAlignment\x12\x07\n\x03TOP\x10\x00\x12\n\n\x06\x43\x45NTER\x10\x01\x12\n\n\x06\x42OTTOM\x10\x02\x42\r\n\x0b_gap_config\x1aM\n\nExpandable\x12\r\n\x05label\x18\x01 \x01(\t\x12\x15\n\x08\x65xpanded\x18\x02 \x01(\x08H\x00\x88\x01\x01\x12\x0c\n\x04icon\x18\x03 \x01(\tB\x0b\n\t_expanded\x1a\x9d\x01\n\x06\x44ialog\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64ismissible\x18\x02 \x01(\x08\x12(\n\x05width\x18\x03 \x01(\x0e\x32\x19.Block.Dialog.DialogWidth\x12\x14\n\x07is_open\x18\x04 \x01(\x08H\x00\x88\x01\x01\"#\n\x0b\x44ialogWidth\x12\t\n\x05SMALL\x10\x00\x12\t\n\x05LARGE\x10\x01\x42\n\n\x08_is_open\x1aY\n\x04\x46orm\x12\x0f\n\x07\x66orm_id\x18\x01 \x01(\t\x12\x17\n\x0f\x63lear_on_submit\x18\x02 \x01(\x08\x12\x0e\n\x06\x62order\x18\x03 \x01(\x08\x12\x17\n\x0f\x65nter_to_submit\x18\x04 \x01(\x08\x1a\x0e\n\x0cTabContainer\x1a\x14\n\x03Tab\x12\r\n\x05label\x18\x01 \x01(\t\x1a\x63\n\x07Popover\x12\r\n\x05label\x18\x01 \x01(\t\x12\x1b\n\x13use_container_width\x18\x02 \x01(\x08\x12\x0c\n\x04help\x18\x03 \x01(\t\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\x0c\n\x04icon\x18\x05 \x01(\t\x1a\xd1\x01\n\x0b\x43hatMessage\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x61vatar\x18\x02 \x01(\t\x12\x32\n\x0b\x61vatar_type\x18\x03 \x01(\x0e\x32\x1d.Block.ChatMessage.AvatarType\x12\x31\n\x0cwidth_config\x18\x04 \x01(\x0b\x32\x16.streamlit.WidthConfigH\x00\x88\x01\x01\",\n\nAvatarType\x12\t\n\x05IMAGE\x10\x00\x12\t\n\x05\x45MOJI\x10\x01\x12\x08\n\x04ICON\x10\x02\x42\x0f\n\r_width_configB\x06\n\x04typeB\x05\n\x03_idB*\n\x1c\x63om.snowflake.apps.streamlitB\nBlockProtob\x06proto3')
21
21
 
22
22
  _globals = globals()
23
23
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -28,7 +28,7 @@ if not _descriptor._USE_C_DESCRIPTORS:
28
28
  _globals['_BLOCK_COLUMN'].fields_by_name['gap']._loaded_options = None
29
29
  _globals['_BLOCK_COLUMN'].fields_by_name['gap']._serialized_options = b'\030\001'
30
30
  _globals['_BLOCK']._serialized_start=134
31
- _globals['_BLOCK']._serialized_end=1852
31
+ _globals['_BLOCK']._serialized_end=1920
32
32
  _globals['_BLOCK_VERTICAL']._serialized_start=595
33
33
  _globals['_BLOCK_VERTICAL']._serialized_end=637
34
34
  _globals['_BLOCK_HORIZONTAL']._serialized_start=639
@@ -56,7 +56,7 @@ if not _descriptor._USE_C_DESCRIPTORS:
56
56
  _globals['_BLOCK_POPOVER']._serialized_start=1594
57
57
  _globals['_BLOCK_POPOVER']._serialized_end=1693
58
58
  _globals['_BLOCK_CHATMESSAGE']._serialized_start=1696
59
- _globals['_BLOCK_CHATMESSAGE']._serialized_end=1837
60
- _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_start=1793
61
- _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_end=1837
59
+ _globals['_BLOCK_CHATMESSAGE']._serialized_end=1905
60
+ _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_start=1844
61
+ _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_end=1888
62
62
  # @@protoc_insertion_point(module_scope)
@@ -310,17 +310,23 @@ class Block(google.protobuf.message.Message):
310
310
  NAME_FIELD_NUMBER: builtins.int
311
311
  AVATAR_FIELD_NUMBER: builtins.int
312
312
  AVATAR_TYPE_FIELD_NUMBER: builtins.int
313
+ WIDTH_CONFIG_FIELD_NUMBER: builtins.int
313
314
  name: builtins.str
314
315
  avatar: builtins.str
315
316
  avatar_type: global___Block.ChatMessage.AvatarType.ValueType
317
+ @property
318
+ def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig: ...
316
319
  def __init__(
317
320
  self,
318
321
  *,
319
322
  name: builtins.str = ...,
320
323
  avatar: builtins.str = ...,
321
324
  avatar_type: global___Block.ChatMessage.AvatarType.ValueType = ...,
325
+ width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
322
326
  ) -> None: ...
323
- def ClearField(self, field_name: typing.Literal["avatar", b"avatar", "avatar_type", b"avatar_type", "name", b"name"]) -> None: ...
327
+ def HasField(self, field_name: typing.Literal["_width_config", b"_width_config", "width_config", b"width_config"]) -> builtins.bool: ...
328
+ def ClearField(self, field_name: typing.Literal["_width_config", b"_width_config", "avatar", b"avatar", "avatar_type", b"avatar_type", "name", b"name", "width_config", b"width_config"]) -> None: ...
329
+ def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
324
330
 
325
331
  VERTICAL_FIELD_NUMBER: builtins.int
326
332
  HORIZONTAL_FIELD_NUMBER: builtins.int
@@ -12,9 +12,10 @@ from google.protobuf.internal import builder as _builder
12
12
  _sym_db = _symbol_database.Default()
13
13
 
14
14
 
15
+ from streamlit.proto import WidthConfig_pb2 as streamlit_dot_proto_dot_WidthConfig__pb2
15
16
 
16
17
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/ChatInput.proto\"\xd0\x02\n\tChatInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bplaceholder\x18\x02 \x01(\t\x12\x11\n\tmax_chars\x18\x03 \x01(\r\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\r\n\x05value\x18\x05 \x01(\t\x12\x11\n\tset_value\x18\x06 \x01(\x08\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x07 \x01(\t\x12%\n\x08position\x18\x08 \x01(\x0e\x32\x13.ChatInput.Position\x12*\n\x0b\x61\x63\x63\x65pt_file\x18\t \x01(\x0e\x32\x15.ChatInput.AcceptFile\x12\x11\n\tfile_type\x18\n \x03(\t\x12\x1a\n\x12max_upload_size_mb\x18\x0b \x01(\x05\"\x16\n\x08Position\x12\n\n\x06\x42OTTOM\x10\x00\"0\n\nAcceptFile\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SINGLE\x10\x01\x12\x0c\n\x08MULTIPLE\x10\x02\x42.\n\x1c\x63om.snowflake.apps.streamlitB\x0e\x43hatInputProtob\x06proto3')
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/ChatInput.proto\x1a!streamlit/proto/WidthConfig.proto\"\x94\x03\n\tChatInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bplaceholder\x18\x02 \x01(\t\x12\x11\n\tmax_chars\x18\x03 \x01(\r\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\r\n\x05value\x18\x05 \x01(\t\x12\x11\n\tset_value\x18\x06 \x01(\x08\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x07 \x01(\t\x12%\n\x08position\x18\x08 \x01(\x0e\x32\x13.ChatInput.Position\x12*\n\x0b\x61\x63\x63\x65pt_file\x18\t \x01(\x0e\x32\x15.ChatInput.AcceptFile\x12\x11\n\tfile_type\x18\n \x03(\t\x12\x1a\n\x12max_upload_size_mb\x18\x0b \x01(\x05\x12\x31\n\x0cwidth_config\x18\x0c \x01(\x0b\x32\x16.streamlit.WidthConfigH\x00\x88\x01\x01\"\x16\n\x08Position\x12\n\n\x06\x42OTTOM\x10\x00\"0\n\nAcceptFile\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SINGLE\x10\x01\x12\x0c\n\x08MULTIPLE\x10\x02\x42\x0f\n\r_width_configB.\n\x1c\x63om.snowflake.apps.streamlitB\x0e\x43hatInputProtob\x06proto3')
18
19
 
19
20
  _globals = globals()
20
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -22,10 +23,10 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.ChatInput_p
22
23
  if not _descriptor._USE_C_DESCRIPTORS:
23
24
  _globals['DESCRIPTOR']._loaded_options = None
24
25
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\016ChatInputProto'
25
- _globals['_CHATINPUT']._serialized_start=36
26
- _globals['_CHATINPUT']._serialized_end=372
27
- _globals['_CHATINPUT_POSITION']._serialized_start=300
28
- _globals['_CHATINPUT_POSITION']._serialized_end=322
29
- _globals['_CHATINPUT_ACCEPTFILE']._serialized_start=324
30
- _globals['_CHATINPUT_ACCEPTFILE']._serialized_end=372
26
+ _globals['_CHATINPUT']._serialized_start=71
27
+ _globals['_CHATINPUT']._serialized_end=475
28
+ _globals['_CHATINPUT_POSITION']._serialized_start=386
29
+ _globals['_CHATINPUT_POSITION']._serialized_end=408
30
+ _globals['_CHATINPUT_ACCEPTFILE']._serialized_start=410
31
+ _globals['_CHATINPUT_ACCEPTFILE']._serialized_end=458
31
32
  # @@protoc_insertion_point(module_scope)