solara-ui 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.
- prefix/etc/jupyter/jupyter_notebook_config.d/solara.json +7 -0
- prefix/etc/jupyter/jupyter_server_config.d/solara.json +7 -0
- solara/__init__.py +124 -0
- solara/__main__.py +734 -0
- solara/alias.py +6 -0
- solara/autorouting.py +546 -0
- solara/cache.py +303 -0
- solara/checks.html +71 -0
- solara/checks.py +224 -0
- solara/comm.py +28 -0
- solara/components/__init__.py +59 -0
- solara/components/alert.py +155 -0
- solara/components/applayout.py +393 -0
- solara/components/button.py +85 -0
- solara/components/card.py +87 -0
- solara/components/checkbox.py +50 -0
- solara/components/code_highlight_css.py +11 -0
- solara/components/code_highlight_css.vue +63 -0
- solara/components/columns.py +159 -0
- solara/components/component_vue.py +110 -0
- solara/components/cross_filter.py +335 -0
- solara/components/dataframe.py +546 -0
- solara/components/datatable.py +221 -0
- solara/components/datatable.vue +175 -0
- solara/components/details.py +21 -0
- solara/components/download.vue +35 -0
- solara/components/echarts.py +75 -0
- solara/components/echarts.vue +128 -0
- solara/components/figure_altair.py +39 -0
- solara/components/file_browser.py +182 -0
- solara/components/file_download.py +199 -0
- solara/components/file_drop.py +139 -0
- solara/components/file_drop.vue +83 -0
- solara/components/file_list_widget.vue +78 -0
- solara/components/head.py +27 -0
- solara/components/head_tag.py +49 -0
- solara/components/head_tag.vue +60 -0
- solara/components/image.py +173 -0
- solara/components/input.py +436 -0
- solara/components/link.py +55 -0
- solara/components/markdown.py +378 -0
- solara/components/markdown_editor.py +25 -0
- solara/components/markdown_editor.vue +362 -0
- solara/components/matplotlib.py +74 -0
- solara/components/meta.py +47 -0
- solara/components/misc.py +333 -0
- solara/components/pivot_table.py +258 -0
- solara/components/pivot_table.vue +158 -0
- solara/components/progress.py +47 -0
- solara/components/select.py +182 -0
- solara/components/select.vue +27 -0
- solara/components/slider.py +442 -0
- solara/components/slider_date.vue +56 -0
- solara/components/spinner-solara.vue +105 -0
- solara/components/spinner.py +30 -0
- solara/components/sql_code.py +33 -0
- solara/components/sql_code.vue +128 -0
- solara/components/style.py +105 -0
- solara/components/switch.py +68 -0
- solara/components/tab_navigation.py +37 -0
- solara/components/title.py +90 -0
- solara/components/title.vue +38 -0
- solara/components/togglebuttons.py +200 -0
- solara/components/tooltip.py +61 -0
- solara/datatypes.py +143 -0
- solara/express.py +241 -0
- solara/hooks/__init__.py +4 -0
- solara/hooks/dataframe.py +99 -0
- solara/hooks/misc.py +263 -0
- solara/hooks/use_reactive.py +129 -0
- solara/hooks/use_thread.py +129 -0
- solara/kitchensink.py +8 -0
- solara/lab/__init__.py +34 -0
- solara/lab/components/__init__.py +6 -0
- solara/lab/components/chat.py +203 -0
- solara/lab/components/confirmation_dialog.py +163 -0
- solara/lab/components/cross_filter.py +7 -0
- solara/lab/components/input_date.py +298 -0
- solara/lab/components/menu.py +181 -0
- solara/lab/components/menu.vue +38 -0
- solara/lab/components/tabs.py +274 -0
- solara/lab/components/theming.py +98 -0
- solara/lab/components/theming.vue +72 -0
- solara/lab/hooks/__init__.py +0 -0
- solara/lab/hooks/dataframe.py +12 -0
- solara/lab/toestand.py +3 -0
- solara/lab/utils/__init__.py +2 -0
- solara/lab/utils/cookies.py +5 -0
- solara/lab/utils/dataframe.py +115 -0
- solara/lab/utils/headers.py +5 -0
- solara/layout.py +44 -0
- solara/lifecycle.py +46 -0
- solara/minisettings.py +133 -0
- solara/py.typed +0 -0
- solara/reactive.py +93 -0
- solara/routing.py +268 -0
- solara/scope/__init__.py +88 -0
- solara/scope/types.py +55 -0
- solara/server/__init__.py +0 -0
- solara/server/app.py +491 -0
- solara/server/assets/custom.css +1 -0
- solara/server/assets/custom.js +1 -0
- solara/server/assets/favicon.png +0 -0
- solara/server/assets/favicon.svg +5 -0
- solara/server/assets/style.css +1665 -0
- solara/server/assets/theme-dark.css +437 -0
- solara/server/assets/theme-light.css +420 -0
- solara/server/assets/theme.js +3 -0
- solara/server/cdn_helper.py +77 -0
- solara/server/esm.py +69 -0
- solara/server/fastapi.py +5 -0
- solara/server/flask.py +286 -0
- solara/server/jupyter/__init__.py +2 -0
- solara/server/jupyter/cdn_handler.py +28 -0
- solara/server/jupyter/server_extension.py +29 -0
- solara/server/jupytertools.py +46 -0
- solara/server/kernel.py +338 -0
- solara/server/kernel_context.py +357 -0
- solara/server/patch.py +552 -0
- solara/server/reload.py +242 -0
- solara/server/server.py +456 -0
- solara/server/settings.py +215 -0
- solara/server/shell.py +251 -0
- solara/server/starlette.py +601 -0
- solara/server/static/ansi.js +270 -0
- solara/server/static/highlight-dark.css +82 -0
- solara/server/static/highlight.css +43 -0
- solara/server/static/main-vuetify.js +260 -0
- solara/server/static/main.js +163 -0
- solara/server/static/solara_bootstrap.py +129 -0
- solara/server/static/sun.svg +23 -0
- solara/server/static/webworker.js +42 -0
- solara/server/telemetry.py +212 -0
- solara/server/templates/index.html.j2 +1 -0
- solara/server/templates/loader-plain.css +11 -0
- solara/server/templates/loader-plain.html +20 -0
- solara/server/templates/loader-solara.css +111 -0
- solara/server/templates/loader-solara.html +40 -0
- solara/server/templates/plain.html +82 -0
- solara/server/templates/solara.html.j2 +446 -0
- solara/server/threaded.py +75 -0
- solara/server/utils.py +30 -0
- solara/server/websocket.py +45 -0
- solara/settings.py +56 -0
- solara/tasks.py +837 -0
- solara/template/button.py +16 -0
- solara/template/markdown.py +42 -0
- solara/template/portal/.flake8 +6 -0
- solara/template/portal/.pre-commit-config.yaml +28 -0
- solara/template/portal/LICENSE +21 -0
- solara/template/portal/Procfile +7 -0
- solara/template/portal/mypy.ini +3 -0
- solara/template/portal/pyproject.toml +26 -0
- solara/template/portal/solara_portal/__init__.py +4 -0
- solara/template/portal/solara_portal/components/__init__.py +2 -0
- solara/template/portal/solara_portal/components/article.py +28 -0
- solara/template/portal/solara_portal/components/data.py +28 -0
- solara/template/portal/solara_portal/components/header.py +6 -0
- solara/template/portal/solara_portal/components/layout.py +6 -0
- solara/template/portal/solara_portal/content/articles/equis-in-vidi.md +85 -0
- solara/template/portal/solara_portal/content/articles/substiterat-vati.md +70 -0
- solara/template/portal/solara_portal/data.py +60 -0
- solara/template/portal/solara_portal/pages/__init__.py +67 -0
- solara/template/portal/solara_portal/pages/article/__init__.py +26 -0
- solara/template/portal/solara_portal/pages/tabular.py +29 -0
- solara/template/portal/solara_portal/pages/viz/__init__.py +70 -0
- solara/template/portal/solara_portal/pages/viz/overview.py +14 -0
- solara/test/__init__.py +0 -0
- solara/test/pytest_plugin.py +697 -0
- solara/toestand.py +772 -0
- solara/util.py +308 -0
- solara/website/__init__.py +0 -0
- solara/website/assets/custom.css +468 -0
- solara/website/assets/images/logo-small.png +0 -0
- solara/website/assets/images/logo.svg +17 -0
- solara/website/assets/images/logo_white.svg +50 -0
- solara/website/assets/theme.js +8 -0
- solara/website/components/__init__.py +5 -0
- solara/website/components/algolia.vue +24 -0
- solara/website/components/algolia_api.vue +187 -0
- solara/website/components/docs.py +118 -0
- solara/website/components/header.py +72 -0
- solara/website/components/hero.py +15 -0
- solara/website/components/mailchimp.py +12 -0
- solara/website/components/mailchimp.vue +47 -0
- solara/website/components/markdown.py +30 -0
- solara/website/components/notebook.py +171 -0
- solara/website/pages/__init__.py +575 -0
- solara/website/pages/apps/__init__.py +16 -0
- solara/website/pages/apps/authorization/__init__.py +119 -0
- solara/website/pages/apps/authorization/admin.py +12 -0
- solara/website/pages/apps/authorization/users.py +12 -0
- solara/website/pages/apps/jupyter-dashboard-1.py +116 -0
- solara/website/pages/apps/layout-demo.py +40 -0
- solara/website/pages/apps/multipage/__init__.py +38 -0
- solara/website/pages/apps/multipage/page1.py +26 -0
- solara/website/pages/apps/multipage/page2.py +34 -0
- solara/website/pages/apps/scatter.py +136 -0
- solara/website/pages/apps/scrolling.py +63 -0
- solara/website/pages/apps/tutorial-streamlit.py +18 -0
- solara/website/pages/changelog/__init__.py +8 -0
- solara/website/pages/changelog/changelog.md +204 -0
- solara/website/pages/contact/__init__.py +8 -0
- solara/website/pages/contact/contact.md +17 -0
- solara/website/pages/doc_use_download.py +85 -0
- solara/website/pages/documentation/__init__.py +184 -0
- solara/website/pages/documentation/advanced/__init__.py +9 -0
- solara/website/pages/documentation/advanced/content/00-overview.md +1 -0
- solara/website/pages/documentation/advanced/content/10-howto/00-overview.md +6 -0
- solara/website/pages/documentation/advanced/content/10-howto/10-multipage.md +196 -0
- solara/website/pages/documentation/advanced/content/10-howto/20-layout.md +125 -0
- solara/website/pages/documentation/advanced/content/10-howto/30-testing.md +162 -0
- solara/website/pages/documentation/advanced/content/10-howto/31-debugging.md +69 -0
- solara/website/pages/documentation/advanced/content/10-howto/40-embed.md +49 -0
- solara/website/pages/documentation/advanced/content/10-howto/50-ipywidget_libraries.md +124 -0
- solara/website/pages/documentation/advanced/content/15-reference/00-overview.md +3 -0
- solara/website/pages/documentation/advanced/content/15-reference/40-static_files.md +31 -0
- solara/website/pages/documentation/advanced/content/15-reference/41-asset-files.md +36 -0
- solara/website/pages/documentation/advanced/content/15-reference/60-static-site-generation.md +59 -0
- solara/website/pages/documentation/advanced/content/15-reference/70-search.md +34 -0
- solara/website/pages/documentation/advanced/content/15-reference/80-reloading.md +34 -0
- solara/website/pages/documentation/advanced/content/15-reference/90-notebook-support.md +7 -0
- solara/website/pages/documentation/advanced/content/15-reference/95-caching.md +148 -0
- solara/website/pages/documentation/advanced/content/20-understanding/00-introduction.md +10 -0
- solara/website/pages/documentation/advanced/content/20-understanding/05-ipywidgets.md +35 -0
- solara/website/pages/documentation/advanced/content/20-understanding/06-ipyvuetify.md +42 -0
- solara/website/pages/documentation/advanced/content/20-understanding/10-reacton.md +28 -0
- solara/website/pages/documentation/advanced/content/20-understanding/12-reacton-basics.md +108 -0
- solara/website/pages/documentation/advanced/content/20-understanding/15-anatomy.md +23 -0
- solara/website/pages/documentation/advanced/content/20-understanding/17-rules-of-hooks.md +7 -0
- solara/website/pages/documentation/advanced/content/20-understanding/18-containers.md +166 -0
- solara/website/pages/documentation/advanced/content/20-understanding/20-solara.md +18 -0
- solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md +240 -0
- solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md +97 -0
- solara/website/pages/documentation/advanced/content/20-understanding/60-voila.md +12 -0
- solara/website/pages/documentation/advanced/content/30-enterprise/00-overview.md +1 -0
- solara/website/pages/documentation/advanced/content/30-enterprise/10-oauth.md +171 -0
- solara/website/pages/documentation/advanced/content/40-development/00-overview.md +0 -0
- solara/website/pages/documentation/advanced/content/40-development/01-contribute.md +45 -0
- solara/website/pages/documentation/advanced/content/40-development/10-setup.md +76 -0
- solara/website/pages/documentation/api/__init__.py +19 -0
- solara/website/pages/documentation/api/cross_filter/__init__.py +9 -0
- solara/website/pages/documentation/api/cross_filter/cross_filter_dataframe.py +23 -0
- solara/website/pages/documentation/api/cross_filter/cross_filter_report.py +22 -0
- solara/website/pages/documentation/api/cross_filter/cross_filter_select.py +22 -0
- solara/website/pages/documentation/api/cross_filter/cross_filter_slider.py +22 -0
- solara/website/pages/documentation/api/hooks/__init__.py +9 -0
- solara/website/pages/documentation/api/hooks/use_cross_filter.py +25 -0
- solara/website/pages/documentation/api/hooks/use_dark_effective.py +12 -0
- solara/website/pages/documentation/api/hooks/use_effect.md +43 -0
- solara/website/pages/documentation/api/hooks/use_effect.py +9 -0
- solara/website/pages/documentation/api/hooks/use_exception.py +33 -0
- solara/website/pages/documentation/api/hooks/use_memo.md +16 -0
- solara/website/pages/documentation/api/hooks/use_memo.py +9 -0
- solara/website/pages/documentation/api/hooks/use_previous.py +33 -0
- solara/website/pages/documentation/api/hooks/use_reactive.py +16 -0
- solara/website/pages/documentation/api/hooks/use_state.py +10 -0
- solara/website/pages/documentation/api/hooks/use_state_or_update.py +69 -0
- solara/website/pages/documentation/api/hooks/use_thread.md +58 -0
- solara/website/pages/documentation/api/hooks/use_thread.py +44 -0
- solara/website/pages/documentation/api/hooks/use_trait_observe.py +12 -0
- solara/website/pages/documentation/api/routing/__init__.py +9 -0
- solara/website/pages/documentation/api/routing/generate_routes.py +10 -0
- solara/website/pages/documentation/api/routing/generate_routes_directory.py +10 -0
- solara/website/pages/documentation/api/routing/resolve_path.py +35 -0
- solara/website/pages/documentation/api/routing/route.py +31 -0
- solara/website/pages/documentation/api/routing/use_route.py +80 -0
- solara/website/pages/documentation/api/routing/use_router.py +16 -0
- solara/website/pages/documentation/api/utilities/__init__.py +9 -0
- solara/website/pages/documentation/api/utilities/component_vue.py +10 -0
- solara/website/pages/documentation/api/utilities/computed.py +16 -0
- solara/website/pages/documentation/api/utilities/display.py +16 -0
- solara/website/pages/documentation/api/utilities/get_kernel_id.py +16 -0
- solara/website/pages/documentation/api/utilities/get_session_id.py +16 -0
- solara/website/pages/documentation/api/utilities/memoize.py +35 -0
- solara/website/pages/documentation/api/utilities/on_kernel_start.py +27 -0
- solara/website/pages/documentation/api/utilities/reactive.py +16 -0
- solara/website/pages/documentation/api/utilities/widget.py +104 -0
- solara/website/pages/documentation/components/__init__.py +12 -0
- solara/website/pages/documentation/components/advanced/__init__.py +9 -0
- solara/website/pages/documentation/components/advanced/link.py +27 -0
- solara/website/pages/documentation/components/advanced/meta.py +20 -0
- solara/website/pages/documentation/components/advanced/style.py +45 -0
- solara/website/pages/documentation/components/common.py +9 -0
- solara/website/pages/documentation/components/data/__init__.py +9 -0
- solara/website/pages/documentation/components/data/dataframe.py +44 -0
- solara/website/pages/documentation/components/data/pivot_table.py +81 -0
- solara/website/pages/documentation/components/enterprise/__init__.py +9 -0
- solara/website/pages/documentation/components/enterprise/avatar.py +24 -0
- solara/website/pages/documentation/components/enterprise/avatar_menu.py +25 -0
- solara/website/pages/documentation/components/input/__init__.py +9 -0
- solara/website/pages/documentation/components/input/button.py +23 -0
- solara/website/pages/documentation/components/input/checkbox.py +10 -0
- solara/website/pages/documentation/components/input/file_browser.py +32 -0
- solara/website/pages/documentation/components/input/file_drop.py +76 -0
- solara/website/pages/documentation/components/input/input.py +19 -0
- solara/website/pages/documentation/components/input/select.py +22 -0
- solara/website/pages/documentation/components/input/slider.py +29 -0
- solara/website/pages/documentation/components/input/switch.py +10 -0
- solara/website/pages/documentation/components/input/togglebuttons.py +21 -0
- solara/website/pages/documentation/components/lab/__init__.py +9 -0
- solara/website/pages/documentation/components/lab/chat.py +109 -0
- solara/website/pages/documentation/components/lab/confirmation_dialog.py +55 -0
- solara/website/pages/documentation/components/lab/cookies_headers.py +48 -0
- solara/website/pages/documentation/components/lab/input_date.py +20 -0
- solara/website/pages/documentation/components/lab/menu.py +22 -0
- solara/website/pages/documentation/components/lab/tab.py +25 -0
- solara/website/pages/documentation/components/lab/tabs.py +45 -0
- solara/website/pages/documentation/components/lab/task.py +11 -0
- solara/website/pages/documentation/components/lab/theming.py +72 -0
- solara/website/pages/documentation/components/lab/use_task.py +11 -0
- solara/website/pages/documentation/components/layout/__init__.py +9 -0
- solara/website/pages/documentation/components/layout/app_bar.py +16 -0
- solara/website/pages/documentation/components/layout/app_bar_title.py +16 -0
- solara/website/pages/documentation/components/layout/app_layout.py +24 -0
- solara/website/pages/documentation/components/layout/card.py +15 -0
- solara/website/pages/documentation/components/layout/card_actions.py +16 -0
- solara/website/pages/documentation/components/layout/column.py +30 -0
- solara/website/pages/documentation/components/layout/columns.py +27 -0
- solara/website/pages/documentation/components/layout/columns_responsive.py +68 -0
- solara/website/pages/documentation/components/layout/griddraggable.py +62 -0
- solara/website/pages/documentation/components/layout/gridfixed.py +21 -0
- solara/website/pages/documentation/components/layout/hbox.py +18 -0
- solara/website/pages/documentation/components/layout/row.py +30 -0
- solara/website/pages/documentation/components/layout/sidebar.py +24 -0
- solara/website/pages/documentation/components/layout/vbox.py +19 -0
- solara/website/pages/documentation/components/output/__init__.py +9 -0
- solara/website/pages/documentation/components/output/file_download.py +11 -0
- solara/website/pages/documentation/components/output/html.py +21 -0
- solara/website/pages/documentation/components/output/image.py +11 -0
- solara/website/pages/documentation/components/output/markdown.py +57 -0
- solara/website/pages/documentation/components/output/markdown_editor.py +51 -0
- solara/website/pages/documentation/components/output/sql_code.py +85 -0
- solara/website/pages/documentation/components/output/tooltip.py +11 -0
- solara/website/pages/documentation/components/page/__init__.py +9 -0
- solara/website/pages/documentation/components/page/head.py +18 -0
- solara/website/pages/documentation/components/page/title.py +27 -0
- solara/website/pages/documentation/components/status/__init__.py +9 -0
- solara/website/pages/documentation/components/status/error.py +40 -0
- solara/website/pages/documentation/components/status/info.py +40 -0
- solara/website/pages/documentation/components/status/progress.py +10 -0
- solara/website/pages/documentation/components/status/spinner.py +11 -0
- solara/website/pages/documentation/components/status/success.py +40 -0
- solara/website/pages/documentation/components/status/warning.py +47 -0
- solara/website/pages/documentation/components/viz/__init__.py +9 -0
- solara/website/pages/documentation/components/viz/altair.py +42 -0
- solara/website/pages/documentation/components/viz/echarts.py +75 -0
- solara/website/pages/documentation/components/viz/matplotlib.py +30 -0
- solara/website/pages/documentation/components/viz/plotly.py +63 -0
- solara/website/pages/documentation/components/viz/plotly_express.py +41 -0
- solara/website/pages/documentation/examples/__init__.py +52 -0
- solara/website/pages/documentation/examples/ai/__init__.py +11 -0
- solara/website/pages/documentation/examples/ai/chatbot.py +95 -0
- solara/website/pages/documentation/examples/ai/tokenizer.py +107 -0
- solara/website/pages/documentation/examples/basics/__init__.py +10 -0
- solara/website/pages/documentation/examples/basics/sine.py +28 -0
- solara/website/pages/documentation/examples/fullscreen/__init__.py +10 -0
- solara/website/pages/documentation/examples/fullscreen/authorization.py +3 -0
- solara/website/pages/documentation/examples/fullscreen/layout_demo.py +3 -0
- solara/website/pages/documentation/examples/fullscreen/multipage.py +3 -0
- solara/website/pages/documentation/examples/fullscreen/scatter.py +3 -0
- solara/website/pages/documentation/examples/fullscreen/scrolling.py +3 -0
- solara/website/pages/documentation/examples/fullscreen/tutorial_streamlit.py +3 -0
- solara/website/pages/documentation/examples/general/__init__.py +10 -0
- solara/website/pages/documentation/examples/general/custom_storage.py +70 -0
- solara/website/pages/documentation/examples/general/deploy_model.py +115 -0
- solara/website/pages/documentation/examples/general/live_update.py +38 -0
- solara/website/pages/documentation/examples/general/login_oauth.py +81 -0
- solara/website/pages/documentation/examples/general/mycard.vue +58 -0
- solara/website/pages/documentation/examples/general/pokemon_search.py +51 -0
- solara/website/pages/documentation/examples/general/vue_component.py +50 -0
- solara/website/pages/documentation/examples/ipycanvas.py +49 -0
- solara/website/pages/documentation/examples/libraries/__init__.py +10 -0
- solara/website/pages/documentation/examples/libraries/altair.py +64 -0
- solara/website/pages/documentation/examples/libraries/bqplot.py +39 -0
- solara/website/pages/documentation/examples/libraries/ipyleaflet.py +33 -0
- solara/website/pages/documentation/examples/libraries/ipyleaflet_advanced.py +66 -0
- solara/website/pages/documentation/examples/utilities/__init__.py +10 -0
- solara/website/pages/documentation/examples/utilities/calculator.py +157 -0
- solara/website/pages/documentation/examples/utilities/countdown_timer.py +64 -0
- solara/website/pages/documentation/examples/utilities/todo.py +196 -0
- solara/website/pages/documentation/examples/visualization/__init__.py +6 -0
- solara/website/pages/documentation/examples/visualization/annotator.py +69 -0
- solara/website/pages/documentation/examples/visualization/linked_views.py +84 -0
- solara/website/pages/documentation/examples/visualization/plotly.py +44 -0
- solara/website/pages/documentation/faq/__init__.py +12 -0
- solara/website/pages/documentation/faq/content/99-faq.md +76 -0
- solara/website/pages/documentation/getting_started/__init__.py +9 -0
- solara/website/pages/documentation/getting_started/content/00-quickstart.md +89 -0
- solara/website/pages/documentation/getting_started/content/01-introduction.md +125 -0
- solara/website/pages/documentation/getting_started/content/02-installing.md +134 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/00-overview.md +14 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/10_data_science.py +13 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md +89 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/30-ipywidgets.md +124 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md +146 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/50-dash.md +144 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/60-jupyter-dashboard-part1.py +64 -0
- 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 +445 -0
- solara/website/pages/documentation/getting_started/content/04-tutorials/_jupyter_dashboard_1.ipynb +1000 -0
- solara/website/pages/documentation/getting_started/content/05-fundamentals/00-overview.md +11 -0
- solara/website/pages/documentation/getting_started/content/05-fundamentals/10-components.md +223 -0
- solara/website/pages/documentation/getting_started/content/05-fundamentals/50-state-management.md +88 -0
- solara/website/pages/documentation/getting_started/content/07-deploying/00-overview.md +7 -0
- solara/website/pages/documentation/getting_started/content/07-deploying/10-self-hosted.md +273 -0
- solara/website/pages/documentation/getting_started/content/07-deploying/20-cloud-hosted.md +80 -0
- solara/website/pages/documentation/getting_started/content/80-what-is-lab.md +7 -0
- solara/website/pages/documentation/getting_started/content/90-troubleshoot.md +26 -0
- solara/website/pages/docutils.py +38 -0
- solara/website/pages/showcase/__init__.py +105 -0
- solara/website/pages/showcase/domino_code_assist.py +60 -0
- solara/website/pages/showcase/planeto_tessa.py +19 -0
- solara/website/pages/showcase/solara_dev.py +54 -0
- solara/website/pages/showcase/solarathon_2023_team_2.py +22 -0
- solara/website/pages/showcase/solarathon_2023_team_4.py +22 -0
- solara/website/pages/showcase/solarathon_2023_team_5.py +23 -0
- solara/website/pages/showcase/solarathon_2023_team_6.py +34 -0
- solara/website/pages/showcase/wanderlust.py +27 -0
- solara/website/public/beach.jpeg +0 -0
- solara/website/public/logo.svg +6 -0
- solara/website/public/social/discord.svg +1 -0
- solara/website/public/social/github.svg +1 -0
- solara/website/public/social/twitter.svg +3 -0
- solara/website/public/success.html +25 -0
- solara/website/templates/index.html.j2 +117 -0
- solara/website/utils.py +51 -0
- solara/widgets/__init__.py +1 -0
- solara/widgets/vue/gridlayout.vue +110 -0
- solara/widgets/vue/html.vue +4 -0
- solara/widgets/vue/navigator.vue +104 -0
- solara/widgets/vue/vegalite.vue +115 -0
- solara/widgets/widgets.py +66 -0
- solara_ui-1.31.0.data/data/etc/jupyter/jupyter_notebook_config.d/solara.json +7 -0
- solara_ui-1.31.0.data/data/etc/jupyter/jupyter_server_config.d/solara.json +7 -0
- solara_ui-1.31.0.dist-info/METADATA +158 -0
- solara_ui-1.31.0.dist-info/RECORD +439 -0
- solara_ui-1.31.0.dist-info/WHEEL +5 -0
- solara_ui-1.31.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""# Custom state storage
|
|
2
|
+
|
|
3
|
+
Solara makes it easy to store state/data on the server side, scoped to a kernel, using [reactive variables](/api/reactive).
|
|
4
|
+
|
|
5
|
+
However, sometimes you want to store state yourself in an external system (i.e. not Solara), and for this you can use the
|
|
6
|
+
[get_kernel_id()](/api/get_kernel_id) function to get a unique id for each kernel.
|
|
7
|
+
|
|
8
|
+
If you want to store state/data scoped to a browser session, you can use the [get_session_id()](/api/get_session_id)
|
|
9
|
+
function to get a unique id tied to the users browser. This can be used to store state that outlives a page refresh.
|
|
10
|
+
|
|
11
|
+
In case you want to store state/data scoped to a user, you can use a similar strategy, but use a unique identifier based on the user,
|
|
12
|
+
instead of the session id. You can take a look at [Our oauth example](examples/general/login_oauth) or
|
|
13
|
+
[the authorization example](/apps/authorization) for inspiration.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from typing import Dict
|
|
18
|
+
|
|
19
|
+
import solara
|
|
20
|
+
import solara.lab
|
|
21
|
+
|
|
22
|
+
# used only to force updating of the page
|
|
23
|
+
force_update_counter = solara.reactive(0)
|
|
24
|
+
|
|
25
|
+
# Kernel storage is scoped to the kernel, and will be cleared when the kernel is stopped.
|
|
26
|
+
kernel_storage: Dict[str, str] = {}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def store_in_kernel_storage(value):
|
|
30
|
+
kernel_storage[solara.get_kernel_id()] = value
|
|
31
|
+
force_update_counter.value += 1
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@solara.lab.on_kernel_start
|
|
35
|
+
def initialize_kernel_storage():
|
|
36
|
+
# when a kernel gets started, we initialize the dict entry
|
|
37
|
+
kernel_storage[solara.get_kernel_id()] = "This does not"
|
|
38
|
+
|
|
39
|
+
def cleanup():
|
|
40
|
+
# when a kernel gets stopped, we remove the dict entry
|
|
41
|
+
del kernel_storage[solara.get_kernel_id()]
|
|
42
|
+
|
|
43
|
+
# cleaning up kernel storage, we prevent memory leaks
|
|
44
|
+
return cleanup
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# session storage has no lifecycle management, and will only be cleared when the server is restarted.
|
|
48
|
+
session_storage: Dict[str, str] = {}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def store_in_session_storage(value):
|
|
52
|
+
session_storage[solara.get_session_id()] = value
|
|
53
|
+
force_update_counter.value += 1
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@solara.component
|
|
57
|
+
def Page():
|
|
58
|
+
solara.InputText(
|
|
59
|
+
"Stored under the kernel id key",
|
|
60
|
+
value=kernel_storage[solara.get_kernel_id()],
|
|
61
|
+
on_value=store_in_kernel_storage,
|
|
62
|
+
continuous_update=True,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
solara.InputText(
|
|
66
|
+
"Stored under the session id key",
|
|
67
|
+
value=session_storage.get(solara.get_session_id(), "This outlives a page refresh"),
|
|
68
|
+
on_value=store_in_session_storage,
|
|
69
|
+
continuous_update=True,
|
|
70
|
+
)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""# Deploy model demo
|
|
2
|
+
|
|
3
|
+
This show off a combination of [solara.lab.Menu](/documentation/components/lab/menu) and
|
|
4
|
+
[solara.lab.ConfirmationDialog](/documentation/components/lab/confirmation_dialog)
|
|
5
|
+
and [solara.use_thread](/documentation/api/hooks/use_thread) to demonstrate how to tune, fit and deploy a model.
|
|
6
|
+
The actually deployment is not real, but simulated by a thread that returns a boolean value on success and sleep for a while to
|
|
7
|
+
similate the deployment taking time.
|
|
8
|
+
|
|
9
|
+
* Right click on the plot to either fit or reset the model parameters.
|
|
10
|
+
* Clicking on the button shows a custom menu to deploy to several environments.
|
|
11
|
+
* A confirmation dialog is used before executing the deployment.
|
|
12
|
+
* If the deployment fails, a confirmation dialog is shown to retry the deployment.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import time
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
import pandas as pd
|
|
19
|
+
import plotly.express as px
|
|
20
|
+
import solara
|
|
21
|
+
import solara.lab
|
|
22
|
+
|
|
23
|
+
slope = solara.reactive(1.5)
|
|
24
|
+
intercept = solara.reactive(0.5)
|
|
25
|
+
|
|
26
|
+
x = np.arange(0, 100, 2) / 10
|
|
27
|
+
# fake data with noise
|
|
28
|
+
y_data = (slope.value * 0.8) * x + (intercept.value + 0.4) + np.random.normal(0, 0.5, len(x))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@solara.component
|
|
32
|
+
def Page():
|
|
33
|
+
deploy_environment_request = solara.use_reactive("")
|
|
34
|
+
deploy_environment = solara.use_reactive("")
|
|
35
|
+
fake_failed = solara.use_reactive(False)
|
|
36
|
+
|
|
37
|
+
def deploy_model():
|
|
38
|
+
if deploy_environment.value == "":
|
|
39
|
+
return
|
|
40
|
+
|
|
41
|
+
# 'dummy' deployment
|
|
42
|
+
time.sleep(1.5)
|
|
43
|
+
|
|
44
|
+
# fake a failure the first time
|
|
45
|
+
if not fake_failed.value:
|
|
46
|
+
fake_failed.value = True
|
|
47
|
+
return False
|
|
48
|
+
else:
|
|
49
|
+
return True
|
|
50
|
+
|
|
51
|
+
deploy_state: solara.Result[bool] = solara.use_thread(deploy_model, dependencies=[deploy_environment.value])
|
|
52
|
+
|
|
53
|
+
x_model = x
|
|
54
|
+
y_model = (slope.value) * x_model + (intercept.value)
|
|
55
|
+
df1 = pd.DataFrame({"x": x, "y": y_data})
|
|
56
|
+
df2 = pd.DataFrame({"x": x_model, "y": y_model})
|
|
57
|
+
df = pd.concat([df1, df2], keys=["data", "model"], names=["type"]).reset_index()
|
|
58
|
+
fig = px.line(df, x="x", y="y", color="type")
|
|
59
|
+
with solara.Card("My fancy model"):
|
|
60
|
+
fig_element = solara.FigurePlotly(fig)
|
|
61
|
+
|
|
62
|
+
def reset():
|
|
63
|
+
slope.set(1.5)
|
|
64
|
+
intercept.set(0.5)
|
|
65
|
+
|
|
66
|
+
def fit():
|
|
67
|
+
slope.set(1.5 * 0.8)
|
|
68
|
+
intercept.set(0.9)
|
|
69
|
+
|
|
70
|
+
with solara.lab.ContextMenu(activator=fig_element):
|
|
71
|
+
solara.Button("Reset", text=True, icon_name="mdi-refresh", on_click=reset)
|
|
72
|
+
solara.Button("Fit", text=True, icon_name="mdi-brain", on_click=fit)
|
|
73
|
+
|
|
74
|
+
solara.FloatSlider("Slope", value=slope, min=-2, max=5, step=0.1)
|
|
75
|
+
solara.FloatSlider("Intercept", value=intercept, min=-10, max=10, step=0.1)
|
|
76
|
+
|
|
77
|
+
solara.lab.ConfirmationDialog(
|
|
78
|
+
deploy_environment_request.value != "",
|
|
79
|
+
title="Confirm deployment",
|
|
80
|
+
content=solara.Markdown(f"Are you sure you want to deploy to **{deploy_environment_request.value}**?"),
|
|
81
|
+
ok=f"Deploy to {deploy_environment_request.value}",
|
|
82
|
+
on_ok=lambda: deploy_environment.set(deploy_environment_request.value),
|
|
83
|
+
on_close=lambda: deploy_environment_request.set(""),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
solara.lab.ConfirmationDialog(
|
|
87
|
+
deploy_state.value is False and deploy_state.state == solara.ResultState.FINISHED,
|
|
88
|
+
title="Deployment failed",
|
|
89
|
+
on_close=lambda: None,
|
|
90
|
+
on_ok=lambda: deploy_state.retry(),
|
|
91
|
+
content=solara.Error(solara.Markdown(f"Deployment to **{deploy_environment.value}** failed. Do you want to try again?")),
|
|
92
|
+
ok="Retry deployment",
|
|
93
|
+
cancel="Ignore the failure",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def request_deploy(environment):
|
|
97
|
+
deploy_environment.value = ""
|
|
98
|
+
deploy_environment_request.set(environment)
|
|
99
|
+
|
|
100
|
+
deploying = bool(deploy_environment.value and deploy_state.state == solara.ResultState.RUNNING)
|
|
101
|
+
deploy_button = solara.Button("Deploy model", color="primary", icon_name="mdi-rocket", loading=deploying)
|
|
102
|
+
with solara.lab.Menu(activator=deploy_button):
|
|
103
|
+
with solara.Column(gap="0px"):
|
|
104
|
+
solara.Button("Deploy to testing environment", text=True, icon_name="mdi-bug", on_click=lambda: request_deploy("testing"))
|
|
105
|
+
solara.Button("Deploy to staging environment", text=True, icon_name="mdi-test-tube", on_click=lambda: request_deploy("staging"))
|
|
106
|
+
solara.Button(
|
|
107
|
+
"Deploy to production",
|
|
108
|
+
text=True,
|
|
109
|
+
icon_name="mdi-rocket",
|
|
110
|
+
style={"justify-content": "left"}, # make the icon appear on the left
|
|
111
|
+
on_click=lambda: request_deploy("production"),
|
|
112
|
+
)
|
|
113
|
+
if deploy_state.value is True and deploy_state.state == solara.ResultState.FINISHED:
|
|
114
|
+
# add some margin in the y direction using my-4
|
|
115
|
+
solara.Success(solara.Markdown(f"Model deployed successfully to **{deploy_environment.value}**!"), classes=["my-4"])
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from time import sleep
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from matplotlib import pyplot as plt
|
|
5
|
+
|
|
6
|
+
import solara
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@solara.component
|
|
10
|
+
def Page():
|
|
11
|
+
# define some state which will be updated regularly in a separate thread
|
|
12
|
+
counter = solara.use_reactive(0)
|
|
13
|
+
|
|
14
|
+
def render():
|
|
15
|
+
"""Infinite loop regularly mutating counter state"""
|
|
16
|
+
while True:
|
|
17
|
+
sleep(0.2)
|
|
18
|
+
counter.value += 1
|
|
19
|
+
|
|
20
|
+
# run the render loop in a separate thread
|
|
21
|
+
result: solara.Result[bool] = solara.use_thread(render)
|
|
22
|
+
if result.error:
|
|
23
|
+
raise result.error
|
|
24
|
+
|
|
25
|
+
# create the LiveUpdatingComponent, this component depends on the counter
|
|
26
|
+
# value so will be redrawn whenever counter value changes
|
|
27
|
+
LiveUpdatingComponent(counter.value)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@solara.component
|
|
31
|
+
def LiveUpdatingComponent(counter):
|
|
32
|
+
"""Component which will be redrawn whenever the counter value changes."""
|
|
33
|
+
fig, ax = plt.subplots()
|
|
34
|
+
ax.plot(np.arange(10), np.random.random(10))
|
|
35
|
+
solara.FigureMatplotlib(fig)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Page()
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import pprint
|
|
2
|
+
from types import ModuleType
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
import reacton.ipyvuetify as v
|
|
6
|
+
|
|
7
|
+
auth: Optional[ModuleType]
|
|
8
|
+
try:
|
|
9
|
+
from solara_enterprise import auth
|
|
10
|
+
except ImportError:
|
|
11
|
+
auth = None
|
|
12
|
+
import solara as sl
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@sl.component
|
|
16
|
+
def UserCard():
|
|
17
|
+
assert auth is not None
|
|
18
|
+
user = auth.user.value
|
|
19
|
+
if user:
|
|
20
|
+
user_info = user.get("userinfo")
|
|
21
|
+
if user_info:
|
|
22
|
+
# based on https://v2.vuetifyjs.com/en/components/cards/#props
|
|
23
|
+
with v.Card(width="400px"):
|
|
24
|
+
with v.ListItem(three_line=True):
|
|
25
|
+
with v.ListItemContent():
|
|
26
|
+
sl.Div("Logged in", class_="text-overline mb-4")
|
|
27
|
+
v.ListItemTitle(children=[user_info["email"]])
|
|
28
|
+
v.ListItemSubtitle(children=["You are now logged in, log out via the app bar, or the button below"])
|
|
29
|
+
with v.ListItemAvatar():
|
|
30
|
+
auth.Avatar()
|
|
31
|
+
|
|
32
|
+
with v.CardActions():
|
|
33
|
+
sl.Button("logout", icon_name="mdi-logout", href=auth.get_logout_url(), text=True)
|
|
34
|
+
else:
|
|
35
|
+
sl.Error("No user info")
|
|
36
|
+
else:
|
|
37
|
+
sl.Error("No user")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@sl.component
|
|
41
|
+
def Page():
|
|
42
|
+
assert auth is not None
|
|
43
|
+
sl.Title("Login demo using OAuth")
|
|
44
|
+
with sl.AppBar():
|
|
45
|
+
if auth.user.value:
|
|
46
|
+
auth.AvatarMenu()
|
|
47
|
+
else:
|
|
48
|
+
sl.Button(icon_name="mdi-login", href=auth.get_login_url(), icon=True)
|
|
49
|
+
|
|
50
|
+
with sl.Column():
|
|
51
|
+
if auth.user.value:
|
|
52
|
+
UserCard()
|
|
53
|
+
with sl.Details("Raw data"):
|
|
54
|
+
sl.Markdown(
|
|
55
|
+
"""
|
|
56
|
+
### Raw user data
|
|
57
|
+
|
|
58
|
+
*Note: do not share this data with anyone, it contains sensitive information.*
|
|
59
|
+
|
|
60
|
+
This is the raw user data from the auth provider.
|
|
61
|
+
|
|
62
|
+
We use the `picture` field to display an avatar in the [AppBar](/documentation/components/layout/app_bar).
|
|
63
|
+
"""
|
|
64
|
+
)
|
|
65
|
+
sl.Preformatted(pprint.pformat(auth.user.value))
|
|
66
|
+
else:
|
|
67
|
+
sl.Markdown(
|
|
68
|
+
"""
|
|
69
|
+
### Login demo
|
|
70
|
+
|
|
71
|
+
This is a demo of a login system using OAuth. You can login with your google account, github account or with a username and password.
|
|
72
|
+
We are using [Auth0](https://auth0.com/) as an OAuth provider.
|
|
73
|
+
|
|
74
|
+
"""
|
|
75
|
+
)
|
|
76
|
+
with sl.Row():
|
|
77
|
+
sl.Button("login", icon_name="mdi-login", href=auth.get_login_url())
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
if auth is None:
|
|
81
|
+
del Page
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-card class="text-center" :color="color" dark>
|
|
3
|
+
<v-card-text>
|
|
4
|
+
<v-sheet color="rgba(0, 0, 0, .12)">
|
|
5
|
+
<v-sparkline :value="value" color="rgba(255, 255, 255, .7)" height="100" padding="24" stroke-linecap="round"
|
|
6
|
+
smooth>
|
|
7
|
+
<template v-slot:label="item">
|
|
8
|
+
${{ item.value }}
|
|
9
|
+
</template>
|
|
10
|
+
</v-sparkline>
|
|
11
|
+
</v-sheet>
|
|
12
|
+
</v-card-text>
|
|
13
|
+
|
|
14
|
+
<v-card-text>
|
|
15
|
+
<h1 class="solara-some-class">{{ caption }}</h1>
|
|
16
|
+
</v-card-text>
|
|
17
|
+
|
|
18
|
+
<v-divider></v-divider>
|
|
19
|
+
|
|
20
|
+
<v-card-actions class="justify-center">
|
|
21
|
+
<v-btn block text @click="goto_report">
|
|
22
|
+
Go to Report
|
|
23
|
+
</v-btn>
|
|
24
|
+
</v-card-actions>
|
|
25
|
+
</v-card>
|
|
26
|
+
</template>
|
|
27
|
+
<style id="mycard">
|
|
28
|
+
.solara-some-class {
|
|
29
|
+
font-weight: lighter;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
export default {
|
|
35
|
+
data: () => ({
|
|
36
|
+
value: [
|
|
37
|
+
423,
|
|
38
|
+
446,
|
|
39
|
+
675,
|
|
40
|
+
510,
|
|
41
|
+
590,
|
|
42
|
+
610,
|
|
43
|
+
760,
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
mounted: () => {
|
|
47
|
+
console.log('mounted');
|
|
48
|
+
},
|
|
49
|
+
destroyed: () => {
|
|
50
|
+
console.log('destroyed');
|
|
51
|
+
},
|
|
52
|
+
watch: {
|
|
53
|
+
value: function (val) {
|
|
54
|
+
console.log('value changed to', val);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""# Pokemon search
|
|
2
|
+
|
|
3
|
+
This example shows to to dynamically fetch data and render the results in a table when done, and show an error on failure.
|
|
4
|
+
|
|
5
|
+
It also shows an optional filter to narrow down the results.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import solara
|
|
9
|
+
from solara import use_fetch
|
|
10
|
+
from solara.alias import rv
|
|
11
|
+
|
|
12
|
+
github_url = solara.util.github_url(__file__)
|
|
13
|
+
|
|
14
|
+
json_url = "https://jherr-pokemon.s3.us-west-1.amazonaws.com/index.json"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@solara.component
|
|
18
|
+
def Page():
|
|
19
|
+
data = use_fetch(json_url)
|
|
20
|
+
json = solara.use_json_load(data)
|
|
21
|
+
filter, set_filter = solara.use_state("")
|
|
22
|
+
|
|
23
|
+
with solara.Div() as main:
|
|
24
|
+
if json.error:
|
|
25
|
+
solara.Error(f"Error {json.error}")
|
|
26
|
+
solara.Button("Retry", on_click=data.retry)
|
|
27
|
+
else:
|
|
28
|
+
if json.value:
|
|
29
|
+
solara.InputText(label="Filter pokemons by name", value=filter, on_value=set_filter, continuous_update=True)
|
|
30
|
+
pokemons = json.value
|
|
31
|
+
if filter:
|
|
32
|
+
pokemons = [k for k in pokemons if filter.lower() in k["name"].lower()]
|
|
33
|
+
if len(pokemons) == 0:
|
|
34
|
+
solara.Warning("No pokemons found, try a different filter")
|
|
35
|
+
else:
|
|
36
|
+
solara.Info(f"{len(pokemons)} pokemons found")
|
|
37
|
+
else:
|
|
38
|
+
solara.Info(f"{len(pokemons)} pokemons in total")
|
|
39
|
+
with solara.GridFixed(columns=4, align_items="end", justify_items="stretch"):
|
|
40
|
+
for pokemon in pokemons[:20]:
|
|
41
|
+
with solara.Div():
|
|
42
|
+
name = pokemon["name"]
|
|
43
|
+
url = "https://jherr-pokemon.s3.us-west-1.amazonaws.com/" + pokemon["image"]
|
|
44
|
+
# TODO: how to do this with solara
|
|
45
|
+
rv.Img(src=url, contain=True, max_height="200px")
|
|
46
|
+
solara.Text(name)
|
|
47
|
+
else:
|
|
48
|
+
with solara.Div():
|
|
49
|
+
solara.Text("Loading...")
|
|
50
|
+
rv.ProgressCircular(indeterminate=True, class_="solara-progress")
|
|
51
|
+
return main
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Demonstrates how to use Vue components in Solara.
|
|
2
|
+
|
|
3
|
+
Although many components can be made from the Python side, sometimes it is easier to write components using Vue directly.
|
|
4
|
+
It can also be beneficial for performance, since instead of creating many widgets from the Python side we only send data to
|
|
5
|
+
the frontend. If event handling is also done on the frontend, this reduces latency and makes you app feel much smoother.
|
|
6
|
+
|
|
7
|
+
See [the API documentation on component_vue](/documentation/api/utilities/component_vue) for more information.
|
|
8
|
+
|
|
9
|
+
This example is based on [the vuetify docs](https://v2.vuetifyjs.com/en/components/sparklines/#custom-labels),
|
|
10
|
+
Note that the "Go to report" button does not do anything yet.
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from typing import Callable
|
|
15
|
+
|
|
16
|
+
import numpy as np
|
|
17
|
+
import solara
|
|
18
|
+
|
|
19
|
+
seed = solara.reactive(42)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@solara.component_vue("mycard.vue")
|
|
23
|
+
def MyCard(
|
|
24
|
+
event_goto_report: Callable[[dict], None],
|
|
25
|
+
value=[1, 10, 30, 20, 3],
|
|
26
|
+
caption="My Card",
|
|
27
|
+
color="red",
|
|
28
|
+
):
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@solara.component
|
|
33
|
+
def Page():
|
|
34
|
+
gen = np.random.RandomState(seed=seed.value)
|
|
35
|
+
sales_data = np.floor(np.cumsum(gen.random(7) - 0.5) * 100 + 100)
|
|
36
|
+
show_report = solara.use_reactive(False)
|
|
37
|
+
|
|
38
|
+
with solara.Column(style={"min-width": "600px"}):
|
|
39
|
+
if show_report.value:
|
|
40
|
+
with solara.Card("Report"):
|
|
41
|
+
solara.Markdown("Lorum ipsum dolor sit amet")
|
|
42
|
+
solara.Button("Go back", on_click=lambda: show_report.set(False))
|
|
43
|
+
else:
|
|
44
|
+
|
|
45
|
+
def new_seed():
|
|
46
|
+
seed.value = np.random.randint(0, 100)
|
|
47
|
+
|
|
48
|
+
solara.Button("Generate new data", on_click=new_seed)
|
|
49
|
+
|
|
50
|
+
MyCard(value=sales_data.tolist(), color="green", caption="Sales Last 7 Days", event_goto_report=lambda data: show_report.set(True))
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Disabled, sometimes crashes the webpage.
|
|
2
|
+
# import ipycanvas
|
|
3
|
+
# import numpy as np
|
|
4
|
+
# import solara
|
|
5
|
+
# from reacton import ipycanvas as c
|
|
6
|
+
# from reacton import ipywidgets as w
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# def polygon(canvas, x, y, radius1, radius2, n_points):
|
|
10
|
+
# index = np.arange(n_points)
|
|
11
|
+
# angles = (2 * np.pi / n_points) * index
|
|
12
|
+
|
|
13
|
+
# radius = np.where(index % 2, radius1, radius2)
|
|
14
|
+
# v_x = x + np.cos(angles) * radius
|
|
15
|
+
# v_y = y + np.sin(angles) * radius
|
|
16
|
+
|
|
17
|
+
# points = np.stack((v_x, v_y), axis=1)
|
|
18
|
+
|
|
19
|
+
# canvas.fill_polygon(points)
|
|
20
|
+
# canvas.stroke_polygon(points)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# @solara.component
|
|
24
|
+
# def Page():
|
|
25
|
+
# width, height = 800, 800
|
|
26
|
+
# view_count, set_view_count = solara.use_state(0)
|
|
27
|
+
# with w.ViewcountVBox(set_view_count) as main:
|
|
28
|
+
# fill = w.color("#63934e", "fill color")
|
|
29
|
+
# stroke = w.color("#4e6393", "stroke color")
|
|
30
|
+
# line_width = w.slider_int(4, description="line width", min=0, max=30)
|
|
31
|
+
# n_points = w.slider_int(5, "Points", min=1, max=8) * 2
|
|
32
|
+
# radius_inner = w.slider_float(30, "Inner radius", min=0, max=100)
|
|
33
|
+
# radius_outer = w.slider_float(80, "Outer radius", min=0, max=100)
|
|
34
|
+
|
|
35
|
+
# def real_drawing():
|
|
36
|
+
# canvas: ipycanvas.Canvas = solara.core.get_widget(canvas_element)
|
|
37
|
+
|
|
38
|
+
# with ipycanvas.hold_canvas(canvas):
|
|
39
|
+
# canvas.clear()
|
|
40
|
+
# canvas.fill_style = fill
|
|
41
|
+
# canvas.stroke_style = stroke
|
|
42
|
+
# canvas.line_width = line_width
|
|
43
|
+
# radius = width // 3
|
|
44
|
+
# polygon(canvas, width // 2, height // 2, radius * radius_inner / 100, radius * radius_outer / 100, n_points)
|
|
45
|
+
|
|
46
|
+
# solara.use_side_effect(real_drawing, [fill, stroke, line_width, n_points, view_count, radius_inner, radius_outer])
|
|
47
|
+
# canvas_element = c.Canvas(width=width, height=height)
|
|
48
|
+
|
|
49
|
+
# return main
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""# Altair
|
|
2
|
+
|
|
3
|
+
[Altair](https://altair-viz.github.io/index.html) is a declarative statistical visualization library for Python.
|
|
4
|
+
|
|
5
|
+
This example show how to use the [on_click handler](/documentation/components/viz/altair) to display data for a specific day in the chart.
|
|
6
|
+
|
|
7
|
+
Based on [an Altair example](https://altair-viz.github.io/gallery/annual_weather_heatmap.html)
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import altair as alt
|
|
12
|
+
import pandas as pd
|
|
13
|
+
import solara
|
|
14
|
+
from vega_datasets import data
|
|
15
|
+
|
|
16
|
+
# title = "Altair visualization"
|
|
17
|
+
source = data.seattle_weather()
|
|
18
|
+
|
|
19
|
+
selected_datum = solara.reactive(None)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@solara.component
|
|
23
|
+
def Page():
|
|
24
|
+
def on_click(datum):
|
|
25
|
+
selected_datum.value = datum
|
|
26
|
+
|
|
27
|
+
chart = (
|
|
28
|
+
alt.Chart(source, title="Daily Max Temperatures (C) in Seattle, WA")
|
|
29
|
+
.mark_rect()
|
|
30
|
+
.encode(
|
|
31
|
+
alt.X("date(date):O").title("Day").axis(format="%e", labelAngle=0),
|
|
32
|
+
alt.Y("month(date):O").title("Month"),
|
|
33
|
+
alt.Color("max(temp_max)").title(None),
|
|
34
|
+
tooltip=[
|
|
35
|
+
alt.Tooltip("monthdate(date)", title="Date"),
|
|
36
|
+
alt.Tooltip("max(temp_max)", title="Max Temp"),
|
|
37
|
+
],
|
|
38
|
+
)
|
|
39
|
+
.configure_view(step=13, strokeWidth=0)
|
|
40
|
+
.configure_axis(domain=False)
|
|
41
|
+
)
|
|
42
|
+
with solara.Card("Annual Weather Heatmap for Seattle, WA"):
|
|
43
|
+
solara.AltairChart(chart, on_click=on_click)
|
|
44
|
+
df = source
|
|
45
|
+
if selected_datum.value:
|
|
46
|
+
month_date = selected_datum.value["monthdate_date_end"]
|
|
47
|
+
dt = pd.to_datetime(month_date)
|
|
48
|
+
df = df[(df["date"].dt.month == dt.month) & (df["date"].dt.day == dt.day)]
|
|
49
|
+
solara.Markdown(f"Day of year: {dt.month_name()} - {dt.day}")
|
|
50
|
+
solara.Button("Clear selection", on_click=lambda: selected_datum.set(None))
|
|
51
|
+
solara.display(df)
|
|
52
|
+
|
|
53
|
+
with solara.Details("Click data"):
|
|
54
|
+
solara.Markdown(
|
|
55
|
+
f"""
|
|
56
|
+
Click data:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
{selected_datum.value}
|
|
60
|
+
```
|
|
61
|
+
"""
|
|
62
|
+
)
|
|
63
|
+
else:
|
|
64
|
+
solara.Markdown("Click on the chart to see data for a specific day")
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# bqplot
|
|
3
|
+
|
|
4
|
+
[bqplot](https://github.com/bqplot/bqplot) is a 2-D visualization system for Jupyter, based on the constructs of the Grammar of Graphics.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
import reacton.bqplot as bqplot
|
|
9
|
+
|
|
10
|
+
import solara
|
|
11
|
+
|
|
12
|
+
x0 = np.linspace(0, 2, 100)
|
|
13
|
+
|
|
14
|
+
exponent = solara.reactive(1.0)
|
|
15
|
+
log_scale = solara.reactive(False)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@solara.component
|
|
19
|
+
def Page(x=x0, ymax=5):
|
|
20
|
+
y = x**exponent.value
|
|
21
|
+
color = "red"
|
|
22
|
+
display_legend = True
|
|
23
|
+
label = "bqplot graph"
|
|
24
|
+
|
|
25
|
+
solara.SliderFloat(value=exponent, min=0.1, max=3, label="Exponent")
|
|
26
|
+
solara.Checkbox(value=log_scale, label="Log scale")
|
|
27
|
+
|
|
28
|
+
x_scale = bqplot.LinearScale()
|
|
29
|
+
if log_scale.value:
|
|
30
|
+
y_scale = bqplot.LogScale(min=0.1, max=ymax)
|
|
31
|
+
else:
|
|
32
|
+
y_scale = bqplot.LinearScale(min=0, max=ymax)
|
|
33
|
+
|
|
34
|
+
lines = bqplot.Lines(x=x, y=y, scales={"x": x_scale, "y": y_scale}, stroke_width=3, colors=[color], display_legend=display_legend, labels=[label])
|
|
35
|
+
x_axis = bqplot.Axis(scale=x_scale)
|
|
36
|
+
y_axis = bqplot.Axis(scale=y_scale, orientation="vertical")
|
|
37
|
+
bqplot.Figure(axes=[x_axis, y_axis], marks=[lines], scale_x=x_scale, scale_y=y_scale, layout={"min_width": "800px"})
|
|
38
|
+
|
|
39
|
+
# return main
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# ipyleaflet
|
|
3
|
+
Map visualization using [ipyleaflet](https://ipyleaflet.readthedocs.io/), a ipywidgets wrapper for [leaflet.js](https://leafletjs.com/)
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import ipyleaflet
|
|
7
|
+
|
|
8
|
+
import solara
|
|
9
|
+
|
|
10
|
+
zoom = solara.reactive(5)
|
|
11
|
+
center = solara.reactive((53.2305799, 6.5323552))
|
|
12
|
+
bounds = solara.reactive(None)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@solara.component
|
|
16
|
+
def Page():
|
|
17
|
+
# Isolation is required to prevent the map from overlapping navigation (when screen width < 960px)
|
|
18
|
+
with solara.Column(style={"min-width": "500px", "height": "500px", "isolation": "isolate"}):
|
|
19
|
+
# solara components support reactive variables
|
|
20
|
+
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20)
|
|
21
|
+
# using 3rd party widget library require wiring up the events manually
|
|
22
|
+
# using zoom.value and zoom.set
|
|
23
|
+
ipyleaflet.Map.element( # type: ignore
|
|
24
|
+
zoom=zoom.value,
|
|
25
|
+
on_zoom=zoom.set,
|
|
26
|
+
center=center.value,
|
|
27
|
+
on_center=center.set,
|
|
28
|
+
on_bounds=bounds.set,
|
|
29
|
+
scroll_wheel_zoom=True,
|
|
30
|
+
)
|
|
31
|
+
solara.Text(f"Zoom: {zoom.value}")
|
|
32
|
+
solara.Text(f"Center: {center.value}")
|
|
33
|
+
solara.Text(f"Bounds: {bounds.value}")
|