streamlit-nightly 1.36.1.dev20240630__py2.py3-none-any.whl → 1.36.1.dev20240703__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/commands/navigation.py +2 -2
- streamlit/components/v1/component_arrow.py +16 -11
- streamlit/components/v1/custom_component.py +2 -1
- streamlit/config.py +1 -136
- streamlit/dataframe_util.py +835 -0
- streamlit/delta_generator.py +5 -3
- streamlit/elements/arrow.py +17 -13
- streamlit/elements/dialog_decorator.py +1 -1
- streamlit/elements/exception.py +2 -8
- streamlit/elements/image.py +2 -1
- streamlit/elements/lib/built_in_chart_utils.py +78 -12
- streamlit/elements/lib/column_config_utils.py +1 -1
- streamlit/elements/lib/pandas_styler_utils.py +2 -2
- streamlit/elements/lib/policies.py +20 -2
- streamlit/elements/lib/utils.py +100 -10
- streamlit/elements/map.py +2 -2
- streamlit/elements/media.py +1 -1
- streamlit/elements/metric.py +5 -2
- streamlit/elements/plotly_chart.py +1 -1
- streamlit/elements/pyplot.py +26 -39
- streamlit/elements/vega_charts.py +6 -5
- streamlit/elements/widgets/button.py +1 -1
- streamlit/elements/widgets/camera_input.py +7 -2
- streamlit/elements/widgets/chat.py +1 -1
- streamlit/elements/widgets/checkbox.py +7 -2
- streamlit/elements/widgets/color_picker.py +7 -2
- streamlit/elements/widgets/data_editor.py +10 -9
- streamlit/elements/widgets/file_uploader.py +7 -2
- streamlit/elements/widgets/multiselect.py +6 -7
- streamlit/elements/widgets/number_input.py +7 -2
- streamlit/elements/widgets/radio.py +6 -7
- streamlit/elements/widgets/select_slider.py +6 -7
- streamlit/elements/widgets/selectbox.py +6 -7
- streamlit/elements/widgets/slider.py +7 -2
- streamlit/elements/widgets/text_widgets.py +8 -5
- streamlit/elements/widgets/time_widgets.py +7 -2
- streamlit/elements/write.py +5 -5
- streamlit/errors.py +0 -29
- streamlit/navigation/page.py +8 -3
- streamlit/proto/NewSession_pb2.pyi +1 -1
- streamlit/runtime/app_session.py +0 -4
- streamlit/runtime/caching/cache_utils.py +1 -1
- streamlit/runtime/scriptrunner/script_runner.py +7 -22
- streamlit/runtime/state/common.py +51 -2
- streamlit/runtime/state/session_state.py +2 -1
- streamlit/runtime/state/session_state_proxy.py +1 -1
- streamlit/runtime/state/widgets.py +1 -1
- streamlit/static/asset-manifest.json +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/main.28e3c6e9.js +2 -0
- streamlit/testing/v1/element_tree.py +3 -3
- streamlit/type_util.py +0 -1069
- streamlit/watcher/path_watcher.py +1 -2
- {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/RECORD +60 -59
- {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/WHEEL +1 -1
- streamlit/static/static/js/main.0326e951.js +0 -2
- /streamlit/static/static/js/{main.0326e951.js.LICENSE.txt → main.28e3c6e9.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.36.1.dev20240630.data → streamlit_nightly-1.36.1.dev20240703.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.36.1.dev20240630.dist-info → streamlit_nightly-1.36.1.dev20240703.dist-info}/top_level.txt +0 -0
streamlit/errors.py
CHANGED
@@ -108,35 +108,6 @@ class StreamlitAPIWarning(StreamlitAPIException, Warning):
|
|
108
108
|
return util.repr_(self)
|
109
109
|
|
110
110
|
|
111
|
-
class StreamlitDeprecationWarning(StreamlitAPIWarning):
|
112
|
-
"""Used to display a warning.
|
113
|
-
|
114
|
-
Note that this should not be "raised", but passed to st.exception
|
115
|
-
instead.
|
116
|
-
"""
|
117
|
-
|
118
|
-
def __init__(self, config_option, msg, *args):
|
119
|
-
message = """
|
120
|
-
{0}
|
121
|
-
|
122
|
-
You can disable this warning by disabling the config option:
|
123
|
-
`{1}`
|
124
|
-
|
125
|
-
```
|
126
|
-
st.set_option('{1}', False)
|
127
|
-
```
|
128
|
-
or in your `.streamlit/config.toml`
|
129
|
-
```
|
130
|
-
[deprecation]
|
131
|
-
{2} = false
|
132
|
-
```
|
133
|
-
""".format(msg, config_option, config_option.split(".")[1])
|
134
|
-
super().__init__(message, *args)
|
135
|
-
|
136
|
-
def __repr__(self) -> str:
|
137
|
-
return util.repr_(self)
|
138
|
-
|
139
|
-
|
140
111
|
class StreamlitModuleNotFoundError(StreamlitAPIWarning):
|
141
112
|
"""Print a pretty message when a Streamlit command requires a dependency
|
142
113
|
that is not one of our core dependencies."""
|
streamlit/navigation/page.py
CHANGED
@@ -41,11 +41,16 @@ def Page(
|
|
41
41
|
``st.navigation`` to declare a page in your app.
|
42
42
|
|
43
43
|
When a user navigates to a page, ``st.navigation`` returns the selected
|
44
|
-
``StreamlitPage`` object. Call
|
45
|
-
to execute the page. You can only run the page returned by
|
44
|
+
``StreamlitPage`` object. Call ``.run()`` on the returned ``StreamlitPage``
|
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``.
|
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.
|
49
54
|
|
50
55
|
Parameters
|
51
56
|
----------
|
@@ -211,7 +211,7 @@ class Config(google.protobuf.message.Message):
|
|
211
211
|
hide_top_bar: builtins.bool
|
212
212
|
"""See config option "ui.hideTopBar"."""
|
213
213
|
hide_sidebar_nav: builtins.bool
|
214
|
-
"""See config option "
|
214
|
+
"""See config option "client.showSidebarNavigation"."""
|
215
215
|
toolbar_mode: global___Config.ToolbarMode.ValueType
|
216
216
|
def __init__(
|
217
217
|
self,
|
streamlit/runtime/app_session.py
CHANGED
@@ -270,8 +270,6 @@ class AppSession:
|
|
270
270
|
The message to enqueue
|
271
271
|
|
272
272
|
"""
|
273
|
-
if not config.get_option("client.displayEnabled"):
|
274
|
-
return
|
275
273
|
|
276
274
|
if self._debug_last_backmsg_id:
|
277
275
|
msg.debug_last_backmsg_id = self._debug_last_backmsg_id
|
@@ -883,8 +881,6 @@ def _populate_config_msg(msg: Config) -> None:
|
|
883
881
|
msg.max_cached_message_age = config.get_option("global.maxCachedMessageAge")
|
884
882
|
msg.allow_run_on_save = config.get_option("server.allowRunOnSave")
|
885
883
|
msg.hide_top_bar = config.get_option("ui.hideTopBar")
|
886
|
-
# ui.hideSidebarNav is deprecated, will be removed in the future
|
887
|
-
msg.hide_sidebar_nav = config.get_option("ui.hideSidebarNav")
|
888
884
|
if config.get_option("client.showSidebarNavigation") is False:
|
889
885
|
msg.hide_sidebar_nav = True
|
890
886
|
msg.toolbar_mode = _get_toolbar_mode()
|
@@ -26,6 +26,7 @@ from collections import defaultdict
|
|
26
26
|
from typing import TYPE_CHECKING, Any, Callable, Final
|
27
27
|
|
28
28
|
from streamlit import type_util
|
29
|
+
from streamlit.dataframe_util import UNEVALUATED_DATAFRAME_TYPES
|
29
30
|
from streamlit.elements.spinner import spinner
|
30
31
|
from streamlit.logger import get_logger
|
31
32
|
from streamlit.runtime.caching.cache_errors import (
|
@@ -44,7 +45,6 @@ from streamlit.runtime.caching.cached_message_replay import (
|
|
44
45
|
replay_cached_messages,
|
45
46
|
)
|
46
47
|
from streamlit.runtime.caching.hashing import HashFuncsDict, update_hash
|
47
|
-
from streamlit.type_util import UNEVALUATED_DATAFRAME_TYPES
|
48
48
|
from streamlit.util import HASHLIB_KWARGS
|
49
49
|
|
50
50
|
if TYPE_CHECKING:
|
@@ -336,12 +336,7 @@ class ScriptRunner:
|
|
336
336
|
# Whenever we enqueue a ForwardMsg, we also handle any pending
|
337
337
|
# execution control request. This means that a script can be
|
338
338
|
# cleanly interrupted and stopped inside most `st.foo` calls.
|
339
|
-
|
340
|
-
# (If "runner.installTracer" is true, then we'll actually be
|
341
|
-
# handling these requests in a callback called after every Python
|
342
|
-
# instruction instead.)
|
343
|
-
if not config.get_option("runner.installTracer"):
|
344
|
-
self._maybe_handle_execution_control_request()
|
339
|
+
self._maybe_handle_execution_control_request()
|
345
340
|
|
346
341
|
# Pass the message to our associated AppSession.
|
347
342
|
self.on_event.send(
|
@@ -382,17 +377,6 @@ class ScriptRunner:
|
|
382
377
|
assert request.type == ScriptRequestType.STOP
|
383
378
|
raise StopException()
|
384
379
|
|
385
|
-
def _install_tracer(self) -> None:
|
386
|
-
"""Install function that runs before each line of the script."""
|
387
|
-
|
388
|
-
def trace_calls(frame, event, arg):
|
389
|
-
self._maybe_handle_execution_control_request()
|
390
|
-
return trace_calls
|
391
|
-
|
392
|
-
# Python interpreters are not required to implement sys.settrace.
|
393
|
-
if hasattr(sys, "settrace"):
|
394
|
-
sys.settrace(trace_calls)
|
395
|
-
|
396
380
|
@contextmanager
|
397
381
|
def _set_execing_flag(self):
|
398
382
|
"""A context for setting the ScriptRunner._execing flag.
|
@@ -426,8 +410,12 @@ class ScriptRunner:
|
|
426
410
|
start_time: float = timer()
|
427
411
|
prep_time: float = 0 # This will be overwritten once preparations are done.
|
428
412
|
|
429
|
-
|
430
|
-
|
413
|
+
if not rerun_data.fragment_id_queue:
|
414
|
+
# Don't clear session refs for media files if we're running a fragment.
|
415
|
+
# Otherwise, we're likely to remove files that still have corresponding
|
416
|
+
# download buttons/links to them present in the app, which will result
|
417
|
+
# in a 404 should the user click on them.
|
418
|
+
runtime.get_instance().media_file_mgr.clear_session_refs()
|
431
419
|
|
432
420
|
self._pages_manager.set_script_intent(
|
433
421
|
rerun_data.page_script_hash, rerun_data.page_name
|
@@ -520,9 +508,6 @@ class ScriptRunner:
|
|
520
508
|
# is to run it. Errors thrown during execution will be shown to the
|
521
509
|
# user as ExceptionElements.
|
522
510
|
|
523
|
-
if config.get_option("runner.installTracer"):
|
524
|
-
self._install_tracer()
|
525
|
-
|
526
511
|
# Create fake module. This gives us a name global namespace to
|
527
512
|
# execute the code in.
|
528
513
|
module = self._new_module("__main__")
|
@@ -27,13 +27,16 @@ from typing import (
|
|
27
27
|
Final,
|
28
28
|
Generic,
|
29
29
|
Iterable,
|
30
|
+
Literal,
|
30
31
|
Tuple,
|
31
32
|
TypeVar,
|
32
33
|
Union,
|
34
|
+
cast,
|
35
|
+
get_args,
|
33
36
|
)
|
34
37
|
|
35
38
|
from google.protobuf.message import Message
|
36
|
-
from typing_extensions import TypeAlias
|
39
|
+
from typing_extensions import TypeAlias, TypeGuard
|
37
40
|
|
38
41
|
from streamlit import config, util
|
39
42
|
from streamlit.errors import StreamlitAPIException
|
@@ -64,7 +67,6 @@ if TYPE_CHECKING:
|
|
64
67
|
|
65
68
|
from streamlit.runtime.scriptrunner.script_run_context import ScriptRunContext
|
66
69
|
from streamlit.runtime.state.widgets import NoValue
|
67
|
-
from streamlit.type_util import ValueFieldName
|
68
70
|
|
69
71
|
|
70
72
|
# Protobuf types for all widgets.
|
@@ -110,6 +112,53 @@ WidgetCallback: TypeAlias = Callable[..., None]
|
|
110
112
|
WidgetDeserializer: TypeAlias = Callable[[Any, str], T]
|
111
113
|
WidgetSerializer: TypeAlias = Callable[[T], Any]
|
112
114
|
|
115
|
+
# The array value field names are part of the larger set of possible value
|
116
|
+
# field names. See the explanation for said set below. The message types
|
117
|
+
# associated with these fields are distinguished by storing data in a `data`
|
118
|
+
# field in their messages, meaning they need special treatment in certain
|
119
|
+
# circumstances. Hence, they need their own, dedicated, sub-type.
|
120
|
+
ArrayValueFieldName: TypeAlias = Literal[
|
121
|
+
"double_array_value",
|
122
|
+
"int_array_value",
|
123
|
+
"string_array_value",
|
124
|
+
]
|
125
|
+
|
126
|
+
# A frozenset containing the allowed values of the ArrayValueFieldName type.
|
127
|
+
# Useful for membership checking.
|
128
|
+
_ARRAY_VALUE_FIELD_NAMES: Final = frozenset(
|
129
|
+
cast(
|
130
|
+
"tuple[ArrayValueFieldName, ...]",
|
131
|
+
# NOTE: get_args is not recursive, so this only works as long as
|
132
|
+
# ArrayValueFieldName remains flat.
|
133
|
+
get_args(ArrayValueFieldName),
|
134
|
+
)
|
135
|
+
)
|
136
|
+
|
137
|
+
# These are the possible field names that can be set in the `value` oneof-field
|
138
|
+
# of the WidgetState message (schema found in .proto/WidgetStates.proto).
|
139
|
+
# We need these as a literal type to ensure correspondence with the protobuf
|
140
|
+
# schema in certain parts of the python code.
|
141
|
+
# TODO(harahu): It would be preferable if this type was automatically derived
|
142
|
+
# from the protobuf schema, rather than manually maintained. Not sure how to
|
143
|
+
# achieve that, though.
|
144
|
+
ValueFieldName: TypeAlias = Literal[
|
145
|
+
ArrayValueFieldName,
|
146
|
+
"arrow_value",
|
147
|
+
"bool_value",
|
148
|
+
"bytes_value",
|
149
|
+
"double_value",
|
150
|
+
"file_uploader_state_value",
|
151
|
+
"int_value",
|
152
|
+
"json_value",
|
153
|
+
"string_value",
|
154
|
+
"trigger_value",
|
155
|
+
"string_trigger_value",
|
156
|
+
]
|
157
|
+
|
158
|
+
|
159
|
+
def is_array_value_field_name(obj: object) -> TypeGuard[ArrayValueFieldName]:
|
160
|
+
return obj in _ARRAY_VALUE_FIELD_NAMES
|
161
|
+
|
113
162
|
|
114
163
|
@dataclass(frozen=True)
|
115
164
|
class WidgetMetadata(Generic[T]):
|
@@ -40,13 +40,14 @@ from streamlit.proto.WidgetStates_pb2 import WidgetStates as WidgetStatesProto
|
|
40
40
|
from streamlit.runtime.state.common import (
|
41
41
|
RegisterWidgetResult,
|
42
42
|
T,
|
43
|
+
ValueFieldName,
|
43
44
|
WidgetMetadata,
|
45
|
+
is_array_value_field_name,
|
44
46
|
is_keyed_widget_id,
|
45
47
|
is_widget_id,
|
46
48
|
)
|
47
49
|
from streamlit.runtime.state.query_params import QueryParams
|
48
50
|
from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
|
49
|
-
from streamlit.type_util import ValueFieldName, is_array_value_field_name
|
50
51
|
|
51
52
|
if TYPE_CHECKING:
|
52
53
|
from streamlit.runtime.session_manager import SessionManager
|
@@ -18,11 +18,11 @@ from typing import Any, Final, Iterator, MutableMapping
|
|
18
18
|
|
19
19
|
from streamlit import logger as _logger
|
20
20
|
from streamlit import runtime
|
21
|
+
from streamlit.elements.lib.utils import Key
|
21
22
|
from streamlit.runtime.metrics_util import gather_metrics
|
22
23
|
from streamlit.runtime.state.common import require_valid_user_key
|
23
24
|
from streamlit.runtime.state.safe_session_state import SafeSessionState
|
24
25
|
from streamlit.runtime.state.session_state import SessionState
|
25
|
-
from streamlit.type_util import Key
|
26
26
|
|
27
27
|
_LOGGER: Final = _logger.get_logger(__name__)
|
28
28
|
|
@@ -25,6 +25,7 @@ from streamlit.proto.WidgetStates_pb2 import WidgetState, WidgetStates
|
|
25
25
|
from streamlit.runtime.state.common import (
|
26
26
|
RegisterWidgetResult,
|
27
27
|
T,
|
28
|
+
ValueFieldName,
|
28
29
|
WidgetArgs,
|
29
30
|
WidgetCallback,
|
30
31
|
WidgetDeserializer,
|
@@ -37,7 +38,6 @@ from streamlit.runtime.state.common import (
|
|
37
38
|
|
38
39
|
if TYPE_CHECKING:
|
39
40
|
from streamlit.runtime.scriptrunner import ScriptRunContext
|
40
|
-
from streamlit.type_util import ValueFieldName
|
41
41
|
|
42
42
|
|
43
43
|
ElementType: TypeAlias = str
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.29bca1b5.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.28e3c6e9.js",
|
5
5
|
"static/js/9336.3e046ad7.chunk.js": "./static/js/9336.3e046ad7.chunk.js",
|
6
6
|
"static/js/9330.2b4c99e0.chunk.js": "./static/js/9330.2b4c99e0.chunk.js",
|
7
7
|
"static/js/2736.4336e2b9.chunk.js": "./static/js/2736.4336e2b9.chunk.js",
|
@@ -151,6 +151,6 @@
|
|
151
151
|
},
|
152
152
|
"entrypoints": [
|
153
153
|
"static/css/main.29bca1b5.css",
|
154
|
-
"static/js/main.
|
154
|
+
"static/js/main.28e3c6e9.js"
|
155
155
|
]
|
156
156
|
}
|
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"/><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.
|
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.28e3c6e9.js"></script><link href="./static/css/main.29bca1b5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|