streamlit-nightly 1.42.3.dev20250226__py2.py3-none-any.whl → 1.42.3.dev20250228__py2.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 (101) hide show
  1. streamlit/commands/navigation.py +16 -4
  2. streamlit/commands/page_config.py +1 -2
  3. streamlit/elements/arrow.py +6 -5
  4. streamlit/elements/lib/column_types.py +101 -70
  5. streamlit/elements/widgets/button.py +18 -9
  6. streamlit/elements/widgets/chat.py +2 -1
  7. streamlit/elements/widgets/data_editor.py +6 -5
  8. streamlit/elements/widgets/number_input.py +3 -2
  9. streamlit/elements/widgets/slider.py +11 -3
  10. streamlit/errors.py +11 -9
  11. streamlit/navigation/page.py +2 -10
  12. streamlit/proto/ChatInput_pb2.py +6 -6
  13. streamlit/proto/ChatInput_pb2.pyi +5 -1
  14. streamlit/proto/ForwardMsg_pb2.py +12 -10
  15. streamlit/proto/PagesChanged_pb2.pyi +3 -1
  16. streamlit/runtime/app_session.py +1 -13
  17. streamlit/runtime/context.py +47 -2
  18. streamlit/runtime/pages_manager.py +61 -232
  19. streamlit/runtime/scriptrunner/script_runner.py +49 -2
  20. streamlit/runtime/scriptrunner_utils/script_run_context.py +1 -1
  21. streamlit/source_util.py +4 -90
  22. streamlit/static/index.html +1 -1
  23. streamlit/static/static/js/{FileDownload.esm.CWn5B5ZN.js → FileDownload.esm.BjRCwIvW.js} +1 -1
  24. streamlit/static/static/js/FileHelper.CGrcmoNK.js +5 -0
  25. streamlit/static/static/js/{FormClearHelper.BlCIuWCo.js → FormClearHelper.CyjIZnZM.js} +1 -1
  26. streamlit/static/static/js/{Hooks.DURid8_V.js → Hooks.-DbiQ7Am.js} +1 -1
  27. streamlit/static/static/js/{InputInstructions.gFFpIc6i.js → InputInstructions.CV_L9pmm.js} +1 -1
  28. streamlit/static/static/js/{ProgressBar.CtXtbXhv.js → ProgressBar.BMUfDSdU.js} +1 -1
  29. streamlit/static/static/js/{RenderInPortalIfExists.DKWNQmbm.js → RenderInPortalIfExists.DBak2tzf.js} +1 -1
  30. streamlit/static/static/js/{Toolbar.CKKwksQV.js → Toolbar.BpCHhFl7.js} +1 -1
  31. streamlit/static/static/js/{base-input.BUY9TLqO.js → base-input.B4K7gn3m.js} +1 -1
  32. streamlit/static/static/js/{checkbox.C4L_5Z9H.js → checkbox.CAX7YHDZ.js} +1 -1
  33. streamlit/static/static/js/{createSuper.DprEKsA6.js → createSuper.D9gT0sOi.js} +1 -1
  34. streamlit/static/static/js/{data-grid-overlay-editor.BArvtwSg.js → data-grid-overlay-editor.gLdGVwGm.js} +1 -1
  35. streamlit/static/static/js/{downloader.C5pxkE2v.js → downloader.DcsU6eyn.js} +1 -1
  36. streamlit/static/static/js/{es6.DmKjMqyQ.js → es6.dTL0Du7U.js} +2 -2
  37. streamlit/static/static/js/{iframeResizer.contentWindow.DhqbXIl1.js → iframeResizer.contentWindow.flH1YmDM.js} +1 -1
  38. streamlit/static/static/js/{index.D2-IYCcZ.js → index.-WtL21xT.js} +1 -1
  39. streamlit/static/static/js/{index.B-S4HX7x.js → index.B0VH6CCN.js} +1 -1
  40. streamlit/static/static/js/{index.xTncca7J.js → index.B6RoN18x.js} +1 -1
  41. streamlit/static/static/js/index.B7TcBuqC.js +1 -0
  42. streamlit/static/static/js/{index.B-vrwvgD.js → index.BCg2ff_8.js} +2 -2
  43. streamlit/static/static/js/{index.CvNhwseQ.js → index.BFxZ-0WR.js} +1 -1
  44. streamlit/static/static/js/{index.Cd03IYkG.js → index.BJIOzTyr.js} +1 -1
  45. streamlit/static/static/js/{index.DNr2W0gq.js → index.BMUI3dle.js} +1 -1
  46. streamlit/static/static/js/{index.KPwXWqBk.js → index.BUNYdCvS.js} +146 -146
  47. streamlit/static/static/js/{index.Bk3A478D.js → index.BV2qQuMO.js} +6 -6
  48. streamlit/static/static/js/{index.D2G24Udm.js → index.BX8IgiDA.js} +1 -1
  49. streamlit/static/static/js/{index.WAlW9lgW.js → index.BYdIAAme.js} +1 -1
  50. streamlit/static/static/js/{index.RFfgDsnM.js → index.BzXJd4o6.js} +1 -1
  51. streamlit/static/static/js/index.BzxT1LSG.js +1 -0
  52. streamlit/static/static/js/{index.NKOzzX__.js → index.CHfW08Eb.js} +1 -1
  53. streamlit/static/static/js/{index.c_V1HXTs.js → index.CWFsehBI.js} +1 -1
  54. streamlit/static/static/js/index.C_m4U-ik.js +201 -0
  55. streamlit/static/static/js/index.CgbCWpVz.js +4537 -0
  56. streamlit/static/static/js/{index.O5-Wn4Yr.js → index.ChXmN16b.js} +1 -1
  57. streamlit/static/static/js/{index.BUnWa5Cg.js → index.D-_iawK3.js} +1 -1
  58. streamlit/static/static/js/{index.BVHfAEko.js → index.D7qPBPzh.js} +1 -1
  59. streamlit/static/static/js/{index.BSczaRDm.js → index.D9Gtya_A.js} +1 -1
  60. streamlit/static/static/js/{index.oPGa5nFU.js → index.D9jWe5tN.js} +1 -1
  61. streamlit/static/static/js/{index.Bds7Anva.js → index.DB-0Yu8-.js} +1 -1
  62. streamlit/static/static/js/{index.CoQjULdH.js → index.DGu65w1V.js} +3 -3
  63. streamlit/static/static/js/index.DIHkG0HG.js +12 -0
  64. streamlit/static/static/js/{index.UE_L1IEZ.js → index.DIgKi8Bp.js} +1 -1
  65. streamlit/static/static/js/{index.BoBCblDb.js → index.DbiiV9to.js} +1 -1
  66. streamlit/static/static/js/{index.EIkP6R_d.js → index.DgSb0EiE.js} +1 -1
  67. streamlit/static/static/js/{index.RrEbViHi.js → index.DkoFwjhv.js} +1 -1
  68. streamlit/static/static/js/{index.doRPQ8od.js → index.DwAnNzqz.js} +1 -1
  69. streamlit/static/static/js/{index.ChEJa75P.js → index.PrjikacM.js} +1 -1
  70. streamlit/static/static/js/{index.BmnSGdtS.js → index.QEh4WZkI.js} +1 -1
  71. streamlit/static/static/js/{index.CXpOPWFV.js → index.iqovFu7V.js} +1 -1
  72. streamlit/static/static/js/{index.C3l2zbST.js → index.mRpR0u1n.js} +1 -1
  73. streamlit/static/static/js/{index.BEnZZwfW.js → index.u-XgtJxJ.js} +3 -3
  74. streamlit/static/static/js/{index.DtIKjlNZ.js → index.y-qJHV46.js} +1 -1
  75. streamlit/static/static/js/{input.EkJ_AsTP.js → input.DqgaXn2o.js} +1 -1
  76. streamlit/static/static/js/{memory.BFs17dZE.js → memory.DszNDPLb.js} +1 -1
  77. streamlit/static/static/js/{mergeWith.B4u0whL-.js → mergeWith.DFTSkXIf.js} +1 -1
  78. streamlit/static/static/js/{number-overlay-editor.DwazN43x.js → number-overlay-editor.C8_ha9YJ.js} +1 -1
  79. streamlit/static/static/js/{possibleConstructorReturn.CZfYLVBb.js → possibleConstructorReturn.cS4Ei6et.js} +1 -1
  80. streamlit/static/static/js/{sandbox.PjijA1v1.js → sandbox.Bj-BfqPP.js} +1 -1
  81. streamlit/static/static/js/{textarea.BGGnQXtw.js → textarea.BrvMyGxB.js} +1 -1
  82. streamlit/static/static/js/{timepicker.eLEnk1tw.js → timepicker.Ds8_GzH8.js} +2 -2
  83. streamlit/static/static/js/{toConsumableArray.CgKj9NUY.js → toConsumableArray.RfoD5uEy.js} +1 -1
  84. streamlit/static/static/js/{uniqueId.CPmOGhdZ.js → uniqueId.R_vr2E5T.js} +1 -1
  85. streamlit/static/static/js/{useBasicWidgetState.Bw_fxTtX.js → useBasicWidgetState.Cglgg1W1.js} +1 -1
  86. streamlit/static/static/js/{useOnInputChange.D8qi7pm4.js → useOnInputChange.CFTHBDsA.js} +1 -1
  87. streamlit/static/static/js/{withFullScreenWrapper.BjVufR9b.js → withFullScreenWrapper.BcyXoen-.js} +1 -1
  88. streamlit/testing/v1/app_test.py +8 -10
  89. streamlit/user_info.py +3 -0
  90. {streamlit_nightly-1.42.3.dev20250226.dist-info → streamlit_nightly-1.42.3.dev20250228.dist-info}/METADATA +1 -1
  91. {streamlit_nightly-1.42.3.dev20250226.dist-info → streamlit_nightly-1.42.3.dev20250228.dist-info}/RECORD +95 -95
  92. streamlit/static/static/js/FileHelper.Bii_mi1A.js +0 -5
  93. streamlit/static/static/js/index.BAfr2RC0.js +0 -3865
  94. streamlit/static/static/js/index.BCErGZwr.js +0 -1
  95. streamlit/static/static/js/index.CTqvpoOz.js +0 -12
  96. streamlit/static/static/js/index.DhcYAj3f.js +0 -1
  97. streamlit/static/static/js/index.u1gL_Cm_.js +0 -201
  98. {streamlit_nightly-1.42.3.dev20250226.data → streamlit_nightly-1.42.3.dev20250228.data}/scripts/streamlit.cmd +0 -0
  99. {streamlit_nightly-1.42.3.dev20250226.dist-info → streamlit_nightly-1.42.3.dev20250228.dist-info}/WHEEL +0 -0
  100. {streamlit_nightly-1.42.3.dev20250226.dist-info → streamlit_nightly-1.42.3.dev20250228.dist-info}/entry_points.txt +0 -0
  101. {streamlit_nightly-1.42.3.dev20250226.dist-info → streamlit_nightly-1.42.3.dev20250228.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,7 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  from pathlib import Path
18
- from typing import TYPE_CHECKING, Callable, Literal
18
+ from typing import TYPE_CHECKING, Callable, Literal, Union
19
19
 
20
20
  from typing_extensions import TypeAlias
21
21
 
@@ -25,6 +25,7 @@ from streamlit.navigation.page import StreamlitPage
25
25
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
26
26
  from streamlit.proto.Navigation_pb2 import Navigation as NavigationProto
27
27
  from streamlit.runtime.metrics_util import gather_metrics
28
+ from streamlit.runtime.pages_manager import PagesManager
28
29
  from streamlit.runtime.scriptrunner_utils.script_run_context import (
29
30
  ScriptRunContext,
30
31
  get_script_run_ctx,
@@ -34,6 +35,7 @@ if TYPE_CHECKING:
34
35
  from streamlit.source_util import PageHash, PageInfo
35
36
 
36
37
  SectionHeader: TypeAlias = str
38
+ PageType: TypeAlias = Union[str, Path, Callable[[], None], StreamlitPage]
37
39
 
38
40
 
39
41
  def convert_to_streamlit_page(
@@ -78,8 +80,7 @@ def send_page_not_found(ctx: ScriptRunContext):
78
80
 
79
81
  @gather_metrics("navigation")
80
82
  def navigation(
81
- pages: list[str | Path | Callable[[], None] | StreamlitPage]
82
- | dict[SectionHeader, list[str | Path | Callable[[], None] | StreamlitPage]],
83
+ pages: list[PageType] | dict[SectionHeader, list[PageType]],
83
84
  *,
84
85
  position: Literal["sidebar", "hidden"] = "sidebar",
85
86
  expanded: bool = False,
@@ -214,6 +215,18 @@ def navigation(
214
215
  - The first page is automatically set as default if none specified
215
216
  - Common widgets should be defined in the entrypoint file for state sharing
216
217
  """
218
+ # Disable the use of the pages feature (ie disregard v1 behavior of Multipage Apps)
219
+ PagesManager.uses_pages_directory = False
220
+
221
+ return _navigation(pages, position=position, expanded=expanded)
222
+
223
+
224
+ def _navigation(
225
+ pages: list[PageType] | dict[SectionHeader, list[PageType]],
226
+ *,
227
+ position: Literal["sidebar", "hidden"],
228
+ expanded: bool,
229
+ ) -> StreamlitPage:
217
230
  if isinstance(pages, list):
218
231
  converted_pages = [convert_to_streamlit_page(p) for p in pages]
219
232
  nav_sections = {"": converted_pages}
@@ -222,7 +235,6 @@ def navigation(
222
235
  section: [convert_to_streamlit_page(p) for p in section_pages]
223
236
  for section, section_pages in pages.items()
224
237
  }
225
-
226
238
  page_list = pages_from_nav_sections(nav_sections)
227
239
 
228
240
  if not page_list:
@@ -165,8 +165,7 @@ def set_page_config(
165
165
  https://share.streamlit.io/streamlit/emoji-shortcodes.
166
166
 
167
167
  - The string literal, ``"random"``. You can set ``page_icon="random"``
168
- to set a random emoji from the supported list above. Emoji icons are
169
- courtesy of Twemoji and loaded from MaxCDN.
168
+ to set a random emoji from the supported list above.
170
169
 
171
170
  - An icon from the Material Symbols library (rounded style) in the
172
171
  format ``":material/icon_name:"`` where "icon_name" is the name
@@ -331,10 +331,10 @@ class ArrowMixin:
331
331
 
332
332
  use_container_width : bool
333
333
  Whether to override ``width`` with the width of the parent
334
- container. If ``use_container_width`` is ``False``, Streamlit
335
- sets the dataframe's width according to ``width``. If
336
- ``use_container_width`` is ``True`` (default), Streamlit sets the
337
- width of the dataframe to match the width of the parent container.
334
+ container. If this is ``True`` (default), Streamlit sets the width
335
+ of the dataframe to match the width of the parent container. If
336
+ this is ``False``, Streamlit sets the dataframe's width according
337
+ to ``width``.
338
338
 
339
339
  hide_index : bool or None
340
340
  Whether to hide the index column(s). If ``hide_index`` is ``None``
@@ -421,7 +421,8 @@ class ArrowMixin:
421
421
 
422
422
  row_height : int or None
423
423
  The height of each row in the dataframe in pixels. If ``row_height``
424
- is ``None`` (default), Streamlit will use a default row height.
424
+ is ``None`` (default), Streamlit will use a default row height,
425
+ which fits one line of text.
425
426
 
426
427
  Returns
427
428
  -------
@@ -419,25 +419,28 @@ def NumberColumn(
419
419
 
420
420
  format: str, "plain", "localized", "percent", "dollar", "euro", "accounting", "compact", "scientific", "engineering", or None
421
421
  A format string controlling how numbers are displayed.
422
- Can be one of the following:
423
-
424
- - ``"plain"``: Shows the full number without any formatting (1234.567)
425
- - ``"localized"``: Shows the number in the default locale format (1,234.567)
426
- - ``"percent"``: Shows the number as a percentage (123456.70%)
427
- - ``"dollar"``: Shows the number as a dollar amount ($1,234.57)
428
- - ``"euro"``: Shows the number as a euro amount (1,234.57)
429
- - ``"accounting"``: Shows the number in an accounting format (1,234.00)
430
- - ``"compact"``: Shows the number in a compact format (1.2K)
431
- - ``"scientific"``: Shows the number in a scientific notation (1.235E3)
432
- - ``"engineering"``: Shows the number in an engineering notation (1.235E3)
433
- - printf-style format string: The following formatters are valid:
434
- ``%d``, ``%e``, ``%f``, ``%g``, ``%i``, ``%u``. You can also add
435
- prefixes and suffixes, e.g. ``"$ %.2f"`` to show a dollar prefix.
436
- - ``None`` (default): the numbers are formatted via a default formatter.
422
+ This can be one of the following values:
423
+
424
+ - ``None`` (default): Streamlit infers the formatting from the data.
425
+ - ``"plain"``: Show the full number without any formatting (e.g. "1234.567").
426
+ - ``"localized"``: Show the number in the default locale format (e.g. "1,234.567").
427
+ - ``"percent"``: Show the number as a percentage (e.g. "123456.70%").
428
+ - ``"dollar"``: Show the number as a dollar amount (e.g. "$1,234.57").
429
+ - ``"euro"``: Show the number as a euro amount (e.g. "€1,234.57").
430
+ - ``"accounting"``: Show the number in an accounting format (e.g. "1,234.00").
431
+ - ``"compact"``: Show the number in a compact format (e.g. "1.2K").
432
+ - ``"scientific"``: Show the number in scientific notation (e.g. "1.235E3").
433
+ - ``"engineering"``: Show the number in engineering notation (e.g. "1.235E3").
434
+ - printf-style format string: Format the number with a printf
435
+ specifier, like ``"%d"`` to show a signed integer (e.g. "1234") or
436
+ ``"%X"`` to show an unsigned hexidecimal integer (e.g. "4D2"). You
437
+ can also add prefixes and suffixes. To show British pounds, use
438
+ ``"£ %.2f"`` (e.g. "£ 1234.57"). For more information, see `sprint-js
439
+ <https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
437
440
 
438
- Number formatting from ``column_config`` always takes precedence over
439
- number formatting from ``pandas.Styler``. The number formatting does
440
- not impact the return value when used in ``st.data_editor``.
441
+ Formatting from ``column_config`` always takes precedence over
442
+ formatting from ``pandas.Styler``. The formatting does not impact the
443
+ return value when used in ``st.data_editor``.
441
444
 
442
445
  min_value: int, float, or None
443
446
  The minimum value that can be entered. If this is ``None`` (default),
@@ -1571,18 +1574,25 @@ def DatetimeColumn(
1571
1574
 
1572
1575
  format: str, "localized", "distance", "calendar", "iso8601", or None
1573
1576
  A format string controlling how datetimes are displayed.
1574
- Can be one of the following:
1575
-
1576
- - ``"localized"``: Shows the datetime in the default locale format.
1577
- - ``"distance"``: Shows the datetime in a relative format.
1578
- - ``"calendar"``: Shows the datetime in a calendar format.
1579
- - ``"iso8601"``: Shows the datetime in ISO 8601 format.
1580
- - A momentJS format string: See `momentJS docs <https://momentjs.com/docs/#/displaying/format/>`_
1581
- for available formats.
1582
- - ``None`` (default): uses ``YYYY-MM-DD HH:mm:ss`` as format.
1577
+ This can be one of the following values:
1578
+
1579
+ - ``None`` (default): Show the datetime in ``"YYYY-MM-DD HH:mm:ss"``
1580
+ format (e.g. "2025-03-04 20:00:00").
1581
+ - ``"localized"``: Show the datetime in the default locale format (e.g.
1582
+ "Mar 4, 2025, 12:00:00 PM" in the America/Los_Angeles timezone).
1583
+ - ``"distance"``: Show the datetime in a relative format (e.g.
1584
+ "a few seconds ago").
1585
+ - ``"calendar"``: Show the datetime in a calendar format (e.g.
1586
+ "Today at 8:00 PM").
1587
+ - ``"iso8601"``: Show the datetime in ISO 8601 format (e.g.
1588
+ "2025-03-04T20:00:00.000Z").
1589
+ - A momentJS format string: Format the datetime with a string, like
1590
+ ``"ddd ha"`` to show "Tue 8pm". For available formats, see
1591
+ `momentJS <https://momentjs.com/docs/#/displaying/format/>`_.
1583
1592
 
1584
1593
  Formatting from ``column_config`` always takes precedence over
1585
- datetime formatting from ``pandas.Styler``.
1594
+ formatting from ``pandas.Styler``. The formatting does not impact the
1595
+ return value when used in ``st.data_editor``.
1586
1596
 
1587
1597
  min_value: datetime.datetime or None
1588
1598
  The minimum datetime that can be entered. If this is ``None``
@@ -1728,15 +1738,21 @@ def TimeColumn(
1728
1738
 
1729
1739
  format: str, "localized", "iso8601", or None
1730
1740
  A format string controlling how times are displayed.
1731
- Can be one of the following:
1732
- - ``"localized"``: Shows the time in the default locale format.
1733
- - ``"iso8601"``: Shows the time in ISO 8601 format.
1734
- - A momentJS format string: See `momentJS docs <https://momentjs.com/docs/#/displaying/format/>`_
1735
- for available formats.
1736
- - ``None`` (default): uses ``HH:mm:ss`` as format.
1741
+ This can be one of the following values:
1742
+
1743
+ - ``None`` (default): Show the time in ``"HH:mm:ss"`` format (e.g.
1744
+ "20:00:00").
1745
+ - ``"localized"``: Show the time in the default locale format (e.g.
1746
+ "12:00:00 PM" in the America/Los_Angeles timezone).
1747
+ - ``"iso8601"``: Show the time in ISO 8601 format (e.g.
1748
+ "20:00:00.000Z").
1749
+ - A momentJS format string: Format the time with a string, like
1750
+ ``"ha"`` to show "8pm". For available formats, see
1751
+ `momentJS <https://momentjs.com/docs/#/displaying/format/>`_.
1737
1752
 
1738
- Time formatting from ``column_config`` always takes precedence over
1739
- time formatting from ``pandas.Styler``.
1753
+ Formatting from ``column_config`` always takes precedence over
1754
+ formatting from ``pandas.Styler``. The formatting does not impact the
1755
+ return value when used in ``st.data_editor``.
1740
1756
 
1741
1757
  min_value: datetime.time or None
1742
1758
  The minimum time that can be entered. If this is ``None`` (default),
@@ -1876,17 +1892,24 @@ def DateColumn(
1876
1892
  the user. This defaults to ``None``.
1877
1893
 
1878
1894
  format: str, "localized", "distance", "iso8601", or None
1879
- A format string controlling how the dates are displayed.
1880
- Can be one of the following:
1881
- - ``"localized"``: Shows the date in the default locale format.
1882
- - ``"distance"``: Shows the date in a relative format (e.g. "1 day ago").
1883
- - ``"iso8601"``: Shows the date in ISO 8601 format.
1884
- - A momentJS format string: See `momentJS docs <https://momentjs.com/docs/#/displaying/format/>`_
1885
- for available formats.
1886
- - ``None`` (default): uses ``YYYY-MM-DD`` as format.
1887
-
1888
- Date formatting from ``column_config`` always takes precedence over
1889
- date formatting from ``pandas.Styler``.
1895
+ A format string controlling how dates are displayed.
1896
+ This can be one of the following values:
1897
+
1898
+ - ``None`` (default): Show the date in ``"YYYY-MM-DD"`` format (e.g.
1899
+ "2025-03-04").
1900
+ - ``"localized"``: Show the date in the default locale format (e.g.
1901
+ "Mar 4, 2025" in the America/Los_Angeles timezone).
1902
+ - ``"distance"``: Show the date in a relative format (e.g.
1903
+ "a few seconds ago").
1904
+ - ``"iso8601"``: Show the date in ISO 8601 format (e.g.
1905
+ "2025-03-04").
1906
+ - A momentJS format string: Format the date with a string, like
1907
+ ``"ddd, MMM Do"`` to show "Tue, Mar 4th". For available formats, see
1908
+ `momentJS <https://momentjs.com/docs/#/displaying/format/>`_.
1909
+
1910
+ Formatting from ``column_config`` always takes precedence over
1911
+ formatting from ``pandas.Styler``. The formatting does not impact the
1912
+ return value when used in ``st.data_editor``.
1890
1913
 
1891
1914
  min_value: datetime.date or None
1892
1915
  The minimum date that can be entered. If this is ``None`` (default),
@@ -1996,25 +2019,29 @@ def ProgressColumn(
1996
2019
  ``st.markdown``.
1997
2020
 
1998
2021
  format: str, "plain", "localized", "percent", "dollar", "euro", "accounting", "compact", "scientific", "engineering", or None
1999
- A format string controlling how numbers are displayed.
2000
- Can be one of the following:
2001
-
2002
- - ``"plain"``: Shows the full number without any formatting (1234.567)
2003
- - ``"localized"``: Shows the number in the default locale format (1,234.567)
2004
- - ``"percent"``: Shows the number as a percentage (123456.70%)
2005
- - ``"dollar"``: Shows the number as a dollar amount ($1,234.57)
2006
- - ``"euro"``: Shows the number as a euro amount (1,234.57)
2007
- - ``"accounting"``: Shows the number in an accounting format (1,234.00)
2008
- - ``"compact"``: Shows the number in a compact format (1.2K)
2009
- - ``"scientific"``: Shows the number in a scientific notation (1.235E3)
2010
- - ``"engineering"``: Shows the number in an engineering notation (1.235E3)
2011
- - printf-style format string: The following formatters are valid:
2012
- ``%d``, ``%e``, ``%f``, ``%g``, ``%i``, ``%u``. You can also add
2013
- prefixes and suffixes, e.g. ``"$ %.2f"`` to show a dollar prefix.
2014
- - ``None`` (default): the numbers are formatted via a default formatter.
2015
-
2016
- The number formatting does not impact the return value when used in
2017
- ``st.data_editor``.
2022
+ A format string controlling how the numbers are displayed.
2023
+ This can be one of the following values:
2024
+
2025
+ - ``None`` (default): Streamlit infers the formatting from the data.
2026
+ - ``"plain"``: Show the full number without any formatting (e.g. "1234.567").
2027
+ - ``"localized"``: Show the number in the default locale format (e.g. "1,234.567").
2028
+ - ``"percent"``: Show the number as a percentage (e.g. "123456.70%").
2029
+ - ``"dollar"``: Show the number as a dollar amount (e.g. "$1,234.57").
2030
+ - ``"euro"``: Show the number as a euro amount (e.g. "€1,234.57").
2031
+ - ``"accounting"``: Show the number in an accounting format (e.g. "1,234.00").
2032
+ - ``"compact"``: Show the number in a compact format (e.g. "1.2K").
2033
+ - ``"scientific"``: Show the number in scientific notation (e.g. "1.235E3").
2034
+ - ``"engineering"``: Show the number in engineering notation (e.g. "1.235E3").
2035
+ - printf-style format string: Format the number with a printf
2036
+ specifier, like ``"%d"`` to show a signed integer (e.g. "1234") or
2037
+ ``"%X"`` to show an unsigned hexidecimal integer (e.g. "4D2"). You
2038
+ can also add prefixes and suffixes. To show British pounds, use
2039
+ ``"£ %.2f"`` (e.g. 1234.57"). For more information, see `sprint-js
2040
+ <https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
2041
+
2042
+ Number formatting from ``column_config`` always takes precedence over
2043
+ number formatting from ``pandas.Styler``. The number formatting does
2044
+ not impact the return value when used in ``st.data_editor``.
2018
2045
 
2019
2046
  pinned: bool or None
2020
2047
  Whether the column is pinned. A pinned column will stay visible on the
@@ -2085,8 +2112,8 @@ def JsonColumn(
2085
2112
  ) -> ColumnConfig:
2086
2113
  """Configure a JSON column in ``st.dataframe`` or ``st.data_editor``.
2087
2114
 
2088
- Cells need to contain a JSON string or JSON-compatible objects.
2089
- JSON columns are not editable at the moment. This command needs to be used in the
2115
+ Cells need to contain JSON strings or JSON-compatible objects. JSON columns
2116
+ are not editable at the moment. This command needs to be used in the
2090
2117
  ``column_config`` parameter of ``st.dataframe`` or ``st.data_editor``.
2091
2118
 
2092
2119
  Parameters
@@ -2106,8 +2133,12 @@ def JsonColumn(
2106
2133
  - ``"large"``: 400px wide
2107
2134
 
2108
2135
  help: str or None
2109
- An optional tooltip that gets displayed when hovering over the column
2110
- label. If this is ``None`` (default), no tooltip is displayed.
2136
+ A tooltip that gets displayed when hovering over the column label. If
2137
+ this is ``None`` (default), no tooltip is displayed.
2138
+
2139
+ The tooltip can optionally contain GitHub-flavored Markdown, including
2140
+ the Markdown directives described in the ``body`` parameter of
2141
+ ``st.markdown``.
2111
2142
 
2112
2143
  pinned: bool or None
2113
2144
  Whether the column is pinned. A pinned column will stay visible on the
@@ -52,6 +52,7 @@ from streamlit.proto.DownloadButton_pb2 import DownloadButton as DownloadButtonP
52
52
  from streamlit.proto.LinkButton_pb2 import LinkButton as LinkButtonProto
53
53
  from streamlit.proto.PageLink_pb2 import PageLink as PageLinkProto
54
54
  from streamlit.runtime.metrics_util import gather_metrics
55
+ from streamlit.runtime.pages_manager import PagesManager
55
56
  from streamlit.runtime.scriptrunner import ScriptRunContext, get_script_run_ctx
56
57
  from streamlit.runtime.state import (
57
58
  WidgetArgs,
@@ -334,8 +335,19 @@ class ButtonMixin:
334
335
  including the Markdown directives described in the ``body``
335
336
  parameter of ``st.markdown``.
336
337
 
337
- on_click : callable
338
- An optional callback invoked when this button is clicked.
338
+ on_click : callable, "rerun", "ignore", or None
339
+ How the button should respond to user interaction. This controls
340
+ whether or not the button triggers a rerun and if a callback
341
+ function is called. This can be one of the following values:
342
+
343
+ - ``"rerun"`` (default): The user downloads the file and the app
344
+ reruns. No callback function is called.
345
+ - ``"ignore"``: The user downloads the file and the app doesn't
346
+ rerun. No callback function is called.
347
+ - A ``callable``: The user downloads the file and app reruns. The
348
+ callable is called before the rest of the app.
349
+ - ``None``: This is same as ``on_click="rerun"``. This value exists
350
+ for backwards compatibility and shouldn't be used.
339
351
 
340
352
  args : tuple
341
353
  An optional tuple of args to pass to the callback.
@@ -883,22 +895,19 @@ class ButtonMixin:
883
895
  for page_data in all_app_pages.values():
884
896
  full_path = page_data["script_path"]
885
897
  page_name = page_data["page_name"]
898
+ url_pathname = page_data["url_pathname"]
886
899
  if requested_page == full_path:
887
900
  if label is None:
888
- page_link_proto.label = page_name.replace("_", " ")
901
+ page_link_proto.label = page_name
889
902
  page_link_proto.page_script_hash = page_data["page_script_hash"]
890
- page_link_proto.page = page_name
903
+ page_link_proto.page = url_pathname
891
904
  break
892
905
 
893
906
  if page_link_proto.page_script_hash == "":
894
- is_mpa_v2 = (
895
- ctx.pages_manager is not None and ctx.pages_manager.mpa_version == 2
896
- )
897
-
898
907
  raise StreamlitPageNotFoundError(
899
- is_mpa_v2=is_mpa_v2,
900
908
  page=page,
901
909
  main_script_directory=main_script_directory,
910
+ uses_pages_directory=bool(PagesManager.uses_pages_directory),
902
911
  )
903
912
 
904
913
  return self.dg._enqueue("page_link", page_link_proto)
@@ -25,7 +25,7 @@ from typing import (
25
25
  overload,
26
26
  )
27
27
 
28
- from streamlit import runtime
28
+ from streamlit import config, runtime
29
29
  from streamlit.delta_generator_singletons import get_dg_singleton_instance
30
30
  from streamlit.elements.lib.file_uploader_utils import normalize_upload_file_type
31
31
  from streamlit.elements.lib.form_utils import is_in_form
@@ -597,6 +597,7 @@ class ChatMixin:
597
597
  )
598
598
 
599
599
  chat_input_proto.file_type[:] = file_type if file_type is not None else []
600
+ chat_input_proto.max_upload_size_mb = config.get_option("server.maxUploadSize")
600
601
 
601
602
  serde = ChatInputSerde(accept_files=bool(accept_file))
602
603
  widget_state = register_widget( # type: ignore[misc]
@@ -636,10 +636,10 @@ class DataEditorMixin:
636
636
 
637
637
  use_container_width : bool
638
638
  Whether to override ``width`` with the width of the parent
639
- container. If ``use_container_width`` is ``False``, Streamlit
640
- sets the data editor's width according to ``width``. If
641
- ``use_container_width`` is ``True`` (default), Streamlit sets the
642
- width of the data editor to match the width of the parent container.
639
+ container. If this is ``True`` (default), Streamlit sets the width
640
+ of the data editor to match the width of the parent container. If
641
+ this is ``False``, Streamlit sets the data editor's width according
642
+ to ``width``.
643
643
 
644
644
  hide_index : bool or None
645
645
  Whether to hide the index column(s). If ``hide_index`` is ``None``
@@ -697,7 +697,8 @@ class DataEditorMixin:
697
697
 
698
698
  row_height : int or None
699
699
  The height of each row in the data editor in pixels. If ``row_height``
700
- is ``None`` (default), Streamlit will use a default row height.
700
+ is ``None`` (default), Streamlit will use a default row height,
701
+ which fits one line of text.
701
702
 
702
703
  Returns
703
704
  -------
@@ -240,8 +240,9 @@ class NumberInputMixin:
240
240
  format : str or None
241
241
  A printf-style format string controlling how the interface should
242
242
  display numbers. The output must be purely numeric. This does not
243
- impact the return value of the widget. Formatting is handled by
244
- `sprintf.js <https://github.com/alexei/sprintf.js>`_.
243
+ impact the return value of the widget. For more information about
244
+ the formatting specification, see `sprintf.js
245
+ <https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
245
246
 
246
247
  For example, ``format="%0.1f"`` adjusts the displayed decimal
247
248
  precision to only show one digit after the decimal.
@@ -415,9 +415,17 @@ class SliderMixin:
415
415
  format : str or None
416
416
  A printf-style format string controlling how the interface should
417
417
  display numbers. This does not impact the return value.
418
- Formatter for int/float supports: %d %e %f %g %i
419
- Formatter for date/time/datetime uses Moment.js notation:
420
- https://momentjs.com/docs/#/displaying/format/
418
+
419
+ For information about formatting integers and floats, see
420
+ `sprintf.js
421
+ <https://github.com/alexei/sprintf.js?tab=readme-ov-file#format-specification>`_.
422
+ For example, ``format="%0.1f"`` adjusts the displayed decimal
423
+ precision to only show one digit after the decimal.
424
+
425
+ For information about formatting datetimes, dates, and times, see
426
+ `momentJS <https://momentjs.com/docs/#/displaying/format/>`_.
427
+ For example, ``format="ddd ha"`` adjusts the displayed datetime to
428
+ show the day of the week and the hour ("Tue 8pm").
421
429
 
422
430
  key : str or int
423
431
  An optional string or integer to use as the unique key for the widget.
streamlit/errors.py CHANGED
@@ -376,21 +376,23 @@ class StreamlitMissingPageLabelError(LocalizableStreamlitException):
376
376
  class StreamlitPageNotFoundError(LocalizableStreamlitException):
377
377
  """Exception raised the linked page can not be found."""
378
378
 
379
- def __init__(self, page: str, main_script_directory: str, is_mpa_v2: bool):
379
+ def __init__(
380
+ self, page: str, main_script_directory: str, uses_pages_directory: bool
381
+ ):
380
382
  directory = os.path.basename(main_script_directory)
381
383
 
382
384
  message = (
383
- "Could not find page: `{page}`. You must provide a file path "
384
- "relative to the entrypoint file (from the directory `{directory}`). "
385
- "Only the entrypoint file and files in the `pages/` directory are supported."
385
+ "Could not find page: `{page}`. You must provide a `StreamlitPage` "
386
+ "object or file path relative to the entrypoint file. Only pages "
387
+ "previously defined by `st.Page` and passed to `st.navigation` are "
388
+ "allowed."
386
389
  )
387
390
 
388
- if is_mpa_v2:
391
+ if uses_pages_directory:
389
392
  message = (
390
- "Could not find page: `{page}`. You must provide a `StreamlitPage` "
391
- "object or file path relative to the entrypoint file. Only pages "
392
- "previously defined by `st.Page` and passed to `st.navigation` are "
393
- "allowed."
393
+ "Could not find page: `{page}`. You must provide a file path "
394
+ "relative to the entrypoint file (from the directory `{directory}`). "
395
+ "Only the entrypoint file and files in the `pages/` directory are supported."
394
396
  )
395
397
 
396
398
  super().__init__(
@@ -45,12 +45,7 @@ def Page(
45
45
  object to execute the page. You can only run the page returned by
46
46
  ``st.navigation``, and you can only run it once per app rerun.
47
47
 
48
- A page can be defined by a Python file or ``Callable``. Python files used
49
- as a ``StreamlitPage`` source will have ``__name__ == "__page__"``.
50
- Functions used as a ``StreamlitPage`` source will have ``__name__``
51
- corresponding to the module they were imported from. Only the entrypoint
52
- file and functions defined within the entrypoint file have
53
- ``__name__ == "__main__"`` to adhere to Python convention.
48
+ A page can be defined by a Python file or ``Callable``.
54
49
 
55
50
  Parameters
56
51
  ----------
@@ -297,10 +292,7 @@ class StreamlitPage:
297
292
  return
298
293
  else:
299
294
  code = ctx.pages_manager.get_page_script_byte_code(str(self._page))
300
-
301
- # We create a module named __page__ for this specific
302
- # script. This is differentiate it from the `__main__` module
303
- module = types.ModuleType("__page__")
295
+ module = types.ModuleType("__main__")
304
296
  # We want __file__ to be the path to the script
305
297
  module.__dict__["__file__"] = self._page
306
298
  exec(code, module.__dict__)
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
 
16
16
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/ChatInput.proto\"\xb4\x02\n\tChatInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bplaceholder\x18\x02 \x01(\t\x12\x11\n\tmax_chars\x18\x03 \x01(\r\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\r\n\x05value\x18\x05 \x01(\t\x12\x11\n\tset_value\x18\x06 \x01(\x08\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x07 \x01(\t\x12%\n\x08position\x18\x08 \x01(\x0e\x32\x13.ChatInput.Position\x12*\n\x0b\x61\x63\x63\x65pt_file\x18\t \x01(\x0e\x32\x15.ChatInput.AcceptFile\x12\x11\n\tfile_type\x18\n \x03(\t\"\x16\n\x08Position\x12\n\n\x06\x42OTTOM\x10\x00\"0\n\nAcceptFile\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SINGLE\x10\x01\x12\x0c\n\x08MULTIPLE\x10\x02\x42.\n\x1c\x63om.snowflake.apps.streamlitB\x0e\x43hatInputProtob\x06proto3')
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/ChatInput.proto\"\xd0\x02\n\tChatInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bplaceholder\x18\x02 \x01(\t\x12\x11\n\tmax_chars\x18\x03 \x01(\r\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\r\n\x05value\x18\x05 \x01(\t\x12\x11\n\tset_value\x18\x06 \x01(\x08\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x07 \x01(\t\x12%\n\x08position\x18\x08 \x01(\x0e\x32\x13.ChatInput.Position\x12*\n\x0b\x61\x63\x63\x65pt_file\x18\t \x01(\x0e\x32\x15.ChatInput.AcceptFile\x12\x11\n\tfile_type\x18\n \x03(\t\x12\x1a\n\x12max_upload_size_mb\x18\x0b \x01(\x05\"\x16\n\x08Position\x12\n\n\x06\x42OTTOM\x10\x00\"0\n\nAcceptFile\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SINGLE\x10\x01\x12\x0c\n\x08MULTIPLE\x10\x02\x42.\n\x1c\x63om.snowflake.apps.streamlitB\x0e\x43hatInputProtob\x06proto3')
18
18
 
19
19
  _globals = globals()
20
20
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,9 +23,9 @@ if not _descriptor._USE_C_DESCRIPTORS:
23
23
  _globals['DESCRIPTOR']._loaded_options = None
24
24
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\016ChatInputProto'
25
25
  _globals['_CHATINPUT']._serialized_start=36
26
- _globals['_CHATINPUT']._serialized_end=344
27
- _globals['_CHATINPUT_POSITION']._serialized_start=272
28
- _globals['_CHATINPUT_POSITION']._serialized_end=294
29
- _globals['_CHATINPUT_ACCEPTFILE']._serialized_start=296
30
- _globals['_CHATINPUT_ACCEPTFILE']._serialized_end=344
26
+ _globals['_CHATINPUT']._serialized_end=372
27
+ _globals['_CHATINPUT_POSITION']._serialized_start=300
28
+ _globals['_CHATINPUT_POSITION']._serialized_end=322
29
+ _globals['_CHATINPUT_ACCEPTFILE']._serialized_start=324
30
+ _globals['_CHATINPUT_ACCEPTFILE']._serialized_end=372
31
31
  # @@protoc_insertion_point(module_scope)
@@ -75,6 +75,7 @@ class ChatInput(google.protobuf.message.Message):
75
75
  POSITION_FIELD_NUMBER: builtins.int
76
76
  ACCEPT_FILE_FIELD_NUMBER: builtins.int
77
77
  FILE_TYPE_FIELD_NUMBER: builtins.int
78
+ MAX_UPLOAD_SIZE_MB_FIELD_NUMBER: builtins.int
78
79
  id: builtins.str
79
80
  placeholder: builtins.str
80
81
  max_chars: builtins.int
@@ -84,6 +85,8 @@ class ChatInput(google.protobuf.message.Message):
84
85
  default: builtins.str
85
86
  position: global___ChatInput.Position.ValueType
86
87
  accept_file: global___ChatInput.AcceptFile.ValueType
88
+ max_upload_size_mb: builtins.int
89
+ """Max file size allowed by server config"""
87
90
  @property
88
91
  def file_type(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
89
92
  """Supported file types: For example: ["png","jpg","img"]"""
@@ -101,7 +104,8 @@ class ChatInput(google.protobuf.message.Message):
101
104
  position: global___ChatInput.Position.ValueType = ...,
102
105
  accept_file: global___ChatInput.AcceptFile.ValueType = ...,
103
106
  file_type: collections.abc.Iterable[builtins.str] | None = ...,
107
+ max_upload_size_mb: builtins.int = ...,
104
108
  ) -> None: ...
105
- def ClearField(self, field_name: typing.Literal["accept_file", b"accept_file", "default", b"default", "disabled", b"disabled", "file_type", b"file_type", "id", b"id", "max_chars", b"max_chars", "placeholder", b"placeholder", "position", b"position", "set_value", b"set_value", "value", b"value"]) -> None: ...
109
+ def ClearField(self, field_name: typing.Literal["accept_file", b"accept_file", "default", b"default", "disabled", b"disabled", "file_type", b"file_type", "id", b"id", "max_chars", b"max_chars", "max_upload_size_mb", b"max_upload_size_mb", "placeholder", b"placeholder", "position", b"position", "set_value", b"set_value", "value", b"value"]) -> None: ...
106
110
 
107
111
  global___ChatInput = ChatInput