streamlit-nightly 1.37.2.dev20240812__py2.py3-none-any.whl → 1.37.2.dev20240813__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.
- streamlit/connections/sql_connection.py +6 -1
- streamlit/dataframe_util.py +2 -2
- streamlit/elements/widgets/number_input.py +80 -34
- streamlit/elements/widgets/selectbox.py +37 -1
- streamlit/elements/widgets/slider.py +179 -19
- streamlit/external/langchain/streamlit_callback_handler.py +7 -2
- streamlit/testing/v1/element_tree.py +12 -13
- streamlit/web/bootstrap.py +2 -2
- {streamlit_nightly-1.37.2.dev20240812.dist-info → streamlit_nightly-1.37.2.dev20240813.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.37.2.dev20240812.dist-info → streamlit_nightly-1.37.2.dev20240813.dist-info}/RECORD +14 -14
- {streamlit_nightly-1.37.2.dev20240812.dist-info → streamlit_nightly-1.37.2.dev20240813.dist-info}/WHEEL +1 -1
- {streamlit_nightly-1.37.2.dev20240812.data → streamlit_nightly-1.37.2.dev20240813.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.37.2.dev20240812.dist-info → streamlit_nightly-1.37.2.dev20240813.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.37.2.dev20240812.dist-info → streamlit_nightly-1.37.2.dev20240813.dist-info}/top_level.txt +0 -0
@@ -12,6 +12,11 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# NOTE: We ignore all mypy import-not-found errors as top-level since
|
16
|
+
# this module is optional and the SQLAlchemy dependency is not installed
|
17
|
+
# by default.
|
18
|
+
# mypy: disable-error-code="import-not-found, redundant-cast"
|
19
|
+
|
15
20
|
from __future__ import annotations
|
16
21
|
|
17
22
|
from collections import ChainMap
|
@@ -277,7 +282,7 @@ class SQLConnection(BaseConnection["Engine"]):
|
|
277
282
|
|
278
283
|
This is equivalent to accessing ``self._instance.driver``.
|
279
284
|
"""
|
280
|
-
return self._instance.driver
|
285
|
+
return cast(str, self._instance.driver)
|
281
286
|
|
282
287
|
@property
|
283
288
|
def session(self) -> Session:
|
streamlit/dataframe_util.py
CHANGED
@@ -1192,7 +1192,7 @@ def convert_pandas_df_to_data_format(
|
|
1192
1192
|
data_format == DataFormat.POLARS_DATAFRAME
|
1193
1193
|
or data_format == DataFormat.POLARS_LAZYFRAME
|
1194
1194
|
):
|
1195
|
-
import polars as pl
|
1195
|
+
import polars as pl # type: ignore[import-not-found]
|
1196
1196
|
|
1197
1197
|
return pl.from_pandas(df)
|
1198
1198
|
elif data_format == DataFormat.POLARS_SERIES:
|
@@ -1200,7 +1200,7 @@ def convert_pandas_df_to_data_format(
|
|
1200
1200
|
|
1201
1201
|
return pl.from_pandas(_pandas_df_to_series(df))
|
1202
1202
|
elif data_format == DataFormat.XARRAY_DATASET:
|
1203
|
-
import xarray as xr
|
1203
|
+
import xarray as xr # type: ignore[import-not-found]
|
1204
1204
|
|
1205
1205
|
return xr.Dataset.from_dataframe(df)
|
1206
1206
|
elif data_format == DataFormat.XARRAY_DATA_ARRAY:
|
@@ -17,7 +17,7 @@ from __future__ import annotations
|
|
17
17
|
import numbers
|
18
18
|
from dataclasses import dataclass
|
19
19
|
from textwrap import dedent
|
20
|
-
from typing import TYPE_CHECKING, Literal, Union, cast, overload
|
20
|
+
from typing import TYPE_CHECKING, Literal, TypeVar, Union, cast, overload
|
21
21
|
|
22
22
|
from typing_extensions import TypeAlias
|
23
23
|
|
@@ -51,6 +51,8 @@ if TYPE_CHECKING:
|
|
51
51
|
|
52
52
|
|
53
53
|
Number: TypeAlias = Union[int, float]
|
54
|
+
IntOrNone = TypeVar("IntOrNone", int, None)
|
55
|
+
FloatOrNone = TypeVar("FloatOrNone", float, None)
|
54
56
|
|
55
57
|
|
56
58
|
@dataclass
|
@@ -73,47 +75,91 @@ class NumberInputSerde:
|
|
73
75
|
|
74
76
|
|
75
77
|
class NumberInputMixin:
|
78
|
+
# For easier readability, all the arguments with un-changing types across these overload signatures have been
|
79
|
+
# collapsed onto a single line.
|
80
|
+
|
81
|
+
# fmt: off
|
82
|
+
# If "min_value: int" is given and all other numerical inputs are
|
83
|
+
# "int"s or not provided (value optionally being "min"), return "int"
|
84
|
+
# If "min_value: int, value: None" is given and all other numerical inputs
|
85
|
+
# are "int"s or not provided, return "int | None"
|
76
86
|
@overload
|
77
87
|
def number_input(
|
78
88
|
self,
|
79
89
|
label: str,
|
80
|
-
min_value:
|
81
|
-
max_value:
|
82
|
-
value:
|
83
|
-
step:
|
84
|
-
format: str | None = None,
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
disabled: bool = False,
|
93
|
-
label_visibility: LabelVisibility = "visible",
|
94
|
-
) -> Number:
|
95
|
-
pass
|
96
|
-
|
90
|
+
min_value: int,
|
91
|
+
max_value: int | None = None,
|
92
|
+
value: IntOrNone | Literal["min"] = "min",
|
93
|
+
step: int | None = None,
|
94
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, placeholder: str | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
95
|
+
) -> int | IntOrNone:
|
96
|
+
...
|
97
|
+
|
98
|
+
# If "max_value: int" is given and all other numerical inputs are
|
99
|
+
# "int"s or not provided (value optionally being "min"), return "int"
|
100
|
+
# If "max_value: int, value=None" is given and all other numerical inputs
|
101
|
+
# are "int"s or not provided, return "int | None"
|
97
102
|
@overload
|
98
103
|
def number_input(
|
99
104
|
self,
|
100
105
|
label: str,
|
101
|
-
min_value:
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
key: Key | None = None,
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
106
|
+
min_value: int | None = None,
|
107
|
+
*,
|
108
|
+
max_value: int,
|
109
|
+
value: IntOrNone | Literal["min"] = "min",
|
110
|
+
step: int | None = None,
|
111
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, placeholder: str | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
112
|
+
) -> int | IntOrNone:
|
113
|
+
...
|
114
|
+
|
115
|
+
# If "value=int" is given and all other numerical inputs are "int"s
|
116
|
+
# or not provided, return "int"
|
117
|
+
@overload
|
118
|
+
def number_input(
|
119
|
+
self,
|
120
|
+
label: str,
|
121
|
+
min_value: int | None = None,
|
122
|
+
max_value: int | None = None,
|
123
|
+
*,
|
124
|
+
value: int,
|
125
|
+
step: int | None = None,
|
126
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, placeholder: str | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
127
|
+
) -> int:
|
128
|
+
...
|
129
|
+
|
130
|
+
# If "step=int" is given and all other numerical inputs are "int"s
|
131
|
+
# or not provided (value optionally being "min"), return "int"
|
132
|
+
# If "step=int, value=None" is given and all other numerical inputs
|
133
|
+
# are "int"s or not provided, return "int | None"
|
134
|
+
@overload
|
135
|
+
def number_input(
|
136
|
+
self,
|
137
|
+
label: str,
|
138
|
+
min_value: int | None = None,
|
139
|
+
max_value: int | None = None,
|
140
|
+
value: IntOrNone | Literal["min"] = "min",
|
141
|
+
*,
|
142
|
+
step: int,
|
143
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, placeholder: str | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
144
|
+
) -> int | IntOrNone:
|
145
|
+
...
|
146
|
+
|
147
|
+
# If all numerical inputs are floats (with value optionally being "min")
|
148
|
+
# or are not provided, return "float"
|
149
|
+
# If only "value=None" is given and none of the other numerical inputs
|
150
|
+
# are "int"s, return "float | None"
|
151
|
+
@overload
|
152
|
+
def number_input(
|
153
|
+
self,
|
154
|
+
label: str,
|
155
|
+
min_value: float | None = None,
|
156
|
+
max_value: float | None = None,
|
157
|
+
value: FloatOrNone | Literal["min"] = "min",
|
158
|
+
step: float | None = None,
|
159
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, placeholder: str | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
160
|
+
) -> float | FloatOrNone:
|
161
|
+
...
|
162
|
+
# # fmt: on
|
117
163
|
|
118
164
|
@gather_metrics("number_input")
|
119
165
|
def number_input(
|
@@ -15,7 +15,7 @@ from __future__ import annotations
|
|
15
15
|
|
16
16
|
from dataclasses import dataclass
|
17
17
|
from textwrap import dedent
|
18
|
-
from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, cast
|
18
|
+
from typing import TYPE_CHECKING, Any, Callable, Generic, Sequence, cast, overload
|
19
19
|
|
20
20
|
from streamlit.dataframe_util import OptionSequence, convert_anything_to_sequence
|
21
21
|
from streamlit.elements.form import current_form_id
|
@@ -74,6 +74,42 @@ class SelectboxSerde(Generic[T]):
|
|
74
74
|
|
75
75
|
|
76
76
|
class SelectboxMixin:
|
77
|
+
@overload
|
78
|
+
def selectbox(
|
79
|
+
self,
|
80
|
+
label: str,
|
81
|
+
options: OptionSequence[T],
|
82
|
+
index: int = 0,
|
83
|
+
format_func: Callable[[Any], Any] = str,
|
84
|
+
key: Key | None = None,
|
85
|
+
help: str | None = None,
|
86
|
+
on_change: WidgetCallback | None = None,
|
87
|
+
args: WidgetArgs | None = None,
|
88
|
+
kwargs: WidgetKwargs | None = None,
|
89
|
+
*, # keyword-only arguments:
|
90
|
+
placeholder: str = "Choose an option",
|
91
|
+
disabled: bool = False,
|
92
|
+
label_visibility: LabelVisibility = "visible",
|
93
|
+
) -> T: ...
|
94
|
+
|
95
|
+
@overload
|
96
|
+
def selectbox(
|
97
|
+
self,
|
98
|
+
label: str,
|
99
|
+
options: OptionSequence[T],
|
100
|
+
index: None,
|
101
|
+
format_func: Callable[[Any], Any] = str,
|
102
|
+
key: Key | None = None,
|
103
|
+
help: str | None = None,
|
104
|
+
on_change: WidgetCallback | None = None,
|
105
|
+
args: WidgetArgs | None = None,
|
106
|
+
kwargs: WidgetKwargs | None = None,
|
107
|
+
*, # keyword-only arguments:
|
108
|
+
placeholder: str = "Choose an option",
|
109
|
+
disabled: bool = False,
|
110
|
+
label_visibility: LabelVisibility = "visible",
|
111
|
+
) -> T | None: ...
|
112
|
+
|
77
113
|
@gather_metrics("selectbox")
|
78
114
|
def selectbox(
|
79
115
|
self,
|
@@ -18,7 +18,18 @@ from dataclasses import dataclass
|
|
18
18
|
from datetime import date, datetime, time, timedelta, timezone, tzinfo
|
19
19
|
from numbers import Integral, Real
|
20
20
|
from textwrap import dedent
|
21
|
-
from typing import
|
21
|
+
from typing import (
|
22
|
+
TYPE_CHECKING,
|
23
|
+
Any,
|
24
|
+
Final,
|
25
|
+
List,
|
26
|
+
Sequence,
|
27
|
+
Tuple,
|
28
|
+
TypeVar,
|
29
|
+
Union,
|
30
|
+
cast,
|
31
|
+
overload,
|
32
|
+
)
|
22
33
|
|
23
34
|
from typing_extensions import TypeAlias
|
24
35
|
|
@@ -50,14 +61,31 @@ from streamlit.runtime.state.common import compute_widget_id
|
|
50
61
|
if TYPE_CHECKING:
|
51
62
|
from streamlit.delta_generator import DeltaGenerator
|
52
63
|
|
53
|
-
|
64
|
+
SliderNumericT = TypeVar("SliderNumericT", int, float)
|
65
|
+
SliderDatelikeT = TypeVar("SliderDatelikeT", date, time, datetime)
|
54
66
|
|
55
|
-
|
56
|
-
|
67
|
+
SliderNumericSpanT: TypeAlias = Union[
|
68
|
+
List[SliderNumericT],
|
69
|
+
Tuple[()],
|
70
|
+
Tuple[SliderNumericT],
|
71
|
+
Tuple[SliderNumericT, SliderNumericT],
|
72
|
+
]
|
73
|
+
SliderDatelikeSpanT: TypeAlias = Union[
|
74
|
+
List[SliderDatelikeT],
|
75
|
+
Tuple[()],
|
76
|
+
Tuple[SliderDatelikeT],
|
77
|
+
Tuple[SliderDatelikeT, SliderDatelikeT],
|
78
|
+
]
|
57
79
|
|
80
|
+
StepNumericT: TypeAlias = SliderNumericT
|
81
|
+
StepDatelikeT: TypeAlias = timedelta
|
82
|
+
|
83
|
+
SliderStep = Union[int, float, timedelta]
|
84
|
+
SliderScalar = Union[int, float, date, time, datetime]
|
85
|
+
SliderValueT = TypeVar("SliderValueT", int, float, date, time, datetime)
|
58
86
|
SliderValueGeneric: TypeAlias = Union[
|
59
|
-
|
60
|
-
Sequence[
|
87
|
+
SliderValueT,
|
88
|
+
Sequence[SliderValueT],
|
61
89
|
]
|
62
90
|
SliderValue: TypeAlias = Union[
|
63
91
|
SliderValueGeneric[int],
|
@@ -66,11 +94,10 @@ SliderValue: TypeAlias = Union[
|
|
66
94
|
SliderValueGeneric[time],
|
67
95
|
SliderValueGeneric[datetime],
|
68
96
|
]
|
69
|
-
|
70
97
|
SliderReturnGeneric: TypeAlias = Union[
|
71
|
-
|
72
|
-
Tuple[
|
73
|
-
Tuple[
|
98
|
+
SliderValueT,
|
99
|
+
Tuple[SliderValueT],
|
100
|
+
Tuple[SliderValueT, SliderValueT],
|
74
101
|
]
|
75
102
|
SliderReturn: TypeAlias = Union[
|
76
103
|
SliderReturnGeneric[int],
|
@@ -166,14 +193,152 @@ class SliderSerde:
|
|
166
193
|
|
167
194
|
|
168
195
|
class SliderMixin:
|
169
|
-
|
196
|
+
# For easier readability, all the arguments with un-changing types across these overload signatures have been
|
197
|
+
# collapsed onto a single line.
|
198
|
+
|
199
|
+
# fmt: off
|
200
|
+
# If min/max/value/step are not provided, then we return an int.
|
201
|
+
# if ONLY step is provided, then it must be an int and we return an int.
|
202
|
+
@overload
|
203
|
+
def slider(
|
204
|
+
self,
|
205
|
+
label: str,
|
206
|
+
min_value: None = None,
|
207
|
+
max_value: None = None,
|
208
|
+
value: None = None,
|
209
|
+
step: int | None = None,
|
210
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
211
|
+
) -> int:
|
212
|
+
...
|
213
|
+
|
214
|
+
# If min-value or max_value is provided and a numeric type, and value (if provided)
|
215
|
+
# is a singular numeric, return the same numeric type.
|
216
|
+
@overload
|
217
|
+
def slider(
|
218
|
+
self,
|
219
|
+
label: str,
|
220
|
+
min_value: SliderNumericT | None = None,
|
221
|
+
max_value: SliderNumericT | None = None,
|
222
|
+
value: SliderNumericT | None = None,
|
223
|
+
step: StepNumericT[SliderNumericT] | None = None,
|
224
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
225
|
+
) -> SliderNumericT:
|
226
|
+
...
|
227
|
+
|
228
|
+
# If value is provided and a sequence of numeric type,
|
229
|
+
# return a tuple of the same numeric type.
|
230
|
+
@overload
|
231
|
+
def slider(
|
232
|
+
self,
|
233
|
+
label: str,
|
234
|
+
min_value: SliderNumericT | None = None,
|
235
|
+
max_value: SliderNumericT | None = None,
|
236
|
+
*,
|
237
|
+
value: SliderNumericSpanT[SliderNumericT],
|
238
|
+
step: StepNumericT[SliderNumericT] | None = None,
|
239
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
240
|
+
) -> tuple[SliderNumericT, SliderNumericT]:
|
241
|
+
...
|
242
|
+
|
243
|
+
# If value is provided positionally and a sequence of numeric type,
|
244
|
+
# return a tuple of the same numeric type.
|
245
|
+
@overload
|
246
|
+
def slider(
|
247
|
+
self,
|
248
|
+
label: str,
|
249
|
+
min_value: SliderNumericT,
|
250
|
+
max_value: SliderNumericT,
|
251
|
+
value: SliderNumericSpanT[SliderNumericT],
|
252
|
+
/,
|
253
|
+
step: StepNumericT[SliderNumericT] | None = None,
|
254
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
255
|
+
) -> tuple[SliderNumericT, SliderNumericT]:
|
256
|
+
...
|
257
|
+
|
258
|
+
# If min-value is provided and a datelike type, and value (if provided)
|
259
|
+
# is a singular datelike, return the same datelike type.
|
260
|
+
@overload
|
261
|
+
def slider(
|
262
|
+
self,
|
263
|
+
label: str,
|
264
|
+
min_value: SliderDatelikeT,
|
265
|
+
max_value: SliderDatelikeT | None = None,
|
266
|
+
value: SliderDatelikeT | None = None,
|
267
|
+
step: StepDatelikeT | None = None,
|
268
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
269
|
+
) -> SliderDatelikeT:
|
270
|
+
...
|
271
|
+
|
272
|
+
# If max-value is provided and a datelike type, and value (if provided)
|
273
|
+
# is a singular datelike, return the same datelike type.
|
274
|
+
@overload
|
275
|
+
def slider(
|
276
|
+
self,
|
277
|
+
label: str,
|
278
|
+
min_value: SliderDatelikeT | None = None,
|
279
|
+
*,
|
280
|
+
max_value: SliderDatelikeT,
|
281
|
+
value: SliderDatelikeT | None = None,
|
282
|
+
step: StepDatelikeT | None = None,
|
283
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
284
|
+
) -> SliderDatelikeT:
|
285
|
+
...
|
286
|
+
|
287
|
+
# If value is provided and a datelike type, return the same datelike type.
|
288
|
+
@overload
|
289
|
+
def slider(
|
290
|
+
self,
|
291
|
+
label: str,
|
292
|
+
min_value: SliderDatelikeT | None = None,
|
293
|
+
max_value: SliderDatelikeT | None = None,
|
294
|
+
*,
|
295
|
+
value: SliderDatelikeT,
|
296
|
+
step: StepDatelikeT | None = None,
|
297
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
298
|
+
) -> SliderDatelikeT:
|
299
|
+
...
|
300
|
+
|
301
|
+
# If value is provided and a sequence of datelike type,
|
302
|
+
# return a tuple of the same datelike type.
|
303
|
+
@overload
|
304
|
+
def slider(
|
305
|
+
self,
|
306
|
+
label: str,
|
307
|
+
min_value: SliderDatelikeT | None = None,
|
308
|
+
max_value: SliderDatelikeT | None = None,
|
309
|
+
*,
|
310
|
+
value: SliderDatelikeSpanT[SliderDatelikeT],
|
311
|
+
step: StepDatelikeT | None = None,
|
312
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
313
|
+
) -> tuple[SliderDatelikeT, SliderDatelikeT]:
|
314
|
+
...
|
315
|
+
|
316
|
+
# If value is provided positionally and a sequence of datelike type,
|
317
|
+
# return a tuple of the same datelike type.
|
318
|
+
@overload
|
319
|
+
def slider(
|
320
|
+
self,
|
321
|
+
label: str,
|
322
|
+
min_value: SliderDatelikeT,
|
323
|
+
max_value: SliderDatelikeT,
|
324
|
+
value: SliderDatelikeSpanT[SliderDatelikeT],
|
325
|
+
/,
|
326
|
+
step: StepDatelikeT | None = None,
|
327
|
+
format: str | None = None, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = None, *, disabled: bool = False, label_visibility: LabelVisibility = "visible"
|
328
|
+
) -> tuple[SliderDatelikeT, SliderDatelikeT]:
|
329
|
+
...
|
330
|
+
|
331
|
+
# fmt: on
|
332
|
+
|
333
|
+
# https://github.com/python/mypy/issues/17614
|
334
|
+
@gather_metrics("slider") # type: ignore[misc]
|
170
335
|
def slider(
|
171
336
|
self,
|
172
337
|
label: str,
|
173
338
|
min_value: SliderScalar | None = None,
|
174
339
|
max_value: SliderScalar | None = None,
|
175
340
|
value: SliderValue | None = None,
|
176
|
-
step:
|
341
|
+
step: SliderStep | None = None,
|
177
342
|
format: str | None = None,
|
178
343
|
key: Key | None = None,
|
179
344
|
help: str | None = None,
|
@@ -183,11 +348,6 @@ class SliderMixin:
|
|
183
348
|
*, # keyword-only arguments:
|
184
349
|
disabled: bool = False,
|
185
350
|
label_visibility: LabelVisibility = "visible",
|
186
|
-
# TODO(harahu): Add overload definitions. The return type is
|
187
|
-
# `SliderReturn`, in reality, but the return type is left as `Any`
|
188
|
-
# until we have proper overload definitions in place. Otherwise the
|
189
|
-
# user would have to cast the return value more often than not, which
|
190
|
-
# can be annoying.
|
191
351
|
) -> Any:
|
192
352
|
r"""Display a slider widget.
|
193
353
|
|
@@ -360,7 +520,7 @@ class SliderMixin:
|
|
360
520
|
min_value=None,
|
361
521
|
max_value=None,
|
362
522
|
value=None,
|
363
|
-
step
|
523
|
+
step=None,
|
364
524
|
format: str | None = None,
|
365
525
|
key: Key | None = None,
|
366
526
|
help: str | None = None,
|
@@ -509,7 +669,7 @@ class SliderMixin:
|
|
509
669
|
if max_value is None:
|
510
670
|
max_value = DEFAULTS[data_type]["max_value"]
|
511
671
|
if step is None:
|
512
|
-
step =
|
672
|
+
step = DEFAULTS[data_type]["step"]
|
513
673
|
if data_type in (
|
514
674
|
SliderProto.DATETIME,
|
515
675
|
SliderProto.DATE,
|
@@ -31,20 +31,25 @@ the API *from LangChain itself*.
|
|
31
31
|
This module is lazy-loaded.
|
32
32
|
"""
|
33
33
|
|
34
|
+
# NOTE: We ignore all mypy import-not-found errors as top-level since
|
35
|
+
# this module is optional and the langchain dependency is not installed
|
36
|
+
# by default.
|
37
|
+
# mypy: disable-error-code="import-not-found, unused-ignore, misc"
|
38
|
+
|
34
39
|
from __future__ import annotations
|
35
40
|
|
36
41
|
import time
|
37
42
|
from enum import Enum
|
38
43
|
from typing import TYPE_CHECKING, Any, NamedTuple
|
39
44
|
|
40
|
-
from langchain.callbacks.base import (
|
45
|
+
from langchain.callbacks.base import (
|
41
46
|
BaseCallbackHandler,
|
42
47
|
)
|
43
48
|
|
44
49
|
from streamlit.runtime.metrics_util import gather_metrics
|
45
50
|
|
46
51
|
if TYPE_CHECKING:
|
47
|
-
from langchain.schema import (
|
52
|
+
from langchain.schema import (
|
48
53
|
AgentAction,
|
49
54
|
AgentFinish,
|
50
55
|
LLMResult,
|
@@ -36,10 +36,9 @@ from streamlit import dataframe_util, util
|
|
36
36
|
from streamlit.elements.heading import HeadingProtoTag
|
37
37
|
from streamlit.elements.widgets.select_slider import SelectSliderSerde
|
38
38
|
from streamlit.elements.widgets.slider import (
|
39
|
-
SliderScalar,
|
40
|
-
SliderScalarT,
|
41
39
|
SliderSerde,
|
42
|
-
|
40
|
+
SliderStep,
|
41
|
+
SliderValueT,
|
43
42
|
)
|
44
43
|
from streamlit.elements.widgets.time_widgets import (
|
45
44
|
DateInputSerde,
|
@@ -1127,17 +1126,17 @@ class SelectSlider(Widget, Generic[T]):
|
|
1127
1126
|
|
1128
1127
|
|
1129
1128
|
@dataclass(repr=False)
|
1130
|
-
class Slider(Widget, Generic[
|
1129
|
+
class Slider(Widget, Generic[SliderValueT]):
|
1131
1130
|
"""A representation of ``st.slider``."""
|
1132
1131
|
|
1133
|
-
_value:
|
1132
|
+
_value: SliderValueT | Sequence[SliderValueT] | None
|
1134
1133
|
|
1135
1134
|
proto: SliderProto = field(repr=False)
|
1136
1135
|
label: str
|
1137
1136
|
data_type: SliderProto.DataType.ValueType
|
1138
|
-
min:
|
1139
|
-
max:
|
1140
|
-
step:
|
1137
|
+
min: SliderValueT
|
1138
|
+
max: SliderValueT
|
1139
|
+
step: SliderStep
|
1141
1140
|
help: str
|
1142
1141
|
form_id: str
|
1143
1142
|
|
@@ -1146,8 +1145,8 @@ class Slider(Widget, Generic[SliderScalarT]):
|
|
1146
1145
|
self.type = "slider"
|
1147
1146
|
|
1148
1147
|
def set_value(
|
1149
|
-
self, v:
|
1150
|
-
) -> Slider[
|
1148
|
+
self, v: SliderValueT | Sequence[SliderValueT]
|
1149
|
+
) -> Slider[SliderValueT]:
|
1151
1150
|
"""Set the (single) value of the slider."""
|
1152
1151
|
self._value = v
|
1153
1152
|
return self
|
@@ -1164,7 +1163,7 @@ class Slider(Widget, Generic[SliderScalarT]):
|
|
1164
1163
|
return ws
|
1165
1164
|
|
1166
1165
|
@property
|
1167
|
-
def value(self) ->
|
1166
|
+
def value(self) -> SliderValueT | Sequence[SliderValueT]:
|
1168
1167
|
"""The currently selected value or range. (Any or Sequence of Any)"""
|
1169
1168
|
if self._value is not None:
|
1170
1169
|
return self._value
|
@@ -1175,8 +1174,8 @@ class Slider(Widget, Generic[SliderScalarT]):
|
|
1175
1174
|
return state[self.id] # type: ignore
|
1176
1175
|
|
1177
1176
|
def set_range(
|
1178
|
-
self, lower:
|
1179
|
-
) -> Slider[
|
1177
|
+
self, lower: SliderValueT, upper: SliderValueT
|
1178
|
+
) -> Slider[SliderValueT]:
|
1180
1179
|
"""Set the ranged value of the slider."""
|
1181
1180
|
return self.set_value([lower, upper])
|
1182
1181
|
|
streamlit/web/bootstrap.py
CHANGED
@@ -160,9 +160,9 @@ def _fix_pydantic_duplicate_validators_error():
|
|
160
160
|
which should not be critical.
|
161
161
|
"""
|
162
162
|
try:
|
163
|
-
from pydantic import class_validators
|
163
|
+
from pydantic import class_validators # type: ignore[import-not-found]
|
164
164
|
|
165
|
-
class_validators.in_ipython = lambda: True
|
165
|
+
class_validators.in_ipython = lambda: True
|
166
166
|
except ImportError:
|
167
167
|
pass
|
168
168
|
|
@@ -10,7 +10,7 @@ streamlit/config_option.py,sha256=7kfzt-xhJs3awfyIHsyRaTBSxLpz1RioobDl5uXV37g,11
|
|
10
10
|
streamlit/config_util.py,sha256=-MGb5eBrsZvNmqywmiBmo27ll1F9OmCDX4toGWglv2c,6015
|
11
11
|
streamlit/constants.py,sha256=KhNjCeooky2bbW7QMX3ijOA5enHIOgj6Xo4TBhtTJNE,798
|
12
12
|
streamlit/cursor.py,sha256=LUDB6o7xyGb1it_8rl5QU_N3MRhFCdtnd9tuTx78abU,6001
|
13
|
-
streamlit/dataframe_util.py,sha256=
|
13
|
+
streamlit/dataframe_util.py,sha256=fEpPeYh4cgGEOj9nuftg7U2Z_qVM5AnzdL_Ne34uw_E,43347
|
14
14
|
streamlit/delta_generator.py,sha256=KyejN5ndG3QZVCCoHFDFIuKJhe4cuvdwkCYcaMy64_Q,22909
|
15
15
|
streamlit/deprecation_util.py,sha256=3JxWWS424v1kQ-qOq-9sQNYPQ8_UERH3QpYtkWxLP74,6516
|
16
16
|
streamlit/development.py,sha256=iO-KQc62Do9uSwoa5vV2tfImqz3QPhJ1Md6DETcnHkc,813
|
@@ -58,7 +58,7 @@ streamlit/connections/__init__.py,sha256=WSOEtrwhiNYti89iCk3O7I83rurZl8gXoM8tA2d
|
|
58
58
|
streamlit/connections/base_connection.py,sha256=0BRLiQFe1H5j1CqVPgIlbtpXpeEgRLsoZhCIDUtB1P4,7465
|
59
59
|
streamlit/connections/snowflake_connection.py,sha256=0fM-Lpg3GnB4jVVQEhMeJcIQs6GlNy-emgrSlPodUTo,12522
|
60
60
|
streamlit/connections/snowpark_connection.py,sha256=DsAZ68D6dR915LUv4W4aQDHkGxtS0TOPOHy7bkOiGK4,8066
|
61
|
-
streamlit/connections/sql_connection.py,sha256=
|
61
|
+
streamlit/connections/sql_connection.py,sha256=ugNIXCQXZZWGjbkcdJ2t4QlQMUb2Ze8ObdhWtCht9E4,12534
|
62
62
|
streamlit/connections/util.py,sha256=3Ryc93a5KstsVwQl6ug5cmb8F-WQoD4c0mBWNPLoFsY,3022
|
63
63
|
streamlit/elements/__init__.py,sha256=Vrf1yVMOcTyhUPnYvsfyeL96Vpd5z8KoSV5ZzTcTQgU,616
|
64
64
|
streamlit/elements/alert.py,sha256=gn1U2KZObOy55ix5gA2g-r5aP7te1X_wLZKfXp8rTcg,7424
|
@@ -116,16 +116,16 @@ streamlit/elements/widgets/color_picker.py,sha256=xD8sYLtxm7Ps51kFZMlC6vw8f9DwrV
|
|
116
116
|
streamlit/elements/widgets/data_editor.py,sha256=7SikpYw8SFVhu8xgFddGdtF4GfQZALirzjjMQRi-hG8,35944
|
117
117
|
streamlit/elements/widgets/file_uploader.py,sha256=JlquzBQ-CEwTZMphwvIxJJMq3lyLbt-mFQ5-6aJkv4s,17015
|
118
118
|
streamlit/elements/widgets/multiselect.py,sha256=SMNArPbJbzIzpX0UWLPHqYSeLC-65Ee3nmQiPcrI_XQ,11992
|
119
|
-
streamlit/elements/widgets/number_input.py,sha256=
|
119
|
+
streamlit/elements/widgets/number_input.py,sha256=lTEN0f_1MAlGnpdGRlfxi3pCVhCokUrb4AuCjyi1JwU,20430
|
120
120
|
streamlit/elements/widgets/radio.py,sha256=aJNXOQRtVUd2nVgKoo__v7rReYgaVILRvtEvAmll7AI,12360
|
121
121
|
streamlit/elements/widgets/select_slider.py,sha256=ly2104-MXAyzQuL8P9X9iEpJxZ2hCE0KKLlVnPKty_0,13224
|
122
|
-
streamlit/elements/widgets/selectbox.py,sha256=
|
123
|
-
streamlit/elements/widgets/slider.py,sha256=
|
122
|
+
streamlit/elements/widgets/selectbox.py,sha256=EjYGqzymQI35-nJNVUxw85CWT05_11ZIzF5qMvEBCIE,12299
|
123
|
+
streamlit/elements/widgets/slider.py,sha256=s3wi-WdOR_blEopvj8OnIDGpKzZ_trKRCsXKKaEoeD8,32575
|
124
124
|
streamlit/elements/widgets/text_widgets.py,sha256=1W0CIt14JqhbChOX-GiBLJ53rdZaP15tyvqfBHDc85E,21171
|
125
125
|
streamlit/elements/widgets/time_widgets.py,sha256=AQGahztRpIALzJeJ8e-ZCPDyCj5xvn0RQnKrDShECPY,28752
|
126
126
|
streamlit/external/__init__.py,sha256=Vrf1yVMOcTyhUPnYvsfyeL96Vpd5z8KoSV5ZzTcTQgU,616
|
127
127
|
streamlit/external/langchain/__init__.py,sha256=sAzaNf4Cje3cJikPBVvF7pj1sEdEvUfKIEY_Z6Zk8cA,814
|
128
|
-
streamlit/external/langchain/streamlit_callback_handler.py,sha256=
|
128
|
+
streamlit/external/langchain/streamlit_callback_handler.py,sha256=vB_J45E1aLEiH6KCCUl5WvQLb8FtMTIg3pv5l2S7Vsw,15427
|
129
129
|
streamlit/hello/Animation_Demo.py,sha256=iWkDHrhHhKITjkDv4qGcyR_aIpLyYmnZD8CzcuEyyb8,2971
|
130
130
|
streamlit/hello/Dataframe_Demo.py,sha256=zJdbGwhovc2SOXNRXSGRQfem9h5J5KCK136Be18TB4c,2539
|
131
131
|
streamlit/hello/Hello.py,sha256=Oya8ISBTpaykP7gAtGy_bGTCboW0E-5CAO31MLRlN74,1546
|
@@ -509,7 +509,7 @@ streamlit/static/static/media/rocket.b75b17d2b0a063c6cea230d1a9d77f1e.svg,sha256
|
|
509
509
|
streamlit/testing/__init__.py,sha256=Vrf1yVMOcTyhUPnYvsfyeL96Vpd5z8KoSV5ZzTcTQgU,616
|
510
510
|
streamlit/testing/v1/__init__.py,sha256=XGxNOq4VfmwlVj9K6vXB8dAH1YbI_8AIsvw_vbzQoNA,690
|
511
511
|
streamlit/testing/v1/app_test.py,sha256=17YVrcfljnHpHzb2xiCkQ0GYWegVOn22nf_pW0c7UUQ,37443
|
512
|
-
streamlit/testing/v1/element_tree.py,sha256=
|
512
|
+
streamlit/testing/v1/element_tree.py,sha256=DvzrYRTMj31vdaQyd9Vw5oWua2Ojvw0m3ptYOvx-sis,63119
|
513
513
|
streamlit/testing/v1/local_script_runner.py,sha256=OSbOJJooiy70lkjYMqAytWm7X_12Ry7G1JZHaLl3-cI,6595
|
514
514
|
streamlit/testing/v1/util.py,sha256=zDKYdj0J0Dpc6tacvf2CWXL-buh3JnlOkwV0lBFjbsw,1791
|
515
515
|
streamlit/vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -524,7 +524,7 @@ streamlit/watcher/path_watcher.py,sha256=-tb8m4PqRCk_4MdjDwC-3QND7pAH5kCqb_bsTO1
|
|
524
524
|
streamlit/watcher/polling_path_watcher.py,sha256=VwQ06abbvHSIuvR66YpFDx9ANhrzTmoQylKqSjUosFE,3822
|
525
525
|
streamlit/watcher/util.py,sha256=uDsWPxQ8WLNQ4U_MCqWm38H7BEjSrBpPsIZj1ySK8KM,5203
|
526
526
|
streamlit/web/__init__.py,sha256=Vrf1yVMOcTyhUPnYvsfyeL96Vpd5z8KoSV5ZzTcTQgU,616
|
527
|
-
streamlit/web/bootstrap.py,sha256
|
527
|
+
streamlit/web/bootstrap.py,sha256=-1cYmVnvdkUSkjCHkl41PgKULa8ZSAQv9tE3CrUtqJg,12958
|
528
528
|
streamlit/web/cache_storage_manager_config.py,sha256=3bBXzQOPfMhBKCtrywwZQi7LuGf9b4Lm-RbhInd5o5k,1215
|
529
529
|
streamlit/web/cli.py,sha256=2QkmLRRwWiC5yNJlzNofNJJheXa2my-9gehbwiHtc_U,11165
|
530
530
|
streamlit/web/server/__init__.py,sha256=w4TFcV0OjM5zx8ej7oThRIyB6gq3kqdt45XBk1zkRWo,1080
|
@@ -538,9 +538,9 @@ streamlit/web/server/server_util.py,sha256=C3M971XFoEXTMufQLwHbZdtZOE30nWx-2WiXm
|
|
538
538
|
streamlit/web/server/stats_request_handler.py,sha256=47nQHe4ETsO9QS9FAEUF8rZigU_k5eACJZw4-jc8U6c,3684
|
539
539
|
streamlit/web/server/upload_file_request_handler.py,sha256=ftyKpARrUjOpRcFETIXuoTyOG_mo-ToOw5NI0y_W4lE,5003
|
540
540
|
streamlit/web/server/websocket_headers.py,sha256=xkmLm7-WyXyQM8fW-NuURBnD_rmQaiO3oBlu6woF71w,2207
|
541
|
-
streamlit_nightly-1.37.2.
|
542
|
-
streamlit_nightly-1.37.2.
|
543
|
-
streamlit_nightly-1.37.2.
|
544
|
-
streamlit_nightly-1.37.2.
|
545
|
-
streamlit_nightly-1.37.2.
|
546
|
-
streamlit_nightly-1.37.2.
|
541
|
+
streamlit_nightly-1.37.2.dev20240813.data/scripts/streamlit.cmd,sha256=ZEYM3vBJSp-k7vwSJ3ba5NzEk9-qHdSeLvGYAAe1mMw,676
|
542
|
+
streamlit_nightly-1.37.2.dev20240813.dist-info/METADATA,sha256=SzfMk9byoMVDmVq5LKO3KtQUiwUl5pBosv6hVblLtFk,8511
|
543
|
+
streamlit_nightly-1.37.2.dev20240813.dist-info/WHEEL,sha256=M4n4zmFKzQZk4mLCcycNIzIXO7YPKE_b5Cw4PnhHEg8,109
|
544
|
+
streamlit_nightly-1.37.2.dev20240813.dist-info/entry_points.txt,sha256=uNJ4DwGNXEhOK0USwSNanjkYyR-Bk7eYQbJFDrWyOgY,53
|
545
|
+
streamlit_nightly-1.37.2.dev20240813.dist-info/top_level.txt,sha256=V3FhKbm7G2LnR0s4SytavrjIPNIhvcsAGXfYHAwtQzw,10
|
546
|
+
streamlit_nightly-1.37.2.dev20240813.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|