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.
Files changed (139) hide show
  1. streamlit/__init__.py +4 -1
  2. streamlit/column_config.py +11 -9
  3. streamlit/commands/execution_control.py +5 -6
  4. streamlit/commands/logo.py +7 -2
  5. streamlit/components/v1/components.py +1 -1
  6. streamlit/connections/__init__.py +2 -2
  7. streamlit/connections/base_connection.py +2 -2
  8. streamlit/connections/snowflake_connection.py +4 -3
  9. streamlit/dataframe_util.py +2 -1
  10. streamlit/delta_generator.py +17 -37
  11. streamlit/elements/alert.py +1 -1
  12. streamlit/elements/arrow.py +3 -3
  13. streamlit/elements/deck_gl_json_chart.py +1 -1
  14. streamlit/elements/exception.py +5 -1
  15. streamlit/elements/json.py +1 -1
  16. streamlit/elements/layouts.py +3 -9
  17. streamlit/elements/lib/built_in_chart_utils.py +14 -6
  18. streamlit/elements/lib/column_config_utils.py +1 -3
  19. streamlit/elements/lib/column_types.py +2 -2
  20. streamlit/elements/lib/dialog.py +2 -1
  21. streamlit/elements/lib/file_uploader_utils.py +7 -2
  22. streamlit/elements/lib/js_number.py +4 -4
  23. streamlit/elements/lib/options_selector_utils.py +9 -6
  24. streamlit/elements/media.py +8 -7
  25. streamlit/elements/metric.py +4 -4
  26. streamlit/elements/progress.py +1 -1
  27. streamlit/elements/vega_charts.py +2 -2
  28. streamlit/elements/widgets/button.py +5 -6
  29. streamlit/elements/widgets/number_input.py +81 -28
  30. streamlit/elements/widgets/slider.py +87 -35
  31. streamlit/elements/widgets/time_widgets.py +43 -0
  32. streamlit/errors.py +9 -6
  33. streamlit/proto/DateInput_pb2.py +4 -3
  34. streamlit/proto/DateInput_pb2.pyi +8 -2
  35. streamlit/proto/TimeInput_pb2.py +4 -3
  36. streamlit/proto/TimeInput_pb2.pyi +9 -2
  37. streamlit/runtime/__init__.py +1 -1
  38. streamlit/runtime/caching/__init__.py +6 -6
  39. streamlit/runtime/caching/cache_data_api.py +7 -9
  40. streamlit/runtime/caching/hashing.py +1 -1
  41. streamlit/runtime/caching/storage/cache_storage_protocol.py +1 -1
  42. streamlit/runtime/connection_factory.py +1 -1
  43. streamlit/runtime/credentials.py +4 -4
  44. streamlit/runtime/fragment.py +2 -2
  45. streamlit/runtime/metrics_util.py +2 -2
  46. streamlit/runtime/runtime.py +1 -1
  47. streamlit/runtime/runtime_util.py +2 -1
  48. streamlit/runtime/scriptrunner/__init__.py +4 -4
  49. streamlit/runtime/scriptrunner/script_runner.py +6 -9
  50. streamlit/runtime/scriptrunner_utils/script_run_context.py +1 -0
  51. streamlit/runtime/secrets.py +15 -8
  52. streamlit/runtime/state/__init__.py +5 -5
  53. streamlit/runtime/state/query_params.py +8 -8
  54. streamlit/runtime/state/session_state.py +8 -1
  55. streamlit/static/index.html +1 -1
  56. streamlit/static/static/js/{ErrorOutline.esm.Bp4VdNOc.js → ErrorOutline.esm.BgsGCsV4.js} +1 -1
  57. streamlit/static/static/js/{FileDownload.esm.hVzDDDNS.js → FileDownload.esm.CCKezPn5.js} +1 -1
  58. streamlit/static/static/js/{FileHelper.BGcyDQ_S.js → FileHelper.CprSF_kT.js} +1 -1
  59. streamlit/static/static/js/{FormClearHelper.a0IiSXcn.js → FormClearHelper.DiwQ0EtT.js} +1 -1
  60. streamlit/static/static/js/{Hooks.C2dZkryw.js → Hooks.DDqhyZ1_.js} +1 -1
  61. streamlit/static/static/js/{InputInstructions.Cn0WICoN.js → InputInstructions.BCEZxme4.js} +1 -1
  62. streamlit/static/static/js/{ProgressBar.VRmRPHtW.js → ProgressBar.CGdY94g_.js} +1 -1
  63. streamlit/static/static/js/{RenderInPortalIfExists.CZa97lrw.js → RenderInPortalIfExists.uGJp_Q0v.js} +1 -1
  64. streamlit/static/static/js/{Toolbar.DJZBBDvl.js → Toolbar.hTlw0-K1.js} +1 -1
  65. streamlit/static/static/js/{base-input.CzerGAEH.js → base-input.mGTY3-qU.js} +1 -1
  66. streamlit/static/static/js/{checkbox.C6Sj4eVw.js → checkbox.Cg-5cKAh.js} +1 -1
  67. streamlit/static/static/js/{createSuper.C7yhRETi.js → createSuper.-HPb1oYT.js} +1 -1
  68. streamlit/static/static/js/{data-grid-overlay-editor.DAgcbVks.js → data-grid-overlay-editor.BpNYxiTp.js} +1 -1
  69. streamlit/static/static/js/{downloader.B8HL-u_1.js → downloader.DS9891pS.js} +1 -1
  70. streamlit/static/static/js/{es6.BxAW_jrO.js → es6.CU1PEL2w.js} +2 -2
  71. streamlit/static/static/js/{iframeResizer.contentWindow.CS8fz-W7.js → iframeResizer.contentWindow.CgJE2bJN.js} +1 -1
  72. streamlit/static/static/js/{index.BwnckS8e.js → index.B209tswL.js} +1 -1
  73. streamlit/static/static/js/{index.C7t1-CQQ.js → index.BC0ueJ8H.js} +1 -1
  74. streamlit/static/static/js/{index.DWb5kgxt.js → index.BHVQ94t4.js} +1 -1
  75. streamlit/static/static/js/{index.DgOrPDFa.js → index.BT0p7gAu.js} +1 -1
  76. streamlit/static/static/js/{index.uOOdkOMl.js → index.BTTj6ld4.js} +1 -1
  77. streamlit/static/static/js/{index.CG2pASlR.js → index.BVjgrQ4R.js} +1 -1
  78. streamlit/static/static/js/{index.6jptdEp6.js → index.BXYstdPh.js} +1 -1
  79. streamlit/static/static/js/{index.Dt0FtS-M.js → index.BZ9mqzEJ.js} +1 -1
  80. streamlit/static/static/js/{index.CSAdYIt3.js → index.Bb-Ukg41.js} +1 -1
  81. streamlit/static/static/js/{index.B2tTSlE1.js → index.BhTok8vt.js} +1 -1
  82. streamlit/static/static/js/{index.DIZcktIN.js → index.Bph6ZoI5.js} +1 -1
  83. streamlit/static/static/js/{index.B7UKH_JX.js → index.CJPcdxPe.js} +1 -1
  84. streamlit/static/static/js/{index.D6KElXAI.js → index.CMOA-8Q2.js} +1 -1
  85. streamlit/static/static/js/{index.Cxp7siQJ.js → index.CN91oQMB.js} +5 -5
  86. streamlit/static/static/js/{index.Cr1JUXmf.js → index.CtoDsUtq.js} +1 -1
  87. streamlit/static/static/js/{index.C4KrRG3c.js → index.CvFsF3FD.js} +1 -1
  88. streamlit/static/static/js/{index.DDCep3pE.js → index.CyGuL4If.js} +1 -1
  89. streamlit/static/static/js/{index.ChOkUAuD.js → index.CzGUd4IN.js} +1 -1
  90. streamlit/static/static/js/{index.A_t8lw--.js → index.DAxf3_iz.js} +1 -1
  91. streamlit/static/static/js/{index.DG9Swsby.js → index.DJHUlWgy.js} +1 -1
  92. streamlit/static/static/js/{index.CHL4u91M.js → index.DLTqo4pp.js} +1 -1
  93. streamlit/static/static/js/{index.o12m2E2P.js → index.DPJBu2uZ.js} +1 -1
  94. streamlit/static/static/js/{index.CLFopaXS.js → index.DVpzZJNg.js} +1 -1
  95. streamlit/static/static/js/{index.vdE-PayY.js → index.DWV80Vyw.js} +1 -1
  96. streamlit/static/static/js/{index.DR2lTx8N.js → index.DZ6oX-v9.js} +5 -5
  97. streamlit/static/static/js/{index.DtY8dAVN.js → index.Dh4RKl-F.js} +1 -1
  98. streamlit/static/static/js/{index.BRtyx04t.js → index.Dn76KVNf.js} +1 -1
  99. streamlit/static/static/js/{index.qMnAjj-G.js → index.DtqvdV-p.js} +1 -1
  100. streamlit/static/static/js/{index.BwlA1Cf_.js → index.ErkF0SoX.js} +1 -1
  101. streamlit/static/static/js/{index.QdRaJV_a.js → index.GSYBrzVp.js} +1 -1
  102. streamlit/static/static/js/{index.CSPC2m_c.js → index.OngWTN39.js} +1 -1
  103. streamlit/static/static/js/{index.CGzwdjEF.js → index.PSwG8ayC.js} +1 -1
  104. streamlit/static/static/js/{index.D_0HKLRm.js → index.UTlCdasa.js} +1 -1
  105. streamlit/static/static/js/{index.aBgCjIEX.js → index.eR_vQpeg.js} +1 -1
  106. streamlit/static/static/js/{index.BBClg-gm.js → index.fLsU9uCJ.js} +1 -1
  107. streamlit/static/static/js/{index.BDzCUpOG.js → index.hPjr68pz.js} +1 -1
  108. streamlit/static/static/js/{index.CgzjjllY.js → index.kXOZCC_6.js} +1 -1
  109. streamlit/static/static/js/{input.qNZgmgfK.js → input.DY17i94N.js} +1 -1
  110. streamlit/static/static/js/{memory.DifcSUze.js → memory.DsIIcbSd.js} +1 -1
  111. streamlit/static/static/js/{mergeWith.Bykfc0n-.js → mergeWith.cRgGdgvI.js} +1 -1
  112. streamlit/static/static/js/{number-overlay-editor.D_L9PQiU.js → number-overlay-editor.B8Xi2dYq.js} +1 -1
  113. streamlit/static/static/js/{possibleConstructorReturn.Cyeph4pU.js → possibleConstructorReturn.BgDi5nUm.js} +1 -1
  114. streamlit/static/static/js/{sandbox.DT6zcSKI.js → sandbox.BH9emp13.js} +1 -1
  115. streamlit/static/static/js/{textarea.C46FrViu.js → textarea.DAyShsGG.js} +1 -1
  116. streamlit/static/static/js/{timepicker.N6lFakQJ.js → timepicker.CCH2R2Y0.js} +1 -1
  117. streamlit/static/static/js/{toConsumableArray.DwaNiLbv.js → toConsumableArray.CNffSDCu.js} +1 -1
  118. streamlit/static/static/js/{uniqueId.bNZuA9Mz.js → uniqueId.B49CstkV.js} +1 -1
  119. streamlit/static/static/js/{useBasicWidgetState.qUuCVRZV.js → useBasicWidgetState.CkThOkF9.js} +1 -1
  120. streamlit/static/static/js/{useOnInputChange.CylEhpc7.js → useOnInputChange.BqEq0xFZ.js} +1 -1
  121. streamlit/static/static/js/{withFullScreenWrapper.BQay_j7X.js → withFullScreenWrapper.UsvF_Jwr.js} +1 -1
  122. streamlit/string_util.py +8 -5
  123. streamlit/web/bootstrap.py +5 -4
  124. streamlit/web/cli.py +2 -1
  125. streamlit/web/server/__init__.py +2 -2
  126. streamlit/web/server/browser_websocket_handler.py +3 -2
  127. streamlit/web/server/component_request_handler.py +7 -7
  128. streamlit/web/server/media_file_handler.py +2 -2
  129. streamlit/web/server/oauth_authlib_routes.py +3 -3
  130. streamlit/web/server/routes.py +2 -2
  131. streamlit/web/server/server.py +4 -4
  132. streamlit/web/server/upload_file_request_handler.py +4 -3
  133. streamlit/web/server/websocket_headers.py +1 -1
  134. {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/METADATA +1 -1
  135. {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/RECORD +139 -139
  136. {streamlit_nightly-1.45.1.dev20250504.data → streamlit_nightly-1.45.1.dev20250506.data}/scripts/streamlit.cmd +0 -0
  137. {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/WHEEL +0 -0
  138. {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/entry_points.txt +0 -0
  139. {streamlit_nightly-1.45.1.dev20250504.dist-info → streamlit_nightly-1.45.1.dev20250506.dist-info}/top_level.txt +0 -0
@@ -23,6 +23,7 @@ import google.protobuf.descriptor
23
23
  import google.protobuf.internal.containers
24
24
  import google.protobuf.message
25
25
  import streamlit.proto.LabelVisibilityMessage_pb2
26
+ import streamlit.proto.WidthConfig_pb2
26
27
  import typing
27
28
 
28
29
  DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
@@ -44,6 +45,7 @@ class DateInput(google.protobuf.message.Message):
44
45
  DISABLED_FIELD_NUMBER: builtins.int
45
46
  LABEL_VISIBILITY_FIELD_NUMBER: builtins.int
46
47
  FORMAT_FIELD_NUMBER: builtins.int
48
+ WIDTH_CONFIG_FIELD_NUMBER: builtins.int
47
49
  id: builtins.str
48
50
  label: builtins.str
49
51
  min: builtins.str
@@ -60,6 +62,8 @@ class DateInput(google.protobuf.message.Message):
60
62
  def value(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ...
61
63
  @property
62
64
  def label_visibility(self) -> streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage: ...
65
+ @property
66
+ def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig: ...
63
67
  def __init__(
64
68
  self,
65
69
  *,
@@ -76,8 +80,10 @@ class DateInput(google.protobuf.message.Message):
76
80
  disabled: builtins.bool = ...,
77
81
  label_visibility: streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage | None = ...,
78
82
  format: builtins.str = ...,
83
+ width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
79
84
  ) -> None: ...
80
- def HasField(self, field_name: typing.Literal["label_visibility", b"label_visibility"]) -> builtins.bool: ...
81
- def ClearField(self, field_name: typing.Literal["default", b"default", "disabled", b"disabled", "form_id", b"form_id", "format", b"format", "help", b"help", "id", b"id", "is_range", b"is_range", "label", b"label", "label_visibility", b"label_visibility", "max", b"max", "min", b"min", "set_value", b"set_value", "value", b"value"]) -> None: ...
85
+ def HasField(self, field_name: typing.Literal["_width_config", b"_width_config", "label_visibility", b"label_visibility", "width_config", b"width_config"]) -> builtins.bool: ...
86
+ def ClearField(self, field_name: typing.Literal["_width_config", b"_width_config", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "format", b"format", "help", b"help", "id", b"id", "is_range", b"is_range", "label", b"label", "label_visibility", b"label_visibility", "max", b"max", "min", b"min", "set_value", b"set_value", "value", b"value", "width_config", b"width_config"]) -> None: ...
87
+ def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
82
88
 
83
89
  global___DateInput = DateInput
@@ -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/TimeInput.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\xeb\x01\n\tTimeInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x0c\n\x04help\x18\x04 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x05 \x01(\t\x12\x12\n\x05value\x18\x06 \x01(\tH\x01\x88\x01\x01\x12\x11\n\tset_value\x18\x07 \x01(\x08\x12\x10\n\x08\x64isabled\x18\x08 \x01(\x08\x12\x31\n\x10label_visibility\x18\t \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x0c\n\x04step\x18\n \x01(\x03\x42\n\n\x08_defaultB\x08\n\x06_valueB.\n\x1c\x63om.snowflake.apps.streamlitB\x0eTimeInputProtob\x06proto3')
19
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/TimeInput.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\x1a!streamlit/proto/WidthConfig.proto\"\xaf\x02\n\tTimeInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x0c\n\x04help\x18\x04 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x05 \x01(\t\x12\x12\n\x05value\x18\x06 \x01(\tH\x01\x88\x01\x01\x12\x11\n\tset_value\x18\x07 \x01(\x08\x12\x10\n\x08\x64isabled\x18\x08 \x01(\x08\x12\x31\n\x10label_visibility\x18\t \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x0c\n\x04step\x18\n \x01(\x03\x12\x31\n\x0cwidth_config\x18\x0b \x01(\x0b\x32\x16.streamlit.WidthConfigH\x02\x88\x01\x01\x42\n\n\x08_defaultB\x08\n\x06_valueB\x0f\n\r_width_configB.\n\x1c\x63om.snowflake.apps.streamlitB\x0eTimeInputProtob\x06proto3')
19
20
 
20
21
  _globals = globals()
21
22
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,6 +24,6 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.TimeInput_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\016TimeInputProto'
26
- _globals['_TIMEINPUT']._serialized_start=82
27
- _globals['_TIMEINPUT']._serialized_end=317
27
+ _globals['_TIMEINPUT']._serialized_start=117
28
+ _globals['_TIMEINPUT']._serialized_end=420
28
29
  # @@protoc_insertion_point(module_scope)
@@ -21,6 +21,7 @@ import builtins
21
21
  import google.protobuf.descriptor
22
22
  import google.protobuf.message
23
23
  import streamlit.proto.LabelVisibilityMessage_pb2
24
+ import streamlit.proto.WidthConfig_pb2
24
25
  import typing
25
26
 
26
27
  DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
@@ -39,6 +40,7 @@ class TimeInput(google.protobuf.message.Message):
39
40
  DISABLED_FIELD_NUMBER: builtins.int
40
41
  LABEL_VISIBILITY_FIELD_NUMBER: builtins.int
41
42
  STEP_FIELD_NUMBER: builtins.int
43
+ WIDTH_CONFIG_FIELD_NUMBER: builtins.int
42
44
  id: builtins.str
43
45
  label: builtins.str
44
46
  default: builtins.str
@@ -50,6 +52,8 @@ class TimeInput(google.protobuf.message.Message):
50
52
  step: builtins.int
51
53
  @property
52
54
  def label_visibility(self) -> streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage: ...
55
+ @property
56
+ def width_config(self) -> streamlit.proto.WidthConfig_pb2.WidthConfig: ...
53
57
  def __init__(
54
58
  self,
55
59
  *,
@@ -63,12 +67,15 @@ class TimeInput(google.protobuf.message.Message):
63
67
  disabled: builtins.bool = ...,
64
68
  label_visibility: streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage | None = ...,
65
69
  step: builtins.int = ...,
70
+ width_config: streamlit.proto.WidthConfig_pb2.WidthConfig | None = ...,
66
71
  ) -> None: ...
67
- def HasField(self, field_name: typing.Literal["_default", b"_default", "_value", b"_value", "default", b"default", "label_visibility", b"label_visibility", "value", b"value"]) -> builtins.bool: ...
68
- def ClearField(self, field_name: typing.Literal["_default", b"_default", "_value", b"_value", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "set_value", b"set_value", "step", b"step", "value", b"value"]) -> None: ...
72
+ def HasField(self, field_name: typing.Literal["_default", b"_default", "_value", b"_value", "_width_config", b"_width_config", "default", b"default", "label_visibility", b"label_visibility", "value", b"value", "width_config", b"width_config"]) -> builtins.bool: ...
73
+ def ClearField(self, field_name: typing.Literal["_default", b"_default", "_value", b"_value", "_width_config", b"_width_config", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "set_value", b"set_value", "step", b"step", "value", b"value", "width_config", b"width_config"]) -> None: ...
69
74
  @typing.overload
70
75
  def WhichOneof(self, oneof_group: typing.Literal["_default", b"_default"]) -> typing.Literal["default"] | None: ...
71
76
  @typing.overload
72
77
  def WhichOneof(self, oneof_group: typing.Literal["_value", b"_value"]) -> typing.Literal["value"] | None: ...
78
+ @typing.overload
79
+ def WhichOneof(self, oneof_group: typing.Literal["_width_config", b"_width_config"]) -> typing.Literal["width_config"] | None: ...
73
80
 
74
81
  global___TimeInput = TimeInput
@@ -45,6 +45,6 @@ __all__ = [
45
45
  "RuntimeState",
46
46
  "SessionClient",
47
47
  "SessionClientDisconnectedError",
48
- "get_instance",
49
48
  "exists",
49
+ "get_instance",
50
50
  ]
@@ -86,13 +86,13 @@ cache = _cache
86
86
 
87
87
 
88
88
  __all__ = [
89
- "cache",
90
89
  "CACHE_DOCS_URL",
91
- "save_element_message",
92
- "save_block_message",
93
- "save_media_data",
94
- "get_data_cache_stats_provider",
95
- "get_resource_cache_stats_provider",
90
+ "cache",
96
91
  "cache_data",
97
92
  "cache_resource",
93
+ "get_data_cache_stats_provider",
94
+ "get_resource_cache_stats_provider",
95
+ "save_block_message",
96
+ "save_element_message",
97
+ "save_media_data",
98
98
  ]
@@ -57,7 +57,7 @@ from streamlit.runtime.caching.storage import (
57
57
  CacheStorageManager,
58
58
  )
59
59
  from streamlit.runtime.caching.storage.cache_storage_protocol import (
60
- InvalidCacheStorageContext,
60
+ InvalidCacheStorageContextError,
61
61
  )
62
62
  from streamlit.runtime.caching.storage.dummy_cache_storage import (
63
63
  MemoryCacheStorageManager,
@@ -270,12 +270,11 @@ class DataCaches(CacheStatsProvider):
270
270
  )
271
271
  try:
272
272
  self.get_storage_manager().check_context(cache_context)
273
- except InvalidCacheStorageContext as e:
274
- _LOGGER.error(
273
+ except InvalidCacheStorageContextError:
274
+ _LOGGER.exception(
275
275
  "Cache params for function %s are incompatible with current "
276
276
  "cache storage manager.",
277
277
  function_name,
278
- exc_info=e,
279
278
  )
280
279
  raise
281
280
 
@@ -298,11 +297,10 @@ class DataCaches(CacheStatsProvider):
298
297
  def get_storage_manager(self) -> CacheStorageManager:
299
298
  if runtime.exists():
300
299
  return runtime.get_instance().cache_storage_manager
301
- else:
302
- # When running in "raw mode", we can't access the CacheStorageManager,
303
- # so we're falling back to InMemoryCache.
304
- _LOGGER.warning("No runtime found, using MemoryCacheStorageManager")
305
- return MemoryCacheStorageManager()
300
+ # When running in "raw mode", we can't access the CacheStorageManager,
301
+ # so we're falling back to InMemoryCache.
302
+ _LOGGER.warning("No runtime found, using MemoryCacheStorageManager")
303
+ return MemoryCacheStorageManager()
306
304
 
307
305
 
308
306
  # Singleton DataCaches instance
@@ -194,7 +194,7 @@ class _HashStack:
194
194
  def pretty_print(self) -> str:
195
195
  def to_str(v: Any) -> str:
196
196
  try:
197
- return f"Object of type {type_util.get_fqn_type(v)}: {str(v)}"
197
+ return f"Object of type {type_util.get_fqn_type(v)}: {v}"
198
198
  except Exception:
199
199
  return "<Unable to convert item to string>"
200
200
 
@@ -68,7 +68,7 @@ class CacheStorageKeyNotFoundError(CacheStorageError):
68
68
  """Raised when the key is not found in the cache storage."""
69
69
 
70
70
 
71
- class InvalidCacheStorageContext(CacheStorageError):
71
+ class InvalidCacheStorageContextError(CacheStorageError):
72
72
  """Raised if the cache storage manager is not able to work with
73
73
  provided CacheStorageContext.
74
74
  """
@@ -432,4 +432,4 @@ def connection_factory(
432
432
  if pypi_package:
433
433
  extra_info = f"You need to install the '{pypi_package}' package to use this connection."
434
434
 
435
- raise ModuleNotFoundError(f"{str(e)}. {extra_info}")
435
+ raise ModuleNotFoundError(f"{e}. {extra_info}")
@@ -53,7 +53,7 @@ def email_prompt() -> str:
53
53
  return f"""
54
54
  {"👋 " if show_emoji else ""}{cli_util.style_for_cli("Welcome to Streamlit!", bold=True)}
55
55
 
56
- If youd like to receive helpful onboarding emails, news, offers, promotions,
56
+ If you'd like to receive helpful onboarding emails, news, offers, promotions,
57
57
  and the occasional swag, please enter your email address below. Otherwise,
58
58
  leave this field blank.
59
59
 
@@ -79,7 +79,7 @@ def _send_email(email: str) -> None:
79
79
  ).json()
80
80
  metrics_url = response_json.get("url", "")
81
81
  except Exception:
82
- _LOGGER.error("Failed to fetch metrics URL")
82
+ _LOGGER.exception("Failed to fetch metrics URL")
83
83
  return
84
84
 
85
85
  headers = {
@@ -150,7 +150,7 @@ class Credentials:
150
150
  with open(self._conf_file) as f:
151
151
  data = toml.load(f).get("general")
152
152
  if data is None:
153
- raise Exception
153
+ raise RuntimeError # noqa: TRY301
154
154
  self.activation = _verify_email(data.get("email"))
155
155
  except FileNotFoundError:
156
156
  if auto_resolve:
@@ -164,7 +164,7 @@ class Credentials:
164
164
  self.reset()
165
165
  self.activate(show_instructions=not auto_resolve)
166
166
  return
167
- raise Exception(
167
+ raise RuntimeError(
168
168
  textwrap.dedent(
169
169
  """
170
170
  Unable to load credentials from %s.
@@ -246,11 +246,11 @@ def _fragment(
246
246
  except (
247
247
  RerunException,
248
248
  StopException,
249
- ) as e:
249
+ ):
250
250
  # The wrapped_fragment function is executed
251
251
  # inside of a exec_func_with_error_handling call, so
252
252
  # there is a correct handler for these exceptions.
253
- raise e
253
+ raise
254
254
  except Exception as e:
255
255
  # render error here so that the delta path is correct
256
256
  # for full app runs, the error will be displayed by the
@@ -442,12 +442,12 @@ def gather_metrics(name: str, func: F | None = None) -> Callable[[F], F] | F:
442
442
  _LOGGER.debug("Failed to collect command telemetry", exc_info=ex)
443
443
  try:
444
444
  result = non_optional_func(*args, **kwargs)
445
- except RerunException as ex:
445
+ except RerunException:
446
446
  # Duplicated from below, because static analysis tools get confused
447
447
  # by deferring the rethrow.
448
448
  if tracking_activated and command_telemetry:
449
449
  command_telemetry.time = to_microseconds(timer() - exec_start)
450
- raise ex
450
+ raise
451
451
  finally:
452
452
  # Activate tracking again if command executes without any exceptions
453
453
  # we only want to do that if this command has set the
@@ -596,7 +596,7 @@ class Runtime:
596
596
  elif self._state == RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED:
597
597
  pass
598
598
  else:
599
- raise RuntimeError(f"Bad Runtime state at start: {self._state}")
599
+ raise RuntimeError(f"Bad Runtime state at start: {self._state}") # noqa: TRY301
600
600
 
601
601
  # Signal that we're started and ready to accept sessions
602
602
  async_objs.started.set_result(None)
@@ -39,7 +39,8 @@ class MessageSizeError(MarkdownFormattedException):
39
39
  # This needs to have zero indentation otherwise the markdown will render incorrectly.
40
40
  return (
41
41
  f"""
42
- **Data of size {len(failed_msg_str) / 1e6:.1f} MB exceeds the message size limit of {get_max_message_size_bytes() / 1e6} MB.**
42
+ **Data of size {len(failed_msg_str) / 1e6:.1f} MB exceeds the message size limit of
43
+ {get_max_message_size_bytes() / 1e6} MB.**
43
44
 
44
45
  This is often caused by a large chart or dataframe. Please decrease the amount of data sent
45
46
  to the browser, or increase the limit by setting the config option `server.maxMessageSize`.
@@ -27,12 +27,12 @@ from streamlit.runtime.scriptrunner_utils.script_run_context import (
27
27
 
28
28
  __all__ = [
29
29
  "RerunData",
30
- "ScriptRunContext",
31
- "add_script_run_ctx",
32
- "get_script_run_ctx",
33
- "enqueue_message",
34
30
  "RerunException",
31
+ "ScriptRunContext",
35
32
  "ScriptRunner",
36
33
  "ScriptRunnerEvent",
37
34
  "StopException",
35
+ "add_script_run_ctx",
36
+ "enqueue_message",
37
+ "get_script_run_ctx",
38
38
  ]
@@ -161,11 +161,7 @@ def _mpa_v1(main_script_path: str):
161
161
  expanded=False,
162
162
  )
163
163
 
164
- if page._page != main_page._page:
165
- # Only run the page if it is not pointing to this script:
166
- page.run()
167
- # Finish the script execution here to only run the selected page
168
- raise StopException()
164
+ page.run()
169
165
 
170
166
 
171
167
  class ScriptRunner:
@@ -301,7 +297,7 @@ class ScriptRunner:
301
297
 
302
298
  """
303
299
  if self._script_thread is not None:
304
- raise Exception("ScriptRunner was already started")
300
+ raise RuntimeError("ScriptRunner was already started")
305
301
 
306
302
  self._script_thread = threading.Thread(
307
303
  target=self._run_script_thread,
@@ -630,11 +626,11 @@ class ScriptRunner:
630
626
  " Usually this doesn't happen or no action is"
631
627
  " required, so its mainly for debugging."
632
628
  )
633
- except (RerunException, StopException) as e:
629
+ except (RerunException, StopException):
634
630
  # The wrapped_fragment function is executed
635
631
  # inside of a exec_func_with_error_handling call, so
636
632
  # there is a correct handler for these exceptions.
637
- raise e
633
+ raise
638
634
  except Exception: # noqa: S110
639
635
  # Ignore exceptions raised by fragments here as we don't
640
636
  # want to stop the execution of other fragments. The
@@ -645,7 +641,8 @@ class ScriptRunner:
645
641
  else:
646
642
  if PagesManager.uses_pages_directory:
647
643
  _mpa_v1(self._main_script_path)
648
- exec(code, module.__dict__) # noqa: S102
644
+ else:
645
+ exec(code, module.__dict__) # noqa: S102
649
646
  self._fragment_storage.clear(
650
647
  new_fragment_ids=ctx.new_fragment_ids
651
648
  )
@@ -107,6 +107,7 @@ class ScriptRunContext:
107
107
  current_fragment_id: str | None = None
108
108
  fragment_ids_this_run: list[str] | None = None
109
109
  new_fragment_ids: set[str] = field(default_factory=set)
110
+ in_fragment_callback: bool = False
110
111
  _active_script_hash: str = ""
111
112
  # we allow only one dialog to be open at the same time
112
113
  has_dialog_opened: bool = False
@@ -37,7 +37,9 @@ _LOGGER: Final = get_logger(__name__)
37
37
 
38
38
 
39
39
  class SecretErrorMessages:
40
- """SecretErrorMessages stores all error messages we use for secrets to allow customization for different environments.
40
+ """SecretErrorMessages stores all error messages we use for secrets to allow customization
41
+ for different environments.
42
+
41
43
  For example Streamlit Cloud can customize the message to be different than the open source.
42
44
 
43
45
  For internal use, may change in future releases without notice.
@@ -46,13 +48,15 @@ class SecretErrorMessages:
46
48
  def __init__(self):
47
49
  self.missing_attr_message = lambda attr_name: (
48
50
  f'st.secrets has no attribute "{attr_name}". '
49
- f"Did you forget to add it to secrets.toml, mount it to secret directory, or the app settings on Streamlit Cloud? "
50
- f"More info: https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app/secrets-management"
51
+ "Did you forget to add it to secrets.toml, mount it to secret directory, or the app settings "
52
+ "on Streamlit Cloud? More info: "
53
+ "https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app/secrets-management"
51
54
  )
52
55
  self.missing_key_message = lambda key: (
53
56
  f'st.secrets has no key "{key}". '
54
- f"Did you forget to add it to secrets.toml, mount it to secret directory, or the app settings on Streamlit Cloud? "
55
- f"More info: https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app/secrets-management"
57
+ "Did you forget to add it to secrets.toml, mount it to secret directory, or the app settings "
58
+ "on Streamlit Cloud? More info: "
59
+ "https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app/secrets-management"
56
60
  )
57
61
  self.no_secrets_found = lambda file_paths: (
58
62
  f"No secrets found. Valid paths for a secrets.toml file or secret directories are: {', '.join(file_paths)}"
@@ -272,7 +276,8 @@ class Secrets(Mapping[str, Any]):
272
276
  return secrets, found_secrets_file
273
277
 
274
278
  def _parse_directory(self, path: str) -> tuple[Mapping[str, Any], bool]:
275
- """Parse a directory for secrets. Directory style can be used to support Kubernetes secrets that are mounted to folders.
279
+ """Parse a directory for secrets. Directory style can be used to support Kubernetes secrets that are
280
+ mounted to folders.
276
281
 
277
282
  Example structure:
278
283
  - top_level_secret_folder
@@ -310,7 +315,7 @@ class Secrets(Mapping[str, Any]):
310
315
 
311
316
  if len(sub_secrets) == 1:
312
317
  # if there's just one file, collapse it so it's directly under `dirname`
313
- secrets[dirname] = sub_secrets[list(sub_secrets.keys())[0]]
318
+ secrets[dirname] = sub_secrets[next(iter(sub_secrets.keys()))]
314
319
  else:
315
320
  secrets[dirname] = sub_secrets
316
321
 
@@ -380,7 +385,9 @@ class Secrets(Mapping[str, Any]):
380
385
  return self._secrets
381
386
 
382
387
  def to_dict(self) -> dict[str, Any]:
383
- """Converts the secrets store into a nested dictionary, where nested AttrDict objects are also converted into dictionaries."""
388
+ """Converts the secrets store into a nested dictionary, where nested AttrDict objects are
389
+ also converted into dictionaries.
390
+ """
384
391
  secrets = self._parse()
385
392
  return _convert_to_dict(secrets)
386
393
 
@@ -27,15 +27,15 @@ from streamlit.runtime.state.session_state_proxy import (
27
27
  from streamlit.runtime.state.widgets import register_widget
28
28
 
29
29
  __all__ = [
30
- "WidgetArgs",
31
- "WidgetCallback",
32
- "WidgetKwargs",
30
+ "SCRIPT_RUN_WITHOUT_ERRORS_KEY",
33
31
  "QueryParamsProxy",
34
32
  "SafeSessionState",
35
- "SCRIPT_RUN_WITHOUT_ERRORS_KEY",
36
33
  "SessionState",
37
- "SessionStateStatProvider",
38
34
  "SessionStateProxy",
35
+ "SessionStateStatProvider",
36
+ "WidgetArgs",
37
+ "WidgetCallback",
38
+ "WidgetKwargs",
39
39
  "get_session_state",
40
40
  "register_widget",
41
41
  ]
@@ -58,17 +58,17 @@ class QueryParams(MutableMapping[str, str]):
58
58
  If the key is not present, raise KeyError.
59
59
  """
60
60
  self._ensure_single_query_api_used()
61
+ if key in EMBED_QUERY_PARAMS_KEYS:
62
+ raise KeyError(missing_key_error_message(key))
63
+
61
64
  try:
62
- if key in EMBED_QUERY_PARAMS_KEYS:
63
- raise KeyError(missing_key_error_message(key))
64
65
  value = self._query_params[key]
65
66
  if isinstance(value, list):
66
67
  if len(value) == 0:
67
68
  return ""
68
- else:
69
- # Return the last value to mimic Tornado's behavior
70
- # https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.get_query_argument
71
- return value[-1]
69
+ # Return the last value to mimic Tornado's behavior
70
+ # https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.get_query_argument
71
+ return value[-1]
72
72
  return value
73
73
  except KeyError:
74
74
  raise KeyError(missing_key_error_message(key))
@@ -97,9 +97,9 @@ class QueryParams(MutableMapping[str, str]):
97
97
 
98
98
  def __delitem__(self, key: str) -> None:
99
99
  self._ensure_single_query_api_used()
100
+ if key in EMBED_QUERY_PARAMS_KEYS:
101
+ raise KeyError(missing_key_error_message(key))
100
102
  try:
101
- if key in EMBED_QUERY_PARAMS_KEYS:
102
- raise KeyError(missing_key_error_message(key))
103
103
  del self._query_params[key]
104
104
  self._send_query_param_msg()
105
105
  except KeyError:
@@ -269,7 +269,14 @@ class WStates(MutableMapping[str, Any]):
269
269
 
270
270
  args = metadata.callback_args or ()
271
271
  kwargs = metadata.callback_kwargs or {}
272
- callback(*args, **kwargs)
272
+
273
+ ctx = get_script_run_ctx()
274
+ if ctx and metadata.fragment_id is not None:
275
+ ctx.in_fragment_callback = True
276
+ callback(*args, **kwargs)
277
+ ctx.in_fragment_callback = False
278
+ else:
279
+ callback(*args, **kwargs)
273
280
 
274
281
 
275
282
  def _missing_key_error_message(key: str) -> str:
@@ -51,7 +51,7 @@
51
51
  <script>
52
52
  window.prerenderReady = false
53
53
  </script>
54
- <script type="module" crossorigin src="./static/js/index.DR2lTx8N.js"></script>
54
+ <script type="module" crossorigin src="./static/js/index.DZ6oX-v9.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.DR2lTx8N.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
+ import{r,E as a,_ as n}from"./index.DZ6oX-v9.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.DR2lTx8N.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};
1
+ import{r as e,E as n,_ as a}from"./index.DZ6oX-v9.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};