solara 1.30.1__py2.py3-none-any.whl → 1.31.0__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.
- {solara-1.30.1.dist-info → solara-1.31.0.dist-info}/METADATA +7 -42
- solara-1.31.0.dist-info/RECORD +5 -0
- {solara-1.30.1.dist-info → solara-1.31.0.dist-info}/WHEEL +1 -1
- {solara/template/portal → solara-1.31.0.dist-info/licenses}/LICENSE +1 -1
- solara/__init__.py +0 -123
- solara/__main__.py +0 -734
- solara/alias.py +0 -6
- solara/autorouting.py +0 -545
- solara/cache.py +0 -294
- solara/checks.html +0 -71
- solara/checks.py +0 -224
- solara/comm.py +0 -28
- solara/components/__init__.py +0 -59
- solara/components/alert.py +0 -155
- solara/components/applayout.py +0 -393
- solara/components/button.py +0 -85
- solara/components/card.py +0 -87
- solara/components/checkbox.py +0 -50
- solara/components/code_highlight_css.py +0 -11
- solara/components/code_highlight_css.vue +0 -63
- solara/components/columns.py +0 -159
- solara/components/component_vue.py +0 -110
- solara/components/cross_filter.py +0 -335
- solara/components/dataframe.py +0 -546
- solara/components/datatable.py +0 -221
- solara/components/datatable.vue +0 -175
- solara/components/details.py +0 -21
- solara/components/download.vue +0 -35
- solara/components/echarts.py +0 -75
- solara/components/echarts.vue +0 -128
- solara/components/figure_altair.py +0 -39
- solara/components/file_browser.py +0 -182
- solara/components/file_download.py +0 -199
- solara/components/file_drop.py +0 -139
- solara/components/file_drop.vue +0 -83
- solara/components/file_list_widget.vue +0 -78
- solara/components/head.py +0 -27
- solara/components/head_tag.py +0 -49
- solara/components/head_tag.vue +0 -60
- solara/components/image.py +0 -173
- solara/components/input.py +0 -440
- solara/components/link.py +0 -55
- solara/components/markdown.py +0 -371
- solara/components/markdown_editor.py +0 -25
- solara/components/markdown_editor.vue +0 -362
- solara/components/matplotlib.py +0 -74
- solara/components/meta.py +0 -47
- solara/components/misc.py +0 -333
- solara/components/pivot_table.py +0 -258
- solara/components/pivot_table.vue +0 -158
- solara/components/progress.py +0 -47
- solara/components/select.py +0 -186
- solara/components/select.vue +0 -27
- solara/components/slider.py +0 -442
- solara/components/slider_date.vue +0 -56
- solara/components/spinner-solara.vue +0 -105
- solara/components/spinner.py +0 -30
- solara/components/sql_code.py +0 -33
- solara/components/sql_code.vue +0 -128
- solara/components/style.py +0 -105
- solara/components/switch.py +0 -68
- solara/components/tab_navigation.py +0 -37
- solara/components/title.py +0 -90
- solara/components/title.vue +0 -38
- solara/components/togglebuttons.py +0 -202
- solara/components/tooltip.py +0 -61
- solara/datatypes.py +0 -143
- solara/express.py +0 -241
- solara/hooks/__init__.py +0 -4
- solara/hooks/dataframe.py +0 -99
- solara/hooks/misc.py +0 -263
- solara/hooks/use_reactive.py +0 -129
- solara/hooks/use_thread.py +0 -129
- solara/kitchensink.py +0 -8
- solara/lab/__init__.py +0 -34
- solara/lab/components/__init__.py +0 -6
- solara/lab/components/chat.py +0 -203
- solara/lab/components/confirmation_dialog.py +0 -165
- solara/lab/components/cross_filter.py +0 -7
- solara/lab/components/input_date.py +0 -298
- solara/lab/components/menu.py +0 -181
- solara/lab/components/menu.vue +0 -38
- solara/lab/components/tabs.py +0 -274
- solara/lab/components/theming.py +0 -98
- solara/lab/components/theming.vue +0 -72
- solara/lab/hooks/__init__.py +0 -0
- solara/lab/hooks/dataframe.py +0 -12
- solara/lab/toestand.py +0 -3
- solara/lab/utils/__init__.py +0 -2
- solara/lab/utils/cookies.py +0 -5
- solara/lab/utils/dataframe.py +0 -115
- solara/lab/utils/headers.py +0 -5
- solara/layout.py +0 -44
- solara/minisettings.py +0 -133
- solara/py.typed +0 -0
- solara/reactive.py +0 -93
- solara/routing.py +0 -268
- solara/scope/__init__.py +0 -88
- solara/scope/types.py +0 -55
- solara/server/__init__.py +0 -0
- solara/server/app.py +0 -490
- solara/server/assets/custom.css +0 -1
- solara/server/assets/custom.js +0 -1
- solara/server/assets/favicon.png +0 -0
- solara/server/assets/favicon.svg +0 -5
- solara/server/assets/style.css +0 -1665
- solara/server/assets/theme-dark.css +0 -437
- solara/server/assets/theme-light.css +0 -420
- solara/server/assets/theme.js +0 -3
- solara/server/cdn_helper.py +0 -77
- solara/server/esm.py +0 -69
- solara/server/fastapi.py +0 -5
- solara/server/flask.py +0 -286
- solara/server/jupyter/__init__.py +0 -2
- solara/server/jupyter/cdn_handler.py +0 -28
- solara/server/jupyter/server_extension.py +0 -29
- solara/server/jupytertools.py +0 -46
- solara/server/kernel.py +0 -319
- solara/server/kernel_context.py +0 -396
- solara/server/patch.py +0 -552
- solara/server/reload.py +0 -242
- solara/server/server.py +0 -437
- solara/server/settings.py +0 -212
- solara/server/shell.py +0 -240
- solara/server/starlette.py +0 -597
- solara/server/static/ansi.js +0 -270
- solara/server/static/highlight-dark.css +0 -82
- solara/server/static/highlight.css +0 -43
- solara/server/static/main-vuetify.js +0 -260
- solara/server/static/main.js +0 -163
- solara/server/static/solara_bootstrap.py +0 -129
- solara/server/static/sun.svg +0 -23
- solara/server/static/webworker.js +0 -42
- solara/server/telemetry.py +0 -212
- solara/server/templates/index.html.j2 +0 -1
- solara/server/templates/loader-plain.css +0 -11
- solara/server/templates/loader-plain.html +0 -20
- solara/server/templates/loader-solara.css +0 -111
- solara/server/templates/loader-solara.html +0 -40
- solara/server/templates/plain.html +0 -82
- solara/server/templates/solara.html.j2 +0 -446
- solara/server/threaded.py +0 -75
- solara/server/utils.py +0 -30
- solara/server/websocket.py +0 -44
- solara/settings.py +0 -56
- solara/tasks.py +0 -847
- solara/template/button.py +0 -16
- solara/template/markdown.py +0 -42
- solara/template/portal/.flake8 +0 -6
- solara/template/portal/.pre-commit-config.yaml +0 -28
- solara/template/portal/Procfile +0 -7
- solara/template/portal/mypy.ini +0 -3
- solara/template/portal/pyproject.toml +0 -26
- solara/template/portal/solara_portal/__init__.py +0 -3
- solara/template/portal/solara_portal/components/__init__.py +0 -2
- solara/template/portal/solara_portal/components/article.py +0 -28
- solara/template/portal/solara_portal/components/data.py +0 -28
- solara/template/portal/solara_portal/components/header.py +0 -6
- solara/template/portal/solara_portal/components/layout.py +0 -6
- solara/template/portal/solara_portal/content/articles/equis-in-vidi.md +0 -85
- solara/template/portal/solara_portal/content/articles/substiterat-vati.md +0 -70
- solara/template/portal/solara_portal/data.py +0 -60
- solara/template/portal/solara_portal/pages/__init__.py +0 -67
- solara/template/portal/solara_portal/pages/article/__init__.py +0 -26
- solara/template/portal/solara_portal/pages/tabular.py +0 -29
- solara/template/portal/solara_portal/pages/viz/__init__.py +0 -69
- solara/template/portal/solara_portal/pages/viz/overview.py +0 -14
- solara/test/__init__.py +0 -0
- solara/test/pytest_plugin.py +0 -698
- solara/toestand.py +0 -772
- solara/util.py +0 -308
- solara/website/__init__.py +0 -0
- solara/website/assets/custom.css +0 -462
- solara/website/assets/images/logo-small.png +0 -0
- solara/website/assets/images/logo.svg +0 -17
- solara/website/assets/images/logo_white.svg +0 -50
- solara/website/assets/theme.js +0 -8
- solara/website/components/__init__.py +0 -5
- solara/website/components/algolia.vue +0 -24
- solara/website/components/algolia_api.vue +0 -157
- solara/website/components/docs.py +0 -118
- solara/website/components/header.py +0 -72
- solara/website/components/hero.py +0 -15
- solara/website/components/mailchimp.py +0 -12
- solara/website/components/mailchimp.vue +0 -47
- solara/website/components/markdown.py +0 -30
- solara/website/components/notebook.py +0 -172
- solara/website/pages/__init__.py +0 -575
- solara/website/pages/apps/__init__.py +0 -16
- solara/website/pages/apps/authorization/__init__.py +0 -118
- solara/website/pages/apps/authorization/admin.py +0 -12
- solara/website/pages/apps/authorization/users.py +0 -12
- solara/website/pages/apps/jupyter-dashboard-1.py +0 -116
- solara/website/pages/apps/layout-demo.py +0 -40
- solara/website/pages/apps/multipage/__init__.py +0 -38
- solara/website/pages/apps/multipage/page1.py +0 -26
- solara/website/pages/apps/multipage/page2.py +0 -34
- solara/website/pages/apps/scatter.py +0 -136
- solara/website/pages/apps/scrolling.py +0 -63
- solara/website/pages/apps/tutorial-streamlit.py +0 -18
- solara/website/pages/changelog/__init__.py +0 -8
- solara/website/pages/changelog/changelog.md +0 -195
- solara/website/pages/contact/__init__.py +0 -8
- solara/website/pages/contact/contact.md +0 -17
- solara/website/pages/doc_use_download.py +0 -85
- solara/website/pages/documentation/__init__.py +0 -184
- solara/website/pages/documentation/advanced/__init__.py +0 -9
- solara/website/pages/documentation/advanced/content/00-overview.md +0 -1
- solara/website/pages/documentation/advanced/content/10-howto/00-overview.md +0 -6
- solara/website/pages/documentation/advanced/content/10-howto/10-multipage.md +0 -196
- solara/website/pages/documentation/advanced/content/10-howto/20-layout.md +0 -125
- solara/website/pages/documentation/advanced/content/10-howto/30-testing.md +0 -154
- solara/website/pages/documentation/advanced/content/10-howto/31-debugging.md +0 -69
- solara/website/pages/documentation/advanced/content/10-howto/40-embed.md +0 -49
- solara/website/pages/documentation/advanced/content/10-howto/50-ipywidget_libraries.md +0 -124
- solara/website/pages/documentation/advanced/content/20-understanding/00-introduction.md +0 -10
- solara/website/pages/documentation/advanced/content/20-understanding/05-ipywidgets.md +0 -35
- solara/website/pages/documentation/advanced/content/20-understanding/06-ipyvuetify.md +0 -42
- solara/website/pages/documentation/advanced/content/20-understanding/10-reacton.md +0 -28
- solara/website/pages/documentation/advanced/content/20-understanding/12-reacton-basics.md +0 -108
- solara/website/pages/documentation/advanced/content/20-understanding/15-anatomy.md +0 -23
- solara/website/pages/documentation/advanced/content/20-understanding/17-rules-of-hooks.md +0 -7
- solara/website/pages/documentation/advanced/content/20-understanding/18-containers.md +0 -166
- solara/website/pages/documentation/advanced/content/20-understanding/20-solara.md +0 -18
- solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md +0 -240
- solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md +0 -86
- solara/website/pages/documentation/advanced/content/20-understanding/60-voila.md +0 -12
- solara/website/pages/documentation/advanced/content/30-enterprise/00-overview.md +0 -1
- solara/website/pages/documentation/advanced/content/30-enterprise/10-oauth.md +0 -171
- solara/website/pages/documentation/advanced/content/40-development/00-overview.md +0 -0
- solara/website/pages/documentation/advanced/content/40-development/01-contribute.md +0 -45
- solara/website/pages/documentation/advanced/content/40-development/10-setup.md +0 -76
- solara/website/pages/documentation/api/__init__.py +0 -19
- solara/website/pages/documentation/api/cross_filter/__init__.py +0 -9
- solara/website/pages/documentation/api/cross_filter/cross_filter_dataframe.py +0 -23
- solara/website/pages/documentation/api/cross_filter/cross_filter_report.py +0 -22
- solara/website/pages/documentation/api/cross_filter/cross_filter_select.py +0 -22
- solara/website/pages/documentation/api/cross_filter/cross_filter_slider.py +0 -22
- solara/website/pages/documentation/api/hooks/__init__.py +0 -9
- solara/website/pages/documentation/api/hooks/use_cross_filter.py +0 -25
- solara/website/pages/documentation/api/hooks/use_dark_effective.py +0 -13
- solara/website/pages/documentation/api/hooks/use_effect.md +0 -43
- solara/website/pages/documentation/api/hooks/use_effect.py +0 -9
- solara/website/pages/documentation/api/hooks/use_exception.py +0 -33
- solara/website/pages/documentation/api/hooks/use_memo.md +0 -16
- solara/website/pages/documentation/api/hooks/use_memo.py +0 -9
- solara/website/pages/documentation/api/hooks/use_previous.py +0 -32
- solara/website/pages/documentation/api/hooks/use_reactive.py +0 -15
- solara/website/pages/documentation/api/hooks/use_state.py +0 -11
- solara/website/pages/documentation/api/hooks/use_state_or_update.py +0 -68
- solara/website/pages/documentation/api/hooks/use_thread.md +0 -58
- solara/website/pages/documentation/api/hooks/use_thread.py +0 -44
- solara/website/pages/documentation/api/hooks/use_trait_observe.py +0 -13
- solara/website/pages/documentation/api/routing/__init__.py +0 -9
- solara/website/pages/documentation/api/routing/generate_routes.py +0 -11
- solara/website/pages/documentation/api/routing/generate_routes_directory.py +0 -11
- solara/website/pages/documentation/api/routing/resolve_path.py +0 -36
- solara/website/pages/documentation/api/routing/route.py +0 -32
- solara/website/pages/documentation/api/routing/use_route.py +0 -80
- solara/website/pages/documentation/api/routing/use_router.py +0 -15
- solara/website/pages/documentation/api/utilities/__init__.py +0 -9
- solara/website/pages/documentation/api/utilities/component_vue.py +0 -11
- solara/website/pages/documentation/api/utilities/computed.py +0 -16
- solara/website/pages/documentation/api/utilities/display.py +0 -15
- solara/website/pages/documentation/api/utilities/get_kernel_id.py +0 -16
- solara/website/pages/documentation/api/utilities/get_session_id.py +0 -16
- solara/website/pages/documentation/api/utilities/memoize.py +0 -36
- solara/website/pages/documentation/api/utilities/on_kernel_start.py +0 -27
- solara/website/pages/documentation/api/utilities/reactive.py +0 -15
- solara/website/pages/documentation/api/utilities/widget.py +0 -104
- solara/website/pages/documentation/components/__init__.py +0 -12
- solara/website/pages/documentation/components/advanced/__init__.py +0 -9
- solara/website/pages/documentation/components/advanced/link.py +0 -28
- solara/website/pages/documentation/components/advanced/meta.py +0 -21
- solara/website/pages/documentation/components/advanced/style.py +0 -44
- solara/website/pages/documentation/components/common.py +0 -9
- solara/website/pages/documentation/components/data/__init__.py +0 -9
- solara/website/pages/documentation/components/data/dataframe.py +0 -44
- solara/website/pages/documentation/components/data/pivot_table.py +0 -81
- solara/website/pages/documentation/components/enterprise/__init__.py +0 -9
- solara/website/pages/documentation/components/enterprise/avatar.py +0 -19
- solara/website/pages/documentation/components/enterprise/avatar_menu.py +0 -20
- solara/website/pages/documentation/components/input/__init__.py +0 -9
- solara/website/pages/documentation/components/input/button.py +0 -22
- solara/website/pages/documentation/components/input/checkbox.py +0 -12
- solara/website/pages/documentation/components/input/file_browser.py +0 -33
- solara/website/pages/documentation/components/input/file_drop.py +0 -75
- solara/website/pages/documentation/components/input/input.py +0 -18
- solara/website/pages/documentation/components/input/select.py +0 -21
- solara/website/pages/documentation/components/input/slider.py +0 -28
- solara/website/pages/documentation/components/input/switch.py +0 -12
- solara/website/pages/documentation/components/input/togglebuttons.py +0 -20
- solara/website/pages/documentation/components/lab/__init__.py +0 -9
- solara/website/pages/documentation/components/lab/chat.py +0 -108
- solara/website/pages/documentation/components/lab/confirmation_dialog.py +0 -55
- solara/website/pages/documentation/components/lab/cookies_headers.py +0 -48
- solara/website/pages/documentation/components/lab/input_date.py +0 -19
- solara/website/pages/documentation/components/lab/menu.py +0 -21
- solara/website/pages/documentation/components/lab/tab.py +0 -24
- solara/website/pages/documentation/components/lab/tabs.py +0 -44
- solara/website/pages/documentation/components/lab/task.py +0 -12
- solara/website/pages/documentation/components/lab/theming.py +0 -72
- solara/website/pages/documentation/components/lab/use_task.py +0 -12
- solara/website/pages/documentation/components/layout/__init__.py +0 -9
- solara/website/pages/documentation/components/layout/app_bar.py +0 -15
- solara/website/pages/documentation/components/layout/app_bar_title.py +0 -15
- solara/website/pages/documentation/components/layout/app_layout.py +0 -23
- solara/website/pages/documentation/components/layout/card.py +0 -14
- solara/website/pages/documentation/components/layout/card_actions.py +0 -15
- solara/website/pages/documentation/components/layout/column.py +0 -29
- solara/website/pages/documentation/components/layout/columns.py +0 -26
- solara/website/pages/documentation/components/layout/columns_responsive.py +0 -67
- solara/website/pages/documentation/components/layout/griddraggable.py +0 -61
- solara/website/pages/documentation/components/layout/gridfixed.py +0 -21
- solara/website/pages/documentation/components/layout/hbox.py +0 -17
- solara/website/pages/documentation/components/layout/row.py +0 -29
- solara/website/pages/documentation/components/layout/sidebar.py +0 -23
- solara/website/pages/documentation/components/layout/vbox.py +0 -19
- solara/website/pages/documentation/components/output/__init__.py +0 -9
- solara/website/pages/documentation/components/output/file_download.py +0 -12
- solara/website/pages/documentation/components/output/html.py +0 -22
- solara/website/pages/documentation/components/output/image.py +0 -12
- solara/website/pages/documentation/components/output/markdown.py +0 -59
- solara/website/pages/documentation/components/output/markdown_editor.py +0 -53
- solara/website/pages/documentation/components/output/sql_code.py +0 -84
- solara/website/pages/documentation/components/output/tooltip.py +0 -12
- solara/website/pages/documentation/components/page/__init__.py +0 -9
- solara/website/pages/documentation/components/page/head.py +0 -19
- solara/website/pages/documentation/components/page/title.py +0 -28
- solara/website/pages/documentation/components/status/__init__.py +0 -9
- solara/website/pages/documentation/components/status/error.py +0 -40
- solara/website/pages/documentation/components/status/info.py +0 -40
- solara/website/pages/documentation/components/status/progress.py +0 -10
- solara/website/pages/documentation/components/status/spinner.py +0 -10
- solara/website/pages/documentation/components/status/success.py +0 -40
- solara/website/pages/documentation/components/status/warning.py +0 -47
- solara/website/pages/documentation/components/viz/__init__.py +0 -9
- solara/website/pages/documentation/components/viz/altair.py +0 -44
- solara/website/pages/documentation/components/viz/echarts.py +0 -78
- solara/website/pages/documentation/components/viz/matplotlib.py +0 -32
- solara/website/pages/documentation/components/viz/plotly.py +0 -63
- solara/website/pages/documentation/components/viz/plotly_express.py +0 -41
- solara/website/pages/documentation/examples/__init__.py +0 -52
- solara/website/pages/documentation/examples/ai/__init__.py +0 -10
- solara/website/pages/documentation/examples/ai/chatbot.py +0 -96
- solara/website/pages/documentation/examples/ai/tokenizer.py +0 -106
- solara/website/pages/documentation/examples/basics/__init__.py +0 -2
- solara/website/pages/documentation/examples/basics/sine.py +0 -28
- solara/website/pages/documentation/examples/fullscreen/__init__.py +0 -9
- solara/website/pages/documentation/examples/fullscreen/authorization.py +0 -3
- solara/website/pages/documentation/examples/fullscreen/layout_demo.py +0 -3
- solara/website/pages/documentation/examples/fullscreen/multipage.py +0 -3
- solara/website/pages/documentation/examples/fullscreen/scatter.py +0 -3
- solara/website/pages/documentation/examples/fullscreen/scrolling.py +0 -3
- solara/website/pages/documentation/examples/fullscreen/tutorial_streamlit.py +0 -3
- solara/website/pages/documentation/examples/general/__init__.py +0 -9
- solara/website/pages/documentation/examples/general/custom_storage.py +0 -69
- solara/website/pages/documentation/examples/general/deploy_model.py +0 -114
- solara/website/pages/documentation/examples/general/live_update.py +0 -38
- solara/website/pages/documentation/examples/general/login_oauth.py +0 -76
- solara/website/pages/documentation/examples/general/mycard.vue +0 -58
- solara/website/pages/documentation/examples/general/pokemon_search.py +0 -51
- solara/website/pages/documentation/examples/general/vue_component.py +0 -50
- solara/website/pages/documentation/examples/ipycanvas.py +0 -49
- solara/website/pages/documentation/examples/libraries/__init__.py +0 -9
- solara/website/pages/documentation/examples/libraries/altair.py +0 -63
- solara/website/pages/documentation/examples/libraries/bqplot.py +0 -39
- solara/website/pages/documentation/examples/libraries/ipyleaflet.py +0 -32
- solara/website/pages/documentation/examples/libraries/ipyleaflet_advanced.py +0 -65
- solara/website/pages/documentation/examples/utilities/__init__.py +0 -9
- solara/website/pages/documentation/examples/utilities/calculator.py +0 -157
- solara/website/pages/documentation/examples/utilities/countdown_timer.py +0 -64
- solara/website/pages/documentation/examples/utilities/todo.py +0 -195
- solara/website/pages/documentation/examples/visualization/__init__.py +0 -6
- solara/website/pages/documentation/examples/visualization/annotator.py +0 -68
- solara/website/pages/documentation/examples/visualization/linked_views.py +0 -84
- solara/website/pages/documentation/examples/visualization/plotly.py +0 -43
- solara/website/pages/documentation/faq/__init__.py +0 -12
- solara/website/pages/documentation/faq/content/99-faq.md +0 -76
- solara/website/pages/documentation/getting_started/__init__.py +0 -9
- solara/website/pages/documentation/getting_started/content/00-quickstart.md +0 -89
- solara/website/pages/documentation/getting_started/content/01-introduction.md +0 -125
- solara/website/pages/documentation/getting_started/content/02-installing.md +0 -85
- solara/website/pages/documentation/getting_started/content/04-tutorials/00-overview.md +0 -14
- solara/website/pages/documentation/getting_started/content/04-tutorials/10_data_science.py +0 -13
- solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md +0 -89
- solara/website/pages/documentation/getting_started/content/04-tutorials/30-ipywidgets.md +0 -124
- solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md +0 -146
- solara/website/pages/documentation/getting_started/content/04-tutorials/50-dash.md +0 -144
- solara/website/pages/documentation/getting_started/content/04-tutorials/60-jupyter-dashboard-part1.py +0 -64
- solara/website/pages/documentation/getting_started/content/04-tutorials/SF_crime_sample.csv.gz +0 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/_data_science.ipynb +0 -445
- solara/website/pages/documentation/getting_started/content/04-tutorials/_jupyter_dashboard_1.ipynb +0 -1000
- solara/website/pages/documentation/getting_started/content/05-fundamentals/00-overview.md +0 -11
- solara/website/pages/documentation/getting_started/content/05-fundamentals/10-components.md +0 -223
- solara/website/pages/documentation/getting_started/content/05-fundamentals/50-state-management.md +0 -88
- solara/website/pages/documentation/getting_started/content/06-reference/00-overview.md +0 -3
- solara/website/pages/documentation/getting_started/content/06-reference/40-static_files.md +0 -31
- solara/website/pages/documentation/getting_started/content/06-reference/41-asset-files.md +0 -36
- solara/website/pages/documentation/getting_started/content/06-reference/60-static-site-generation.md +0 -59
- solara/website/pages/documentation/getting_started/content/06-reference/70-search.md +0 -34
- solara/website/pages/documentation/getting_started/content/06-reference/80-reloading.md +0 -34
- solara/website/pages/documentation/getting_started/content/06-reference/90-notebook-support.md +0 -7
- solara/website/pages/documentation/getting_started/content/06-reference/95-caching.md +0 -148
- solara/website/pages/documentation/getting_started/content/07-deploying/00-overview.md +0 -7
- solara/website/pages/documentation/getting_started/content/07-deploying/10-self-hosted.md +0 -273
- solara/website/pages/documentation/getting_started/content/07-deploying/20-cloud-hosted.md +0 -80
- solara/website/pages/documentation/getting_started/content/80-what-is-lab.md +0 -7
- solara/website/pages/documentation/getting_started/content/90-troubleshoot.md +0 -26
- solara/website/pages/docutils.py +0 -38
- solara/website/pages/showcase/__init__.py +0 -105
- solara/website/pages/showcase/domino_code_assist.py +0 -60
- solara/website/pages/showcase/planeto_tessa.py +0 -19
- solara/website/pages/showcase/solara_dev.py +0 -54
- solara/website/pages/showcase/solarathon_2023_team_2.py +0 -22
- solara/website/pages/showcase/solarathon_2023_team_4.py +0 -22
- solara/website/pages/showcase/solarathon_2023_team_5.py +0 -23
- solara/website/pages/showcase/solarathon_2023_team_6.py +0 -34
- solara/website/pages/showcase/wanderlust.py +0 -27
- solara/website/public/beach.jpeg +0 -0
- solara/website/public/logo.svg +0 -6
- solara/website/public/social/discord.svg +0 -1
- solara/website/public/social/github.svg +0 -1
- solara/website/public/social/twitter.svg +0 -3
- solara/website/public/success.html +0 -25
- solara/website/templates/index.html.j2 +0 -117
- solara/website/utils.py +0 -51
- solara/widgets/__init__.py +0 -1
- solara/widgets/vue/gridlayout.vue +0 -110
- solara/widgets/vue/html.vue +0 -4
- solara/widgets/vue/navigator.vue +0 -104
- solara/widgets/vue/vegalite.vue +0 -115
- solara/widgets/widgets.py +0 -65
- solara-1.30.1.data/data/etc/jupyter/jupyter_notebook_config.d/solara.json +0 -7
- solara-1.30.1.data/data/etc/jupyter/jupyter_server_config.d/solara.json +0 -7
- solara-1.30.1.dist-info/RECORD +0 -437
- solara-1.30.1.dist-info/entry_points.txt +0 -5
- /solara-1.30.1.dist-info/licenses/LICENSE → /LICENSE +0 -0
solara/components/misc.py
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import warnings
|
|
2
|
-
from typing import Any, Callable, Dict, List, Union
|
|
3
|
-
|
|
4
|
-
import reacton
|
|
5
|
-
import reacton.ipyvuetify as v
|
|
6
|
-
import solara
|
|
7
|
-
import solara.widgets
|
|
8
|
-
from solara.util import _combine_classes
|
|
9
|
-
|
|
10
|
-
Navigator = reacton.core.ComponentWidget(solara.widgets.Navigator)
|
|
11
|
-
GridDraggable = reacton.core.ComponentWidget(solara.widgets.GridLayout)
|
|
12
|
-
# keep the old name for a while
|
|
13
|
-
GridLayout = GridDraggable
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@solara.component
|
|
17
|
-
def ListItem(title, icon_name: str = None, children=[], value=None):
|
|
18
|
-
if value is None:
|
|
19
|
-
value = title
|
|
20
|
-
if children:
|
|
21
|
-
with v.ListItemContent() as main:
|
|
22
|
-
v.ListItemTitle(children=[title])
|
|
23
|
-
if icon_name is not None:
|
|
24
|
-
with v.ListItemIcon():
|
|
25
|
-
v.Icon(children=[icon_name or ""])
|
|
26
|
-
return v.ListGroup(children=children, v_slots=[{"name": "activator", "children": main}], no_action=True, value=True, append_icon=icon_name)
|
|
27
|
-
else:
|
|
28
|
-
with v.ListItem(value=value) as main:
|
|
29
|
-
if icon_name is not None:
|
|
30
|
-
with v.ListItemIcon():
|
|
31
|
-
v.Icon(children=[icon_name or ""])
|
|
32
|
-
with v.ListItemContent():
|
|
33
|
-
v.ListItemTitle(children=[title])
|
|
34
|
-
return main
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def ui_dropdown(label, value=None, options=["foo", "bar"], key=None, disabled=False, **kwargs):
|
|
38
|
-
key = key or str(value) + str(label) + str(options)
|
|
39
|
-
value, set_value = solara.use_state(value, key)
|
|
40
|
-
|
|
41
|
-
def set_index(index):
|
|
42
|
-
set_value(options[index])
|
|
43
|
-
|
|
44
|
-
v.Select(v_model=value, label=label, items=options, on_v_model=set_value, clearable=True, disabled=disabled, **kwargs)
|
|
45
|
-
return value
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def ui_text(label, value="", key=None, clearable=False, hint="", disabled=False, **kwargs):
|
|
49
|
-
key = key or str(value) + str(label) + str(hint)
|
|
50
|
-
value, set_value = solara.use_state(value, key)
|
|
51
|
-
v.TextField(v_model=value, label=label, on_v_model=set_value, clearable=clearable, hint=hint, disabled=disabled, **kwargs)
|
|
52
|
-
return value
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def ui_checkbox(label, value=True, key=None, disabled=False, **kwargs):
|
|
56
|
-
key = key or str(value) + str(label)
|
|
57
|
-
value, set_value = solara.use_state(value, key)
|
|
58
|
-
v.Checkbox(v_model=value, label=label, on_v_model=set_value, **kwargs)
|
|
59
|
-
return value
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def ui_slider(value=1, label="", min=0, max=100, key=None, tick_labels=None, thumb_label=None, disabled=False, **kwargs):
|
|
63
|
-
key = key or str(value) + str(label)
|
|
64
|
-
value, set_value = solara.use_state(value, key)
|
|
65
|
-
v.Slider(
|
|
66
|
-
v_model=value,
|
|
67
|
-
label=label,
|
|
68
|
-
min=min,
|
|
69
|
-
max=max,
|
|
70
|
-
on_v_model=set_value,
|
|
71
|
-
ticks=tick_labels is not None,
|
|
72
|
-
tick_labels=tick_labels,
|
|
73
|
-
thumb_label=thumb_label,
|
|
74
|
-
disabled=disabled,
|
|
75
|
-
**kwargs,
|
|
76
|
-
)
|
|
77
|
-
return value
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@solara.component
|
|
81
|
-
def Text(text, style: Union[str, Dict[str, str], None] = None, classes: List[str] = []):
|
|
82
|
-
style_flat = solara.util._flatten_style(style)
|
|
83
|
-
return v.Html(tag="span", class_=_combine_classes(classes), style_=style_flat, children=[text])
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@solara.component
|
|
87
|
-
def Div(children=[], classes: List[str] = [], style: Union[str, Dict[str, str], None] = None, **kwargs):
|
|
88
|
-
style_flat = solara.util._flatten_style(style)
|
|
89
|
-
classes = classes.copy()
|
|
90
|
-
kwargs = kwargs.copy()
|
|
91
|
-
if "class_" in kwargs:
|
|
92
|
-
classes.append(kwargs.pop("class_"))
|
|
93
|
-
if "style_" in kwargs:
|
|
94
|
-
style_flat += kwargs.pop("style_")
|
|
95
|
-
class_ = _combine_classes(classes)
|
|
96
|
-
|
|
97
|
-
return v.Html(tag="div", children=children, class_=class_, style_=style_flat, **kwargs)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
@solara.component
|
|
101
|
-
def Preformatted(text, **kwargs):
|
|
102
|
-
return v.Html(tag="pre", children=[text], **kwargs)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
@solara.component
|
|
106
|
-
def IconButton(icon_name: str = None, on_click=Callable[[], None], children: list = [], click_event="click", **kwargs):
|
|
107
|
-
return solara.Button(icon_name=icon_name, on_click=on_click, children=children, icon=True, click_event=click_event, **kwargs)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
@solara.component
|
|
111
|
-
def HTML(tag="div", unsafe_innerHTML=None, style: str = None, classes: List[str] = [], attributes=None, class_: str = None):
|
|
112
|
-
"""Render an HTML tag with optional raw HTML text inside.
|
|
113
|
-
|
|
114
|
-
# Arguments
|
|
115
|
-
|
|
116
|
-
* `tag`: HTML tag name for the top level element (default: `div`)
|
|
117
|
-
* `unsafe_innerHTML`: HTML string to be rendered inside the tag.
|
|
118
|
-
Note that this is not sanitized, so be careful this cannot include JavaScript from user input!
|
|
119
|
-
* `style`: CSS style string to be applied to the top level element.
|
|
120
|
-
* `classes`: List of CSS classes to be applied to the top level element.
|
|
121
|
-
* `attributes`: Dictionary of attributes to be applied to the top level element.
|
|
122
|
-
* `class_`: (deprecated) CSS class to be applied to the top level element.
|
|
123
|
-
|
|
124
|
-
"""
|
|
125
|
-
if attributes is None:
|
|
126
|
-
attributes = {}
|
|
127
|
-
else:
|
|
128
|
-
attributes = attributes.copy()
|
|
129
|
-
if style:
|
|
130
|
-
attributes["style"] = style
|
|
131
|
-
if class_ or classes:
|
|
132
|
-
class_ = _combine_classes([*classes, *([] if class_ is None else [class_])])
|
|
133
|
-
attributes["class"] = class_
|
|
134
|
-
return solara.widgets.HTML.element(tag=tag, unsafe_innerHTML=unsafe_innerHTML, attributes=attributes)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
@solara.component
|
|
138
|
-
def VBox(children=[], grow=True, align_items="stretch", classes: List[str] = []):
|
|
139
|
-
"""Deprecated. Use `Row` instead."""
|
|
140
|
-
style = f"flex-direction: column; align-items: {align_items};"
|
|
141
|
-
if grow:
|
|
142
|
-
style += "flex-grow: 1;"
|
|
143
|
-
class_ = _combine_classes(["d-flex", *classes])
|
|
144
|
-
return v.Sheet(class_=class_, style_=style, elevation=0, children=children)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
@solara.component
|
|
148
|
-
def HBox(children=[], grow=True, align_items="stretch", classes: List[str] = []):
|
|
149
|
-
"""Deprecated. Use `Column` instead."""
|
|
150
|
-
style = f"flex-direction: row; align-items: {align_items}; "
|
|
151
|
-
if grow:
|
|
152
|
-
style += "flex-grow: 1;"
|
|
153
|
-
class_ = _combine_classes(["d-flex", *classes])
|
|
154
|
-
return v.Sheet(class_=class_, style_=style, elevation=0, children=children)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
@solara.component
|
|
158
|
-
def Row(children=[], gap="12px", justify="start", margin: int = 0, classes: List[str] = [], style: Union[str, Dict[str, str], None] = None):
|
|
159
|
-
"""Lays out children in a row, side by side, with the given gap between them.
|
|
160
|
-
|
|
161
|
-
See also [Column](/documentation/components/layout/column).
|
|
162
|
-
|
|
163
|
-
Example with three children side by side:
|
|
164
|
-
|
|
165
|
-
```solara
|
|
166
|
-
import solara
|
|
167
|
-
|
|
168
|
-
@solara.component
|
|
169
|
-
def Page():
|
|
170
|
-
with solara.Row(gap="10px", justify="space-around"):
|
|
171
|
-
solara.Text("On the left")
|
|
172
|
-
solara.Text("In the middle")
|
|
173
|
-
solara.Text("On the right")
|
|
174
|
-
```
|
|
175
|
-
## Arguments
|
|
176
|
-
|
|
177
|
-
* `children`: List of children to render in the column.
|
|
178
|
-
* `gap`: The gap between each child, as a CSS string.
|
|
179
|
-
* `justify`: How children are distributed along the x/horizontal-axis, can be "start" (default), "center", "end", "space-around",
|
|
180
|
-
"space-between" or "space-evenly".
|
|
181
|
-
(*Note: this translates to justify-content in CSS*).
|
|
182
|
-
* `margin`: The margin around the column, translate to 4*margin pixels.
|
|
183
|
-
* `classes`: List of CSS classes to apply to the column.
|
|
184
|
-
* `style`: CSS style to apply to the column.
|
|
185
|
-
|
|
186
|
-
"""
|
|
187
|
-
align_items = "stretch"
|
|
188
|
-
style_flat = solara.util._flatten_style(style)
|
|
189
|
-
style_flat = f"flex-direction: row; align-items: {align_items}; justify-content: {justify}; column-gap: {gap};" + style_flat + ";"
|
|
190
|
-
# valid css values, but we don't list them as options to avoid confusion
|
|
191
|
-
extra_justify_options = ["left", "right", "flex-start", "flex-end"]
|
|
192
|
-
if justify not in (["start", "center", "end", "space-around", "space-between", "space-evenly"] + extra_justify_options):
|
|
193
|
-
warnings.warn(f"Invalid value for justify: {justify}, possible values are: start, center, end, space-around, space-between, space-evenly")
|
|
194
|
-
class_ = _combine_classes(["d-flex", f"ma-{margin}", *classes])
|
|
195
|
-
return v.Sheet(class_=class_, style_=style_flat, elevation=0, children=children)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
@solara.component
|
|
199
|
-
def Column(children=[], gap="12px", align="stretch", margin: int = 0, classes: List[str] = [], style: Union[str, Dict[str, str], None] = None):
|
|
200
|
-
"""Lays out children in a column on top of each other, with the given gap between them.
|
|
201
|
-
|
|
202
|
-
See also [Row](/documentation/components/layout/row).
|
|
203
|
-
|
|
204
|
-
Example with three children on top of each other:
|
|
205
|
-
|
|
206
|
-
```solara
|
|
207
|
-
import solara
|
|
208
|
-
|
|
209
|
-
@solara.component
|
|
210
|
-
def Page():
|
|
211
|
-
with solara.Column(gap="10px"):
|
|
212
|
-
solara.Text("On top")
|
|
213
|
-
solara.Text("In the middle")
|
|
214
|
-
solara.Text("On bottom")
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Arguments
|
|
218
|
-
|
|
219
|
-
* `children`: List of children to render in the column.
|
|
220
|
-
* `gap`: The gap between each child, as a CSS string.
|
|
221
|
-
* `align`: The alignment of the children, can be "start", "center", "end", "stretch" (default).
|
|
222
|
-
(*Note: this translates to align-items in CSS*).
|
|
223
|
-
* `margin`: The margin around the column, translate to 4*margin pixels.
|
|
224
|
-
* `classes`: List of CSS classes to apply to the column.
|
|
225
|
-
* `style`: CSS style to apply to the column.
|
|
226
|
-
|
|
227
|
-
"""
|
|
228
|
-
if align == "left":
|
|
229
|
-
warnings.warn("align='left' does not exists, you probably want align='start' instead")
|
|
230
|
-
align = "start"
|
|
231
|
-
if align == "right":
|
|
232
|
-
warnings.warn("align='right' does not exists, you probably want align='end' instead")
|
|
233
|
-
align = "end"
|
|
234
|
-
# valid css options, but we don't list them as options to avoid confusion
|
|
235
|
-
extra_align_options = ["flex-start", "flex-end", "self-start", "self-end", "baseline"]
|
|
236
|
-
if align not in (["start", "center", "end", "stretch"] + extra_align_options):
|
|
237
|
-
warnings.warn(f"Invalid value for align: {align}, possible values are 'start', 'center', 'end' or 'stretch'")
|
|
238
|
-
style_flat = solara.util._flatten_style(style)
|
|
239
|
-
style_flat = f"flex-direction: column; align-items: {align}; row-gap: {gap};" + style_flat + ";"
|
|
240
|
-
class_ = _combine_classes(["d-flex", f"ma-{margin}", *classes])
|
|
241
|
-
return v.Sheet(class_=class_, style_=style_flat, elevation=0, children=children)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
@solara.component
|
|
245
|
-
def GridFixed(columns=4, column_gap="10px", row_gap="10px", children=[], align_items="stretch", justify_items="stretch"):
|
|
246
|
-
"""
|
|
247
|
-
|
|
248
|
-
See css grid spec:
|
|
249
|
-
https://css-tricks.com/snippets/css/complete-guide-grid/
|
|
250
|
-
"""
|
|
251
|
-
style = (
|
|
252
|
-
f"display: grid; grid-template-columns: repeat({columns}, minmax(0, 1fr)); "
|
|
253
|
-
+ f"grid-column-gap: {column_gap}; grid-row-gap: {row_gap}; align-items: {align_items}; justify-items: {justify_items}"
|
|
254
|
-
)
|
|
255
|
-
return Div(style_=style, children=children)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
@solara.component
|
|
259
|
-
def Padding(size, children=[], grow=True):
|
|
260
|
-
style = "flex-direction: row;"
|
|
261
|
-
if grow:
|
|
262
|
-
style += "flex-grow: 1;"
|
|
263
|
-
return v.Sheet(class_=f"pa-{size}", style_=style, elevation=0, children=children)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
@solara.component
|
|
267
|
-
def FigurePlotly(
|
|
268
|
-
fig,
|
|
269
|
-
on_selection: Callable[[Any], None] = None,
|
|
270
|
-
on_deselect: Callable[[Any], None] = None,
|
|
271
|
-
on_click: Callable[[Any], None] = None,
|
|
272
|
-
on_hover: Callable[[Any], None] = None,
|
|
273
|
-
on_unhover: Callable[[Any], None] = None,
|
|
274
|
-
on_relayout: Callable[[Any], None] = None,
|
|
275
|
-
dependencies=None,
|
|
276
|
-
):
|
|
277
|
-
from plotly.graph_objs._figurewidget import FigureWidget
|
|
278
|
-
|
|
279
|
-
def on_points_callback(data):
|
|
280
|
-
if not data:
|
|
281
|
-
return
|
|
282
|
-
|
|
283
|
-
event_type = data["event_type"]
|
|
284
|
-
event_mapping = {
|
|
285
|
-
"plotly_click": on_click,
|
|
286
|
-
"plotly_hover": on_hover,
|
|
287
|
-
"plotly_unhover": on_unhover,
|
|
288
|
-
"plotly_selected": on_selection,
|
|
289
|
-
"plotly_deselect": on_deselect,
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
callback = event_mapping.get(event_type)
|
|
293
|
-
if callback:
|
|
294
|
-
callback(data)
|
|
295
|
-
|
|
296
|
-
fig_element = FigureWidget.element(on__js2py_pointsCallback=on_points_callback, on__js2py_relayout=on_relayout)
|
|
297
|
-
|
|
298
|
-
def update_data():
|
|
299
|
-
fig_widget: FigureWidget = solara.get_widget(fig_element)
|
|
300
|
-
fig_widget.layout = fig.layout
|
|
301
|
-
|
|
302
|
-
length = len(fig_widget.data)
|
|
303
|
-
fig_widget.add_traces(fig.data)
|
|
304
|
-
data = list(fig_widget.data)
|
|
305
|
-
fig_widget.data = data[length:]
|
|
306
|
-
|
|
307
|
-
solara.use_effect(update_data, dependencies or fig)
|
|
308
|
-
return fig_element
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
@solara.component
|
|
312
|
-
def Code(path, path_header=None):
|
|
313
|
-
path_header = path_header or path
|
|
314
|
-
with open(path) as f:
|
|
315
|
-
code = f.read()
|
|
316
|
-
md = solara.Markdown(
|
|
317
|
-
f"""
|
|
318
|
-
### {path_header}
|
|
319
|
-
|
|
320
|
-
```python
|
|
321
|
-
{code}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
"""
|
|
325
|
-
)
|
|
326
|
-
|
|
327
|
-
with v.ExpansionPanels() as main:
|
|
328
|
-
with v.ExpansionPanel():
|
|
329
|
-
with v.ExpansionPanelHeader(children=["View source"]):
|
|
330
|
-
pass
|
|
331
|
-
with v.ExpansionPanelContent(children=[md]):
|
|
332
|
-
pass
|
|
333
|
-
return main
|
solara/components/pivot_table.py
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import operator
|
|
2
|
-
import os
|
|
3
|
-
from functools import reduce
|
|
4
|
-
from typing import Any, Callable, Dict, List, NoReturn
|
|
5
|
-
|
|
6
|
-
import ipyvuetify as v
|
|
7
|
-
|
|
8
|
-
try:
|
|
9
|
-
import numpy as np
|
|
10
|
-
except ModuleNotFoundError:
|
|
11
|
-
np = None # type: ignore
|
|
12
|
-
import traitlets
|
|
13
|
-
|
|
14
|
-
import solara
|
|
15
|
-
from solara.alias import rv
|
|
16
|
-
from solara.lab.hooks.dataframe import use_df_column_names
|
|
17
|
-
|
|
18
|
-
cardheight = "100%"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class PivotTableWidget(v.VuetifyTemplate):
|
|
22
|
-
template_file = os.path.realpath(os.path.join(os.path.dirname(__file__), "pivot_table.vue"))
|
|
23
|
-
d = traitlets.Dict(default_value={"no": "data"}).tag(sync=True)
|
|
24
|
-
selected = traitlets.Dict(default_value=[]).tag(sync=True)
|
|
25
|
-
style_ = traitlets.Unicode("").tag(sync=True)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def assert_never(value) -> NoReturn:
|
|
29
|
-
# This also works at runtime as well
|
|
30
|
-
assert False, f"This code should never be reached, got: {value}"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def translate_agg_to_vaex(aggregation: solara.Aggregation, filter=None):
|
|
34
|
-
if aggregation["type"] == "count":
|
|
35
|
-
import vaex
|
|
36
|
-
|
|
37
|
-
return vaex.agg.count(selection=filter) if filter else vaex.agg.count()
|
|
38
|
-
assert_never(aggregation)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def df_aggregate_vaex(df, columns: List[str], aggregations: Dict[str, solara.Aggregation], filter=None):
|
|
42
|
-
aggs = {key: translate_agg_to_vaex(agg, filter) for key, agg, in aggregations.items()}
|
|
43
|
-
return df.groupby(columns, sort=True).agg(aggs)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def df_aggregate_pivot_vaex(df, x: List[str], y: List[str], aggregation: solara.Aggregation, filter=None) -> solara.PivotTableData:
|
|
47
|
-
agg_name = aggregation["type"]
|
|
48
|
-
|
|
49
|
-
columns = [*x, *y]
|
|
50
|
-
agg_column = "agg_count__"
|
|
51
|
-
row_index = "__row_index__"
|
|
52
|
-
|
|
53
|
-
aggregations = {agg_column: aggregation}
|
|
54
|
-
if x and y:
|
|
55
|
-
dfg = df_aggregate_vaex(df, columns, aggregations, filter=filter)
|
|
56
|
-
else:
|
|
57
|
-
dfg = None
|
|
58
|
-
if x:
|
|
59
|
-
dfgx = df_aggregate_vaex(df, x, aggregations, filter=filter)
|
|
60
|
-
dfgx[row_index] = np.arange(len(dfgx), dtype="int64")
|
|
61
|
-
else:
|
|
62
|
-
dfgx = None
|
|
63
|
-
if y:
|
|
64
|
-
dfgy = df_aggregate_vaex(df, y, aggregations, filter=filter)
|
|
65
|
-
dfgy[row_index] = np.arange(len(dfgy), dtype="int64")
|
|
66
|
-
else:
|
|
67
|
-
dfgy = None
|
|
68
|
-
dfg_total = df._agg(translate_agg_to_vaex(aggregations[agg_column], filter=filter))
|
|
69
|
-
|
|
70
|
-
def formatter(value):
|
|
71
|
-
if isinstance(value, float):
|
|
72
|
-
return f"{value:,.2f}"
|
|
73
|
-
else:
|
|
74
|
-
return f"{value:,d}"
|
|
75
|
-
|
|
76
|
-
if x and y:
|
|
77
|
-
values: List[List[solara.JsonType]] = [[None] * len(dfgy) for _ in range(len(dfgx))]
|
|
78
|
-
else:
|
|
79
|
-
values = [[]]
|
|
80
|
-
if x:
|
|
81
|
-
values_x = list(map(formatter, dfgx[agg_column].tolist()))
|
|
82
|
-
headers_x = [dfgx[k].tolist() for k in x]
|
|
83
|
-
counts_x = len(dfgx)
|
|
84
|
-
else:
|
|
85
|
-
values_x = []
|
|
86
|
-
headers_x = []
|
|
87
|
-
counts_x = 0
|
|
88
|
-
if y:
|
|
89
|
-
values_y = list(map(formatter, dfgy[agg_column].tolist()))
|
|
90
|
-
headers_y = [dfgy[k].tolist() for k in y]
|
|
91
|
-
counts_y = len(dfgy)
|
|
92
|
-
else:
|
|
93
|
-
values_y = []
|
|
94
|
-
headers_y = []
|
|
95
|
-
counts_y = 0
|
|
96
|
-
total = formatter(dfg_total)
|
|
97
|
-
|
|
98
|
-
if x and y:
|
|
99
|
-
for row in dfg.to_records():
|
|
100
|
-
dfs = {"x": dfgx, "y": dfgy}
|
|
101
|
-
for column in columns:
|
|
102
|
-
axis_name = "x" if column in x else "y"
|
|
103
|
-
df_axis = dfs[axis_name]
|
|
104
|
-
if row[column] is None:
|
|
105
|
-
df_axis = df_axis[df[column].ismissing()]
|
|
106
|
-
else:
|
|
107
|
-
df_axis = df_axis[df_axis[column] == row[column]]
|
|
108
|
-
dfs[axis_name] = df_axis
|
|
109
|
-
assert len(dfs["x"])
|
|
110
|
-
assert len(dfs["y"])
|
|
111
|
-
xi = dfs["x"][row_index].tolist()[0]
|
|
112
|
-
yi = dfs["y"][row_index].tolist()[0]
|
|
113
|
-
value = row[agg_column]
|
|
114
|
-
values[xi][yi] = formatter(value)
|
|
115
|
-
|
|
116
|
-
data: solara.PivotTableData = {
|
|
117
|
-
"x": x,
|
|
118
|
-
"y": y,
|
|
119
|
-
"agg": agg_name,
|
|
120
|
-
"values": values,
|
|
121
|
-
"values_x": values_x,
|
|
122
|
-
"values_y": values_y,
|
|
123
|
-
"headers_x": headers_x,
|
|
124
|
-
"headers_y": headers_y,
|
|
125
|
-
"counts_x": counts_x,
|
|
126
|
-
"counts_y": counts_y,
|
|
127
|
-
"total": total,
|
|
128
|
-
}
|
|
129
|
-
return data
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def use_df_pivot_data(df, x: List[str], y: List[str], aggregation: solara.Aggregation, filter=None) -> solara.Result[solara.PivotTableData]:
|
|
133
|
-
return solara.use_thread(lambda: df_aggregate_pivot_vaex(df, x, y, aggregation, filter=filter), dependencies=[*x, *y, aggregation, filter])
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
@solara.component
|
|
137
|
-
def PivotTableView(data: solara.PivotTableData, selected: Dict[str, Any] = {}, on_selected: Callable[[Dict[str, Any]], None] = None, style=""):
|
|
138
|
-
return PivotTableWidget.element(d=data, selected=selected, on_selected=on_selected, style_=style)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
@solara.component
|
|
142
|
-
def PivotTable(
|
|
143
|
-
df,
|
|
144
|
-
x: List[str] = [],
|
|
145
|
-
y: List[str] = [],
|
|
146
|
-
aggregation: solara.Aggregation = solara.AggregationCount(type="count"),
|
|
147
|
-
selected: Dict[str, Any] = {},
|
|
148
|
-
on_selected: Callable[[Dict[str, Any]], None] = None,
|
|
149
|
-
):
|
|
150
|
-
x = x.copy()
|
|
151
|
-
y = y.copy()
|
|
152
|
-
filter, set_filter = solara.use_cross_filter(id(df), "pivottable")
|
|
153
|
-
dff = df
|
|
154
|
-
data_result = use_df_pivot_data(dff, x, y, aggregation, filter=filter)
|
|
155
|
-
previous = solara.use_previous(data_result.value, condition=data_result.state == solara.ResultState.FINISHED)
|
|
156
|
-
selected, set_selected = solara.use_state_or_update(selected.copy())
|
|
157
|
-
|
|
158
|
-
def set_filter_from_pivot_selection(selection):
|
|
159
|
-
set_selected(selection)
|
|
160
|
-
if on_selected:
|
|
161
|
-
on_selected(selection)
|
|
162
|
-
data = data_result.value
|
|
163
|
-
if data is None:
|
|
164
|
-
return
|
|
165
|
-
# assert data is not None
|
|
166
|
-
filters = []
|
|
167
|
-
if "x" in selection:
|
|
168
|
-
sel = selection["x"]
|
|
169
|
-
for level in range(sel[0] + 1):
|
|
170
|
-
value = data["headers_x"][level][sel[1]]
|
|
171
|
-
column = data["x"][level]
|
|
172
|
-
if value is None:
|
|
173
|
-
filters.append(df[column].ismissing())
|
|
174
|
-
else:
|
|
175
|
-
filters.append(df[column] == value)
|
|
176
|
-
|
|
177
|
-
if "y" in selection:
|
|
178
|
-
sel = selection["y"]
|
|
179
|
-
for level in range(sel[0] + 1):
|
|
180
|
-
column = data["y"][level]
|
|
181
|
-
value = data["headers_y"][level][sel[1]]
|
|
182
|
-
if value is None:
|
|
183
|
-
filters.append(df[column].ismissing())
|
|
184
|
-
else:
|
|
185
|
-
filters.append(df[column] == value)
|
|
186
|
-
if filters:
|
|
187
|
-
filter = reduce(operator.and_, filters[1:], filters[0])
|
|
188
|
-
else:
|
|
189
|
-
filter = None
|
|
190
|
-
set_filter(filter if filter is not None else None)
|
|
191
|
-
|
|
192
|
-
# Bug in use_thread on state result we remember that state is finished
|
|
193
|
-
if data_result.state == solara.ResultState.FINISHED and data_result.value is not None:
|
|
194
|
-
with solara.VBox() as main:
|
|
195
|
-
rv.ProgressLinear(indeterminate=False, style_="visibility: hidden;")
|
|
196
|
-
PivotTableView(data=data_result.value, selected=selected, on_selected=set_filter_from_pivot_selection)
|
|
197
|
-
elif previous is not None:
|
|
198
|
-
with solara.VBox() as main:
|
|
199
|
-
rv.ProgressLinear(indeterminate=True)
|
|
200
|
-
PivotTableView(data=previous, selected=selected, on_selected=set_filter_from_pivot_selection, style="opacity: 0.3; pointer-events: none;")
|
|
201
|
-
elif data_result.state == solara.ResultState.ERROR:
|
|
202
|
-
return solara.Error(f"Oops: {data_result.error}")
|
|
203
|
-
else:
|
|
204
|
-
return solara.Info(f"Status: {data_result.state}")
|
|
205
|
-
return main
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
@solara.component
|
|
209
|
-
def PivotTableCard(
|
|
210
|
-
df,
|
|
211
|
-
x=[],
|
|
212
|
-
y=[],
|
|
213
|
-
selected: Dict[str, Any] = {},
|
|
214
|
-
on_selected: Callable[[Dict[str, Any]], None] = None,
|
|
215
|
-
):
|
|
216
|
-
items = use_df_column_names(df)
|
|
217
|
-
with rv.Card(elevation=2, style_="position: relative", height=cardheight) as main:
|
|
218
|
-
with rv.CardTitle(children=["Pivot table"]):
|
|
219
|
-
pass
|
|
220
|
-
with rv.CardText():
|
|
221
|
-
with rv.Btn(v_on="x.on", icon=True, absolute=True, style_="right: 10px; top: 10px") as btn:
|
|
222
|
-
rv.Icon(children=["mdi-settings"])
|
|
223
|
-
with rv.Dialog(v_slots=[{"name": "activator", "variable": "x", "children": btn}]):
|
|
224
|
-
with rv.Sheet():
|
|
225
|
-
with rv.Container(pa_4=True, ma_0=True):
|
|
226
|
-
with rv.Row():
|
|
227
|
-
with rv.Col():
|
|
228
|
-
with rv.Card(elevation=2):
|
|
229
|
-
with rv.CardTitle(children=["Rows"]):
|
|
230
|
-
pass
|
|
231
|
-
with rv.CardText():
|
|
232
|
-
for i in range(10):
|
|
233
|
-
col = solara.ui_dropdown(value=x[i] if i < len(x) else None, label=f"Row {i}", options=items)
|
|
234
|
-
if col is None:
|
|
235
|
-
break
|
|
236
|
-
else:
|
|
237
|
-
if i < len(x):
|
|
238
|
-
x[i] = col
|
|
239
|
-
else:
|
|
240
|
-
x.append(col)
|
|
241
|
-
with rv.Col():
|
|
242
|
-
with rv.Card(elevation=2):
|
|
243
|
-
with rv.CardTitle(children=["Columns"]):
|
|
244
|
-
pass
|
|
245
|
-
with rv.CardText():
|
|
246
|
-
for i in range(10):
|
|
247
|
-
col = solara.ui_dropdown(value=y[i] if i < len(y) else None, label=f"Column {i}", options=items)
|
|
248
|
-
if col is None:
|
|
249
|
-
break
|
|
250
|
-
else:
|
|
251
|
-
if i < len(y):
|
|
252
|
-
y[i] = col
|
|
253
|
-
else:
|
|
254
|
-
y.append(col)
|
|
255
|
-
|
|
256
|
-
PivotTable(df, x, y, selected=selected, on_selected=on_selected)
|
|
257
|
-
|
|
258
|
-
return main
|