streamlit-nightly 1.20.1.dev20230328__py2.py3-none-any.whl → 1.20.1.dev20230329__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/elements/file_uploader.py +9 -9
- streamlit/elements/legacy_data_frame.py +7 -3
- streamlit/elements/text_widgets.py +4 -2
- streamlit/runtime/metrics_util.py +1 -1
- streamlit/runtime/scriptrunner/script_run_context.py +8 -5
- streamlit/runtime/secrets.py +5 -0
- streamlit/static/asset-manifest.json +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/main.bafbd295.js +2 -0
- {streamlit_nightly-1.20.1.dev20230328.dist-info → streamlit_nightly-1.20.1.dev20230329.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.20.1.dev20230328.dist-info → streamlit_nightly-1.20.1.dev20230329.dist-info}/RECORD +16 -16
- streamlit/static/static/js/main.0c21bfaf.js +0 -2
- /streamlit/static/static/js/{main.0c21bfaf.js.LICENSE.txt → main.bafbd295.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.20.1.dev20230328.data → streamlit_nightly-1.20.1.dev20230329.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.20.1.dev20230328.dist-info → streamlit_nightly-1.20.1.dev20230329.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.20.1.dev20230328.dist-info → streamlit_nightly-1.20.1.dev20230329.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.20.1.dev20230328.dist-info → streamlit_nightly-1.20.1.dev20230329.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
from dataclasses import dataclass
|
16
16
|
from textwrap import dedent
|
17
|
-
from typing import List, Optional, Union, cast, overload
|
17
|
+
from typing import List, Optional, Sequence, Union, cast, overload
|
18
18
|
|
19
19
|
from typing_extensions import Literal
|
20
20
|
|
@@ -127,7 +127,7 @@ class FileUploaderMixin:
|
|
127
127
|
def file_uploader(
|
128
128
|
self,
|
129
129
|
label: str,
|
130
|
-
type: Optional[Union[str,
|
130
|
+
type: Optional[Union[str, Sequence[str]]],
|
131
131
|
accept_multiple_files: Literal[True],
|
132
132
|
key: Optional[Key] = None,
|
133
133
|
help: Optional[str] = None,
|
@@ -146,7 +146,7 @@ class FileUploaderMixin:
|
|
146
146
|
def file_uploader(
|
147
147
|
self,
|
148
148
|
label: str,
|
149
|
-
type: Optional[Union[str,
|
149
|
+
type: Optional[Union[str, Sequence[str]]],
|
150
150
|
accept_multiple_files: Literal[False] = False,
|
151
151
|
key: Optional[Key] = None,
|
152
152
|
help: Optional[str] = None,
|
@@ -172,7 +172,7 @@ class FileUploaderMixin:
|
|
172
172
|
label: str,
|
173
173
|
*,
|
174
174
|
accept_multiple_files: Literal[True],
|
175
|
-
type: Optional[Union[str,
|
175
|
+
type: Optional[Union[str, Sequence[str]]] = None,
|
176
176
|
key: Optional[Key] = None,
|
177
177
|
help: Optional[str] = None,
|
178
178
|
on_change: Optional[WidgetCallback] = None,
|
@@ -191,7 +191,7 @@ class FileUploaderMixin:
|
|
191
191
|
label: str,
|
192
192
|
*,
|
193
193
|
accept_multiple_files: Literal[False] = False,
|
194
|
-
type: Optional[Union[str,
|
194
|
+
type: Optional[Union[str, Sequence[str]]] = None,
|
195
195
|
key: Optional[Key] = None,
|
196
196
|
help: Optional[str] = None,
|
197
197
|
on_change: Optional[WidgetCallback] = None,
|
@@ -206,7 +206,7 @@ class FileUploaderMixin:
|
|
206
206
|
def file_uploader(
|
207
207
|
self,
|
208
208
|
label: str,
|
209
|
-
type: Optional[Union[str,
|
209
|
+
type: Optional[Union[str, Sequence[str]]] = None,
|
210
210
|
accept_multiple_files: bool = False,
|
211
211
|
key: Optional[Key] = None,
|
212
212
|
help: Optional[str] = None,
|
@@ -216,7 +216,7 @@ class FileUploaderMixin:
|
|
216
216
|
*, # keyword-only arguments:
|
217
217
|
disabled: bool = False,
|
218
218
|
label_visibility: LabelVisibility = "visible",
|
219
|
-
):
|
219
|
+
) -> SomeUploadedFiles:
|
220
220
|
r"""Display a file uploader widget.
|
221
221
|
By default, uploaded files are limited to 200MB. You can configure
|
222
222
|
this using the `server.maxUploadSize` config option. For more info
|
@@ -362,7 +362,7 @@ class FileUploaderMixin:
|
|
362
362
|
def _file_uploader(
|
363
363
|
self,
|
364
364
|
label: str,
|
365
|
-
type: Optional[Union[str,
|
365
|
+
type: Optional[Union[str, Sequence[str]]] = None,
|
366
366
|
accept_multiple_files: bool = False,
|
367
367
|
key: Optional[Key] = None,
|
368
368
|
help: Optional[str] = None,
|
@@ -373,7 +373,7 @@ class FileUploaderMixin:
|
|
373
373
|
label_visibility: LabelVisibility = "visible",
|
374
374
|
disabled: bool = False,
|
375
375
|
ctx: Optional[ScriptRunContext] = None,
|
376
|
-
):
|
376
|
+
) -> SomeUploadedFiles:
|
377
377
|
key = to_key(key)
|
378
378
|
check_callback_rules(self.dg, on_change)
|
379
379
|
check_session_state_rules(default_value=None, key=key, writes_allowed=False)
|
@@ -371,7 +371,7 @@ def _marshall_index(pandas_index, proto_index) -> None:
|
|
371
371
|
import numpy as np
|
372
372
|
import pandas as pd
|
373
373
|
|
374
|
-
if type(pandas_index) == pd.Index:
|
374
|
+
if type(pandas_index) == pd.Index and pandas_index.dtype.kind not in ["f", "i"]:
|
375
375
|
_marshall_any_array(np.array(pandas_index), proto_index.plain_index.data)
|
376
376
|
elif type(pandas_index) == pd.RangeIndex:
|
377
377
|
min = pandas_index.min()
|
@@ -401,9 +401,13 @@ def _marshall_index(pandas_index, proto_index) -> None:
|
|
401
401
|
)
|
402
402
|
elif type(pandas_index) == pd.TimedeltaIndex:
|
403
403
|
proto_index.timedelta_index.data.data.extend(pandas_index.astype(np.int64))
|
404
|
-
elif
|
404
|
+
elif type_util.is_type(pandas_index, "pandas.core.indexes.numeric.Int64Index") or (
|
405
|
+
type(pandas_index) == pd.Index and pandas_index.dtype.kind == "i"
|
406
|
+
):
|
405
407
|
proto_index.int_64_index.data.data.extend(pandas_index)
|
406
|
-
elif
|
408
|
+
elif type_util.is_type(
|
409
|
+
pandas_index, "pandas.core.indexes.numeric.Float64Index"
|
410
|
+
) or (type(pandas_index) == pd.Index and pandas_index.dtype.kind == "f"):
|
407
411
|
proto_index.float_64_index.data.data.extend(pandas_index)
|
408
412
|
else:
|
409
413
|
raise NotImplementedError("Can't handle %s yet." % type(pandas_index))
|
@@ -16,6 +16,8 @@ from dataclasses import dataclass
|
|
16
16
|
from textwrap import dedent
|
17
17
|
from typing import Optional, cast
|
18
18
|
|
19
|
+
from typing_extensions import Literal
|
20
|
+
|
19
21
|
import streamlit
|
20
22
|
from streamlit.elements.form import current_form_id
|
21
23
|
from streamlit.elements.utils import (
|
@@ -73,7 +75,7 @@ class TextWidgetsMixin:
|
|
73
75
|
value: SupportsStr = "",
|
74
76
|
max_chars: Optional[int] = None,
|
75
77
|
key: Optional[Key] = None,
|
76
|
-
type:
|
78
|
+
type: Literal["default", "password"] = "default",
|
77
79
|
help: Optional[str] = None,
|
78
80
|
autocomplete: Optional[str] = None,
|
79
81
|
on_change: Optional[WidgetCallback] = None,
|
@@ -124,7 +126,7 @@ class TextWidgetsMixin:
|
|
124
126
|
If this is omitted, a key will be generated for the widget
|
125
127
|
based on its content. Multiple widgets of the same type may
|
126
128
|
not share the same key.
|
127
|
-
type :
|
129
|
+
type : "default" or "password"
|
128
130
|
The type of the text input. This can be either "default" (for
|
129
131
|
a regular text input), or "password" (for a text input that
|
130
132
|
masks the user's typed value). Defaults to "default".
|
@@ -277,7 +277,7 @@ def gather_metrics(name: str, func: Optional[F] = None) -> Union[Callable[[F], F
|
|
277
277
|
# get_script_run_ctx gets imported here to prevent circular dependencies
|
278
278
|
from streamlit.runtime.scriptrunner import get_script_run_ctx
|
279
279
|
|
280
|
-
ctx = get_script_run_ctx()
|
280
|
+
ctx = get_script_run_ctx(suppress_warning=True)
|
281
281
|
|
282
282
|
tracking_activated = (
|
283
283
|
ctx is not None
|
@@ -29,7 +29,6 @@ from streamlit.runtime.uploaded_file_manager import UploadedFileManager
|
|
29
29
|
|
30
30
|
LOGGER: Final = get_logger(__name__)
|
31
31
|
|
32
|
-
|
33
32
|
UserInfo: TypeAlias = Dict[str, Optional[str]]
|
34
33
|
|
35
34
|
|
@@ -141,8 +140,12 @@ def add_script_run_ctx(
|
|
141
140
|
return thread
|
142
141
|
|
143
142
|
|
144
|
-
def get_script_run_ctx() -> Optional[ScriptRunContext]:
|
143
|
+
def get_script_run_ctx(suppress_warning: bool = False) -> Optional[ScriptRunContext]:
|
145
144
|
"""
|
145
|
+
Parameters
|
146
|
+
----------
|
147
|
+
suppress_warning : bool
|
148
|
+
If True, don't log a warning if there's no ScriptRunContext.
|
146
149
|
Returns
|
147
150
|
-------
|
148
151
|
ScriptRunContext | None
|
@@ -153,9 +156,9 @@ def get_script_run_ctx() -> Optional[ScriptRunContext]:
|
|
153
156
|
ctx: Optional[ScriptRunContext] = getattr(
|
154
157
|
thread, SCRIPT_RUN_CONTEXT_ATTR_NAME, None
|
155
158
|
)
|
156
|
-
if ctx is None and runtime.exists():
|
157
|
-
# Only warn about a missing ScriptRunContext if
|
158
|
-
# via `streamlit run`. Otherwise, the user is likely running a
|
159
|
+
if ctx is None and runtime.exists() and not suppress_warning:
|
160
|
+
# Only warn about a missing ScriptRunContext if suppress_warning is False, and
|
161
|
+
# we were started via `streamlit run`. Otherwise, the user is likely running a
|
159
162
|
# script "bare", and doesn't need to be warned about streamlit
|
160
163
|
# bits that are irrelevant when not connected to a session.
|
161
164
|
LOGGER.warning("Thread '%s': missing ScriptRunContext", thread.name)
|
streamlit/runtime/secrets.py
CHANGED
@@ -14,8 +14,10 @@
|
|
14
14
|
|
15
15
|
import os
|
16
16
|
import threading
|
17
|
+
from copy import deepcopy
|
17
18
|
from typing import (
|
18
19
|
Any,
|
20
|
+
Dict,
|
19
21
|
ItemsView,
|
20
22
|
Iterator,
|
21
23
|
KeysView,
|
@@ -105,6 +107,9 @@ class AttrDict(Mapping[str, Any]):
|
|
105
107
|
def __setattr__(self, key, value) -> NoReturn:
|
106
108
|
raise TypeError("Secrets does not support attribute assignment.")
|
107
109
|
|
110
|
+
def to_dict(self) -> Dict[str, Any]:
|
111
|
+
return deepcopy(self.__nested_secrets__)
|
112
|
+
|
108
113
|
|
109
114
|
class Secrets(Mapping[str, Any]):
|
110
115
|
"""A dict-like class that stores secrets.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.f4a8738f.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.bafbd295.js",
|
5
5
|
"static/js/464.53a4cca5.chunk.js": "./static/js/464.53a4cca5.chunk.js",
|
6
6
|
"static/js/248.1f4c1c4f.chunk.js": "./static/js/248.1f4c1c4f.chunk.js",
|
7
7
|
"static/js/787.35855372.chunk.js": "./static/js/787.35855372.chunk.js",
|
@@ -143,6 +143,6 @@
|
|
143
143
|
},
|
144
144
|
"entrypoints": [
|
145
145
|
"static/css/main.f4a8738f.css",
|
146
|
-
"static/js/main.
|
146
|
+
"static/js/main.bafbd295.js"
|
147
147
|
]
|
148
148
|
}
|
streamlit/static/index.html
CHANGED
@@ -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"/><title>Streamlit</title><script>window.prerenderReady=!1</script><script src="./vendor/viz/viz-1.8.0.min.js" type="javascript/worker"></script><script src="./vendor/bokeh/bokeh-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-widgets-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-tables-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-api-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-gl-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-mathjax-2.4.3.min.js"></script><script defer="defer" src="./static/js/main.
|
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"/><title>Streamlit</title><script>window.prerenderReady=!1</script><script src="./vendor/viz/viz-1.8.0.min.js" type="javascript/worker"></script><script src="./vendor/bokeh/bokeh-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-widgets-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-tables-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-api-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-gl-2.4.3.min.js"></script><script src="./vendor/bokeh/bokeh-mathjax-2.4.3.min.js"></script><script defer="defer" src="./static/js/main.bafbd295.js"></script><link href="./static/css/main.f4a8738f.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|