streamlit-nightly 1.29.1.dev20240109__py2.py3-none-any.whl → 1.30.1.dev20240111__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/snowflake_connection.py +4 -1
- streamlit/connections/util.py +8 -5
- streamlit/runtime/caching/cache_data_api.py +2 -2
- streamlit/runtime/caching/cache_resource_api.py +2 -2
- streamlit/runtime/forward_msg_cache.py +2 -2
- streamlit/runtime/memory_media_file_storage.py +2 -2
- streamlit/runtime/memory_uploaded_file_manager.py +3 -2
- streamlit/runtime/state/session_state.py +2 -2
- streamlit/runtime/stats.py +24 -20
- streamlit/static/asset-manifest.json +2 -2
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{main.3ab8e8d9.js → main.673a9494.js} +2 -2
- streamlit/testing/v1/element_tree.py +7 -0
- {streamlit_nightly-1.29.1.dev20240109.dist-info → streamlit_nightly-1.30.1.dev20240111.dist-info}/METADATA +2 -2
- {streamlit_nightly-1.29.1.dev20240109.dist-info → streamlit_nightly-1.30.1.dev20240111.dist-info}/RECORD +20 -20
- /streamlit/static/static/js/{main.3ab8e8d9.js.LICENSE.txt → main.673a9494.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.29.1.dev20240109.data → streamlit_nightly-1.30.1.dev20240111.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.29.1.dev20240109.dist-info → streamlit_nightly-1.30.1.dev20240111.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.29.1.dev20240109.dist-info → streamlit_nightly-1.30.1.dev20240111.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.29.1.dev20240109.dist-info → streamlit_nightly-1.30.1.dev20240111.dist-info}/top_level.txt +0 -0
@@ -52,11 +52,14 @@ class SnowflakeConnection(BaseConnection["InternalSnowflakeConnection"]):
|
|
52
52
|
def _connect(self, **kwargs) -> "InternalSnowflakeConnection":
|
53
53
|
import snowflake.connector # type:ignore[import]
|
54
54
|
from snowflake.connector import Error as SnowflakeError # type:ignore[import]
|
55
|
-
from snowflake.snowpark.context import get_active_session # type:ignore[import]
|
56
55
|
|
57
56
|
# If we're running in SiS, just call get_active_session() and retrieve the
|
58
57
|
# lower-level connection from it.
|
59
58
|
if running_in_sis():
|
59
|
+
from snowflake.snowpark.context import ( # type:ignore[import] # isort: skip
|
60
|
+
get_active_session,
|
61
|
+
)
|
62
|
+
|
60
63
|
session = get_active_session()
|
61
64
|
|
62
65
|
if hasattr(session, "connection"):
|
streamlit/connections/util.py
CHANGED
@@ -81,8 +81,11 @@ def load_from_snowsql_config_file(connection_name: str) -> Dict[str, Any]:
|
|
81
81
|
|
82
82
|
def running_in_sis() -> bool:
|
83
83
|
"""Return whether this app is running in SiS."""
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
try:
|
85
|
+
from snowflake.snowpark._internal.utils import ( # type: ignore[import] # isort: skip
|
86
|
+
is_in_stored_procedure,
|
87
|
+
)
|
88
|
+
|
89
|
+
return cast(bool, is_in_stored_procedure())
|
90
|
+
except ModuleNotFoundError:
|
91
|
+
return False
|
@@ -60,7 +60,7 @@ from streamlit.runtime.caching.storage.dummy_cache_storage import (
|
|
60
60
|
)
|
61
61
|
from streamlit.runtime.metrics_util import gather_metrics
|
62
62
|
from streamlit.runtime.scriptrunner.script_run_context import get_script_run_ctx
|
63
|
-
from streamlit.runtime.stats import CacheStat, CacheStatsProvider
|
63
|
+
from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
|
64
64
|
|
65
65
|
_LOGGER = get_logger(__name__)
|
66
66
|
|
@@ -236,7 +236,7 @@ class DataCaches(CacheStatsProvider):
|
|
236
236
|
stats: list[CacheStat] = []
|
237
237
|
for cache in function_caches.values():
|
238
238
|
stats.extend(cache.get_stats())
|
239
|
-
return stats
|
239
|
+
return group_stats(stats)
|
240
240
|
|
241
241
|
def validate_cache_params(
|
242
242
|
self,
|
@@ -47,7 +47,7 @@ from streamlit.runtime.caching.cached_message_replay import (
|
|
47
47
|
from streamlit.runtime.caching.hashing import HashFuncsDict
|
48
48
|
from streamlit.runtime.metrics_util import gather_metrics
|
49
49
|
from streamlit.runtime.scriptrunner.script_run_context import get_script_run_ctx
|
50
|
-
from streamlit.runtime.stats import CacheStat, CacheStatsProvider
|
50
|
+
from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
|
51
51
|
from streamlit.vendor.pympler.asizeof import asizeof
|
52
52
|
|
53
53
|
_LOGGER = get_logger(__name__)
|
@@ -131,7 +131,7 @@ class ResourceCaches(CacheStatsProvider):
|
|
131
131
|
stats: list[CacheStat] = []
|
132
132
|
for cache in function_caches.values():
|
133
133
|
stats.extend(cache.get_stats())
|
134
|
-
return stats
|
134
|
+
return group_stats(stats)
|
135
135
|
|
136
136
|
|
137
137
|
# Singleton ResourceCaches instance
|
@@ -19,7 +19,7 @@ from weakref import WeakKeyDictionary
|
|
19
19
|
from streamlit import config, util
|
20
20
|
from streamlit.logger import get_logger
|
21
21
|
from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
|
22
|
-
from streamlit.runtime.stats import CacheStat, CacheStatsProvider
|
22
|
+
from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
|
23
23
|
from streamlit.util import HASHLIB_KWARGS
|
24
24
|
|
25
25
|
if TYPE_CHECKING:
|
@@ -292,4 +292,4 @@ class ForwardMsgCache(CacheStatsProvider):
|
|
292
292
|
byte_length=entry.msg.ByteSize() if entry.msg is not None else 0,
|
293
293
|
)
|
294
294
|
)
|
295
|
-
return stats
|
295
|
+
return group_stats(stats)
|
@@ -28,7 +28,7 @@ from streamlit.runtime.media_file_storage import (
|
|
28
28
|
MediaFileStorage,
|
29
29
|
MediaFileStorageError,
|
30
30
|
)
|
31
|
-
from streamlit.runtime.stats import CacheStat, CacheStatsProvider
|
31
|
+
from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
|
32
32
|
from streamlit.util import HASHLIB_KWARGS
|
33
33
|
|
34
34
|
LOGGER = get_logger(__name__)
|
@@ -181,4 +181,4 @@ class MemoryMediaFileStorage(MediaFileStorage, CacheStatsProvider):
|
|
181
181
|
byte_length=len(file.content),
|
182
182
|
)
|
183
183
|
)
|
184
|
-
return stats
|
184
|
+
return group_stats(stats)
|
@@ -18,7 +18,7 @@ from typing import Dict, List, Sequence
|
|
18
18
|
|
19
19
|
from streamlit import util
|
20
20
|
from streamlit.logger import get_logger
|
21
|
-
from streamlit.runtime.stats import CacheStat
|
21
|
+
from streamlit.runtime.stats import CacheStat, group_stats
|
22
22
|
from streamlit.runtime.uploaded_file_manager import (
|
23
23
|
UploadedFileManager,
|
24
24
|
UploadedFileRec,
|
@@ -125,7 +125,7 @@ class MemoryUploadedFileManager(UploadedFileManager):
|
|
125
125
|
for session_storage in file_storage_copy.values():
|
126
126
|
all_files.extend(session_storage.values())
|
127
127
|
|
128
|
-
|
128
|
+
stats: List[CacheStat] = [
|
129
129
|
CacheStat(
|
130
130
|
category_name="UploadedFileManager",
|
131
131
|
cache_name="",
|
@@ -133,3 +133,4 @@ class MemoryUploadedFileManager(UploadedFileManager):
|
|
133
133
|
)
|
134
134
|
for file in all_files
|
135
135
|
]
|
136
|
+
return group_stats(stats)
|
@@ -43,7 +43,7 @@ from streamlit.runtime.state.common import (
|
|
43
43
|
is_widget_id,
|
44
44
|
)
|
45
45
|
from streamlit.runtime.state.query_params import QueryParams
|
46
|
-
from streamlit.runtime.stats import CacheStat, CacheStatsProvider
|
46
|
+
from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
|
47
47
|
from streamlit.type_util import ValueFieldName, is_array_value_field_name
|
48
48
|
from streamlit.vendor.pympler.asizeof import asizeof
|
49
49
|
|
@@ -677,4 +677,4 @@ class SessionStateStatProvider(CacheStatsProvider):
|
|
677
677
|
for session_info in self._session_mgr.list_active_sessions():
|
678
678
|
session_state = session_info.session.session_state
|
679
679
|
stats.extend(session_state.get_stats())
|
680
|
-
return stats
|
680
|
+
return group_stats(stats)
|
streamlit/runtime/stats.py
CHANGED
@@ -11,7 +11,6 @@
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
|
-
|
15
14
|
import itertools
|
16
15
|
from abc import abstractmethod
|
17
16
|
from typing import List, NamedTuple
|
@@ -63,6 +62,28 @@ class CacheStat(NamedTuple):
|
|
63
62
|
metric_point.gauge_value.int_value = self.byte_length
|
64
63
|
|
65
64
|
|
65
|
+
def group_stats(stats: List[CacheStat]) -> List[CacheStat]:
|
66
|
+
"""Group a list of CacheStats by category_name and cache_name and sum byte_length"""
|
67
|
+
|
68
|
+
def key_function(individual_stat):
|
69
|
+
return individual_stat.category_name, individual_stat.cache_name
|
70
|
+
|
71
|
+
result: List[CacheStat] = []
|
72
|
+
|
73
|
+
sorted_stats = sorted(stats, key=key_function)
|
74
|
+
grouped_stats = itertools.groupby(sorted_stats, key=key_function)
|
75
|
+
|
76
|
+
for (category_name, cache_name), single_group_stats in grouped_stats:
|
77
|
+
result.append(
|
78
|
+
CacheStat(
|
79
|
+
category_name=category_name,
|
80
|
+
cache_name=cache_name,
|
81
|
+
byte_length=sum(map(lambda item: item.byte_length, single_group_stats)),
|
82
|
+
)
|
83
|
+
)
|
84
|
+
return result
|
85
|
+
|
86
|
+
|
66
87
|
@runtime_checkable
|
67
88
|
class CacheStatsProvider(Protocol):
|
68
89
|
@abstractmethod
|
@@ -82,26 +103,9 @@ class StatsManager:
|
|
82
103
|
self._cache_stats_providers.append(provider)
|
83
104
|
|
84
105
|
def get_stats(self) -> List[CacheStat]:
|
85
|
-
"""Return a list containing all stats from each registered provider.
|
86
|
-
Stats are grouped by category_name and cache_type."""
|
106
|
+
"""Return a list containing all stats from each registered provider."""
|
87
107
|
all_stats: List[CacheStat] = []
|
88
108
|
for provider in self._cache_stats_providers:
|
89
|
-
|
90
|
-
grouped_stats = itertools.groupby(
|
91
|
-
provider_stats,
|
92
|
-
lambda individual_stat: (
|
93
|
-
individual_stat.category_name,
|
94
|
-
individual_stat.cache_name,
|
95
|
-
),
|
96
|
-
)
|
97
|
-
|
98
|
-
for (category_name, cache_name), stats in grouped_stats:
|
99
|
-
all_stats.append(
|
100
|
-
CacheStat(
|
101
|
-
category_name=category_name,
|
102
|
-
cache_name=cache_name,
|
103
|
-
byte_length=sum(map(lambda item: item.byte_length, stats)),
|
104
|
-
)
|
105
|
-
)
|
109
|
+
all_stats.extend(provider.get_stats())
|
106
110
|
|
107
111
|
return all_stats
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.77d1c464.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.673a9494.js",
|
5
5
|
"static/js/9336.2d95d840.chunk.js": "./static/js/9336.2d95d840.chunk.js",
|
6
6
|
"static/js/9330.c0dd1723.chunk.js": "./static/js/9330.c0dd1723.chunk.js",
|
7
7
|
"static/js/7217.d970c074.chunk.js": "./static/js/7217.d970c074.chunk.js",
|
@@ -149,6 +149,6 @@
|
|
149
149
|
},
|
150
150
|
"entrypoints": [
|
151
151
|
"static/css/main.77d1c464.css",
|
152
|
-
"static/js/main.
|
152
|
+
"static/js/main.673a9494.js"
|
153
153
|
]
|
154
154
|
}
|
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.673a9494.js"></script><link href="./static/css/main.77d1c464.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|