streamlit-nightly 1.38.1.dev20240902__py2.py3-none-any.whl → 1.38.1.dev20240903__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 (40) hide show
  1. streamlit/components/v1/custom_component.py +3 -5
  2. streamlit/delta_generator.py +5 -0
  3. streamlit/elements/arrow.py +2 -4
  4. streamlit/elements/layouts.py +19 -1
  5. streamlit/elements/lib/utils.py +120 -2
  6. streamlit/elements/media.py +3 -3
  7. streamlit/elements/plotly_chart.py +13 -9
  8. streamlit/elements/vega_charts.py +2 -4
  9. streamlit/elements/widgets/button.py +6 -6
  10. streamlit/elements/widgets/button_group.py +2 -3
  11. streamlit/elements/widgets/camera_input.py +2 -3
  12. streamlit/elements/widgets/chat.py +5 -4
  13. streamlit/elements/widgets/checkbox.py +2 -3
  14. streamlit/elements/widgets/color_picker.py +2 -3
  15. streamlit/elements/widgets/data_editor.py +2 -4
  16. streamlit/elements/widgets/file_uploader.py +2 -3
  17. streamlit/elements/widgets/multiselect.py +5 -3
  18. streamlit/elements/widgets/number_input.py +2 -3
  19. streamlit/elements/widgets/radio.py +5 -3
  20. streamlit/elements/widgets/select_slider.py +2 -3
  21. streamlit/elements/widgets/selectbox.py +5 -3
  22. streamlit/elements/widgets/slider.py +2 -3
  23. streamlit/elements/widgets/text_widgets.py +3 -5
  24. streamlit/elements/widgets/time_widgets.py +3 -5
  25. streamlit/errors.py +25 -0
  26. streamlit/proto/Block_pb2.py +28 -28
  27. streamlit/proto/Block_pb2.pyi +8 -2
  28. streamlit/runtime/app_session.py +2 -1
  29. streamlit/runtime/state/common.py +3 -51
  30. streamlit/runtime/state/widgets.py +1 -68
  31. streamlit/static/asset-manifest.json +2 -2
  32. streamlit/static/index.html +1 -1
  33. streamlit/static/static/js/{main.3454bbd6.js → main.ba0d2afb.js} +4 -4
  34. {streamlit_nightly-1.38.1.dev20240902.dist-info → streamlit_nightly-1.38.1.dev20240903.dist-info}/METADATA +1 -1
  35. {streamlit_nightly-1.38.1.dev20240902.dist-info → streamlit_nightly-1.38.1.dev20240903.dist-info}/RECORD +40 -40
  36. {streamlit_nightly-1.38.1.dev20240902.dist-info → streamlit_nightly-1.38.1.dev20240903.dist-info}/WHEEL +1 -1
  37. /streamlit/static/static/js/{main.3454bbd6.js.LICENSE.txt → main.ba0d2afb.js.LICENSE.txt} +0 -0
  38. {streamlit_nightly-1.38.1.dev20240902.data → streamlit_nightly-1.38.1.dev20240903.data}/scripts/streamlit.cmd +0 -0
  39. {streamlit_nightly-1.38.1.dev20240902.dist-info → streamlit_nightly-1.38.1.dev20240903.dist-info}/entry_points.txt +0 -0
  40. {streamlit_nightly-1.38.1.dev20240902.dist-info → streamlit_nightly-1.38.1.dev20240903.dist-info}/top_level.txt +0 -0
@@ -14,13 +14,11 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- import textwrap
18
17
  from types import MappingProxyType
19
18
  from typing import TYPE_CHECKING, Final, Mapping
20
19
 
21
20
  from typing_extensions import TypeAlias
22
21
 
23
- from streamlit.errors import DuplicateWidgetID
24
22
  from streamlit.runtime.state.common import (
25
23
  RegisterWidgetResult,
26
24
  T,
@@ -92,8 +90,6 @@ def register_widget(
92
90
  deserializer: WidgetDeserializer[T],
93
91
  serializer: WidgetSerializer[T],
94
92
  ctx: ScriptRunContext | None,
95
- user_key: str | None = None,
96
- widget_func_name: str | None = None,
97
93
  on_change_handler: WidgetCallback | None = None,
98
94
  args: WidgetArgs | None = None,
99
95
  kwargs: WidgetKwargs | None = None,
@@ -114,14 +110,6 @@ def register_widget(
114
110
  Called to convert a widget's value to its protobuf representation.
115
111
  ctx : ScriptRunContext or None
116
112
  Used to ensure uniqueness of widget IDs, and to look up widget values.
117
- user_key : str or None
118
- Optional user-specified string to use as the widget ID.
119
- If this is None, we'll generate an ID by hashing the element.
120
- widget_func_name : str or None
121
- The widget's DeltaGenerator function name, if it's different from
122
- its element_type. Custom components are a special case: they all have
123
- the element_type "component_instance", but are instantiated with
124
- dynamically-named functions.
125
113
  on_change_handler : WidgetCallback or None
126
114
  An optional callback invoked when the widget's value changes.
127
115
  args : WidgetArgs or None
@@ -164,14 +152,12 @@ def register_widget(
164
152
  callback_kwargs=kwargs,
165
153
  fragment_id=ctx.current_fragment_id if ctx else None,
166
154
  )
167
- return register_widget_from_metadata(metadata, ctx, widget_func_name, element_type)
155
+ return register_widget_from_metadata(metadata, ctx)
168
156
 
169
157
 
170
158
  def register_widget_from_metadata(
171
159
  metadata: WidgetMetadata[T],
172
160
  ctx: ScriptRunContext | None,
173
- widget_func_name: str | None,
174
- element_type: ElementType,
175
161
  ) -> RegisterWidgetResult[T]:
176
162
  """Register a widget and return its value, using an already constructed
177
163
  `WidgetMetadata`.
@@ -189,57 +175,4 @@ def register_widget_from_metadata(
189
175
  widget_id = metadata.id
190
176
  user_key = user_key_from_element_id(widget_id)
191
177
 
192
- # Ensure another widget with the same user key hasn't already been registered.
193
- if user_key is not None:
194
- if user_key not in ctx.widget_user_keys_this_run:
195
- ctx.widget_user_keys_this_run.add(user_key)
196
- else:
197
- raise DuplicateWidgetID(
198
- _build_duplicate_widget_message(
199
- widget_func_name if widget_func_name is not None else element_type,
200
- user_key,
201
- )
202
- )
203
-
204
- # Ensure another widget with the same id hasn't already been registered.
205
- new_widget = widget_id not in ctx.widget_ids_this_run
206
- if new_widget:
207
- ctx.widget_ids_this_run.add(widget_id)
208
- else:
209
- raise DuplicateWidgetID(
210
- _build_duplicate_widget_message(
211
- widget_func_name if widget_func_name is not None else element_type,
212
- user_key,
213
- )
214
- )
215
178
  return ctx.session_state.register_widget(metadata, user_key)
216
-
217
-
218
- def _build_duplicate_widget_message(
219
- widget_func_name: str, user_key: str | None = None
220
- ) -> str:
221
- if user_key is not None:
222
- message = textwrap.dedent(
223
- """
224
- There are multiple widgets with the same `key='{user_key}'`.
225
-
226
- To fix this, please make sure that the `key` argument is unique for each
227
- widget you create.
228
- """
229
- )
230
- else:
231
- message = textwrap.dedent(
232
- """
233
- There are multiple identical `st.{widget_type}` widgets with the
234
- same generated key.
235
-
236
- When a widget is created, it's assigned an internal key based on
237
- its structure. Multiple widgets with an identical structure will
238
- result in the same internal key, which causes this error.
239
-
240
- To fix this error, please pass a unique `key` argument to
241
- `st.{widget_type}`.
242
- """
243
- )
244
-
245
- return message.strip("\n").format(widget_type=widget_func_name, user_key=user_key)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.5513bd04.css",
4
- "main.js": "./static/js/main.3454bbd6.js",
4
+ "main.js": "./static/js/main.ba0d2afb.js",
5
5
  "static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
6
6
  "static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
7
7
  "static/js/9077.e0a8db2a.chunk.js": "./static/js/9077.e0a8db2a.chunk.js",
@@ -153,6 +153,6 @@
153
153
  },
154
154
  "entrypoints": [
155
155
  "static/css/main.5513bd04.css",
156
- "static/js/main.3454bbd6.js"
156
+ "static/js/main.ba0d2afb.js"
157
157
  ]
158
158
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.3454bbd6.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.ba0d2afb.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>