streamlit-nightly 1.33.1.dev20240501__py2.py3-none-any.whl → 1.34.1.dev20240503__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/components/v1/custom_component.py +3 -9
- streamlit/delta_generator.py +32 -208
- streamlit/elements/lib/built_in_chart_utils.py +920 -0
- streamlit/elements/utils.py +1 -14
- streamlit/elements/{arrow_altair.py → vega_charts.py} +301 -836
- streamlit/static/asset-manifest.json +5 -5
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/5441.71804c26.chunk.js +1 -0
- streamlit/static/static/js/7483.64f23be7.chunk.js +2 -0
- streamlit/static/static/js/{main.af77b7ba.js → main.3b0201f6.js} +2 -2
- {streamlit_nightly-1.33.1.dev20240501.dist-info → streamlit_nightly-1.34.1.dev20240503.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.33.1.dev20240501.dist-info → streamlit_nightly-1.34.1.dev20240503.dist-info}/RECORD +19 -20
- streamlit/elements/altair_utils.py +0 -40
- streamlit/elements/arrow_vega_lite.py +0 -229
- streamlit/static/static/js/43.c6749504.chunk.js +0 -1
- streamlit/static/static/js/656.7150a933.chunk.js +0 -2
- /streamlit/static/static/css/{43.e3b876c5.chunk.css → 5441.e3b876c5.chunk.css} +0 -0
- /streamlit/static/static/js/{656.7150a933.chunk.js.LICENSE.txt → 7483.64f23be7.chunk.js.LICENSE.txt} +0 -0
- /streamlit/static/static/js/{main.af77b7ba.js.LICENSE.txt → main.3b0201f6.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.33.1.dev20240501.data → streamlit_nightly-1.34.1.dev20240503.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.33.1.dev20240501.dist-info → streamlit_nightly-1.34.1.dev20240503.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.33.1.dev20240501.dist-info → streamlit_nightly-1.34.1.dev20240503.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.33.1.dev20240501.dist-info → streamlit_nightly-1.34.1.dev20240503.dist-info}/top_level.txt +0 -0
@@ -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/delta_generator.py,sha256
|
13
|
+
streamlit/delta_generator.py,sha256=-wskvHM9NKDUtBoOGorIhkRmHy2tf1kjLJOki9ySwaY,28228
|
14
14
|
streamlit/deprecation_util.py,sha256=3JxWWS424v1kQ-qOq-9sQNYPQ8_UERH3QpYtkWxLP74,6516
|
15
15
|
streamlit/development.py,sha256=iO-KQc62Do9uSwoa5vV2tfImqz3QPhJ1Md6DETcnHkc,813
|
16
16
|
streamlit/echo.py,sha256=s0tT_IXxh7BLHOapRS8syE5Tnm4Djm3-oKO0J0MY1wI,4077
|
@@ -50,7 +50,7 @@ streamlit/components/v1/__init__.py,sha256=I7xa1wfGQY84U_nWWsq1i_HO5kCQ7f0BE5_dE
|
|
50
50
|
streamlit/components/v1/component_arrow.py,sha256=BvqxXmK3tx6zv3Ah0YzVYRNpwJBfh42Yh73VlK-q1PE,4125
|
51
51
|
streamlit/components/v1/component_registry.py,sha256=akLvKVy1x84j21V4jPPt8icxTCSpWdfxSY8o83T8z8w,3773
|
52
52
|
streamlit/components/v1/components.py,sha256=6D51UudnEwOMvMqoZsAlaSiYqY8yXSezlIzdCgdlG0Q,1274
|
53
|
-
streamlit/components/v1/custom_component.py,sha256=
|
53
|
+
streamlit/components/v1/custom_component.py,sha256=W5_rVmbiPwTUPF3KIXCBdhUXzzjxT7ToFzAaTSSaFsY,8869
|
54
54
|
streamlit/connections/__init__.py,sha256=WSOEtrwhiNYti89iCk3O7I83rurZl8gXoM8tA2d_E-U,1083
|
55
55
|
streamlit/connections/base_connection.py,sha256=8rzoGovDem0o3FzJTikP0IRdL7i3lBqHhyESBnER9no,7465
|
56
56
|
streamlit/connections/snowflake_connection.py,sha256=z8yUWzHnoDOriydUc6KbDQStI5emvmqkEUtGf0c-AFc,12517
|
@@ -59,10 +59,7 @@ streamlit/connections/sql_connection.py,sha256=Doi_bshOqNBhR7m42bvE6EPtUaLFBqaPR
|
|
59
59
|
streamlit/connections/util.py,sha256=3Ryc93a5KstsVwQl6ug5cmb8F-WQoD4c0mBWNPLoFsY,3022
|
60
60
|
streamlit/elements/__init__.py,sha256=Vrf1yVMOcTyhUPnYvsfyeL96Vpd5z8KoSV5ZzTcTQgU,616
|
61
61
|
streamlit/elements/alert.py,sha256=nf_Pyr6s7ms8DNDp21__qSsZUddul_mHuXUR7e6rCZk,7432
|
62
|
-
streamlit/elements/altair_utils.py,sha256=dYDP5CiZp7DX3gNX6hXaGw5fgVKuWB4yLTfTVprp8bI,1222
|
63
62
|
streamlit/elements/arrow.py,sha256=TlQ5oa-14zLOKKJ2wXUgiaUgT6PBv0Z3rKpM0YKA3Wg,14558
|
64
|
-
streamlit/elements/arrow_altair.py,sha256=CXUKBQTkVjTimK9zYfxiKAh2GmDNRQQftSdLm5pSgZ8,57049
|
65
|
-
streamlit/elements/arrow_vega_lite.py,sha256=4qbKvKQXLtLNcZ-FWLeBWK1Usaps-kabh1T2PnscKto,7579
|
66
63
|
streamlit/elements/balloons.py,sha256=QnORgG96Opga1SVg8tUBOm-l3nMpKWmjvy1crcS2XaU,1482
|
67
64
|
streamlit/elements/bokeh_chart.py,sha256=4Py_NZaxU22iR6WIvE8fxv3wnJqRRMIvouIiMA7EOqA,3916
|
68
65
|
streamlit/elements/code.py,sha256=zltCajNi2DTPev4w19bdCoq_AJkWs9wRxnn4WEci6qM,2476
|
@@ -90,9 +87,11 @@ streamlit/elements/snow.py,sha256=WHqk8zmfOr5iD0R-wLlAdlIkDDbiaayguTVmA4e7V_Q,14
|
|
90
87
|
streamlit/elements/spinner.py,sha256=ZMJlO-J77lpQZbRPvqJ80ur9u11dBUwJr6JgDct8TLY,2934
|
91
88
|
streamlit/elements/text.py,sha256=-g2LYiJpP2OAdllpd7Df9rhTehIOEuiZN7-u1jwKEio,1856
|
92
89
|
streamlit/elements/toast.py,sha256=pqA14fzEE9rJM4rBgUpXPsu6AeX3XyC5LCHBxXYHQvk,4336
|
93
|
-
streamlit/elements/utils.py,sha256=
|
90
|
+
streamlit/elements/utils.py,sha256=Eo8X2KAa_Pkp7QOfFPKoMRNZ01oYt2DbZuHuqhosZv4,8085
|
91
|
+
streamlit/elements/vega_charts.py,sha256=UkUInq1KjFlwd3fmMi1G-zrN5jXwOGATIV6mqXx1fzU,38336
|
94
92
|
streamlit/elements/write.py,sha256=XYR20zqRcDJ8BQVE3s4mrY6gyWatr9ikXfkFqAod900,20804
|
95
93
|
streamlit/elements/lib/__init__.py,sha256=Vrf1yVMOcTyhUPnYvsfyeL96Vpd5z8KoSV5ZzTcTQgU,616
|
94
|
+
streamlit/elements/lib/built_in_chart_utils.py,sha256=_9zHVXvXtW1MF3GXU3eZm5aqe_IxwnDGu4idfV4fmJI,30666
|
96
95
|
streamlit/elements/lib/column_config_utils.py,sha256=zkm0bY2dYFIhnnIpjZB2nAO9FM7waaSiDKUrSjYXtPU,17226
|
97
96
|
streamlit/elements/lib/column_types.py,sha256=DkSw7CyFKjjjC_cqBNwNFr15C2oyGILOYBshp3-lCCo,51174
|
98
97
|
streamlit/elements/lib/dialog.py,sha256=IflTt5K7iWJPao689D-zXmKK5gd4FwEvtqRBqjOa4ug,5685
|
@@ -329,12 +328,12 @@ streamlit/runtime/state/safe_session_state.py,sha256=StGh9V-tm7MCfohgw5FFfwz8tDw
|
|
329
328
|
streamlit/runtime/state/session_state.py,sha256=jOIrZD94Cn1wrLdPZIcMYPxiGK1gbus1pD4FXSYp4Q4,27500
|
330
329
|
streamlit/runtime/state/session_state_proxy.py,sha256=k2JJ9ZX7rMYjpzeGy0WZaBKYaWnXxrbJC5jqdnRQ3jI,5119
|
331
330
|
streamlit/runtime/state/widgets.py,sha256=lOiEnfBQ1X5_zP9fFB4szOBFCjGHjBzTTQYQOR8rl_g,11263
|
332
|
-
streamlit/static/asset-manifest.json,sha256=
|
331
|
+
streamlit/static/asset-manifest.json,sha256=hVDDOVACq0lC41TIRHCELykMSwIXkitlWUxxCAkHgDU,14511
|
333
332
|
streamlit/static/favicon.png,sha256=if5cVgw7azxKOvV5FpGixga7JLn23rfnHcy1CdWI1-E,1019
|
334
|
-
streamlit/static/index.html,sha256=
|
333
|
+
streamlit/static/index.html,sha256=PRptXUaM6YSAn9wRy9oWLE2JhPNLkW5SZc49xzjOZeI,891
|
335
334
|
streamlit/static/static/css/3092.95a45cfe.chunk.css,sha256=QE-zWROIblgpsp6h00VK9cgGrvagmJ8gBzSbnADMOG0,12090
|
336
335
|
streamlit/static/static/css/3466.8b8f33d6.chunk.css,sha256=4m2lbj1eVFXSaGCRBHZNhqyRz-4Ce9KogjJPxIq6On8,33275
|
337
|
-
streamlit/static/static/css/
|
336
|
+
streamlit/static/static/css/5441.e3b876c5.chunk.css,sha256=XExLUUHInaWJp_m8TtBWhQ88SUuxZl6Jnnw5NA6rwI4,2633
|
338
337
|
streamlit/static/static/css/main.3aaaea00.css,sha256=naXr74hoMHcEtYRIM242vwZvl3yv3waMNyAlBU7_-h8,29246
|
339
338
|
streamlit/static/static/js/1074.73973756.chunk.js,sha256=yYfPwAD3dU5390zR-Bx_1D7daQYbNTWlJLaLS1f-8RQ,5446
|
340
339
|
streamlit/static/static/js/1168.fc5c673b.chunk.js,sha256=DpOH1X5qTepJq4qc_18_Y5oCf-NFtqhZMkkGgYLUzxo,11471
|
@@ -362,7 +361,6 @@ streamlit/static/static/js/4132.49bf3f2c.chunk.js.LICENSE.txt,sha256=426lVBKMW2F
|
|
362
361
|
streamlit/static/static/js/4177.69f9f18d.chunk.js,sha256=BEIcTqNGD5WEz9IlGOGHKQhCxm1pBaesg0hIlvDvH2w,2178
|
363
362
|
streamlit/static/static/js/4253.749d5244.chunk.js,sha256=UP0ycQ9KIgPv05x2hS57QSrhPDFIQtHa8OgI5V-BiZU,395952
|
364
363
|
streamlit/static/static/js/4253.749d5244.chunk.js.LICENSE.txt,sha256=6s4mSSf8NHGJqUCFAj3VgMXZuNYyAzshKRhvxYZTQoU,281
|
365
|
-
streamlit/static/static/js/43.c6749504.chunk.js,sha256=hFyD3uAAE6FjWtWS96ir1kva5oCffAkKjIQvaO9CmoI,8717
|
366
364
|
streamlit/static/static/js/4319.bf1c86bf.chunk.js,sha256=NvS6RzpYc6iEn8V7lyH8reMK1C1_LSpaPzIw0_9OpZY,2412
|
367
365
|
streamlit/static/static/js/4477.e10e4373.chunk.js,sha256=QrFcTqscFOn0zFUDP8AAVhDCXTwB7lL75O2zq_5840k,20661
|
368
366
|
streamlit/static/static/js/4500.b6f348d1.chunk.js,sha256=-lgkjMD-44gw_WlOjkI7v7Ruq1GV0-ZaN6r59gdBJEk,587
|
@@ -372,12 +370,11 @@ streamlit/static/static/js/5106.44f0ff51.chunk.js,sha256=aAGpqRrzVOlFHqBopYM2GLt
|
|
372
370
|
streamlit/static/static/js/5117.04bfe5d3.chunk.js,sha256=X9_mcI6Axh7gJ1vHpnWY3WwvrJP4_8RjDj7lf3Sflps,21681
|
373
371
|
streamlit/static/static/js/5345.65c91ee7.chunk.js,sha256=tIPHPVcIHGQMIy3_4CrO5vbHlLjogYqzHZ42Y1p_FEk,8252
|
374
372
|
streamlit/static/static/js/5379.6571574f.chunk.js,sha256=g19Qe0ubL35F_bDHl42_p7sl_786ddUsysjhbJoERuw,10874
|
373
|
+
streamlit/static/static/js/5441.71804c26.chunk.js,sha256=WVLyEBxGlcM-Z7x4X4Zhpk3ceUmol5D2thE1YWdpvNw,8703
|
375
374
|
streamlit/static/static/js/5791.9a42fb4b.chunk.js,sha256=6j7S1fDfB321ibbChH0lWkP3W2iNCCdJEPhtC-S9STM,107585
|
376
375
|
streamlit/static/static/js/6013.64cd6d28.chunk.js,sha256=tyYAjC8ymQwFtmFrrWOaVNNId9fZf3zMN1DJvpa6FBg,11420
|
377
376
|
streamlit/static/static/js/6150.427a30f5.chunk.js,sha256=BSCJetFTA55kqZsAV6TNWWNztFnVh3TcTF4jjXCJ6dM,2262785
|
378
377
|
streamlit/static/static/js/6405.ac5a6f23.chunk.js,sha256=u7b4I7WVspIbm8eKcgMs2L0aTG3f414AHrJtDsHfwSU,13239
|
379
|
-
streamlit/static/static/js/656.7150a933.chunk.js,sha256=btU9-50zhfLK77d9CwoUX89eE_u_uFyxX0ma3RUsmTc,825783
|
380
|
-
streamlit/static/static/js/656.7150a933.chunk.js.LICENSE.txt,sha256=MFVywCe4fCte7HrHaVpL-jnDWhe9ei9zkyRvRUXQU-4,212
|
381
378
|
streamlit/static/static/js/6718.802da17e.chunk.js,sha256=RhbHOhX-Uk28eSUtfqK_O0TkBhdM0JXUUy8fXc_qmkA,24494
|
382
379
|
streamlit/static/static/js/6853.3cbd385e.chunk.js,sha256=Y3tSlCdc9QNb8QtwunYv4FVUon2-wCRx6m2sovFKb04,1371
|
383
380
|
streamlit/static/static/js/7142.83028745.chunk.js,sha256=B803yufbyma709LcFo35WRl6umQplzb28w6vW25Enzk,88545
|
@@ -385,6 +382,8 @@ streamlit/static/static/js/7175.be4076bc.chunk.js,sha256=JfU4QaXURLwBENyoD7Ni7ky
|
|
385
382
|
streamlit/static/static/js/7217.d970c074.chunk.js,sha256=n14UUP4VpXCKq04hD3C-Vy-d3VShoGxN-cdd0Y140Ho,65522
|
386
383
|
streamlit/static/static/js/7323.2808d029.chunk.js,sha256=_PwOSrkykxt7cwgyHDsQVTTKZgy47IelPIOo50qO55I,3383788
|
387
384
|
streamlit/static/static/js/7323.2808d029.chunk.js.LICENSE.txt,sha256=eaJYPeiNKQAvVx6lv1DR9gIPG1pFwki2pcDLddtfQHw,5061
|
385
|
+
streamlit/static/static/js/7483.64f23be7.chunk.js,sha256=2ihtrBgW82q3fNTRgtxz-8A_9SePe3sW6t_7Kwbt3-I,936700
|
386
|
+
streamlit/static/static/js/7483.64f23be7.chunk.js.LICENSE.txt,sha256=MFVywCe4fCte7HrHaVpL-jnDWhe9ei9zkyRvRUXQU-4,212
|
388
387
|
streamlit/static/static/js/7602.e8abc06b.chunk.js,sha256=DADZDCiAPuadYigGbSyaeDZsnQgXZXKJCL7O1SLUIdU,13275
|
389
388
|
streamlit/static/static/js/7805.51638fbc.chunk.js,sha256=oUqnzsn7iKgtE6g3j9TSNXSs3owN1FejwzCp4V-Rnrk,1069
|
390
389
|
streamlit/static/static/js/8005.43974a35.chunk.js,sha256=0WJomUw6UcQmH5JyhRJbaTUPk52drggGHoau5qKzxoQ,3358
|
@@ -401,8 +400,8 @@ streamlit/static/static/js/937.a1248039.chunk.js.LICENSE.txt,sha256=KAhbcQ1jd_N8
|
|
401
400
|
streamlit/static/static/js/9656.8c935274.chunk.js,sha256=3VB6NT0EQErJUX2SYLQpmNAp19sWI45AbNOQLVjcvII,22113
|
402
401
|
streamlit/static/static/js/9758.6e6d8662.chunk.js,sha256=3Gtwgkru2xQTl1mCxFjILQ_Ppb8DMKySHY5YVhm9ihY,2119
|
403
402
|
streamlit/static/static/js/9865.fd93213d.chunk.js,sha256=Ul2N951ZrAXpJOWo4SV4AKlymjMMNPJxpea3uRt8B_Y,4011
|
404
|
-
streamlit/static/static/js/main.
|
405
|
-
streamlit/static/static/js/main.
|
403
|
+
streamlit/static/static/js/main.3b0201f6.js,sha256=s-wLW2wKVOkH2FWUH7u0moaPVX5XdS3SyXlBhR4-wLo,4402098
|
404
|
+
streamlit/static/static/js/main.3b0201f6.js.LICENSE.txt,sha256=YTeqT7R6idssTgnyi3gf0tRiq18-LiPeDOpsWcnbi34,3184
|
406
405
|
streamlit/static/static/media/KaTeX_AMS-Regular.73ea273a72f4aca30ca5.woff2,sha256=DN04fJWQoan5eUVgAi27WWVKfYbxh6oMgUla1C06cwg,28076
|
407
406
|
streamlit/static/static/media/KaTeX_AMS-Regular.853be92419a6c3766b9a.ttf,sha256=aFNIQLz90r_7bw6N60hoTdAefwTqKBMmdXevuQbeHRM,63632
|
408
407
|
streamlit/static/static/media/KaTeX_AMS-Regular.d562e886c52f12660a41.woff,sha256=MNqR6EyJP4deJSaJ-uvcWQsocRReitx_mp1NvYzgslE,33516
|
@@ -521,9 +520,9 @@ streamlit/web/server/server_util.py,sha256=FptUF-CjFh78VjeTQDi3R78m7E64MDe3wcklg
|
|
521
520
|
streamlit/web/server/stats_request_handler.py,sha256=cL__KbJFIhdhf1Zt6skbLehUqT-jo56x1HARxogZDOI,3680
|
522
521
|
streamlit/web/server/upload_file_request_handler.py,sha256=YPDmKWUnaGH9d4QNcMEsY5k1YIz_q-xW1K5fmgHaDzc,4966
|
523
522
|
streamlit/web/server/websocket_headers.py,sha256=07SkWLcOxbyldl7UcBzrMKY9ZojypCQACiKoh5FcH7Y,1870
|
524
|
-
streamlit_nightly-1.
|
525
|
-
streamlit_nightly-1.
|
526
|
-
streamlit_nightly-1.
|
527
|
-
streamlit_nightly-1.
|
528
|
-
streamlit_nightly-1.
|
529
|
-
streamlit_nightly-1.
|
523
|
+
streamlit_nightly-1.34.1.dev20240503.data/scripts/streamlit.cmd,sha256=ZEYM3vBJSp-k7vwSJ3ba5NzEk9-qHdSeLvGYAAe1mMw,676
|
524
|
+
streamlit_nightly-1.34.1.dev20240503.dist-info/METADATA,sha256=_RVCmBTIb6TJSbjE1Ut-xUABmFta4krc_yY8GhlIj-g,8528
|
525
|
+
streamlit_nightly-1.34.1.dev20240503.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
526
|
+
streamlit_nightly-1.34.1.dev20240503.dist-info/entry_points.txt,sha256=uNJ4DwGNXEhOK0USwSNanjkYyR-Bk7eYQbJFDrWyOgY,53
|
527
|
+
streamlit_nightly-1.34.1.dev20240503.dist-info/top_level.txt,sha256=V3FhKbm7G2LnR0s4SytavrjIPNIhvcsAGXfYHAwtQzw,10
|
528
|
+
streamlit_nightly-1.34.1.dev20240503.dist-info/RECORD,,
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
"""Useful classes for our native Altair-based charts.
|
16
|
-
|
17
|
-
These classes are used to pass some important info to add_rows.
|
18
|
-
"""
|
19
|
-
|
20
|
-
from __future__ import annotations
|
21
|
-
|
22
|
-
from dataclasses import dataclass
|
23
|
-
from typing import Hashable, TypedDict
|
24
|
-
|
25
|
-
|
26
|
-
class PrepDataColumns(TypedDict):
|
27
|
-
"""Columns used for the prep_data step in Altair Arrow charts."""
|
28
|
-
|
29
|
-
x_column: str | None
|
30
|
-
y_column_list: list[str]
|
31
|
-
color_column: str | None
|
32
|
-
size_column: str | None
|
33
|
-
|
34
|
-
|
35
|
-
@dataclass
|
36
|
-
class AddRowsMetadata:
|
37
|
-
"""Metadata needed by add_rows on native charts."""
|
38
|
-
|
39
|
-
last_index: Hashable | None
|
40
|
-
columns: PrepDataColumns
|
@@ -1,229 +0,0 @@
|
|
1
|
-
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
"""A Python wrapper around Vega-Lite."""
|
16
|
-
|
17
|
-
from __future__ import annotations
|
18
|
-
|
19
|
-
import json
|
20
|
-
from typing import TYPE_CHECKING, Any, Literal, cast
|
21
|
-
|
22
|
-
import streamlit.elements.lib.dicttools as dicttools
|
23
|
-
from streamlit.elements import arrow
|
24
|
-
from streamlit.elements.arrow import Data
|
25
|
-
from streamlit.errors import StreamlitAPIException
|
26
|
-
from streamlit.proto.ArrowVegaLiteChart_pb2 import (
|
27
|
-
ArrowVegaLiteChart as ArrowVegaLiteChartProto,
|
28
|
-
)
|
29
|
-
from streamlit.runtime.metrics_util import gather_metrics
|
30
|
-
|
31
|
-
if TYPE_CHECKING:
|
32
|
-
from streamlit.delta_generator import DeltaGenerator
|
33
|
-
|
34
|
-
|
35
|
-
class ArrowVegaLiteMixin:
|
36
|
-
@gather_metrics("vega_lite_chart")
|
37
|
-
def vega_lite_chart(
|
38
|
-
self,
|
39
|
-
data: Data = None,
|
40
|
-
spec: dict[str, Any] | None = None,
|
41
|
-
use_container_width: bool = False,
|
42
|
-
theme: Literal["streamlit"] | None = "streamlit",
|
43
|
-
**kwargs: Any,
|
44
|
-
) -> DeltaGenerator:
|
45
|
-
"""Display a chart using the Vega-Lite library.
|
46
|
-
|
47
|
-
Parameters
|
48
|
-
----------
|
49
|
-
data : pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None
|
50
|
-
Either the data to be plotted or a Vega-Lite spec containing the
|
51
|
-
data (which more closely follows the Vega-Lite API).
|
52
|
-
|
53
|
-
spec : dict or None
|
54
|
-
The Vega-Lite spec for the chart. If the spec was already passed in
|
55
|
-
the previous argument, this must be set to None. See
|
56
|
-
https://vega.github.io/vega-lite/docs/ for more info.
|
57
|
-
|
58
|
-
use_container_width : bool
|
59
|
-
If True, set the chart width to the column width. This takes
|
60
|
-
precedence over Vega-Lite's native `width` value.
|
61
|
-
|
62
|
-
theme : "streamlit" or None
|
63
|
-
The theme of the chart. Currently, we only support "streamlit" for the Streamlit
|
64
|
-
defined design or None to fallback to the default behavior of the library.
|
65
|
-
|
66
|
-
**kwargs : any
|
67
|
-
Same as spec, but as keywords.
|
68
|
-
|
69
|
-
Example
|
70
|
-
-------
|
71
|
-
>>> import streamlit as st
|
72
|
-
>>> import pandas as pd
|
73
|
-
>>> import numpy as np
|
74
|
-
>>>
|
75
|
-
>>> chart_data = pd.DataFrame(np.random.randn(200, 3), columns=["a", "b", "c"])
|
76
|
-
>>>
|
77
|
-
>>> st.vega_lite_chart(
|
78
|
-
... chart_data,
|
79
|
-
... {
|
80
|
-
... "mark": {"type": "circle", "tooltip": True},
|
81
|
-
... "encoding": {
|
82
|
-
... "x": {"field": "a", "type": "quantitative"},
|
83
|
-
... "y": {"field": "b", "type": "quantitative"},
|
84
|
-
... "size": {"field": "c", "type": "quantitative"},
|
85
|
-
... "color": {"field": "c", "type": "quantitative"},
|
86
|
-
... },
|
87
|
-
... },
|
88
|
-
... )
|
89
|
-
|
90
|
-
.. output::
|
91
|
-
https://doc-vega-lite-chart.streamlit.app/
|
92
|
-
height: 300px
|
93
|
-
|
94
|
-
Examples of Vega-Lite usage without Streamlit can be found at
|
95
|
-
https://vega.github.io/vega-lite/examples/. Most of those can be easily
|
96
|
-
translated to the syntax shown above.
|
97
|
-
|
98
|
-
"""
|
99
|
-
if theme != "streamlit" and theme != None:
|
100
|
-
raise StreamlitAPIException(
|
101
|
-
f'You set theme="{theme}" while Streamlit charts only support theme=”streamlit” or theme=None to fallback to the default library theme.'
|
102
|
-
)
|
103
|
-
proto = ArrowVegaLiteChartProto()
|
104
|
-
marshall(
|
105
|
-
proto,
|
106
|
-
data,
|
107
|
-
spec,
|
108
|
-
use_container_width=use_container_width,
|
109
|
-
theme=theme,
|
110
|
-
**kwargs,
|
111
|
-
)
|
112
|
-
return self.dg._enqueue("arrow_vega_lite_chart", proto)
|
113
|
-
|
114
|
-
@property
|
115
|
-
def dg(self) -> DeltaGenerator:
|
116
|
-
"""Get our DeltaGenerator."""
|
117
|
-
return cast("DeltaGenerator", self)
|
118
|
-
|
119
|
-
|
120
|
-
def marshall(
|
121
|
-
proto: ArrowVegaLiteChartProto,
|
122
|
-
data: Data = None,
|
123
|
-
spec: dict[str, Any] | None = None,
|
124
|
-
use_container_width: bool = False,
|
125
|
-
theme: None | Literal["streamlit"] = "streamlit",
|
126
|
-
**kwargs,
|
127
|
-
):
|
128
|
-
"""Construct a Vega-Lite chart object.
|
129
|
-
|
130
|
-
See DeltaGenerator.vega_lite_chart for docs.
|
131
|
-
"""
|
132
|
-
# Support passing data inside spec['datasets'] and spec['data'].
|
133
|
-
# (The data gets pulled out of the spec dict later on.)
|
134
|
-
if isinstance(data, dict) and spec is None:
|
135
|
-
spec = data
|
136
|
-
data = None
|
137
|
-
|
138
|
-
# Support passing no spec arg, but filling it with kwargs.
|
139
|
-
# Example:
|
140
|
-
# marshall(proto, baz='boz')
|
141
|
-
if spec is None:
|
142
|
-
spec = dict()
|
143
|
-
else:
|
144
|
-
# Clone the spec dict, since we may be mutating it.
|
145
|
-
spec = dict(spec)
|
146
|
-
|
147
|
-
# Support passing in kwargs. Example:
|
148
|
-
# marshall(proto, {foo: 'bar'}, baz='boz')
|
149
|
-
if len(kwargs):
|
150
|
-
# Merge spec with unflattened kwargs, where kwargs take precedence.
|
151
|
-
# This only works for string keys, but kwarg keys are strings anyways.
|
152
|
-
spec = dict(spec, **dicttools.unflatten(kwargs, _CHANNELS))
|
153
|
-
|
154
|
-
if len(spec) == 0:
|
155
|
-
raise ValueError("Vega-Lite charts require a non-empty spec dict.")
|
156
|
-
|
157
|
-
if "autosize" not in spec:
|
158
|
-
# type fit does not work for many chart types. This change focuses
|
159
|
-
# on vconcat with use_container_width=True as there are unintended
|
160
|
-
# consequences of changing the default autosize for all charts.
|
161
|
-
# fit-x fits the width and height can be adjusted.
|
162
|
-
if "vconcat" in spec and use_container_width:
|
163
|
-
spec["autosize"] = {"type": "fit-x", "contains": "padding"}
|
164
|
-
else:
|
165
|
-
spec["autosize"] = {"type": "fit", "contains": "padding"}
|
166
|
-
|
167
|
-
# Pull data out of spec dict when it's in a 'datasets' key:
|
168
|
-
# marshall(proto, {datasets: {foo: df1, bar: df2}, ...})
|
169
|
-
if "datasets" in spec:
|
170
|
-
for k, v in spec["datasets"].items():
|
171
|
-
dataset = proto.datasets.add()
|
172
|
-
dataset.name = str(k)
|
173
|
-
dataset.has_name = True
|
174
|
-
arrow.marshall(dataset.data, v)
|
175
|
-
del spec["datasets"]
|
176
|
-
|
177
|
-
# Pull data out of spec dict when it's in a top-level 'data' key:
|
178
|
-
# marshall(proto, {data: df})
|
179
|
-
# marshall(proto, {data: {values: df, ...}})
|
180
|
-
# marshall(proto, {data: {url: 'url'}})
|
181
|
-
# marshall(proto, {data: {name: 'foo'}})
|
182
|
-
if "data" in spec:
|
183
|
-
data_spec = spec["data"]
|
184
|
-
|
185
|
-
if isinstance(data_spec, dict):
|
186
|
-
if "values" in data_spec:
|
187
|
-
data = data_spec["values"]
|
188
|
-
del spec["data"]
|
189
|
-
else:
|
190
|
-
data = data_spec
|
191
|
-
del spec["data"]
|
192
|
-
|
193
|
-
proto.spec = json.dumps(spec)
|
194
|
-
proto.use_container_width = use_container_width
|
195
|
-
proto.theme = theme or ""
|
196
|
-
|
197
|
-
if data is not None:
|
198
|
-
arrow.marshall(proto.data, data)
|
199
|
-
|
200
|
-
|
201
|
-
# See https://vega.github.io/vega-lite/docs/encoding.html
|
202
|
-
_CHANNELS = {
|
203
|
-
"x",
|
204
|
-
"y",
|
205
|
-
"x2",
|
206
|
-
"y2",
|
207
|
-
"xError",
|
208
|
-
"xError2",
|
209
|
-
"yError",
|
210
|
-
"yError2",
|
211
|
-
"longitude",
|
212
|
-
"latitude",
|
213
|
-
"color",
|
214
|
-
"opacity",
|
215
|
-
"fillOpacity",
|
216
|
-
"strokeOpacity",
|
217
|
-
"strokeWidth",
|
218
|
-
"size",
|
219
|
-
"shape",
|
220
|
-
"text",
|
221
|
-
"tooltip",
|
222
|
-
"href",
|
223
|
-
"key",
|
224
|
-
"order",
|
225
|
-
"detail",
|
226
|
-
"facet",
|
227
|
-
"row",
|
228
|
-
"column",
|
229
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[43],{10043:(t,e,o)=>{o.r(e),o.d(e,{default:()=>W});var n=o(66845),i=o(25621),a=o(41558),s=o(91149),r=o(60784),l=o(23849),d=o(62622),c=o(63765),h=o(91191),g=o(96825),u=o.n(g),m=o(99394),f=o.n(m),p=o(27466);function b(t,e){const o={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:e.fontSizes.smPx+2,orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.mdPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal"},axis:{labelFontSize:e.fontSizes.twoSmPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:e.fontSizes.smPx,titleColor:(0,p.Xy)(e),titleFontStyle:"normal",ticks:!1,gridColor:(0,p.ny)(e),domain:!1,domainWidth:1,domainColor:(0,p.ny)(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:e.spacing.lgPx,labelPadding:e.spacing.lgPx,labelSeparation:e.spacing.twoXSPx,labelOverlap:!0},legend:{labelFontSize:e.fontSizes.smPx,labelFontWeight:e.fontWeights.normal,labelColor:(0,p.Xy)(e),titleFontSize:e.fontSizes.smPx,titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:(0,p.Xy)(e),titlePadding:5,labelPadding:e.spacing.lgPx,columnPadding:e.spacing.smPx,rowPadding:e.spacing.twoXSPx,padding:7,symbolStrokeWidth:4},range:{category:(0,p.iY)(e),diverging:(0,p.ru)(e),ramp:(0,p.Gy)(e),heatmap:(0,p.Gy)(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:350,continuousWidth:400,discreteHeight:350,discreteWidth:{step:20}},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,...(0,p.Iy)(e)?{color:"#0068C9"}:{color:"#83C9FF"}},bar:{binSpacing:e.spacing.twoXSPx,discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?f()({},o,t,((t,e)=>Array.isArray(e)?e:void 0)):o}const y=(0,o(1515).Z)("div",{target:"egd2k5h0"})((t=>{let{theme:e,useContainerWidth:o,isFullScreen:n}=t;return{width:o||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&.has-actions":{paddingRight:0},".vega-actions":{zIndex:e.zIndices.popupMenu,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:"1px solid ".concat(e.colors.fadedText10),a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:"".concat(e.spacing.twoXS," ").concat(e.spacing.twoXL),color:e.colors.bodyText},"a:hover":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},summary:{opacity:0,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.lg,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms","&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25}}}}}),"");var w=o(40864);const v={DATAFRAME_INDEX:"(index)"},x="source",S=new Set([h.GI.DatetimeIndex,h.GI.Float64Index,h.GI.Int64Index,h.GI.RangeIndex,h.GI.UInt64Index]);class F extends n.PureComponent{constructor(){super(...arguments),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=x,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{var t,e;const{element:o,theme:n,isFullScreen:i,width:a,height:s}=this.props,r=JSON.parse(o.spec),{useContainerWidth:l}=o;if("streamlit"===o.vegaLiteTheme?r.config=b(r.config,n):"streamlit"===(null===(t=r.usermeta)||void 0===t||null===(e=t.embedOptions)||void 0===e?void 0:e.theme)?(r.config=b(r.config,n),r.usermeta.embedOptions.theme=void 0):r.config=function(t,e){const{colors:o,fontSizes:n,genericFonts:i}=e,a={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:n.twoSmPx,titleFontSize:n.twoSmPx},s={background:o.bgColor,axis:{labelColor:o.bodyText,titleColor:o.bodyText,gridColor:(0,p.ny)(e),...a},legend:{labelColor:o.bodyText,titleColor:o.bodyText,...a},title:{color:o.bodyText,subtitleColor:o.bodyText,...a},header:{labelColor:o.bodyText,titleColor:o.bodyText,...a},view:{stroke:(0,p.ny)(e),continuousHeight:350,continuousWidth:400,discreteHeight:350,discreteWidth:{step:20}},mark:{tooltip:!0}};return t?u()({},s,t):s}(r.config,n),i?(r.width=a,r.height=s,"vconcat"in r&&r.vconcat.forEach((t=>{t.width=a}))):l&&(r.width=a,"vconcat"in r&&r.vconcat.forEach((t=>{t.width=a}))),r.padding||(r.padding={}),null==r.padding.bottom&&(r.padding.bottom=20),r.datasets)throw new Error("Datasets should not be passed as part of the spec");return r}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,c.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:o}=t,{element:n,theme:i}=this.props,a=e.spec,{spec:s}=n;if(!this.vegaView||a!==s||o!==i||t.width!==this.props.width||t.height!==this.props.height||t.element.vegaLiteTheme!==this.props.element.vegaLiteTheme){(0,l.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,c.b)(u);this.setState({error:t})}return}const r=e.data,{data:d}=n;(r||d)&&this.updateData(this.defaultDataName,r,d);const h=z(e)||{},g=z(n)||{};for(const[l,c]of Object.entries(g)){const t=l||this.defaultDataName,e=h[t];this.updateData(t,e,c)}for(const l of Object.keys(h))g.hasOwnProperty(l)||l===this.defaultDataName||this.updateData(l,null,null);this.vegaView.resize().runAsync()}updateData(t,e,o){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!o||0===o.data.numRows){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,s.truthy))}if(!e||0===e.data.numRows)return void this.vegaView.insert(t,C(o));const{dataRows:n,dataColumns:i}=e.dimensions,{dataRows:a,dataColumns:r}=o.dimensions;if(function(t,e,o,n,i,a){if(o!==a)return!1;if(e>=i)return!1;if(0===e)return!1;const s=a-1,r=e-1;if(t.getDataValue(0,s)!==n.getDataValue(0,s)||t.getDataValue(r,s)!==n.getDataValue(r,s))return!1;return!0}(e,n,i,o,a,r))n<a&&this.vegaView.insert(t,C(o,n));else{const e=s.changeset().remove(s.truthy).insert(C(o));this.vegaView.change(t,e),(0,l.ji)("Had to clear the ".concat(t," dataset before inserting data through Vega view."))}}async createView(){if((0,l.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),o={ast:!0,expr:r.N,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:n,view:i,finalize:s}=await(0,a.ZP)(this.element,e,o);this.vegaView=i,this.vegaFinalizer=s;const d=function(t){const e=z(t);if(null==e)return null;const o={};for(const[n,i]of Object.entries(e))o[n]=C(i);return o}(t),c=d?Object.keys(d):[];if(1===c.length){const[t]=c;this.defaultDataName=t}else 0===c.length&&n.data&&(this.defaultDataName=x);const h=function(t){const e=t.data;if(!e||0===e.data.numRows)return null;return C(e)}(t);if(h&&i.insert(this.defaultDataName,h),d)for(const[a,r]of Object.entries(d))i.insert(a,r);await i.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,w.jsx)(y,{"data-testid":"stArrowVegaLiteChart",useContainerWidth:this.props.element.useContainerWidth,isFullScreen:this.props.isFullScreen,ref:t=>{this.element=t}})}}function z(t){var e;if(0===(null===(e=t.datasets)||void 0===e?void 0:e.length))return null;const o={};return t.datasets.forEach((t=>{if(!t)return;const e=t.hasName?t.name:null;o[e]=t.data})),o}function C(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.isEmpty())return[];const o=[],{dataRows:n,dataColumns:i}=t.dimensions,a=h.fu.getTypeName(t.types.index[0]),s=S.has(a);for(let r=e;r<n;r++){const e={};if(s){const o=t.getIndexValue(r,0);e[v.DATAFRAME_INDEX]="bigint"===typeof o?Number(o):o}for(let o=0;o<i;o++){const n=t.getDataValue(r,o),i=t.types.data[o],a=h.fu.getTypeName(i);if("datetimetz"!==a&&(n instanceof Date||Number.isFinite(n))&&(a.startsWith("datetime")||"date"===a)){const i=60*new Date(n).getTimezoneOffset()*1e3;e[t.columns[0][o]]=n.valueOf()+i}else e[t.columns[0][o]]="bigint"===typeof n?Number(n):n}o.push(e)}return o}const W=(0,i.b)((0,d.Z)(F))}}]);
|