streamlit-nightly 1.45.2.dev20250526__py3-none-any.whl → 1.45.2.dev20250528__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/auth_util.py +3 -3
- streamlit/config.py +12 -11
- streamlit/config_option.py +2 -4
- streamlit/connections/snowflake_connection.py +4 -3
- streamlit/elements/arrow.py +1 -0
- streamlit/elements/deck_gl_json_chart.py +1 -0
- streamlit/elements/lib/streamlit_plotly_theme.py +54 -53
- streamlit/elements/lib/utils.py +15 -0
- streamlit/elements/plotly_chart.py +1 -0
- streamlit/elements/spinner.py +5 -4
- streamlit/elements/vega_charts.py +1 -0
- streamlit/elements/widgets/audio_input.py +1 -0
- streamlit/elements/widgets/button.py +2 -0
- streamlit/elements/widgets/button_group.py +1 -0
- streamlit/elements/widgets/camera_input.py +1 -0
- streamlit/elements/widgets/chat.py +2 -1
- streamlit/elements/widgets/checkbox.py +1 -0
- streamlit/elements/widgets/color_picker.py +1 -0
- streamlit/elements/widgets/data_editor.py +3 -2
- streamlit/elements/widgets/file_uploader.py +1 -0
- streamlit/elements/widgets/multiselect.py +1 -0
- streamlit/elements/widgets/number_input.py +1 -0
- streamlit/elements/widgets/radio.py +1 -0
- streamlit/elements/widgets/select_slider.py +1 -0
- streamlit/elements/widgets/selectbox.py +1 -0
- streamlit/elements/widgets/slider.py +15 -14
- streamlit/elements/widgets/text_widgets.py +2 -0
- streamlit/elements/widgets/time_widgets.py +2 -0
- streamlit/hello/animation_demo.py +8 -8
- streamlit/hello/dataframe_demo.py +2 -2
- streamlit/hello/mapping_demo.py +2 -2
- streamlit/runtime/app_session.py +11 -8
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +3 -3
- streamlit/runtime/connection_factory.py +12 -12
- streamlit/runtime/credentials.py +5 -5
- streamlit/runtime/runtime_util.py +2 -2
- streamlit/runtime/scriptrunner/script_runner.py +8 -7
- streamlit/watcher/local_sources_watcher.py +1 -1
- streamlit/web/cli.py +5 -5
- streamlit/web/server/authlib_tornado_integration.py +3 -3
- streamlit/web/server/oauth_authlib_routes.py +4 -2
- streamlit/web/server/oidc_mixin.py +6 -5
- {streamlit_nightly-1.45.2.dev20250526.dist-info → streamlit_nightly-1.45.2.dev20250528.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.2.dev20250526.dist-info → streamlit_nightly-1.45.2.dev20250528.dist-info}/RECORD +48 -48
- {streamlit_nightly-1.45.2.dev20250526.data → streamlit_nightly-1.45.2.dev20250528.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250526.dist-info → streamlit_nightly-1.45.2.dev20250528.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.2.dev20250526.dist-info → streamlit_nightly-1.45.2.dev20250528.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250526.dist-info → streamlit_nightly-1.45.2.dev20250528.dist-info}/top_level.txt +0 -0
streamlit/auth_util.py
CHANGED
@@ -53,7 +53,7 @@ class AuthCache:
|
|
53
53
|
def is_authlib_installed() -> bool:
|
54
54
|
"""Check if Authlib is installed."""
|
55
55
|
try:
|
56
|
-
import authlib
|
56
|
+
import authlib
|
57
57
|
|
58
58
|
authlib_version = authlib.__version__
|
59
59
|
authlib_version_tuple = tuple(map(int, authlib_version.split(".")))
|
@@ -87,7 +87,7 @@ def get_secrets_auth_section() -> AttrDict:
|
|
87
87
|
def encode_provider_token(provider: str) -> str:
|
88
88
|
"""Returns a signed JWT token with the provider and expiration time."""
|
89
89
|
try:
|
90
|
-
from authlib.jose import jwt
|
90
|
+
from authlib.jose import jwt
|
91
91
|
except ImportError:
|
92
92
|
raise StreamlitAuthError(
|
93
93
|
"""To use authentication features, you need to install Authlib>=1.3.2, e.g. via `pip install Authlib`."""
|
@@ -116,7 +116,7 @@ def decode_provider_token(provider_token: str) -> ProviderTokenPayload:
|
|
116
116
|
# the 'exp' (and it is not expired), and 'provider' field exists.
|
117
117
|
claim_options = {"exp": {"essential": True}, "provider": {"essential": True}}
|
118
118
|
try:
|
119
|
-
payload: JWTClaims = jwt.decode(
|
119
|
+
payload: JWTClaims = jwt.decode( # type: ignore[no-untyped-call]
|
120
120
|
provider_token, get_signing_secret(), claims_options=claim_options
|
121
121
|
)
|
122
122
|
payload.validate()
|
streamlit/config.py
CHANGED
@@ -167,7 +167,7 @@ def set_user_option(key: str, value: Any) -> None:
|
|
167
167
|
|
168
168
|
raise StreamlitAPIException(
|
169
169
|
f"{key} cannot be set on the fly. Set as command line option, e.g. "
|
170
|
-
"streamlit run script.py --{key}, or in config.toml instead."
|
170
|
+
f"streamlit run script.py --{key}, or in config.toml instead."
|
171
171
|
)
|
172
172
|
|
173
173
|
|
@@ -1381,11 +1381,12 @@ def _set_option(key: str, value: Any, where_defined: str) -> None:
|
|
1381
1381
|
# Import logger locally to prevent circular references
|
1382
1382
|
from streamlit.logger import get_logger
|
1383
1383
|
|
1384
|
-
|
1384
|
+
logger: Final = get_logger(__name__)
|
1385
1385
|
|
1386
|
-
|
1387
|
-
|
1388
|
-
"option set, it may have been removed."
|
1386
|
+
logger.warning(
|
1387
|
+
'"%s" is not a valid config option. If you previously had this config '
|
1388
|
+
"option set, it may have been removed.",
|
1389
|
+
key,
|
1389
1390
|
)
|
1390
1391
|
|
1391
1392
|
else:
|
@@ -1506,9 +1507,9 @@ def _maybe_read_env_variable(value: Any) -> Any:
|
|
1506
1507
|
# Import logger locally to prevent circular references
|
1507
1508
|
from streamlit.logger import get_logger
|
1508
1509
|
|
1509
|
-
|
1510
|
+
logger: Final = get_logger(__name__)
|
1510
1511
|
|
1511
|
-
|
1512
|
+
logger.error("No environment variable called %s", var_name)
|
1512
1513
|
else:
|
1513
1514
|
return _maybe_convert_to_number(env_var)
|
1514
1515
|
|
@@ -1608,8 +1609,8 @@ def get_config_options(
|
|
1608
1609
|
# Import logger locally to prevent circular references.
|
1609
1610
|
from streamlit.logger import get_logger
|
1610
1611
|
|
1611
|
-
|
1612
|
-
|
1612
|
+
logger: Final = get_logger(__name__)
|
1613
|
+
logger.warning(
|
1613
1614
|
"An update to the [server] config option section was detected."
|
1614
1615
|
" To have these changes be reflected, please restart streamlit."
|
1615
1616
|
)
|
@@ -1629,7 +1630,7 @@ def _check_conflicts() -> None:
|
|
1629
1630
|
# Import logger locally to prevent circular references
|
1630
1631
|
from streamlit.logger import get_logger
|
1631
1632
|
|
1632
|
-
|
1633
|
+
logger: Final = get_logger(__name__)
|
1633
1634
|
|
1634
1635
|
if get_option("global.developmentMode"):
|
1635
1636
|
if not _is_unset("server.port"):
|
@@ -1646,7 +1647,7 @@ def _check_conflicts() -> None:
|
|
1646
1647
|
if get_option("server.enableXsrfProtection") and (
|
1647
1648
|
not get_option("server.enableCORS") or get_option("global.developmentMode")
|
1648
1649
|
):
|
1649
|
-
|
1650
|
+
logger.warning(
|
1650
1651
|
"""
|
1651
1652
|
Warning: the config option 'server.enableCORS=false' is not compatible with
|
1652
1653
|
'server.enableXsrfProtection=true'.
|
streamlit/config_option.py
CHANGED
@@ -261,8 +261,7 @@ class ConfigOption:
|
|
261
261
|
# Import here to avoid circular imports
|
262
262
|
from streamlit.logger import get_logger
|
263
263
|
|
264
|
-
|
265
|
-
LOGGER.error(
|
264
|
+
get_logger(__name__).error(
|
266
265
|
textwrap.dedent(
|
267
266
|
f"""
|
268
267
|
════════════════════════════════════════════════
|
@@ -279,8 +278,7 @@ class ConfigOption:
|
|
279
278
|
# Import here to avoid circular imports
|
280
279
|
from streamlit.logger import get_logger
|
281
280
|
|
282
|
-
|
283
|
-
LOGGER.warning(
|
281
|
+
get_logger(__name__).warning(
|
284
282
|
textwrap.dedent(
|
285
283
|
f"""s
|
286
284
|
════════════════════════════════════════════════
|
@@ -41,6 +41,10 @@ if TYPE_CHECKING:
|
|
41
41
|
SnowflakeConnection as InternalSnowflakeConnection,
|
42
42
|
)
|
43
43
|
|
44
|
+
# the ANSI-compliant SQL code for "connection was not established"
|
45
|
+
# (see docs: https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#id6)
|
46
|
+
SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED: Final = "08001"
|
47
|
+
|
44
48
|
|
45
49
|
class SnowflakeConnection(BaseConnection["InternalSnowflakeConnection"]):
|
46
50
|
"""A connection to Snowflake using the Snowflake Connector for Python.
|
@@ -335,9 +339,6 @@ class SnowflakeConnection(BaseConnection["InternalSnowflakeConnection"]):
|
|
335
339
|
"""
|
336
340
|
from tenacity import retry, retry_if_exception, stop_after_attempt, wait_fixed
|
337
341
|
|
338
|
-
# the ANSI-compliant SQL code for "connection was not established" (see docs: https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#id6)
|
339
|
-
SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED = "08001"
|
340
|
-
|
341
342
|
@retry(
|
342
343
|
after=lambda _: self.reset(),
|
343
344
|
stop=stop_after_attempt(3),
|
streamlit/elements/arrow.py
CHANGED
@@ -508,6 +508,7 @@ class PydeckMixin:
|
|
508
508
|
pydeck_proto.id = compute_and_register_element_id(
|
509
509
|
"deck_gl_json_chart",
|
510
510
|
user_key=key,
|
511
|
+
dg=self.dg,
|
511
512
|
is_selection_activated=is_selection_activated,
|
512
513
|
selection_mode=selection_mode,
|
513
514
|
use_container_width=use_container_width,
|
@@ -15,6 +15,60 @@
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
17
|
import contextlib
|
18
|
+
from typing import Final
|
19
|
+
|
20
|
+
# This is the streamlit theme for plotly where we pass in a template.data
|
21
|
+
# and a template.layout.
|
22
|
+
# Template.data is for changing specific graph properties in a general aspect
|
23
|
+
# such as Contour plots or Waterfall plots.
|
24
|
+
# Template.layout is for changing things such as the x axis and fonts and other
|
25
|
+
# general layout properties for general graphs.
|
26
|
+
# We pass in temporary colors to the frontend and the frontend will replace
|
27
|
+
# those colors because we want to change colors based on the background color.
|
28
|
+
# Start at #0000001 because developers may be likely to use #000000
|
29
|
+
CATEGORY_0: Final = "#000001"
|
30
|
+
CATEGORY_1: Final = "#000002"
|
31
|
+
CATEGORY_2: Final = "#000003"
|
32
|
+
CATEGORY_3: Final = "#000004"
|
33
|
+
CATEGORY_4: Final = "#000005"
|
34
|
+
CATEGORY_5: Final = "#000006"
|
35
|
+
CATEGORY_6: Final = "#000007"
|
36
|
+
CATEGORY_7: Final = "#000008"
|
37
|
+
CATEGORY_8: Final = "#000009"
|
38
|
+
CATEGORY_9: Final = "#000010"
|
39
|
+
|
40
|
+
SEQUENTIAL_0: Final = "#000011"
|
41
|
+
SEQUENTIAL_1: Final = "#000012"
|
42
|
+
SEQUENTIAL_2: Final = "#000013"
|
43
|
+
SEQUENTIAL_3: Final = "#000014"
|
44
|
+
SEQUENTIAL_4: Final = "#000015"
|
45
|
+
SEQUENTIAL_5: Final = "#000016"
|
46
|
+
SEQUENTIAL_6: Final = "#000017"
|
47
|
+
SEQUENTIAL_7: Final = "#000018"
|
48
|
+
SEQUENTIAL_8: Final = "#000019"
|
49
|
+
SEQUENTIAL_9: Final = "#000020"
|
50
|
+
|
51
|
+
DIVERGING_0: Final = "#000021"
|
52
|
+
DIVERGING_1: Final = "#000022"
|
53
|
+
DIVERGING_2: Final = "#000023"
|
54
|
+
DIVERGING_3: Final = "#000024"
|
55
|
+
DIVERGING_4: Final = "#000025"
|
56
|
+
DIVERGING_5: Final = "#000026"
|
57
|
+
DIVERGING_6: Final = "#000027"
|
58
|
+
DIVERGING_7: Final = "#000028"
|
59
|
+
DIVERGING_8: Final = "#000029"
|
60
|
+
DIVERGING_9: Final = "#000030"
|
61
|
+
DIVERGING_10: Final = "#000031"
|
62
|
+
|
63
|
+
INCREASING: Final = "#000032"
|
64
|
+
DECREASING: Final = "#000033"
|
65
|
+
TOTAL: Final = "#000034"
|
66
|
+
|
67
|
+
GRAY_70: Final = "#000036"
|
68
|
+
GRAY_90: Final = "#000037"
|
69
|
+
BG_COLOR: Final = "#000038"
|
70
|
+
FADED_TEXT_05: Final = "#000039"
|
71
|
+
BG_MIX: Final = "#000040"
|
18
72
|
|
19
73
|
|
20
74
|
def configure_streamlit_plotly_theme() -> None:
|
@@ -27,59 +81,6 @@ def configure_streamlit_plotly_theme() -> None:
|
|
27
81
|
import plotly.graph_objects as go
|
28
82
|
import plotly.io as pio
|
29
83
|
|
30
|
-
# This is the streamlit theme for plotly where we pass in a template.data
|
31
|
-
# and a template.layout.
|
32
|
-
# Template.data is for changing specific graph properties in a general aspect
|
33
|
-
# such as Contour plots or Waterfall plots.
|
34
|
-
# Template.layout is for changing things such as the x axis and fonts and other
|
35
|
-
# general layout properties for general graphs.
|
36
|
-
# We pass in temporary colors to the frontend and the frontend will replace
|
37
|
-
# those colors because we want to change colors based on the background color.
|
38
|
-
# Start at #0000001 because developers may be likely to use #000000
|
39
|
-
CATEGORY_0 = "#000001"
|
40
|
-
CATEGORY_1 = "#000002"
|
41
|
-
CATEGORY_2 = "#000003"
|
42
|
-
CATEGORY_3 = "#000004"
|
43
|
-
CATEGORY_4 = "#000005"
|
44
|
-
CATEGORY_5 = "#000006"
|
45
|
-
CATEGORY_6 = "#000007"
|
46
|
-
CATEGORY_7 = "#000008"
|
47
|
-
CATEGORY_8 = "#000009"
|
48
|
-
CATEGORY_9 = "#000010"
|
49
|
-
|
50
|
-
SEQUENTIAL_0 = "#000011"
|
51
|
-
SEQUENTIAL_1 = "#000012"
|
52
|
-
SEQUENTIAL_2 = "#000013"
|
53
|
-
SEQUENTIAL_3 = "#000014"
|
54
|
-
SEQUENTIAL_4 = "#000015"
|
55
|
-
SEQUENTIAL_5 = "#000016"
|
56
|
-
SEQUENTIAL_6 = "#000017"
|
57
|
-
SEQUENTIAL_7 = "#000018"
|
58
|
-
SEQUENTIAL_8 = "#000019"
|
59
|
-
SEQUENTIAL_9 = "#000020"
|
60
|
-
|
61
|
-
DIVERGING_0 = "#000021"
|
62
|
-
DIVERGING_1 = "#000022"
|
63
|
-
DIVERGING_2 = "#000023"
|
64
|
-
DIVERGING_3 = "#000024"
|
65
|
-
DIVERGING_4 = "#000025"
|
66
|
-
DIVERGING_5 = "#000026"
|
67
|
-
DIVERGING_6 = "#000027"
|
68
|
-
DIVERGING_7 = "#000028"
|
69
|
-
DIVERGING_8 = "#000029"
|
70
|
-
DIVERGING_9 = "#000030"
|
71
|
-
DIVERGING_10 = "#000031"
|
72
|
-
|
73
|
-
INCREASING = "#000032"
|
74
|
-
DECREASING = "#000033"
|
75
|
-
TOTAL = "#000034"
|
76
|
-
|
77
|
-
GRAY_70 = "#000036"
|
78
|
-
GRAY_90 = "#000037"
|
79
|
-
BG_COLOR = "#000038"
|
80
|
-
FADED_TEXT_05 = "#000039"
|
81
|
-
BG_MIX = "#000040"
|
82
|
-
|
83
84
|
# Plotly represents continuous colorscale through an array of pairs.
|
84
85
|
# The pair's first index is the starting point and the next pair's first index is the end point.
|
85
86
|
# The pair's second index is the starting color and the next pair's second index is the end color.
|
streamlit/elements/lib/utils.py
CHANGED
@@ -31,6 +31,7 @@ from streamlit import config
|
|
31
31
|
from streamlit.errors import StreamlitDuplicateElementId, StreamlitDuplicateElementKey
|
32
32
|
from streamlit.proto.ChatInput_pb2 import ChatInput
|
33
33
|
from streamlit.proto.LabelVisibilityMessage_pb2 import LabelVisibilityMessage
|
34
|
+
from streamlit.proto.RootContainer_pb2 import RootContainer
|
34
35
|
from streamlit.runtime.scriptrunner_utils.script_run_context import (
|
35
36
|
ScriptRunContext,
|
36
37
|
get_script_run_ctx,
|
@@ -45,6 +46,8 @@ if TYPE_CHECKING:
|
|
45
46
|
from builtins import ellipsis
|
46
47
|
from collections.abc import Iterable
|
47
48
|
|
49
|
+
from streamlit.delta_generator import DeltaGenerator
|
50
|
+
|
48
51
|
|
49
52
|
Key: TypeAlias = Union[str, int]
|
50
53
|
|
@@ -182,6 +185,7 @@ def compute_and_register_element_id(
|
|
182
185
|
*,
|
183
186
|
user_key: str | None,
|
184
187
|
form_id: str | None,
|
188
|
+
dg: DeltaGenerator | None = None,
|
185
189
|
**kwargs: SAFE_VALUES | Iterable[SAFE_VALUES],
|
186
190
|
) -> str:
|
187
191
|
"""Compute and register the ID for the given element.
|
@@ -212,6 +216,9 @@ def compute_and_register_element_id(
|
|
212
216
|
The ID of the form that the element belongs to. `None` or empty string
|
213
217
|
if the element doesn't belong to a form or doesn't support forms.
|
214
218
|
|
219
|
+
dg : DeltaGenerator | None
|
220
|
+
The DeltaGenerator of each element. `None` if the element is not a widget.
|
221
|
+
|
215
222
|
kwargs : SAFE_VALUES | Iterable[SAFE_VALUES]
|
216
223
|
The arguments to use to compute the element ID.
|
217
224
|
The arguments must be stable, deterministic values.
|
@@ -229,6 +236,14 @@ def compute_and_register_element_id(
|
|
229
236
|
# pages unique IDs.
|
230
237
|
kwargs_to_use["active_script_hash"] = ctx.active_script_hash
|
231
238
|
|
239
|
+
if dg:
|
240
|
+
# If no key is provided and the widget element is inside the sidebar area
|
241
|
+
# add it to the kwargs
|
242
|
+
# allowing the same widget to be both in main area and sidebar.
|
243
|
+
active_dg_root_container = dg._active_dg._root_container
|
244
|
+
if active_dg_root_container == RootContainer.SIDEBAR and user_key is None:
|
245
|
+
kwargs_to_use["active_dg_root_container"] = str(active_dg_root_container)
|
246
|
+
|
232
247
|
element_id = _compute_element_id(
|
233
248
|
element_type,
|
234
249
|
user_key,
|
streamlit/elements/spinner.py
CHANGED
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|
16
16
|
|
17
17
|
import contextlib
|
18
18
|
import threading
|
19
|
-
from typing import TYPE_CHECKING
|
19
|
+
from typing import TYPE_CHECKING, Final
|
20
20
|
|
21
21
|
import streamlit as st
|
22
22
|
from streamlit.runtime.scriptrunner import add_script_run_ctx
|
@@ -24,6 +24,10 @@ from streamlit.runtime.scriptrunner import add_script_run_ctx
|
|
24
24
|
if TYPE_CHECKING:
|
25
25
|
from collections.abc import Iterator
|
26
26
|
|
27
|
+
# Set the message 0.5 seconds in the future to avoid annoying
|
28
|
+
# flickering if this spinner runs too quickly.
|
29
|
+
DELAY_SECS: Final = 0.5
|
30
|
+
|
27
31
|
|
28
32
|
@contextlib.contextmanager
|
29
33
|
def spinner(
|
@@ -75,9 +79,6 @@ def spinner(
|
|
75
79
|
|
76
80
|
message = st.empty()
|
77
81
|
|
78
|
-
# Set the message 0.5 seconds in the future to avoid annoying
|
79
|
-
# flickering if this spinner runs too quickly.
|
80
|
-
DELAY_SECS = 0.5
|
81
82
|
display_message = True
|
82
83
|
display_message_lock = threading.Lock()
|
83
84
|
|
@@ -1947,6 +1947,7 @@ class VegaChartsMixin:
|
|
1947
1947
|
"arrow_vega_lite_chart",
|
1948
1948
|
user_key=key,
|
1949
1949
|
form_id=vega_lite_proto.form_id,
|
1950
|
+
dg=self.dg,
|
1950
1951
|
vega_lite_spec=vega_lite_proto.spec,
|
1951
1952
|
# The data is either in vega_lite_proto.data.data
|
1952
1953
|
# or in a named dataset in vega_lite_proto.datasets
|
@@ -818,6 +818,7 @@ class ButtonMixin:
|
|
818
818
|
user_key=key,
|
819
819
|
# download_button is not allowed to be used in a form.
|
820
820
|
form_id=None,
|
821
|
+
dg=self.dg,
|
821
822
|
label=label,
|
822
823
|
icon=icon,
|
823
824
|
file_name=file_name,
|
@@ -1009,6 +1010,7 @@ class ButtonMixin:
|
|
1009
1010
|
user_key=key,
|
1010
1011
|
# Only the
|
1011
1012
|
form_id=form_id,
|
1013
|
+
dg=self.dg,
|
1012
1014
|
label=label,
|
1013
1015
|
icon=icon,
|
1014
1016
|
help=help,
|
@@ -123,7 +123,7 @@ def _process_avatar_input(
|
|
123
123
|
Tuple[AvatarType, str]
|
124
124
|
The detected avatar type and the prepared avatar data.
|
125
125
|
"""
|
126
|
-
AvatarType = BlockProto.ChatMessage.AvatarType
|
126
|
+
AvatarType = BlockProto.ChatMessage.AvatarType # noqa: N806
|
127
127
|
|
128
128
|
if avatar is None:
|
129
129
|
return AvatarType.ICON, ""
|
@@ -596,6 +596,7 @@ class ChatMixin:
|
|
596
596
|
user_key=key,
|
597
597
|
# chat_input is not allowed to be used in a form.
|
598
598
|
form_id=None,
|
599
|
+
dg=self.dg,
|
599
600
|
placeholder=placeholder,
|
600
601
|
max_chars=max_chars,
|
601
602
|
accept_file=accept_file,
|
@@ -370,8 +370,8 @@ def _apply_row_additions(
|
|
370
370
|
# Row cannot be added -> skip it and log a warning.
|
371
371
|
_LOGGER.warning(
|
372
372
|
"Cannot automatically add row for the index "
|
373
|
-
|
374
|
-
|
373
|
+
"of type %s without an explicit index value. Row addition skipped.",
|
374
|
+
type(df.index).__name__,
|
375
375
|
)
|
376
376
|
|
377
377
|
|
@@ -933,6 +933,7 @@ class DataEditorMixin:
|
|
933
933
|
"data_editor",
|
934
934
|
user_key=key,
|
935
935
|
form_id=current_form_id(self.dg),
|
936
|
+
dg=self.dg,
|
936
937
|
data=arrow_bytes,
|
937
938
|
width=width,
|
938
939
|
height=height,
|
@@ -118,6 +118,15 @@ DAYS_TO_MICROS: Final = 24 * 60 * 60 * SECONDS_TO_MICROS
|
|
118
118
|
|
119
119
|
UTC_EPOCH: Final = datetime(1970, 1, 1, tzinfo=timezone.utc)
|
120
120
|
|
121
|
+
SUPPORTED_TYPES: Final = {
|
122
|
+
Integral: SliderProto.INT,
|
123
|
+
Real: SliderProto.FLOAT,
|
124
|
+
datetime: SliderProto.DATETIME,
|
125
|
+
date: SliderProto.DATE,
|
126
|
+
time: SliderProto.TIME,
|
127
|
+
}
|
128
|
+
TIMELIKE_TYPES: Final = (SliderProto.DATETIME, SliderProto.TIME, SliderProto.DATE)
|
129
|
+
|
121
130
|
|
122
131
|
def _time_to_datetime(time_: time) -> datetime:
|
123
132
|
# Note, here we pick an arbitrary date well after Unix epoch.
|
@@ -665,6 +674,7 @@ class SliderMixin:
|
|
665
674
|
"slider",
|
666
675
|
user_key=key,
|
667
676
|
form_id=current_form_id(self.dg),
|
677
|
+
dg=self.dg,
|
668
678
|
label=label,
|
669
679
|
min_value=min_value,
|
670
680
|
max_value=max_value,
|
@@ -675,15 +685,6 @@ class SliderMixin:
|
|
675
685
|
width=width,
|
676
686
|
)
|
677
687
|
|
678
|
-
SUPPORTED_TYPES = {
|
679
|
-
Integral: SliderProto.INT,
|
680
|
-
Real: SliderProto.FLOAT,
|
681
|
-
datetime: SliderProto.DATETIME,
|
682
|
-
date: SliderProto.DATE,
|
683
|
-
time: SliderProto.TIME,
|
684
|
-
}
|
685
|
-
TIMELIKE_TYPES = (SliderProto.DATETIME, SliderProto.TIME, SliderProto.DATE)
|
686
|
-
|
687
688
|
if value is None:
|
688
689
|
# We need to know if this is a single or range slider, but don't have
|
689
690
|
# a default value, so we check if session_state can tell us.
|
@@ -747,7 +748,7 @@ class SliderMixin:
|
|
747
748
|
datetime_min = value[0] - timedelta(days=14)
|
748
749
|
datetime_max = value[0] + timedelta(days=14)
|
749
750
|
|
750
|
-
|
751
|
+
defaults: Final = {
|
751
752
|
SliderProto.INT: {
|
752
753
|
"min_value": 0,
|
753
754
|
"max_value": 100,
|
@@ -781,18 +782,18 @@ class SliderMixin:
|
|
781
782
|
}
|
782
783
|
|
783
784
|
if min_value is None:
|
784
|
-
min_value =
|
785
|
+
min_value = defaults[data_type]["min_value"]
|
785
786
|
if max_value is None:
|
786
|
-
max_value =
|
787
|
+
max_value = defaults[data_type]["max_value"]
|
787
788
|
if step is None:
|
788
|
-
step =
|
789
|
+
step = defaults[data_type]["step"]
|
789
790
|
if data_type in (
|
790
791
|
SliderProto.DATETIME,
|
791
792
|
SliderProto.DATE,
|
792
793
|
) and max_value - min_value < timedelta(days=1):
|
793
794
|
step = timedelta(minutes=15)
|
794
795
|
if format is None:
|
795
|
-
format = cast("str",
|
796
|
+
format = cast("str", defaults[data_type]["format"]) # noqa: A001
|
796
797
|
|
797
798
|
if step == 0:
|
798
799
|
raise StreamlitAPIException(
|
@@ -317,6 +317,7 @@ class TextWidgetsMixin:
|
|
317
317
|
"text_input",
|
318
318
|
user_key=key,
|
319
319
|
form_id=current_form_id(self.dg),
|
320
|
+
dg=self.dg,
|
320
321
|
label=label,
|
321
322
|
value=value,
|
322
323
|
max_chars=max_chars,
|
@@ -621,6 +622,7 @@ class TextWidgetsMixin:
|
|
621
622
|
"text_area",
|
622
623
|
user_key=key,
|
623
624
|
form_id=current_form_id(self.dg),
|
625
|
+
dg=self.dg,
|
624
626
|
label=label,
|
625
627
|
value=value,
|
626
628
|
height=height,
|
@@ -523,6 +523,7 @@ class TimeWidgetsMixin:
|
|
523
523
|
"time_input",
|
524
524
|
user_key=key,
|
525
525
|
form_id=current_form_id(self.dg),
|
526
|
+
dg=self.dg,
|
526
527
|
label=label,
|
527
528
|
value=parsed_time if isinstance(value, (datetime, time)) else value,
|
528
529
|
help=help,
|
@@ -909,6 +910,7 @@ class TimeWidgetsMixin:
|
|
909
910
|
"date_input",
|
910
911
|
user_key=key,
|
911
912
|
form_id=current_form_id(self.dg),
|
913
|
+
dg=self.dg,
|
912
914
|
label=label,
|
913
915
|
value=parsed,
|
914
916
|
min_value=parsed_min_date,
|
@@ -46,18 +46,18 @@ def animation_demo() -> None:
|
|
46
46
|
|
47
47
|
# Performing some fractal wizardry.
|
48
48
|
c = separation * np.exp(1j * a)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
z = np.tile(x, (n, 1)) + 1j * np.tile(y, (1, m))
|
50
|
+
c_matrix = np.full((n, m), c)
|
51
|
+
m_matrix: Any = np.full((n, m), True, dtype=bool)
|
52
|
+
n_matrix = np.zeros((n, m))
|
53
53
|
|
54
54
|
for i in range(iterations):
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
z[m_matrix] = z[m_matrix] * z[m_matrix] + c_matrix[m_matrix]
|
56
|
+
m_matrix[np.abs(z) > 2] = False
|
57
|
+
n_matrix[m_matrix] = i
|
58
58
|
|
59
59
|
# Update the image placeholder by calling the image() function on it.
|
60
|
-
image.image(1.0 - (
|
60
|
+
image.image(1.0 - (n_matrix / n_matrix.max()), use_container_width=True)
|
61
61
|
|
62
62
|
# We clear elements by calling empty on them.
|
63
63
|
progress_bar.empty()
|