streamlit 1.49.1__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.
- streamlit/column_config.py +2 -0
- streamlit/commands/navigation.py +3 -1
- streamlit/components/v1/custom_component.py +17 -42
- streamlit/config.py +306 -0
- streamlit/connections/base_connection.py +4 -2
- streamlit/dataframe_util.py +3 -2
- streamlit/delta_generator.py +2 -3
- streamlit/elements/arrow.py +63 -43
- streamlit/elements/deck_gl_json_chart.py +1 -0
- streamlit/elements/form.py +6 -6
- streamlit/elements/graphviz_chart.py +23 -6
- streamlit/elements/iframe.py +0 -2
- streamlit/elements/image.py +10 -9
- streamlit/elements/layouts.py +58 -11
- streamlit/elements/lib/built_in_chart_utils.py +95 -29
- streamlit/elements/lib/column_config_utils.py +5 -0
- streamlit/elements/lib/column_types.py +563 -144
- streamlit/elements/lib/dialog.py +1 -0
- streamlit/elements/lib/pandas_styler_utils.py +30 -14
- streamlit/elements/lib/utils.py +17 -5
- streamlit/elements/map.py +1 -3
- streamlit/elements/media.py +2 -0
- streamlit/elements/metric.py +10 -32
- streamlit/elements/plotly_chart.py +17 -9
- streamlit/elements/pyplot.py +6 -6
- streamlit/elements/vega_charts.py +110 -44
- streamlit/elements/widgets/audio_input.py +48 -0
- streamlit/elements/widgets/button.py +27 -25
- streamlit/elements/widgets/button_group.py +1 -0
- streamlit/elements/widgets/camera_input.py +1 -0
- streamlit/elements/widgets/chat.py +1 -0
- streamlit/elements/widgets/checkbox.py +1 -0
- streamlit/elements/widgets/color_picker.py +1 -0
- streamlit/elements/widgets/data_editor.py +6 -5
- streamlit/elements/widgets/file_uploader.py +1 -0
- streamlit/elements/widgets/multiselect.py +10 -0
- streamlit/elements/widgets/number_input.py +3 -0
- streamlit/elements/widgets/radio.py +1 -0
- streamlit/elements/widgets/select_slider.py +1 -0
- streamlit/elements/widgets/selectbox.py +4 -0
- streamlit/elements/widgets/slider.py +1 -0
- streamlit/elements/widgets/text_widgets.py +6 -0
- streamlit/elements/widgets/time_widgets.py +9 -0
- streamlit/elements/write.py +1 -17
- streamlit/git_util.py +65 -43
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/Arrow_pb2.py +10 -8
- streamlit/proto/Arrow_pb2.pyi +31 -2
- streamlit/proto/AudioInput_pb2.py +2 -2
- streamlit/proto/AudioInput_pb2.pyi +6 -2
- streamlit/proto/Block_pb2.py +11 -11
- streamlit/proto/Block_pb2.pyi +5 -0
- streamlit/proto/NewSession_pb2.py +18 -16
- streamlit/proto/NewSession_pb2.pyi +135 -2
- streamlit/runtime/app_session.py +18 -5
- streamlit/runtime/theme_util.py +148 -0
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +222 -222
- streamlit/static/static/css/index.CHEnSPGk.css +1 -0
- streamlit/static/static/css/{index.C8X8rNzw.css → index.CIiu7Ygf.css} +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.DcGrhbBP.js → ErrorOutline.esm.DUpR0_Ka.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DgBvV6Pq.js → FileDownload.esm.CN4j9-1w.js} +1 -1
- streamlit/static/static/js/{FileHelper.M6AAaeuA.js → FileHelper.CaIUKG91.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DHh1GFzm.js → FormClearHelper.DTcdrasw.js} +1 -1
- streamlit/static/static/js/{Hooks.DGu1od_L.js → Hooks.BRba_Own.js} +1 -1
- streamlit/static/static/js/InputInstructions.xnSDuYeQ.js +1 -0
- streamlit/static/static/js/{Particles.DDVT-6Qc.js → Particles.CElH0XX2.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BEY0cXXV.js → ProgressBar.DetlP5aY.js} +2 -2
- streamlit/static/static/js/Toolbar.C77ar7rq.js +1 -0
- streamlit/static/static/js/{base-input.CK3UVGp1.js → base-input.BQft14La.js} +3 -3
- streamlit/static/static/js/{checkbox.D8W881TL.js → checkbox.yZOfXCeX.js} +1 -1
- streamlit/static/static/js/{createSuper.B6W-Dh9S.js → createSuper.Dh9w1cs8.js} +1 -1
- streamlit/static/static/js/data-grid-overlay-editor.DcuHuCyW.js +1 -0
- streamlit/static/static/js/{downloader.DiKpuU_S.js → downloader.MeHtkq8r.js} +1 -1
- streamlit/static/static/js/{es6.B8zRNPZ-.js → es6.VpBPGCnM.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.DIewJmmh.js → iframeResizer.contentWindow.yMw_ARIL.js} +1 -1
- streamlit/static/static/js/{index.B9mjBcgE.js → index.64ejlaaT.js} +1 -1
- streamlit/static/static/js/{index.CD8HuT3N.js → index.6xX1278W.js} +90 -91
- streamlit/static/static/js/index.B-hiXRzw.js +1 -0
- streamlit/static/static/js/{index.Ch7MBCx0.js → index.B0H9IXUJ.js} +47 -47
- streamlit/static/static/js/{index.4eF4NxG2.js → index.B4cAbHP6.js} +1 -1
- streamlit/static/static/js/{index.Dk4C7X3i.js → index.B4dUQfni.js} +1 -1
- streamlit/static/static/js/{index.CvYYtxD_.js → index.BPQo7BKk.js} +1 -1
- streamlit/static/static/js/index.Baqa90pe.js +2 -0
- streamlit/static/static/js/{index.D5naqx-J.js → index.Bj9JgOEC.js} +1 -1
- streamlit/static/static/js/index.BjCwMzj4.js +3 -0
- streamlit/static/static/js/{index.C_tmcx4B.js → index.Bm3VbPB5.js} +1 -1
- streamlit/static/static/js/{index.C7fRKRs4.js → index.Bxz2yX3P.js} +1 -1
- streamlit/static/static/js/{index.ho6NIXGl.js → index.BycLveZ4.js} +1 -1
- streamlit/static/static/js/{index.452cqrrL.js → index.C9BdUqTi.js} +1 -1
- streamlit/static/static/js/index.CFMf5_ez.js +197 -0
- streamlit/static/static/js/index.CGYqqs6j.js +1 -0
- streamlit/static/static/js/{index.zecpGxtj.js → index.CH1tqnSs.js} +1 -1
- streamlit/static/static/js/{index.CjXWwH-y.js → index.CMItVsFA.js} +1 -1
- streamlit/static/static/js/{index.B6U8LQo3.js → index.CTBk8Vk2.js} +1 -1
- streamlit/static/static/js/index.CiAQIz1H.js +7 -0
- streamlit/static/static/js/index.Cj7DSzVR.js +73 -0
- streamlit/static/static/js/index.Ck8rQ9OL.js +1 -0
- streamlit/static/static/js/{index.Ts_0SdB9.js → index.ClELlchS.js} +2 -2
- streamlit/static/static/js/{index.Bte_9Lyq.js → index.Cnpi3o3E.js} +1 -1
- streamlit/static/static/js/{index.CcJf6BCU.js → index.Ctn27_AE.js} +1 -1
- streamlit/static/static/js/{index.CP5TD2z1.js → index.D2QEXQq_.js} +1 -1
- streamlit/static/static/js/index.DH71Ezyj.js +1 -0
- streamlit/static/static/js/{index.D2-atlaQ.js → index.DHh-U0dK.js} +2 -2
- streamlit/static/static/js/{index.DtYN2x4k.js → index.DK7hD7_w.js} +1 -1
- streamlit/static/static/js/{index.qhs54UAB.js → index.DKv_lNO7.js} +1 -1
- streamlit/static/static/js/index.DNLrMXgm.js +12 -0
- streamlit/static/static/js/index.DW0Grddz.js +1 -0
- streamlit/static/static/js/{index.cnnXF7xQ.js → index.Dbe-Q3C-.js} +1 -1
- streamlit/static/static/js/index.DcPNYEUo.js +1 -0
- streamlit/static/static/js/index.DuxqVQpd.js +1 -0
- streamlit/static/static/js/{index.CejBxbg1.js → index.FFOzOWzC.js} +1 -1
- streamlit/static/static/js/{index.BnEpvLEz.js → index.GRUzrudl.js} +1 -1
- streamlit/static/static/js/{input.nzVJphXi.js → input.s6pjQ49A.js} +1 -1
- streamlit/static/static/js/{memory.CjCgTQz3.js → memory.Cuvsdfrl.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DaRFzZEO.js → number-overlay-editor.DdgVR5m3.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DgiPnZ9N.js → possibleConstructorReturn.CqidKeei.js} +1 -1
- streamlit/static/static/js/{sandbox.mithfq7Z.js → sandbox.CCQREcJx.js} +1 -1
- streamlit/static/static/js/{timepicker.Dbl5KFh6.js → timepicker.mkJF97Bb.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.D-Dx88BQ.js → toConsumableArray.De7I7KVR.js} +1 -1
- streamlit/static/static/js/{uniqueId.Bh26R_3S.js → uniqueId.RI1LJdtz.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.DeK-QJpD.js → useBasicWidgetState.CedkNjUW.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.4iAdLWD-.js → useTextInputAutoExpand.Ca7w8dVs.js} +2 -2
- streamlit/static/static/js/{useUpdateUiValue.CmT7_nJN.js → useUpdateUiValue.DeXelfRH.js} +1 -1
- streamlit/static/static/js/withFullScreenWrapper.C3561XxJ.js +1 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.DeCZgS-4.woff2 +0 -0
- streamlit/string_util.py +58 -1
- streamlit/web/bootstrap.py +0 -31
- streamlit/web/server/routes.py +17 -4
- streamlit/web/server/server.py +1 -0
- {streamlit-1.49.1.dist-info → streamlit-1.50.0.dist-info}/METADATA +1 -1
- {streamlit-1.49.1.dist-info → streamlit-1.50.0.dist-info}/RECORD +136 -135
- streamlit/static/static/css/index.COe1010n.css +0 -1
- streamlit/static/static/js/InputInstructions.z6sVgyYt.js +0 -1
- streamlit/static/static/js/Toolbar.DSnK1fUh.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +0 -1
- streamlit/static/static/js/index.BXYmrqnf.js +0 -1
- streamlit/static/static/js/index.B_8AnktO.js +0 -1
- streamlit/static/static/js/index.Bl7zGQSh.js +0 -7
- streamlit/static/static/js/index.BnJIOYn9.js +0 -73
- streamlit/static/static/js/index.C1HcTl5K.js +0 -1
- streamlit/static/static/js/index.C7lSmSOP.js +0 -1
- streamlit/static/static/js/index.D3K5nOu9.js +0 -197
- streamlit/static/static/js/index.DkKT3LUI.js +0 -1
- streamlit/static/static/js/index.MTPPBDHk.js +0 -2
- streamlit/static/static/js/index.pqW9AMJD.js +0 -3
- streamlit/static/static/js/index.urHgTgMQ.js +0 -12
- streamlit/static/static/js/index.wzkv_11M.js +0 -1
- streamlit/static/static/js/index.yF5AncHY.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
- {streamlit-1.49.1.data → streamlit-1.50.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.49.1.dist-info → streamlit-1.50.0.dist-info}/WHEEL +0 -0
- {streamlit-1.49.1.dist-info → streamlit-1.50.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.49.1.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
|
+
)
|
streamlit/web/bootstrap.py
CHANGED
|
@@ -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.
|
streamlit/web/server/routes.py
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import os
|
|
18
|
-
|
|
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
|
|
80
|
+
if is_index_url or NO_CACHE_PATTERN.search(path):
|
|
72
81
|
self.set_header("Cache-Control", "no-cache")
|
|
73
82
|
else:
|
|
74
|
-
|
|
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:
|
streamlit/web/server/server.py
CHANGED
|
@@ -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
|
|