streamlit 1.49.0__py3-none-any.whl → 1.50.0__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 (156) hide show
  1. streamlit/column_config.py +2 -0
  2. streamlit/commands/navigation.py +3 -1
  3. streamlit/components/v1/custom_component.py +17 -42
  4. streamlit/config.py +306 -0
  5. streamlit/connections/base_connection.py +4 -2
  6. streamlit/dataframe_util.py +3 -2
  7. streamlit/delta_generator.py +2 -3
  8. streamlit/elements/arrow.py +63 -43
  9. streamlit/elements/deck_gl_json_chart.py +1 -0
  10. streamlit/elements/form.py +6 -6
  11. streamlit/elements/graphviz_chart.py +23 -6
  12. streamlit/elements/iframe.py +0 -2
  13. streamlit/elements/image.py +10 -9
  14. streamlit/elements/layouts.py +58 -11
  15. streamlit/elements/lib/built_in_chart_utils.py +95 -29
  16. streamlit/elements/lib/column_config_utils.py +5 -0
  17. streamlit/elements/lib/column_types.py +563 -144
  18. streamlit/elements/lib/dialog.py +1 -0
  19. streamlit/elements/lib/layout_utils.py +4 -4
  20. streamlit/elements/lib/pandas_styler_utils.py +30 -14
  21. streamlit/elements/lib/utils.py +17 -5
  22. streamlit/elements/map.py +1 -3
  23. streamlit/elements/media.py +2 -0
  24. streamlit/elements/metric.py +10 -32
  25. streamlit/elements/plotly_chart.py +17 -9
  26. streamlit/elements/pyplot.py +6 -6
  27. streamlit/elements/vega_charts.py +110 -44
  28. streamlit/elements/widgets/audio_input.py +48 -0
  29. streamlit/elements/widgets/button.py +27 -25
  30. streamlit/elements/widgets/button_group.py +1 -0
  31. streamlit/elements/widgets/camera_input.py +1 -0
  32. streamlit/elements/widgets/chat.py +1 -0
  33. streamlit/elements/widgets/checkbox.py +1 -0
  34. streamlit/elements/widgets/color_picker.py +1 -0
  35. streamlit/elements/widgets/data_editor.py +6 -5
  36. streamlit/elements/widgets/file_uploader.py +1 -0
  37. streamlit/elements/widgets/multiselect.py +10 -0
  38. streamlit/elements/widgets/number_input.py +3 -0
  39. streamlit/elements/widgets/radio.py +1 -0
  40. streamlit/elements/widgets/select_slider.py +1 -0
  41. streamlit/elements/widgets/selectbox.py +4 -0
  42. streamlit/elements/widgets/slider.py +1 -0
  43. streamlit/elements/widgets/text_widgets.py +6 -0
  44. streamlit/elements/widgets/time_widgets.py +9 -0
  45. streamlit/elements/write.py +1 -17
  46. streamlit/git_util.py +65 -43
  47. streamlit/material_icon_names.py +1 -1
  48. streamlit/proto/Arrow_pb2.py +10 -8
  49. streamlit/proto/Arrow_pb2.pyi +31 -2
  50. streamlit/proto/AudioInput_pb2.py +2 -2
  51. streamlit/proto/AudioInput_pb2.pyi +6 -2
  52. streamlit/proto/Block_pb2.py +11 -11
  53. streamlit/proto/Block_pb2.pyi +5 -0
  54. streamlit/proto/NewSession_pb2.py +18 -16
  55. streamlit/proto/NewSession_pb2.pyi +135 -2
  56. streamlit/runtime/app_session.py +18 -5
  57. streamlit/runtime/theme_util.py +148 -0
  58. streamlit/static/index.html +2 -2
  59. streamlit/static/manifest.json +221 -221
  60. streamlit/static/static/css/index.CHEnSPGk.css +1 -0
  61. streamlit/static/static/css/{index.C8X8rNzw.css → index.CIiu7Ygf.css} +1 -1
  62. streamlit/static/static/js/{ErrorOutline.esm.u9XvzxL8.js → ErrorOutline.esm.DUpR0_Ka.js} +1 -1
  63. streamlit/static/static/js/{FileDownload.esm.CaRyZ-b2.js → FileDownload.esm.CN4j9-1w.js} +1 -1
  64. streamlit/static/static/js/{FileHelper.Dk2SwIi3.js → FileHelper.CaIUKG91.js} +1 -1
  65. streamlit/static/static/js/{FormClearHelper.l_UPPvkg.js → FormClearHelper.DTcdrasw.js} +1 -1
  66. streamlit/static/static/js/{Hooks.BxrVEftw.js → Hooks.BRba_Own.js} +1 -1
  67. streamlit/static/static/js/InputInstructions.xnSDuYeQ.js +1 -0
  68. streamlit/static/static/js/{Particles.DkY6FDnc.js → Particles.CElH0XX2.js} +1 -1
  69. streamlit/static/static/js/{ProgressBar.BPtSM82n.js → ProgressBar.DetlP5aY.js} +2 -2
  70. streamlit/static/static/js/Toolbar.C77ar7rq.js +1 -0
  71. streamlit/static/static/js/{base-input.egUI4LjJ.js → base-input.BQft14La.js} +3 -3
  72. streamlit/static/static/js/{checkbox.ButpszcE.js → checkbox.yZOfXCeX.js} +1 -1
  73. streamlit/static/static/js/{createSuper.DYJA5xa6.js → createSuper.Dh9w1cs8.js} +1 -1
  74. streamlit/static/static/js/data-grid-overlay-editor.DcuHuCyW.js +1 -0
  75. streamlit/static/static/js/{downloader.B3TjsSPZ.js → downloader.MeHtkq8r.js} +1 -1
  76. streamlit/static/static/js/{es6.BYSNuG4D.js → es6.VpBPGCnM.js} +2 -2
  77. streamlit/static/static/js/{iframeResizer.contentWindow.CNPHJsF2.js → iframeResizer.contentWindow.yMw_ARIL.js} +1 -1
  78. streamlit/static/static/js/{index.DgpIMUsr.js → index.64ejlaaT.js} +1 -1
  79. streamlit/static/static/js/{index.BBnWuh07.js → index.6xX1278W.js} +90 -91
  80. streamlit/static/static/js/index.B-hiXRzw.js +1 -0
  81. streamlit/static/static/js/{index.DtwkPJs5.js → index.B0H9IXUJ.js} +47 -47
  82. streamlit/static/static/js/{index.0tDq1WXk.js → index.B4cAbHP6.js} +1 -1
  83. streamlit/static/static/js/{index.CFjU0x00.js → index.B4dUQfni.js} +1 -1
  84. streamlit/static/static/js/{index.BrD9sbpx.js → index.BPQo7BKk.js} +1 -1
  85. streamlit/static/static/js/index.Baqa90pe.js +2 -0
  86. streamlit/static/static/js/{index.uInpwWAP.js → index.Bj9JgOEC.js} +1 -1
  87. streamlit/static/static/js/index.BjCwMzj4.js +3 -0
  88. streamlit/static/static/js/{index.C3EXAI-u.js → index.Bm3VbPB5.js} +1 -1
  89. streamlit/static/static/js/{index.DGcW849X.js → index.Bxz2yX3P.js} +1 -1
  90. streamlit/static/static/js/{index.CeXLlclc.js → index.BycLveZ4.js} +1 -1
  91. streamlit/static/static/js/{index.CjQnYKID.js → index.C9BdUqTi.js} +1 -1
  92. streamlit/static/static/js/index.CFMf5_ez.js +197 -0
  93. streamlit/static/static/js/index.CGYqqs6j.js +1 -0
  94. streamlit/static/static/js/{index.CFePF7s4.js → index.CH1tqnSs.js} +1 -1
  95. streamlit/static/static/js/{index.BoJaJReB.js → index.CMItVsFA.js} +1 -1
  96. streamlit/static/static/js/{index.CuEFSQ-o.js → index.CTBk8Vk2.js} +1 -1
  97. streamlit/static/static/js/index.CiAQIz1H.js +7 -0
  98. streamlit/static/static/js/index.Cj7DSzVR.js +73 -0
  99. streamlit/static/static/js/index.Ck8rQ9OL.js +1 -0
  100. streamlit/static/static/js/{index.CqSRo6zQ.js → index.ClELlchS.js} +2 -2
  101. streamlit/static/static/js/{index.DP1rDFP0.js → index.Cnpi3o3E.js} +1 -1
  102. streamlit/static/static/js/{index.Cl_966eE.js → index.Ctn27_AE.js} +1 -1
  103. streamlit/static/static/js/{index.D4jR1m1z.js → index.D2QEXQq_.js} +1 -1
  104. streamlit/static/static/js/index.DH71Ezyj.js +1 -0
  105. streamlit/static/static/js/{index.CfiZGqj3.js → index.DHh-U0dK.js} +2 -2
  106. streamlit/static/static/js/{index.Bp1Of6L8.js → index.DK7hD7_w.js} +1 -1
  107. streamlit/static/static/js/{index.MQLQLR5Z.js → index.DKv_lNO7.js} +1 -1
  108. streamlit/static/static/js/index.DNLrMXgm.js +12 -0
  109. streamlit/static/static/js/index.DW0Grddz.js +1 -0
  110. streamlit/static/static/js/{index.Cb9gN2T2.js → index.Dbe-Q3C-.js} +1 -1
  111. streamlit/static/static/js/index.DcPNYEUo.js +1 -0
  112. streamlit/static/static/js/index.DuxqVQpd.js +1 -0
  113. streamlit/static/static/js/{index.BH79B25f.js → index.FFOzOWzC.js} +1 -1
  114. streamlit/static/static/js/{index.DWedOrkQ.js → index.GRUzrudl.js} +1 -1
  115. streamlit/static/static/js/{input.CbP5ZuQ7.js → input.s6pjQ49A.js} +1 -1
  116. streamlit/static/static/js/{memory.BuacVo2L.js → memory.Cuvsdfrl.js} +1 -1
  117. streamlit/static/static/js/{number-overlay-editor.BZb9zRl_.js → number-overlay-editor.DdgVR5m3.js} +1 -1
  118. streamlit/static/static/js/{possibleConstructorReturn.DSM84rOS.js → possibleConstructorReturn.CqidKeei.js} +1 -1
  119. streamlit/static/static/js/{sandbox.C480llMG.js → sandbox.CCQREcJx.js} +1 -1
  120. streamlit/static/static/js/{timepicker.BunxCVp7.js → timepicker.mkJF97Bb.js} +4 -4
  121. streamlit/static/static/js/{toConsumableArray.B4o8rEx1.js → toConsumableArray.De7I7KVR.js} +1 -1
  122. streamlit/static/static/js/{uniqueId.tii0yosY.js → uniqueId.RI1LJdtz.js} +1 -1
  123. streamlit/static/static/js/{useBasicWidgetState.Bnm4FD6K.js → useBasicWidgetState.CedkNjUW.js} +1 -1
  124. streamlit/static/static/js/{useTextInputAutoExpand.Dgtwc1m0.js → useTextInputAutoExpand.Ca7w8dVs.js} +2 -2
  125. streamlit/static/static/js/{useUpdateUiValue.DjXdMFGw.js → useUpdateUiValue.DeXelfRH.js} +1 -1
  126. streamlit/static/static/js/withFullScreenWrapper.C3561XxJ.js +1 -0
  127. streamlit/static/static/media/MaterialSymbols-Rounded.DeCZgS-4.woff2 +0 -0
  128. streamlit/string_util.py +58 -1
  129. streamlit/web/bootstrap.py +0 -31
  130. streamlit/web/server/routes.py +17 -4
  131. streamlit/web/server/server.py +1 -0
  132. {streamlit-1.49.0.dist-info → streamlit-1.50.0.dist-info}/METADATA +1 -1
  133. {streamlit-1.49.0.dist-info → streamlit-1.50.0.dist-info}/RECORD +137 -136
  134. streamlit/static/static/css/index.COe1010n.css +0 -1
  135. streamlit/static/static/js/InputInstructions.C254RU9X.js +0 -1
  136. streamlit/static/static/js/Toolbar.BO_3WBaS.js +0 -1
  137. streamlit/static/static/js/data-grid-overlay-editor.C9gQLEnU.js +0 -1
  138. streamlit/static/static/js/index.BDZorv41.js +0 -1
  139. streamlit/static/static/js/index.BeTC4Yl-.js +0 -197
  140. streamlit/static/static/js/index.BnOd05Ko.js +0 -2
  141. streamlit/static/static/js/index.Bpe4-O2W.js +0 -1
  142. streamlit/static/static/js/index.C1qCS-sd.js +0 -1
  143. streamlit/static/static/js/index.C77g9sAQ.js +0 -3
  144. streamlit/static/static/js/index.Ca3y4ztK.js +0 -1
  145. streamlit/static/static/js/index.CbwuUwu4.js +0 -12
  146. streamlit/static/static/js/index.DKb-BAE2.js +0 -1
  147. streamlit/static/static/js/index.DStzYLqM.js +0 -73
  148. streamlit/static/static/js/index.DVKQKDLu.js +0 -1
  149. streamlit/static/static/js/index.DYbRPmVF.js +0 -1
  150. streamlit/static/static/js/index.z992t-BQ.js +0 -7
  151. streamlit/static/static/js/withFullScreenWrapper.0cy2pVf5.js +0 -1
  152. streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
  153. {streamlit-1.49.0.data → streamlit-1.50.0.data}/scripts/streamlit.cmd +0 -0
  154. {streamlit-1.49.0.dist-info → streamlit-1.50.0.dist-info}/WHEEL +0 -0
  155. {streamlit-1.49.0.dist-info → streamlit-1.50.0.dist-info}/entry_points.txt +0 -0
  156. {streamlit-1.49.0.dist-info → streamlit-1.50.0.dist-info}/top_level.txt +0 -0
streamlit/string_util.py CHANGED
@@ -14,13 +14,20 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
+ import decimal
18
+ import fractions
19
+ import numbers
17
20
  import re
18
21
  import textwrap
19
- from typing import TYPE_CHECKING, Final
22
+ from typing import TYPE_CHECKING, Any, Final, Union
23
+
24
+ from typing_extensions import TypeAlias
20
25
 
21
26
  from streamlit.errors import StreamlitAPIException
22
27
 
23
28
  if TYPE_CHECKING:
29
+ import numpy as np
30
+
24
31
  from streamlit.type_util import SupportsStr
25
32
 
26
33
  _ALPHANUMERIC_CHAR_REGEX: Final = re.compile(r"^[a-zA-Z0-9_&\-\. ]+$")
@@ -197,3 +204,53 @@ def to_snake_case(camel_case_str: str) -> str:
197
204
  """
198
205
  s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", camel_case_str)
199
206
  return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower()
207
+
208
+
209
+ AnyNumber: TypeAlias = Union[
210
+ "np.integer[Any]",
211
+ "np.floating[Any]",
212
+ int,
213
+ float,
214
+ decimal.Decimal,
215
+ fractions.Fraction,
216
+ numbers.Real,
217
+ numbers.Number,
218
+ ]
219
+
220
+
221
+ def from_number(value: AnyNumber) -> str:
222
+ """Render a real numeric type as a string for display.
223
+
224
+ Parameters
225
+ ----------
226
+ value : AnyNumber
227
+ The numeric value to convert to a string. Can be an ``int``, ``float``,
228
+ any ``numbers.Number`` (e.g., ``decimal.Decimal``), or a NumPy numeric type
229
+ with an ``item()`` method.
230
+
231
+ Returns
232
+ -------
233
+ str
234
+ String representation of the numeric value.
235
+
236
+ Raises
237
+ ------
238
+ TypeError
239
+ If the value is not of an accepted numeric type.
240
+ """
241
+ if isinstance(value, numbers.Number):
242
+ return str(value)
243
+ if hasattr(value, "item"):
244
+ # Add support for numpy values (e.g. int16, float64, etc.)
245
+ try:
246
+ # Item could also be just a variable, so we use try, except
247
+ if isinstance(value.item(), (float, int)):
248
+ return str(value.item())
249
+ except Exception: # noqa: S110
250
+ # If the numpy item is not a valid value, the TypeError below will be raised.
251
+ pass
252
+
253
+ raise TypeError(
254
+ f"'{value}' is of type {type(value)}, which is not an accepted type. "
255
+ "Please convert the value to an accepted number type."
256
+ )
@@ -21,7 +21,6 @@ import sys
21
21
  from typing import Any, Final
22
22
 
23
23
  from streamlit import cli_util, config, env_util, file_util, net_util, secrets
24
- from streamlit.git_util import MIN_GIT_VERSION, GitRepo
25
24
  from streamlit.logger import get_logger
26
25
  from streamlit.watcher import report_watchdog_availability, watch_file
27
26
  from streamlit.web.server import Server, server_address_is_unix_socket, server_util
@@ -101,7 +100,6 @@ def _fix_sys_argv(main_script_path: str, args: list[str]) -> None:
101
100
 
102
101
 
103
102
  def _on_server_start(server: Server) -> None:
104
- _maybe_print_old_git_warning(server.main_script_path)
105
103
  _maybe_print_static_folder_warning(server.main_script_path)
106
104
  _print_url(server.is_running_hello)
107
105
  report_watchdog_availability()
@@ -228,35 +226,6 @@ def _print_url(is_running_hello: bool) -> None:
228
226
  cli_util.print_to_cli("")
229
227
 
230
228
 
231
- def _maybe_print_old_git_warning(main_script_path: str) -> None:
232
- """If our script is running in a Git repo, and we're running a very old
233
- Git version, print a warning that Git integration will be unavailable.
234
- """
235
- repo = GitRepo(main_script_path)
236
- if (
237
- not repo.is_valid()
238
- and repo.git_version is not None
239
- and repo.git_version < MIN_GIT_VERSION
240
- ):
241
- git_version_string = ".".join(str(val) for val in repo.git_version)
242
- min_version_string = ".".join(str(val) for val in MIN_GIT_VERSION)
243
- cli_util.print_to_cli("")
244
- cli_util.print_to_cli(" Git integration is disabled.", fg="yellow", bold=True)
245
- cli_util.print_to_cli("")
246
- cli_util.print_to_cli(
247
- f" Streamlit requires Git {min_version_string} or later, "
248
- f"but you have {git_version_string}.",
249
- fg="yellow",
250
- )
251
- cli_util.print_to_cli(
252
- " Git is used by Streamlit Cloud (https://streamlit.io/cloud).",
253
- fg="yellow",
254
- )
255
- cli_util.print_to_cli(
256
- " To enable this feature, please update Git.", fg="yellow"
257
- )
258
-
259
-
260
229
  def load_config_options(flag_options: dict[str, Any]) -> None:
261
230
  """Load config options from config.toml files, then overlay the ones set by
262
231
  flag_options.
@@ -15,7 +15,8 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  import os
18
- from typing import TYPE_CHECKING, Any, Callable, cast
18
+ import re
19
+ from typing import TYPE_CHECKING, Any, Callable, Final, cast
19
20
 
20
21
  import tornado.web
21
22
 
@@ -30,6 +31,13 @@ if TYPE_CHECKING:
30
31
  from collections.abc import Awaitable, Sequence
31
32
 
32
33
 
34
+ # Files that match this pattern do not get cached.
35
+ NO_CACHE_PATTERN = re.compile(r"(?:\.html$|^manifest\.json$)")
36
+
37
+ # The max-age value to send with cached assets. Set to one year.
38
+ STATIC_ASSET_CACHE_MAX_AGE_SECONDS: Final = 365 * 24 * 60 * 60
39
+
40
+
33
41
  def allow_all_cross_origin_requests() -> bool:
34
42
  """True if cross-origin requests from any origin are allowed.
35
43
 
@@ -62,16 +70,21 @@ class StaticFileHandler(tornado.web.StaticFileHandler):
62
70
  super().initialize(path, default_filename)
63
71
 
64
72
  def set_extra_headers(self, path: str) -> None:
65
- """Disable cache for HTML files.
73
+ """Disable cache for HTML files and manifest.json.
66
74
 
67
75
  Other assets like JS and CSS are suffixed with their hash, so they can
68
76
  be cached indefinitely.
69
77
  """
78
+
70
79
  is_index_url = len(path) == 0
71
- if is_index_url or path.endswith(".html"):
80
+ if is_index_url or NO_CACHE_PATTERN.search(path):
72
81
  self.set_header("Cache-Control", "no-cache")
73
82
  else:
74
- self.set_header("Cache-Control", "public")
83
+ # For all other static files suffixed with their hash, we set a long cache time.
84
+ self.set_header(
85
+ "Cache-Control",
86
+ f"public, immutable, max-age={STATIC_ASSET_CACHE_MAX_AGE_SECONDS}",
87
+ )
75
88
 
76
89
  def validate_absolute_path(self, root: str, absolute_path: str) -> str | None:
77
90
  try:
@@ -318,6 +318,7 @@ class Server:
318
318
  """Ensures that common mime-types are robust against system misconfiguration."""
319
319
  mimetypes.add_type("text/html", ".html")
320
320
  mimetypes.add_type("application/javascript", ".js")
321
+ mimetypes.add_type("application/javascript", ".mjs")
321
322
  mimetypes.add_type("text/css", ".css")
322
323
  mimetypes.add_type("image/webp", ".webp")
323
324
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit
3
- Version: 1.49.0
3
+ Version: 1.50.0
4
4
  Summary: A faster way to build and share data apps
5
5
  Home-page: https://streamlit.io
6
6
  Author: Snowflake Inc