streamlit-nightly 1.45.2.dev20250527__py3-none-any.whl → 1.45.2.dev20250530__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/commands/echo.py +1 -1
- streamlit/config.py +32 -12
- streamlit/config_option.py +3 -5
- streamlit/config_util.py +4 -5
- streamlit/connections/snowflake_connection.py +4 -3
- streamlit/delta_generator.py +10 -14
- streamlit/elements/arrow.py +1 -0
- streamlit/elements/deck_gl_json_chart.py +1 -0
- streamlit/elements/doc_string.py +7 -15
- streamlit/elements/exception.py +4 -12
- streamlit/elements/form.py +14 -0
- streamlit/elements/graphviz_chart.py +1 -1
- streamlit/elements/heading.py +3 -4
- streamlit/elements/json.py +7 -6
- streamlit/elements/layouts.py +21 -3
- streamlit/elements/lib/image_utils.py +2 -3
- streamlit/elements/lib/layout_utils.py +24 -0
- streamlit/elements/lib/mutable_status_container.py +9 -0
- streamlit/elements/lib/streamlit_plotly_theme.py +54 -53
- streamlit/elements/lib/utils.py +15 -0
- streamlit/elements/markdown.py +34 -4
- streamlit/elements/media.py +1 -1
- streamlit/elements/plotly_chart.py +1 -0
- streamlit/elements/progress.py +6 -15
- streamlit/elements/spinner.py +5 -4
- streamlit/elements/vega_charts.py +1 -0
- streamlit/elements/widgets/audio_input.py +4 -10
- streamlit/elements/widgets/button.py +3 -1
- streamlit/elements/widgets/button_group.py +1 -0
- streamlit/elements/widgets/camera_input.py +6 -9
- streamlit/elements/widgets/chat.py +11 -13
- streamlit/elements/widgets/checkbox.py +1 -0
- streamlit/elements/widgets/color_picker.py +9 -14
- streamlit/elements/widgets/data_editor.py +9 -5
- streamlit/elements/widgets/file_uploader.py +10 -9
- streamlit/elements/widgets/multiselect.py +1 -0
- streamlit/elements/widgets/number_input.py +12 -12
- streamlit/elements/widgets/radio.py +2 -1
- streamlit/elements/widgets/select_slider.py +4 -10
- streamlit/elements/widgets/selectbox.py +11 -13
- streamlit/elements/widgets/slider.py +28 -41
- streamlit/elements/widgets/text_widgets.py +16 -24
- streamlit/elements/widgets/time_widgets.py +15 -22
- streamlit/hello/animation_demo.py +9 -9
- streamlit/hello/dataframe_demo.py +2 -2
- streamlit/hello/hello.py +1 -0
- streamlit/hello/mapping_demo.py +5 -6
- streamlit/hello/streamlit_app.py +27 -25
- streamlit/logger.py +1 -1
- streamlit/proto/AudioInput_pb2.py +3 -4
- streamlit/proto/AudioInput_pb2.pyi +2 -7
- streamlit/proto/Block_pb2.py +27 -27
- streamlit/proto/Block_pb2.pyi +3 -17
- streamlit/proto/CameraInput_pb2.py +3 -4
- streamlit/proto/CameraInput_pb2.pyi +2 -8
- streamlit/proto/ChatInput_pb2.py +7 -8
- streamlit/proto/ChatInput_pb2.pyi +1 -10
- streamlit/proto/Code_pb2.py +3 -4
- streamlit/proto/DateInput_pb2.py +3 -4
- streamlit/proto/DateInput_pb2.pyi +2 -8
- streamlit/proto/DocString_pb2.py +5 -6
- streamlit/proto/DocString_pb2.pyi +1 -9
- streamlit/proto/FileUploader_pb2.py +3 -4
- streamlit/proto/FileUploader_pb2.pyi +2 -8
- streamlit/proto/Json_pb2.py +3 -4
- streamlit/proto/Json_pb2.pyi +2 -9
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +7 -2
- streamlit/proto/NumberInput_pb2.py +5 -6
- streamlit/proto/NumberInput_pb2.pyi +2 -9
- streamlit/proto/Progress_pb2.py +3 -4
- streamlit/proto/Progress_pb2.pyi +1 -7
- streamlit/proto/Selectbox_pb2.py +3 -4
- streamlit/proto/Selectbox_pb2.pyi +2 -9
- streamlit/proto/Slider_pb2.py +7 -8
- streamlit/proto/Slider_pb2.pyi +2 -8
- streamlit/proto/TextArea_pb2.py +3 -4
- streamlit/proto/TextArea_pb2.pyi +2 -9
- streamlit/proto/TextInput_pb2.py +5 -6
- streamlit/proto/TextInput_pb2.pyi +2 -9
- streamlit/proto/TimeInput_pb2.py +3 -4
- streamlit/proto/TimeInput_pb2.pyi +2 -9
- streamlit/runtime/app_session.py +11 -8
- streamlit/runtime/caching/hashing.py +8 -9
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +3 -3
- streamlit/runtime/connection_factory.py +12 -12
- streamlit/runtime/credentials.py +13 -26
- streamlit/runtime/runtime_util.py +2 -2
- streamlit/runtime/scriptrunner/script_runner.py +8 -7
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +1240 -0
- streamlit/static/static/js/{ErrorOutline.esm.qteVcUUN.js → ErrorOutline.esm.D5NgCh5m.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.ncu7N-Hr.js → FileDownload.esm.NuObx1Tl.js} +1 -1
- streamlit/static/static/js/{FileHelper.zsMZ7RXt.js → FileHelper.BH7o4_P9.js} +5 -5
- streamlit/static/static/js/{FormClearHelper.W8yVYXZp.js → FormClearHelper.BAxB8JFY.js} +1 -1
- streamlit/static/static/js/{Hooks.DBj6srQ1.js → Hooks.Bjt8oBOT.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BobLsJJb.js → InputInstructions.BZZLp6t9.js} +1 -1
- streamlit/static/static/js/{ProgressBar.CtvJrIzN.js → ProgressBar.BwRgGfI0.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.DnT_UdzV.js → RenderInPortalIfExists.C_c286r8.js} +1 -1
- streamlit/static/static/js/{Toolbar.BVF7NtOB.js → Toolbar.5tXjF_eX.js} +1 -1
- streamlit/static/static/js/{base-input.B4sdS3vw.js → base-input.wfBDFTlB.js} +1 -1
- streamlit/static/static/js/{checkbox.DKDitzF8.js → checkbox.D1GhNngU.js} +1 -1
- streamlit/static/static/js/{createSuper.mhx956J9.js → createSuper.CudEEVs2.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CmXS0PAX.js → data-grid-overlay-editor.DUTI_Rbg.js} +1 -1
- streamlit/static/static/js/{downloader.Cnd9SuxG.js → downloader.BwLpAoXN.js} +1 -1
- streamlit/static/static/js/{es6.DM-pf09u.js → es6.B_HLnUb9.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.Gc5GAjZM.js → iframeResizer.contentWindow.BNcjOcan.js} +1 -1
- streamlit/static/static/js/{index.D4XRYl23.js → index.3WJoJFGb.js} +1 -1
- streamlit/static/static/js/{index.C_2m4F7k.js → index.B0h616Th.js} +1 -1
- streamlit/static/static/js/{index.p2Wl4zMi.js → index.B0paBg5x.js} +1 -1
- streamlit/static/static/js/index.B3vWaIrN.js +1 -0
- streamlit/static/static/js/{index.B45ExNhw.js → index.B4PbMsBe.js} +1 -1
- streamlit/static/static/js/{index.BWTBe3a1.js → index.BGKVW2u9.js} +1 -1
- streamlit/static/static/js/index.BJQPxOFd.js +12 -0
- streamlit/static/static/js/{index.DdyZtGcg.js → index.BOHEcsVb.js} +1 -1
- streamlit/static/static/js/{index.BR-S54Iv.js → index.BPGAPI9w.js} +1 -1
- streamlit/static/static/js/{index.gBOr8z2K.js → index.Bj6uLiaA.js} +1 -1
- streamlit/static/static/js/{index.I3iNnzJx.js → index.BkvVxUIW.js} +1 -1
- streamlit/static/static/js/{index._BaeK1t7.js → index.Bs0m0eUy.js} +1 -1
- streamlit/static/static/js/{index.DwUISpCs.js → index.BtpsTdHN.js} +177 -174
- streamlit/static/static/js/index.C1GNiWbH.js +1 -0
- streamlit/static/static/js/{index.B6xTo8b8.js → index.CL0UH4WF.js} +1 -1
- streamlit/static/static/js/{index.BJQNG4O1.js → index.CXP5ffxh.js} +1 -1
- streamlit/static/static/js/{index.DAvhwYMG.js → index.Ca-9xoC2.js} +1 -1
- streamlit/static/static/js/{index.COBionvf.js → index.Cdd7Ri21.js} +1 -1
- streamlit/static/static/js/index.Cf8KcH2X.js +1 -0
- streamlit/static/static/js/{index.BkLkRTpZ.js → index.CfzaRR6P.js} +1 -1
- streamlit/static/static/js/{index.CkKptP1T.js → index.CjRwuAdg.js} +1 -1
- streamlit/static/static/js/{index.CjBaoWYr.js → index.CkOUlPYT.js} +1 -1
- streamlit/static/static/js/{index.DQGSbu2C.js → index.CxtkoiKl.js} +1 -1
- streamlit/static/static/js/index.D3wYqvI6.js +1 -0
- streamlit/static/static/js/index.D8i27llu.js +3 -0
- streamlit/static/static/js/{index.BfusYuD8.js → index.DA7wmIe4.js} +1 -1
- streamlit/static/static/js/index.DIG9Mo9J.js +1 -0
- streamlit/static/static/js/index.DNR4wKJg.js +1 -0
- streamlit/static/static/js/{index.B29JQLHa.js → index.DNS8a-dx.js} +20 -20
- streamlit/static/static/js/{index.BNNR5Jmd.js → index.NveskZ7j.js} +1 -1
- streamlit/static/static/js/{index.CWgnk1N4.js → index.PR2mcvVR.js} +1 -1
- streamlit/static/static/js/{index.CJ-XXd1r.js → index.df4uuSoD.js} +1 -1
- streamlit/static/static/js/{index.WWYmGCrM.js → index.flyQEkeT.js} +1 -1
- streamlit/static/static/js/{index.vOqxh1m2.js → index.iF9jUtwl.js} +1 -1
- streamlit/static/static/js/{index.C5KKmyWy.js → index.jyqBAhvH.js} +1 -1
- streamlit/static/static/js/{index.AWkO-7e-.js → index.sYLAHlH0.js} +1 -1
- streamlit/static/static/js/{index.CZ5fZcT5.js → index.zq3LdRhj.js} +1 -1
- streamlit/static/static/js/{input.BvD9DHLa.js → input.CtZjQ6Pv.js} +1 -1
- streamlit/static/static/js/{memory.DCVB1HOm.js → memory.Ddl3R0up.js} +1 -1
- streamlit/static/static/js/{mergeWith.BqTORFAq.js → mergeWith.D-TqDY0-.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.VB_OvuPv.js → number-overlay-editor.Dndf05Hx.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DhYxBDlj.js → possibleConstructorReturn.DNEY6J9G.js} +1 -1
- streamlit/static/static/js/{sandbox.CoN7LRFk.js → sandbox.B_XDPkfx.js} +1 -1
- streamlit/static/static/js/{textarea.DkHpIjdT.js → textarea.BZ9lTMhV.js} +1 -1
- streamlit/static/static/js/{timepicker.C8UIzYhf.js → timepicker.D9UUwpRT.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DXfr1fvT.js → toConsumableArray.DNJjbOUS.js} +1 -1
- streamlit/static/static/js/{uniqueId.CgrMSBTb.js → uniqueId.psBJ_tSg.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.C-e-WEFS.js → useBasicWidgetState.CTpx4w-3.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CtRJhZD6.js → useOnInputChange.WKTDSC4O.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.od0SAvAK.js → withFullScreenWrapper.oyWCn2-3.js} +1 -1
- streamlit/watcher/local_sources_watcher.py +1 -1
- streamlit/watcher/path_watcher.py +2 -3
- streamlit/web/bootstrap.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/web/server/server.py +1 -1
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/METADATA +2 -2
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/RECORD +172 -171
- streamlit/static/static/js/index.B0E6Rv1F.js +0 -1
- streamlit/static/static/js/index.BONHiJUZ.js +0 -1
- streamlit/static/static/js/index.BV38yp5k.js +0 -1
- streamlit/static/static/js/index.CgOynO1t.js +0 -1
- streamlit/static/static/js/index.DIyx-z1Q.js +0 -1
- streamlit/static/static/js/index.DOYomqqU.js +0 -1
- streamlit/static/static/js/index.DOl-SOKu.js +0 -3
- streamlit/static/static/js/index.DTU7qmDP.js +0 -12
- {streamlit_nightly-1.45.2.dev20250527.data → streamlit_nightly-1.45.2.dev20250530.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.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/commands/echo.py
CHANGED
@@ -101,7 +101,7 @@ def echo(
|
|
101
101
|
show_code(code_string, "python")
|
102
102
|
|
103
103
|
except FileNotFoundError as err:
|
104
|
-
show_warning("Unable to display code.
|
104
|
+
show_warning(f"Unable to display code. {err}")
|
105
105
|
|
106
106
|
|
107
107
|
def _get_initial_indent(lines: Iterable[str]) -> int:
|
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
|
|
@@ -1225,6 +1225,24 @@ _create_theme_options(
|
|
1225
1225
|
""",
|
1226
1226
|
)
|
1227
1227
|
|
1228
|
+
_create_theme_options(
|
1229
|
+
"buttonRadius",
|
1230
|
+
categories=["theme", CustomThemeCategories.SIDEBAR],
|
1231
|
+
description="""
|
1232
|
+
The radius used as basis for the corners of buttons.
|
1233
|
+
|
1234
|
+
This can be one of the following:
|
1235
|
+
- "none"
|
1236
|
+
- "small"
|
1237
|
+
- "medium"
|
1238
|
+
- "large"
|
1239
|
+
- "full"
|
1240
|
+
- ...or the number in pixels or rem. For example, you can use "10px",
|
1241
|
+
"0.5rem", or "2rem". To follow best practices, use rem instead of
|
1242
|
+
pixels when specifying a numeric size.
|
1243
|
+
""",
|
1244
|
+
)
|
1245
|
+
|
1228
1246
|
_create_theme_options(
|
1229
1247
|
"borderColor",
|
1230
1248
|
categories=["theme", CustomThemeCategories.SIDEBAR],
|
@@ -1301,7 +1319,8 @@ def get_where_defined(key: str) -> str:
|
|
1301
1319
|
config_options = get_config_options()
|
1302
1320
|
|
1303
1321
|
if key not in config_options:
|
1304
|
-
|
1322
|
+
msg = f'Config key "{key}" not defined.'
|
1323
|
+
raise RuntimeError(msg)
|
1305
1324
|
return config_options[key].where_defined
|
1306
1325
|
|
1307
1326
|
|
@@ -1380,11 +1399,12 @@ def _set_option(key: str, value: Any, where_defined: str) -> None:
|
|
1380
1399
|
# Import logger locally to prevent circular references
|
1381
1400
|
from streamlit.logger import get_logger
|
1382
1401
|
|
1383
|
-
|
1402
|
+
logger: Final = get_logger(__name__)
|
1384
1403
|
|
1385
|
-
|
1386
|
-
|
1387
|
-
"option set, it may have been removed."
|
1404
|
+
logger.warning(
|
1405
|
+
'"%s" is not a valid config option. If you previously had this config '
|
1406
|
+
"option set, it may have been removed.",
|
1407
|
+
key,
|
1388
1408
|
)
|
1389
1409
|
|
1390
1410
|
else:
|
@@ -1505,9 +1525,9 @@ def _maybe_read_env_variable(value: Any) -> Any:
|
|
1505
1525
|
# Import logger locally to prevent circular references
|
1506
1526
|
from streamlit.logger import get_logger
|
1507
1527
|
|
1508
|
-
|
1528
|
+
logger: Final = get_logger(__name__)
|
1509
1529
|
|
1510
|
-
|
1530
|
+
logger.error("No environment variable called %s", var_name)
|
1511
1531
|
else:
|
1512
1532
|
return _maybe_convert_to_number(env_var)
|
1513
1533
|
|
@@ -1607,8 +1627,8 @@ def get_config_options(
|
|
1607
1627
|
# Import logger locally to prevent circular references.
|
1608
1628
|
from streamlit.logger import get_logger
|
1609
1629
|
|
1610
|
-
|
1611
|
-
|
1630
|
+
logger: Final = get_logger(__name__)
|
1631
|
+
logger.warning(
|
1612
1632
|
"An update to the [server] config option section was detected."
|
1613
1633
|
" To have these changes be reflected, please restart streamlit."
|
1614
1634
|
)
|
@@ -1628,7 +1648,7 @@ def _check_conflicts() -> None:
|
|
1628
1648
|
# Import logger locally to prevent circular references
|
1629
1649
|
from streamlit.logger import get_logger
|
1630
1650
|
|
1631
|
-
|
1651
|
+
logger: Final = get_logger(__name__)
|
1632
1652
|
|
1633
1653
|
if get_option("global.developmentMode"):
|
1634
1654
|
if not _is_unset("server.port"):
|
@@ -1645,7 +1665,7 @@ def _check_conflicts() -> None:
|
|
1645
1665
|
if get_option("server.enableXsrfProtection") and (
|
1646
1666
|
not get_option("server.enableCORS") or get_option("global.developmentMode")
|
1647
1667
|
):
|
1648
|
-
|
1668
|
+
logger.warning(
|
1649
1669
|
"""
|
1650
1670
|
Warning: the config option 'server.enableCORS=false' is not compatible with
|
1651
1671
|
'server.enableXsrfProtection=true'.
|
streamlit/config_option.py
CHANGED
@@ -189,7 +189,7 @@ class ConfigOption:
|
|
189
189
|
if self.replaced_by:
|
190
190
|
self.deprecated = True
|
191
191
|
if deprecation_text is None:
|
192
|
-
deprecation_text = "Replaced by
|
192
|
+
deprecation_text = f"Replaced by {self.replaced_by}."
|
193
193
|
|
194
194
|
if self.deprecated:
|
195
195
|
if not expiration_date:
|
@@ -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
|
════════════════════════════════════════════════
|
streamlit/config_util.py
CHANGED
@@ -84,7 +84,7 @@ def show_config(
|
|
84
84
|
continue
|
85
85
|
|
86
86
|
out.append("")
|
87
|
-
append_section("[
|
87
|
+
append_section(f"[{section}]")
|
88
88
|
out.append("")
|
89
89
|
|
90
90
|
for option in section_options.values():
|
@@ -125,8 +125,7 @@ def show_config(
|
|
125
125
|
append_comment(line)
|
126
126
|
append_comment("")
|
127
127
|
append_comment(
|
128
|
-
"This option will be removed on or after
|
129
|
-
% option.expiration_date
|
128
|
+
f"This option will be removed on or after {option.expiration_date}."
|
130
129
|
)
|
131
130
|
|
132
131
|
import toml
|
@@ -138,7 +137,7 @@ def show_config(
|
|
138
137
|
# Ensure a line break before appending "Default" comment, if not already there
|
139
138
|
if out[-1] != "#":
|
140
139
|
append_comment("")
|
141
|
-
append_comment("Default:
|
140
|
+
append_comment(f"Default: {toml_default}")
|
142
141
|
else:
|
143
142
|
# Don't say "Default: (unset)" here because this branch applies
|
144
143
|
# to complex config settings too.
|
@@ -151,7 +150,7 @@ def show_config(
|
|
151
150
|
if option_is_manually_set:
|
152
151
|
if out[-1] != "# ":
|
153
152
|
append_comment("")
|
154
|
-
append_comment("The value below was set in
|
153
|
+
append_comment(f"The value below was set in {option.where_defined}")
|
155
154
|
|
156
155
|
toml_setting = toml.dumps({key: option.value})
|
157
156
|
|
@@ -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/delta_generator.py
CHANGED
@@ -63,6 +63,10 @@ from streamlit.elements.image import ImageMixin
|
|
63
63
|
from streamlit.elements.json import JsonMixin
|
64
64
|
from streamlit.elements.layouts import LayoutsMixin
|
65
65
|
from streamlit.elements.lib.form_utils import FormData, current_form_id
|
66
|
+
from streamlit.elements.lib.layout_utils import (
|
67
|
+
get_height_config,
|
68
|
+
get_width_config,
|
69
|
+
)
|
66
70
|
from streamlit.elements.map import MapMixin
|
67
71
|
from streamlit.elements.markdown import MarkdownMixin
|
68
72
|
from streamlit.elements.media import MediaMixin
|
@@ -480,22 +484,14 @@ class DeltaGenerator(
|
|
480
484
|
|
481
485
|
if layout_config:
|
482
486
|
if layout_config.height:
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
)
|
487
|
-
elif layout_config.height == "content":
|
488
|
-
msg.delta.new_element.height_config.use_content = True
|
489
|
-
else:
|
490
|
-
msg.delta.new_element.height_config.use_stretch = True
|
487
|
+
msg.delta.new_element.height_config.CopyFrom(
|
488
|
+
get_height_config(layout_config.height)
|
489
|
+
)
|
491
490
|
|
492
491
|
if layout_config.width:
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
msg.delta.new_element.width_config.use_content = True
|
497
|
-
else:
|
498
|
-
msg.delta.new_element.width_config.use_stretch = True
|
492
|
+
msg.delta.new_element.width_config.CopyFrom(
|
493
|
+
get_width_config(layout_config.width)
|
494
|
+
)
|
499
495
|
|
500
496
|
# Only enqueue message and fill in metadata if there's a container.
|
501
497
|
msg_was_enqueued = False
|
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,
|
streamlit/elements/doc_string.py
CHANGED
@@ -24,10 +24,9 @@ import types
|
|
24
24
|
from typing import TYPE_CHECKING, Any, Final, cast
|
25
25
|
|
26
26
|
import streamlit
|
27
|
-
from streamlit.elements.lib.layout_utils import validate_width
|
27
|
+
from streamlit.elements.lib.layout_utils import LayoutConfig, validate_width
|
28
28
|
from streamlit.proto.DocString_pb2 import DocString as DocStringProto
|
29
29
|
from streamlit.proto.DocString_pb2 import Member as MemberProto
|
30
|
-
from streamlit.proto.WidthConfig_pb2 import WidthConfig
|
31
30
|
from streamlit.runtime.metrics_util import gather_metrics
|
32
31
|
from streamlit.runtime.scriptrunner.script_runner import (
|
33
32
|
__file__ as SCRIPTRUNNER_FILENAME, # noqa: N812
|
@@ -125,9 +124,12 @@ class HelpMixin:
|
|
125
124
|
doc_string_proto = DocStringProto()
|
126
125
|
|
127
126
|
validate_width(width, allow_content=False)
|
128
|
-
|
127
|
+
layout_config = LayoutConfig(width=width)
|
128
|
+
_marshall(doc_string_proto, obj)
|
129
129
|
|
130
|
-
return self.dg._enqueue(
|
130
|
+
return self.dg._enqueue(
|
131
|
+
"doc_string", doc_string_proto, layout_config=layout_config
|
132
|
+
)
|
131
133
|
|
132
134
|
@property
|
133
135
|
def dg(self) -> DeltaGenerator:
|
@@ -135,9 +137,7 @@ class HelpMixin:
|
|
135
137
|
return cast("DeltaGenerator", self)
|
136
138
|
|
137
139
|
|
138
|
-
def _marshall(
|
139
|
-
doc_string_proto: DocStringProto, obj: Any, width: WidthWithoutContent = "stretch"
|
140
|
-
) -> None:
|
140
|
+
def _marshall(doc_string_proto: DocStringProto, obj: Any) -> None:
|
141
141
|
"""Construct a DocString object.
|
142
142
|
|
143
143
|
See DeltaGenerator.help for docs.
|
@@ -159,14 +159,6 @@ def _marshall(
|
|
159
159
|
|
160
160
|
doc_string_proto.members.extend(_get_members(obj))
|
161
161
|
|
162
|
-
# Set width configuration
|
163
|
-
width_config = WidthConfig()
|
164
|
-
if isinstance(width, int):
|
165
|
-
width_config.pixel_width = width
|
166
|
-
else:
|
167
|
-
width_config.use_stretch = True
|
168
|
-
doc_string_proto.width_config.CopyFrom(width_config)
|
169
|
-
|
170
162
|
|
171
163
|
def _get_name(obj: object) -> str | None:
|
172
164
|
# Try to get the fully-qualified name of the object.
|
streamlit/elements/exception.py
CHANGED
@@ -237,18 +237,10 @@ def _format_syntax_error_message(exception: SyntaxError) -> str:
|
|
237
237
|
)
|
238
238
|
|
239
239
|
return (
|
240
|
-
'File "
|
241
|
-
"
|
242
|
-
"
|
243
|
-
"
|
244
|
-
% {
|
245
|
-
"filename": exception.filename,
|
246
|
-
"lineno": exception.lineno,
|
247
|
-
"text": exception.text.rstrip(),
|
248
|
-
"caret_indent": caret_indent,
|
249
|
-
"errname": type(exception).__name__,
|
250
|
-
"msg": exception.msg,
|
251
|
-
}
|
240
|
+
f'File "{exception.filename}", line {exception.lineno}\n'
|
241
|
+
f" {exception.text.rstrip()}\n"
|
242
|
+
f" {caret_indent}^\n"
|
243
|
+
f"{type(exception).__name__}: {exception.msg}"
|
252
244
|
)
|
253
245
|
# If a few edge cases, SyntaxErrors don't have all these nice fields. So we
|
254
246
|
# have a fall back here.
|
streamlit/elements/form.py
CHANGED
@@ -17,6 +17,14 @@ import textwrap
|
|
17
17
|
from typing import TYPE_CHECKING, Literal, cast
|
18
18
|
|
19
19
|
from streamlit.elements.lib.form_utils import FormData, current_form_id, is_in_form
|
20
|
+
from streamlit.elements.lib.layout_utils import (
|
21
|
+
Height,
|
22
|
+
Width,
|
23
|
+
get_height_config,
|
24
|
+
get_width_config,
|
25
|
+
validate_height,
|
26
|
+
validate_width,
|
27
|
+
)
|
20
28
|
from streamlit.elements.lib.policies import (
|
21
29
|
check_cache_replay_rules,
|
22
30
|
check_session_state_rules,
|
@@ -67,6 +75,8 @@ class FormMixin:
|
|
67
75
|
*,
|
68
76
|
enter_to_submit: bool = True,
|
69
77
|
border: bool = True,
|
78
|
+
width: Width = "stretch",
|
79
|
+
height: Height = "content",
|
70
80
|
) -> DeltaGenerator:
|
71
81
|
"""Create a form that batches elements together with a "Submit" button.
|
72
82
|
|
@@ -181,6 +191,10 @@ class FormMixin:
|
|
181
191
|
block_proto.form.clear_on_submit = clear_on_submit
|
182
192
|
block_proto.form.enter_to_submit = enter_to_submit
|
183
193
|
block_proto.form.border = border
|
194
|
+
validate_width(width, allow_content=True)
|
195
|
+
block_proto.width_config.CopyFrom(get_width_config(width))
|
196
|
+
validate_height(height, allow_content=True)
|
197
|
+
block_proto.height_config.CopyFrom(get_height_config(height))
|
184
198
|
block_dg = self.dg._block(block_proto)
|
185
199
|
|
186
200
|
# Attach the form's button info to the newly-created block's
|
streamlit/elements/heading.py
CHANGED
@@ -286,14 +286,13 @@ class HeadingMixin:
|
|
286
286
|
proto.anchor = anchor
|
287
287
|
elif anchor is True: # type: ignore
|
288
288
|
raise StreamlitAPIException(
|
289
|
-
"Anchor parameter has invalid value:
|
290
|
-
"Supported values: None, any string or False"
|
289
|
+
f"Anchor parameter has invalid value: {anchor}. "
|
290
|
+
"Supported values: None, any string or False"
|
291
291
|
)
|
292
292
|
else:
|
293
293
|
raise StreamlitAPIException(
|
294
|
-
"Anchor parameter has invalid type:
|
294
|
+
f"Anchor parameter has invalid type: {type(anchor).__name__}. "
|
295
295
|
"Supported values: None, any string or False"
|
296
|
-
% type(anchor).__name__
|
297
296
|
)
|
298
297
|
|
299
298
|
if help:
|
streamlit/elements/json.py
CHANGED
@@ -19,7 +19,11 @@ import types
|
|
19
19
|
from collections import ChainMap, UserDict
|
20
20
|
from typing import TYPE_CHECKING, Any, cast
|
21
21
|
|
22
|
-
from streamlit.elements.lib.layout_utils import
|
22
|
+
from streamlit.elements.lib.layout_utils import (
|
23
|
+
LayoutConfig,
|
24
|
+
WidthWithoutContent,
|
25
|
+
validate_width,
|
26
|
+
)
|
23
27
|
from streamlit.proto.Json_pb2 import Json as JsonProto
|
24
28
|
from streamlit.runtime.metrics_util import gather_metrics
|
25
29
|
from streamlit.type_util import (
|
@@ -139,12 +143,9 @@ class JsonMixin:
|
|
139
143
|
)
|
140
144
|
|
141
145
|
validate_width(width)
|
142
|
-
|
143
|
-
json_proto.width_config.pixel_width = width
|
144
|
-
else:
|
145
|
-
json_proto.width_config.use_stretch = True
|
146
|
+
layout_config = LayoutConfig(width=width)
|
146
147
|
|
147
|
-
return self.dg._enqueue("json", json_proto)
|
148
|
+
return self.dg._enqueue("json", json_proto, layout_config=layout_config)
|
148
149
|
|
149
150
|
@property
|
150
151
|
def dg(self) -> DeltaGenerator:
|
streamlit/elements/layouts.py
CHANGED
@@ -20,6 +20,11 @@ from typing import TYPE_CHECKING, Literal, Union, cast
|
|
20
20
|
from typing_extensions import TypeAlias
|
21
21
|
|
22
22
|
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
23
|
+
from streamlit.elements.lib.layout_utils import (
|
24
|
+
WidthWithoutContent,
|
25
|
+
get_width_config,
|
26
|
+
validate_width,
|
27
|
+
)
|
23
28
|
from streamlit.elements.lib.utils import Key, compute_and_register_element_id, to_key
|
24
29
|
from streamlit.errors import (
|
25
30
|
StreamlitAPIException,
|
@@ -160,7 +165,9 @@ class LayoutsMixin:
|
|
160
165
|
|
161
166
|
height_config = HeightConfig()
|
162
167
|
height_config.pixel_height = height
|
163
|
-
|
168
|
+
# Use block-level height_config instead of flex_container
|
169
|
+
block_proto.height_config.CopyFrom(height_config)
|
170
|
+
|
164
171
|
if border is None:
|
165
172
|
# If border is None, we activated the
|
166
173
|
# border as default setting for scrolling
|
@@ -398,7 +405,12 @@ class LayoutsMixin:
|
|
398
405
|
return [row._block(column_proto(w / total_weight)) for w in weights]
|
399
406
|
|
400
407
|
@gather_metrics("tabs")
|
401
|
-
def tabs(
|
408
|
+
def tabs(
|
409
|
+
self,
|
410
|
+
tabs: Sequence[str],
|
411
|
+
*,
|
412
|
+
width: WidthWithoutContent = "stretch",
|
413
|
+
) -> Sequence[DeltaGenerator]:
|
402
414
|
r"""Insert containers separated into tabs.
|
403
415
|
|
404
416
|
Inserts a number of multi-element containers as tabs.
|
@@ -499,6 +511,8 @@ class LayoutsMixin:
|
|
499
511
|
|
500
512
|
block_proto = BlockProto()
|
501
513
|
block_proto.tab_container.SetInParent()
|
514
|
+
validate_width(width)
|
515
|
+
block_proto.width_config.CopyFrom(get_width_config(width))
|
502
516
|
tab_container = self.dg._block(block_proto)
|
503
517
|
return tuple(tab_container._block(tab_proto(tab_label)) for tab_label in tabs)
|
504
518
|
|
@@ -509,6 +523,7 @@ class LayoutsMixin:
|
|
509
523
|
expanded: bool = False,
|
510
524
|
*,
|
511
525
|
icon: str | None = None,
|
526
|
+
width: WidthWithoutContent = "stretch",
|
512
527
|
) -> DeltaGenerator:
|
513
528
|
r"""Insert a multi-element container that can be expanded/collapsed.
|
514
529
|
|
@@ -611,6 +626,8 @@ class LayoutsMixin:
|
|
611
626
|
block_proto = BlockProto()
|
612
627
|
block_proto.allow_empty = False
|
613
628
|
block_proto.expandable.CopyFrom(expandable_proto)
|
629
|
+
validate_width(width)
|
630
|
+
block_proto.width_config.CopyFrom(get_width_config(width))
|
614
631
|
|
615
632
|
return self.dg._block(block_proto=block_proto)
|
616
633
|
|
@@ -761,6 +778,7 @@ class LayoutsMixin:
|
|
761
778
|
*,
|
762
779
|
expanded: bool = False,
|
763
780
|
state: Literal["running", "complete", "error"] = "running",
|
781
|
+
width: WidthWithoutContent = "stretch",
|
764
782
|
) -> StatusContainer:
|
765
783
|
r"""Insert a status container to display output from long-running tasks.
|
766
784
|
|
@@ -863,7 +881,7 @@ class LayoutsMixin:
|
|
863
881
|
|
864
882
|
"""
|
865
883
|
return get_dg_singleton_instance().status_container_cls._create(
|
866
|
-
self.dg, label, expanded=expanded, state=state
|
884
|
+
self.dg, label, expanded=expanded, state=state, width=width
|
867
885
|
)
|
868
886
|
|
869
887
|
def _dialog(
|
@@ -160,8 +160,7 @@ def _verify_np_shape(array: npt.NDArray[Any]) -> npt.NDArray[Any]:
|
|
160
160
|
raise StreamlitAPIException("Numpy shape has to be of length 2 or 3.")
|
161
161
|
if len(shape) == 3 and shape[-1] not in (1, 3, 4):
|
162
162
|
raise StreamlitAPIException(
|
163
|
-
"Channel can only be 1, 3, or 4 got
|
164
|
-
% (shape[-1], str(shape))
|
163
|
+
f"Channel can only be 1, 3, or 4 got {shape[-1]}. Shape is {shape}"
|
165
164
|
)
|
166
165
|
|
167
166
|
# If there's only one channel, convert is to x, y
|
@@ -437,7 +436,7 @@ def marshall_images(
|
|
437
436
|
|
438
437
|
# We use the index of the image in the input image list to identify this image inside
|
439
438
|
# MediaFileManager. For this, we just add the index to the image's "coordinates".
|
440
|
-
image_id = "
|
439
|
+
image_id = f"{coordinates}-{coord_suffix}"
|
441
440
|
|
442
441
|
proto_img.url = image_to_url(
|
443
442
|
single_image, width, clamp, channels, output_format, image_id
|
@@ -19,6 +19,8 @@ from typing import Literal, Union
|
|
19
19
|
from typing_extensions import TypeAlias
|
20
20
|
|
21
21
|
from streamlit.errors import StreamlitInvalidHeightError, StreamlitInvalidWidthError
|
22
|
+
from streamlit.proto.HeightConfig_pb2 import HeightConfig
|
23
|
+
from streamlit.proto.WidthConfig_pb2 import WidthConfig
|
22
24
|
|
23
25
|
WidthWithoutContent: TypeAlias = Union[int, Literal["stretch"]]
|
24
26
|
Width: TypeAlias = Union[int, Literal["stretch", "content"]]
|
@@ -89,3 +91,25 @@ def validate_height(height: Height, allow_content: bool = False) -> None:
|
|
89
91
|
|
90
92
|
elif height <= 0:
|
91
93
|
raise StreamlitInvalidHeightError(height, allow_content)
|
94
|
+
|
95
|
+
|
96
|
+
def get_width_config(width: Width) -> WidthConfig:
|
97
|
+
width_config = WidthConfig()
|
98
|
+
if isinstance(width, int):
|
99
|
+
width_config.pixel_width = width
|
100
|
+
elif width == "content":
|
101
|
+
width_config.use_content = True
|
102
|
+
else:
|
103
|
+
width_config.use_stretch = True
|
104
|
+
return width_config
|
105
|
+
|
106
|
+
|
107
|
+
def get_height_config(height: Height) -> HeightConfig:
|
108
|
+
height_config = HeightConfig()
|
109
|
+
if isinstance(height, int):
|
110
|
+
height_config.pixel_height = height
|
111
|
+
elif height == "content":
|
112
|
+
height_config.use_content = True
|
113
|
+
else:
|
114
|
+
height_config.use_stretch = True
|
115
|
+
return height_config
|
@@ -20,6 +20,11 @@ from typing import TYPE_CHECKING, Literal, cast
|
|
20
20
|
from typing_extensions import Self, TypeAlias
|
21
21
|
|
22
22
|
from streamlit.delta_generator import DeltaGenerator
|
23
|
+
from streamlit.elements.lib.layout_utils import (
|
24
|
+
WidthWithoutContent,
|
25
|
+
get_width_config,
|
26
|
+
validate_width,
|
27
|
+
)
|
23
28
|
from streamlit.errors import StreamlitAPIException
|
24
29
|
from streamlit.proto.Block_pb2 import Block as BlockProto
|
25
30
|
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
|
@@ -40,6 +45,7 @@ class StatusContainer(DeltaGenerator):
|
|
40
45
|
label: str,
|
41
46
|
expanded: bool = False,
|
42
47
|
state: States = "running",
|
48
|
+
width: WidthWithoutContent = "stretch",
|
43
49
|
) -> StatusContainer:
|
44
50
|
expandable_proto = BlockProto.Expandable()
|
45
51
|
expandable_proto.expanded = expanded
|
@@ -60,6 +66,9 @@ class StatusContainer(DeltaGenerator):
|
|
60
66
|
block_proto.allow_empty = True
|
61
67
|
block_proto.expandable.CopyFrom(expandable_proto)
|
62
68
|
|
69
|
+
validate_width(width=width)
|
70
|
+
block_proto.width_config.CopyFrom(get_width_config(width))
|
71
|
+
|
63
72
|
delta_path: list[int] = (
|
64
73
|
parent._active_dg._cursor.delta_path if parent._active_dg._cursor else []
|
65
74
|
)
|