solara 1.30.0__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.0.dist-info → solara-1.31.0.dist-info}/METADATA +7 -42
- solara-1.31.0.dist-info/RECORD +5 -0
- {solara-1.30.0.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 -554
- 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 -109
- 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 -87
- 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 -393
- 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/notebook.py +0 -172
- solara/website/pages/__init__.py +0 -564
- 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 -180
- 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 -36
- solara/website/pages/documentation/advanced/content/00-overview.md +0 -1
- solara/website/pages/documentation/advanced/content/10-howto/00-overview.md +0 -1
- solara/website/pages/documentation/advanced/content/10-howto/10-multipage.md +0 -191
- solara/website/pages/documentation/advanced/content/10-howto/20-layout.md +0 -120
- solara/website/pages/documentation/advanced/content/10-howto/30-testing.md +0 -149
- solara/website/pages/documentation/advanced/content/10-howto/31-debugging.md +0 -66
- solara/website/pages/documentation/advanced/content/10-howto/40-embed.md +0 -43
- solara/website/pages/documentation/advanced/content/10-howto/50-ipywidget_libraries.md +0 -120
- solara/website/pages/documentation/advanced/content/20-understanding/00-introduction.md +0 -4
- solara/website/pages/documentation/advanced/content/20-understanding/05-ipywidgets.md +0 -30
- solara/website/pages/documentation/advanced/content/20-understanding/06-ipyvuetify.md +0 -38
- solara/website/pages/documentation/advanced/content/20-understanding/10-reacton.md +0 -24
- solara/website/pages/documentation/advanced/content/20-understanding/12-reacton-basics.md +0 -104
- solara/website/pages/documentation/advanced/content/20-understanding/15-anatomy.md +0 -19
- solara/website/pages/documentation/advanced/content/20-understanding/17-rules-of-hooks.md +0 -3
- solara/website/pages/documentation/advanced/content/20-understanding/18-containers.md +0 -160
- solara/website/pages/documentation/advanced/content/20-understanding/20-solara.md +0 -13
- solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md +0 -236
- solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md +0 -81
- solara/website/pages/documentation/advanced/content/20-understanding/60-voila.md +0 -7
- 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 -167
- 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 -41
- solara/website/pages/documentation/advanced/content/40-development/10-setup.md +0 -72
- solara/website/pages/documentation/advanced/content/__init__.py +0 -0
- 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 -11
- solara/website/pages/documentation/faq/content/99-faq.md +0 -73
- solara/website/pages/documentation/getting_started/__init__.py +0 -15
- solara/website/pages/documentation/getting_started/content/00-quickstart.md +0 -84
- solara/website/pages/documentation/getting_started/content/01-introduction.md +0 -121
- solara/website/pages/documentation/getting_started/content/02-installing.md +0 -81
- solara/website/pages/documentation/getting_started/content/04-tutorials/00-overview.md +0 -9
- 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 -84
- solara/website/pages/documentation/getting_started/content/04-tutorials/30-ipywidgets.md +0 -120
- solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md +0 -141
- solara/website/pages/documentation/getting_started/content/04-tutorials/50-dash.md +0 -140
- 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 -7
- solara/website/pages/documentation/getting_started/content/05-fundamentals/10-components.md +0 -218
- solara/website/pages/documentation/getting_started/content/05-fundamentals/50-state-management.md +0 -83
- 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 -27
- solara/website/pages/documentation/getting_started/content/06-reference/41-asset-files.md +0 -32
- solara/website/pages/documentation/getting_started/content/06-reference/60-static-site-generation.md +0 -55
- solara/website/pages/documentation/getting_started/content/06-reference/70-search.md +0 -30
- solara/website/pages/documentation/getting_started/content/06-reference/80-reloading.md +0 -30
- solara/website/pages/documentation/getting_started/content/06-reference/90-notebook-support.md +0 -4
- solara/website/pages/documentation/getting_started/content/06-reference/95-caching.md +0 -143
- solara/website/pages/documentation/getting_started/content/07-deploying/00-overview.md +0 -3
- solara/website/pages/documentation/getting_started/content/07-deploying/10-self-hosted.md +0 -269
- solara/website/pages/documentation/getting_started/content/07-deploying/20-cloud-hosted.md +0 -76
- solara/website/pages/documentation/getting_started/content/08-lab/00-what-is-lab.md +0 -3
- solara/website/pages/documentation/getting_started/content/90-troubleshoot.md +0 -22
- solara/website/pages/documentation/getting_started/content/__init__.py +0 -0
- 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.0.data/data/etc/jupyter/jupyter_notebook_config.d/solara.json +0 -7
- solara-1.30.0.data/data/etc/jupyter/jupyter_server_config.d/solara.json +0 -7
- solara-1.30.0.dist-info/RECORD +0 -438
- solara-1.30.0.dist-info/entry_points.txt +0 -5
- /solara-1.30.0.dist-info/licenses/LICENSE → /LICENSE +0 -0
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# How can I use ipywidget library X?
|
|
2
|
-
|
|
3
|
-
Solara can work with any ipywidget library, such as [ipyleaflet](https://github.com/jupyter-widgets/ipyleaflet), [ipydatagrid](https://github.com/bloomberg/ipydatagrid) or [bqplot](https://github.com/bqplot/bqplot).
|
|
4
|
-
|
|
5
|
-
After `solara` is imported, every widget class has an extra `.element(...)` method added to itself. This allows us to create elements for all existing widgets. For example using regular ipywidgets:
|
|
6
|
-
|
|
7
|
-
```python
|
|
8
|
-
import ipywidgets
|
|
9
|
-
button_element = ipywidgets.Button.element(description="Click me")
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Example with ipyleaflet
|
|
13
|
-
|
|
14
|
-
For instance, if we want to use ipyleaflet using the classical ipywidget API, we can do:
|
|
15
|
-
|
|
16
|
-
```python
|
|
17
|
-
import ipyleaflet
|
|
18
|
-
|
|
19
|
-
map = ipyleaflet.Map(center=(52, 10), zoom=8)
|
|
20
|
-
|
|
21
|
-
marker = Marker(location=(52.1, 10.1), draggable=True)
|
|
22
|
-
m.add_layer(marker)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
In Solara, we should not create widgets, but elements instead. We can create elements using the `.element(...)` method. This method takes the same arguments as the widget constructor, but returns an element instead of a widget. The element can be used in the same way as a widget, but it is not a widget. It is a special object that can be used in Solara.
|
|
26
|
-
|
|
27
|
-
However, how do we add the marker to the map? The map element object does not have an `add_layer` method. That is the downside of using the React-like API of Solara. We cannot call methods on the widget
|
|
28
|
-
anymore. Instead, we need to pass the marker to the layers argument. That, however, introduces a new problem. Ipyleaflet by default adds a layer to the map when it is created, and the `add_layer` adds the second layer. We now need to manually add the map layer ourselves.
|
|
29
|
-
|
|
30
|
-
Putting this together.
|
|
31
|
-
```solara
|
|
32
|
-
import ipyleaflet
|
|
33
|
-
import solara
|
|
34
|
-
|
|
35
|
-
url = ipyleaflet.basemaps.OpenStreetMap.Mapnik["url"]
|
|
36
|
-
|
|
37
|
-
@solara.component
|
|
38
|
-
def Page():
|
|
39
|
-
marker = ipyleaflet.Marker.element(location=(52.1, 10.1), draggable=True)
|
|
40
|
-
map = ipyleaflet.Map.element(
|
|
41
|
-
center=(52, 10),
|
|
42
|
-
zoom=8,
|
|
43
|
-
layers=[
|
|
44
|
-
ipyleaflet.TileLayer.element(url=url),
|
|
45
|
-
marker,
|
|
46
|
-
],
|
|
47
|
-
)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Note that this is about the worst example of something that looks easy in ipyleaflet using the classical API becoming a bit more involved in Solara.
|
|
51
|
-
In practice, this does not happen often, and your code in general will be shorter and more readable.
|
|
52
|
-
|
|
53
|
-
Another thing of note is that ipyleaflet uses CSS `z-index` to layer content, potentially causing issues with your map overlaying other content. This can be avoided by styling the parent element of the map with `isolation: isolate;`. For examples of how to do this, you can see the below examples.
|
|
54
|
-
|
|
55
|
-
See also [the basic ipyleaflet example](/examples/libraries/ipyleaflet) and [the advanced ipyleaflet example](/examples/libraries/ipyleaflet_advanced).
|
|
56
|
-
|
|
57
|
-
## Example with ipywidgets
|
|
58
|
-
|
|
59
|
-
Most widgets in (classic) ipywidgets can be used without problems in Solara. Two widgets stand out that are difficult to use.
|
|
60
|
-
|
|
61
|
-
### Image
|
|
62
|
-
|
|
63
|
-
The `Image` widget can be used normally, but we cannot use the factory methods like `Image.from_file` and `Image.from_url`, for this reason we create the [Image](/api/image) component that
|
|
64
|
-
makes this easier.
|
|
65
|
-
|
|
66
|
-
### Video
|
|
67
|
-
|
|
68
|
-
The `Video` widget does not have a corresponding component in solara (yet), but we can manually fill in the `value`. For example:
|
|
69
|
-
|
|
70
|
-
```solara
|
|
71
|
-
import solara
|
|
72
|
-
import ipywidgets
|
|
73
|
-
|
|
74
|
-
url = 'https://user-images.githubusercontent.com/1765949/240697327-25b296bd-72c6-4412-948b-2d37e8196260.mp4'
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@solara.component
|
|
78
|
-
def Page():
|
|
79
|
-
ipywidgets.Video.element(value=url.encode('utf8'),
|
|
80
|
-
format='url',
|
|
81
|
-
width=500
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Wrapper libraries
|
|
87
|
-
|
|
88
|
-
However, because we care about type safety, we generate wrapper components for some libraries. This enables type completion in VSCode, type checks with VSCode, and mypy.
|
|
89
|
-
|
|
90
|
-
The following libraries are fully wrapped:
|
|
91
|
-
|
|
92
|
-
* `ipywidgets` wrapper: `reacton.ipywidgets`
|
|
93
|
-
* `ipyvuetify` wrapper: `reacton.ipyvuetify`
|
|
94
|
-
* `bqplot` wrapper: `reacton.bqplot`
|
|
95
|
-
* `ipycanvas` wrapper: `reacton.ipycanvas`
|
|
96
|
-
|
|
97
|
-
This allows us to do instead:
|
|
98
|
-
```python
|
|
99
|
-
import reacton.ipywidgets as w
|
|
100
|
-
button_element = w.Button(description="Click me)
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
And enjoy auto complete and type checking.
|
|
104
|
-
|
|
105
|
-
## Create your own wrapper
|
|
106
|
-
|
|
107
|
-
The best example would be to take a look at the source code for now:
|
|
108
|
-
|
|
109
|
-
* [ipywidgets](https://github.com/widgetti/reacton/blob/master/reacton/ipywidgets.py)
|
|
110
|
-
* [bqplot](https://github.com/widgetti/reacton/blob/master/reacton/bqplot.py)
|
|
111
|
-
* [ipyvuetify](https://github.com/widgetti/reacton/blob/master/reacton/ipyvuetify.py)
|
|
112
|
-
|
|
113
|
-
The code is generated by executing:
|
|
114
|
-
|
|
115
|
-
$ python -m reacton.ipywidgets
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## Limitation
|
|
119
|
-
|
|
120
|
-
Reacton assumes the widget constructor arguments match the traits. If this is not the case, this may result in runtime errors. If this leads to issues, please open an [Issue](https://github.com/widgetti/solara/issues/new) to discuss this.
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# IPywidgets
|
|
2
|
-
|
|
3
|
-
* [Documentation](https://ipywidgets.readthedocs.io/en/stable/)
|
|
4
|
-
* [GitHub](https://github.com/jupyter-widgets/ipywidgets)
|
|
5
|
-
|
|
6
|
-
IPywidgets is a Python library for creating UI objects that live in the Python side *and* on the browser side. They provide bi-directional communication, meaning you can change a slider in the browser, or from the Python side. `IPywidgets` takes care of communication and synchronization.
|
|
7
|
-
|
|
8
|
-
With ipywidgets you get access to the browser without writing a single line of JavaScript or CSS.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Solara and ipywidgets
|
|
12
|
-
|
|
13
|
-
Solara can use almost all existing ipywidgets, from the core library that provides sliders, to [ipyvuetify](./ipyvuetify) which gives us rich UI elements, to ipyvolume that gives us interactive 3d visualizations.
|
|
14
|
-
|
|
15
|
-
## Where do ipywidgets work?
|
|
16
|
-
|
|
17
|
-
There are various places where ipywidgets work, and [Solara server](./solara-server) is one of these. There is a [list of frontends that support](https://github.com/jupyter/jupyter/wiki/Jupyter-Widgets#frontends-that-support-jupyter-widgets) meaning that you ipywidgets based applications run
|
|
18
|
-
on many places (From Jupyter Notebook, Jupyter Lab, Google Colab to even VS Code).
|
|
19
|
-
|
|
20
|
-
## Which ipywidget libraries exist?
|
|
21
|
-
|
|
22
|
-
There is a list [of ipywidget libraries](https://github.com/jupyter/jupyter/wiki/Jupyter-Widgets#custom-jupyter-widgets), but that are probably
|
|
23
|
-
many more.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Do all ipywidget libraries work with Solara server?
|
|
27
|
-
|
|
28
|
-
All these libraries should work with [Solara server](./solara-server), but we have not tested all of them. If you use a regular ipywidget based app, you should not run into issues. If you do, consider [opening a GitHub issue](https://github.com/widgetti/solara/issues/new)
|
|
29
|
-
|
|
30
|
-
If you write a Reacton-based Solara application, check out [the reacton page](./reacton).
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# ipyvuetify
|
|
2
|
-
|
|
3
|
-
* [Documentation](https://ipyvuetify.readthedocs.io/)
|
|
4
|
-
* [GitHub](https://github.com/widgetti/ipyvuetify)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ipyvuetify is an [ipywidget based](./ipywidgets) library, that wraps the [Vuetify component library](https://v2.vuetifyjs.com/) to give beautiful
|
|
8
|
-
material design based widgets.
|
|
9
|
-
|
|
10
|
-

|
|
11
|
-
|
|
12
|
-
## Reacton and ipyvuetify
|
|
13
|
-
|
|
14
|
-
We consider ipyvuetify one of the most essential ipywidget libraries, and that is the reason why [Reacton](/documentation/advanced/understanding/reacton) ships with
|
|
15
|
-
generated ipyvuetify components to make your app type safe.
|
|
16
|
-
|
|
17
|
-
```solara
|
|
18
|
-
|
|
19
|
-
import solara
|
|
20
|
-
# rv is the reacton-ipyvuetify wrapper for Reacton/Solara
|
|
21
|
-
import reacton.ipyvuetify as rv
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@solara.component
|
|
25
|
-
def Page():
|
|
26
|
-
clicks, set_clicks = solara.use_state(0)
|
|
27
|
-
def my_click_handler(*ignore_args):
|
|
28
|
-
# trigger a new render with a new value for clicks
|
|
29
|
-
set_clicks(clicks+1)
|
|
30
|
-
button = rv.Btn(children=[f"Clicked {clicks} times"])
|
|
31
|
-
rv.use_event(button, 'click', my_click_handler)
|
|
32
|
-
return button
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Solara and ipyvuetify
|
|
37
|
-
|
|
38
|
-
Many of the Solara components are based on ipyvuetify. Do not hesitate the look at the [source code of the Solara components](https://github.com/widgetti/solara/tree/master/solara/components) to learn how to create your own components.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Reacton
|
|
2
|
-
|
|
3
|
-
* [Documentation](https://reacton.solara.dev/)
|
|
4
|
-
* [GitHub](https://github.com/widgetti/reacton/)
|
|
5
|
-
|
|
6
|
-
Reacton is a React-like layer around ipywidgets.
|
|
7
|
-
|
|
8
|
-
Using a declarative way, in a React (JS) style, makes your codebase smaller, less error-prone, and easier to reason about. We don't see a good reason not to use it.
|
|
9
|
-
|
|
10
|
-
Also, React has proven itself, and by adopting a proven technology, we can stand on the shoulders of giants, make use of a lot of existing resources, and do not have to reinvent the wheel.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Solara or Reacton?
|
|
14
|
-
|
|
15
|
-
We consider Solara a superset of Reacton, and that's why the full namespace of the `reacton` package is imported into the `solara` package.
|
|
16
|
-
Therefore, you can write `solara.use_state` or `reacton.use_state`, they are the same function.
|
|
17
|
-
|
|
18
|
-
The reason for this is simplicity for newcomers, who don't care about the difference between `solara` and `reacton`.
|
|
19
|
-
But in practice, it also saves having to import both `solara` and `reacton`.
|
|
20
|
-
Also, when writing Solara based apps, one does not think about Reacton anymore, it is all Solara.
|
|
21
|
-
|
|
22
|
-
## How do I use Reacton or Solara with ipywidget library X
|
|
23
|
-
|
|
24
|
-
[The reacton documentation has a page on this](https://reacton.solara.dev/en/latest/libraries/)
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# Reacton basic understanding
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Let us take our favorite component, and try to understand a bit better how it works to improve your understanding of Reacton and thus how to use Solara.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```solara
|
|
8
|
-
import solara
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@solara.component
|
|
12
|
-
def ClickButton():
|
|
13
|
-
clicks, set_clicks = solara.use_state(0)
|
|
14
|
-
|
|
15
|
-
def my_click_hander():
|
|
16
|
-
set_clicks(clicks + 1)
|
|
17
|
-
|
|
18
|
-
return solara.Button(label=f"Clicked: {clicks}", on_click=my_click_hander)
|
|
19
|
-
|
|
20
|
-
Page = ClickButton
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
This example does a few things:
|
|
24
|
-
|
|
25
|
-
* Add state (`clicks`) to the component.
|
|
26
|
-
* Create a callback function (`my_click_handler`). When executed, it will increase ask Solara/Reacton to increase the `clicks` value on the next render, by calling `set_clicks`.
|
|
27
|
-
* Pass the callback function to the child component (`Button`).
|
|
28
|
-
* Set the `label` value on each render.
|
|
29
|
-
|
|
30
|
-
Now if a user clicks the button:
|
|
31
|
-
|
|
32
|
-
* The `my_click_hander` callback will be called by Solara/Reacton.
|
|
33
|
-
* Your code (the body of `my_click_hander`) will be executed and will ask Reacton to change the state of `clicks` by increasing the value by 1.
|
|
34
|
-
* Solara/Reacton got asked to change the of `clicks`, and will execute your render function (the body of the `ClickButton` component) once.
|
|
35
|
-
* Solara/Reacton will compare the return value of your component and will update the associated widget. In this case it will update the label to `"`Clicked: 1"`.
|
|
36
|
-
|
|
37
|
-
This pattern is very common, where a parent component (ClickButton) managed the state (the number of times clicked), and state changes (increasing the clicks by 1 on a button click).
|
|
38
|
-
|
|
39
|
-
## Graphically
|
|
40
|
-
|
|
41
|
-
Is the above text a bit dry? Maybe the annotated code will make it easier to understand for you.
|
|
42
|
-
|
|
43
|
-

|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## Going deeper
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Still not satisfied? Let's go through all the steps in more detail in this sequence diagram:
|
|
50
|
-
|
|
51
|
-
```mermaid
|
|
52
|
-
sequenceDiagram
|
|
53
|
-
actor You
|
|
54
|
-
participant Frontend as Frontend
|
|
55
|
-
participant ipywidgets as IPyWidgets
|
|
56
|
-
participant react as Reacton
|
|
57
|
-
participant component as ButtonClick
|
|
58
|
-
participant app as Solara
|
|
59
|
-
|
|
60
|
-
app->>component: el=ButtonClick()
|
|
61
|
-
app->>react: render(el)
|
|
62
|
-
|
|
63
|
-
activate react
|
|
64
|
-
react->>component: render()
|
|
65
|
-
component->>react: use_state(0)<br>(returns 0)
|
|
66
|
-
|
|
67
|
-
react->>react: reconsolidate()
|
|
68
|
-
react->>ipywidgets: create Button<br>description="Clicked: 0"
|
|
69
|
-
deactivate react
|
|
70
|
-
ipywidgets--)Frontend: create Button view
|
|
71
|
-
|
|
72
|
-
You->>Frontend: clicks button
|
|
73
|
-
|
|
74
|
-
Frontend--)ipywidgets: Button clicked
|
|
75
|
-
ipywidgets->>component: on_click
|
|
76
|
-
activate component
|
|
77
|
-
component->>react: set_clicks(1)
|
|
78
|
-
activate react
|
|
79
|
-
deactivate component
|
|
80
|
-
react->>+component: render()
|
|
81
|
-
component->>-react: use_state(0)<br> (now returns 1)
|
|
82
|
-
react->>react: reconsolidate()
|
|
83
|
-
react->>ipywidgets: update Button<br>description="Clicked 1"
|
|
84
|
-
deactivate react
|
|
85
|
-
ipywidgets--)Frontend: update Button<br>description="Clicked 1"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
In words
|
|
89
|
-
|
|
90
|
-
1. Solara create `el = ButtonClick()` from your component.
|
|
91
|
-
1. The `display(el)` triggers the call to Reacton.
|
|
92
|
-
1. The render call enters the render phase, which will call the function body (which we call render function) of the `ButtonClick` component.
|
|
93
|
-
1. Our ButtonClick render function calls [`use_state`](/documentation/api/hooks/use_state). Because this is our first render phase, this returns the initial value (0).
|
|
94
|
-
1. The ButtonClick render function returns a Button element (not a widget!) with `description="Clicked: 0 times"`.
|
|
95
|
-
1. The Reacton render call is done with the render phase, and enters the reconciliation phase, where it looks at the difference between the real widgets and the virtual widgets tree (represented by the Reacton elements). We find there is no previous widget associated with the virtual widget (or element) and decide to create a widget.
|
|
96
|
-
1. Asynchronously via the Jupyter protocol, a widget model and view are created and displayed to the user in the browser.
|
|
97
|
-
1. The user clicks on the button.
|
|
98
|
-
1. The `on_click` handler gets triggered on the Python side, inside of the `ButtonClick` component (called `my_click_handler`).
|
|
99
|
-
1. `my_click_handler` handler calls `set_clicks(1)` which triggers a re-render.
|
|
100
|
-
1. The render call enters the render phase, which calls the render function of `ButtonClick` for the second time.
|
|
101
|
-
1. Our ButtonClick render function calls [`reacton.use_state`](#use_state). Because this is our second render phase, this returns the last set value, which is 1.
|
|
102
|
-
1. The ButtonClick render function returns a new Button element (not a widget!) with the description `"Clicked: 1 times"`.
|
|
103
|
-
1. The Reacton render call is done with the render phase, and enters the reconciliation phase, where it looks at the difference between the real widgets and the virtual widgets tree (represented by the Reacton elements). We find there is a widget associated with the virtual widget (or element) and decide to update the changed attributes of the widget and set `description` to `"Clicked: 1 times"`.
|
|
104
|
-
1. Asynchronously via the Jupyter protocol, the widet model and view are being updated in the browser.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Anatomy
|
|
2
|
-
|
|
3
|
-
For communication, it is useful to speak the same language and use the same idiom.
|
|
4
|
-
As a reference, we provide this "anatomy" image of our favorite `ClickButton` component with a layout that we consider best practice.
|
|
5
|
-
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
## Explanations
|
|
9
|
-
|
|
10
|
-
* Import `solara` and you also get the `reacton` namespace with it (saves typing, and finding/remembering which hooks is in which packages)
|
|
11
|
-
* Add a `@solara.component` decorator to turn your function into a component.
|
|
12
|
-
* Start with `use_state` hooks and other hooks. This avoids issues with [conditional hooks](/documentation/advanced/understanding/rules-of-hooks) or hooks in loops.
|
|
13
|
-
* Data/state flows down (to children)
|
|
14
|
-
* Information (events, data) flows up from children via events and callbacks (`on_<some_event_name>=my_callback`).
|
|
15
|
-
* If you need multiple components, use a [parent container component](/documentation/components/layout/app_layout) as context manager. A good default name to give this context manager is `main`. Don't forget to return it in your render function!
|
|
16
|
-
* The body of your component (the function you wrote) is called the render function.
|
|
17
|
-
* In between the hooks as defining all your elements, you put your custom code, like checking variables, defining callbacks, and other logic.
|
|
18
|
-
* The only way for a component to cause itself to rerender is to have state (using `use_state`) and change it (calling the second return value with a different value).
|
|
19
|
-
* Reacton is declarative. Your render function gets executed after every state change (and thus should be relatively cheap to execute). Reacton will find out the changes for you and will add, remove and update the associated widgets for you. This means you can easily do conditional rendering (creating an element in an if statement or in a loop).
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
# Laying out components with containers
|
|
2
|
-
|
|
3
|
-
## Introduction
|
|
4
|
-
Some components, such as our favorite `ClickButton` only add logic on top of an existing component:
|
|
5
|
-
|
|
6
|
-
```solara
|
|
7
|
-
import solara
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@solara.component
|
|
11
|
-
def ClickButton():
|
|
12
|
-
clicks, set_clicks = solara.use_state(0)
|
|
13
|
-
|
|
14
|
-
def my_click_hander():
|
|
15
|
-
set_clicks(clicks + 1)
|
|
16
|
-
|
|
17
|
-
# We return a single component
|
|
18
|
-
return solara.Button(label=f"Clicked: {clicks}", on_click=my_click_hander)
|
|
19
|
-
|
|
20
|
-
Page = ClickButton
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Containers with children
|
|
25
|
-
However, more sophisticated components will add multiple components together into a container component, let's take a look at an example.
|
|
26
|
-
|
|
27
|
-
```solara
|
|
28
|
-
import solara
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@solara.component
|
|
32
|
-
def FancyClickButton():
|
|
33
|
-
clicks, set_clicks = solara.use_state(0)
|
|
34
|
-
|
|
35
|
-
def increase_count():
|
|
36
|
-
set_clicks(clicks + 1)
|
|
37
|
-
|
|
38
|
-
def reset_count():
|
|
39
|
-
set_clicks(0)
|
|
40
|
-
|
|
41
|
-
button_increase = solara.Button(label=f"Clicked: {clicks}", on_click=increase_count)
|
|
42
|
-
button_reset = solara.Button(label="Reset", on_click=reset_count)
|
|
43
|
-
|
|
44
|
-
return solara.Row(children=[button_increase,
|
|
45
|
-
button_reset,
|
|
46
|
-
])
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Page = FancyClickButton
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Here we use an [HBox](/documentation/components/layout/hbox) to lay out two child components horizontally.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## Cleaner way to add children to containers
|
|
58
|
-
|
|
59
|
-
Because using container components is so common, we created a more convenient way to pass children to components and made your code look neater and more structured as well (avoiding nested lists).
|
|
60
|
-
|
|
61
|
-
```solara
|
|
62
|
-
import solara
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@solara.component
|
|
66
|
-
def FancyClickButton():
|
|
67
|
-
clicks, set_clicks = solara.use_state(0)
|
|
68
|
-
|
|
69
|
-
def increase_count():
|
|
70
|
-
set_clicks(clicks + 1)
|
|
71
|
-
|
|
72
|
-
def reset_count():
|
|
73
|
-
set_clicks(0)
|
|
74
|
-
|
|
75
|
-
with solara.Row() as main:
|
|
76
|
-
solara.Button(label=f"Clicked: {clicks}", on_click=increase_count)
|
|
77
|
-
solara.Button(label="Reset", on_click=reset_count)
|
|
78
|
-
return main
|
|
79
|
-
|
|
80
|
-
Page = FancyClickButton
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Here we are using the top-level Row as a context manager (with the name `main`). All child elements created within this context are automatically added as a child.
|
|
85
|
-
|
|
86
|
-
### About Context managers
|
|
87
|
-
|
|
88
|
-
Context managers are a Python language feature, there are two ways to use them:
|
|
89
|
-
|
|
90
|
-
```python
|
|
91
|
-
|
|
92
|
-
with some_anonymous_context_manager():
|
|
93
|
-
print("some code")
|
|
94
|
-
|
|
95
|
-
with some_named_context_manager() as this_is_my_name:
|
|
96
|
-
print("some other code")
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Where the last example assigns the context manager to a variable. In Solara we only need to do that to the top context manager, since we need to return that in our [render function](/documentation/advanced/understanding/anatomy).
|
|
100
|
-
|
|
101
|
-
All Reacton or Solara components return elements that can be used as context managers. Context managers allow for code to be executed before and after your code block inside of the context manager. This allows us to capture all elements created inside of the context manager. If you want to know more about context managers, consult the Python documentation since this is not Solara specific.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### Nested layout
|
|
105
|
-
|
|
106
|
-
Adding children using context managers work at any level, you can nest Rows and Columns [or any other containers](/api#components).
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```solara
|
|
110
|
-
import solara
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
@solara.component
|
|
114
|
-
def FancyClickButton():
|
|
115
|
-
clicks, set_clicks = solara.use_state(0)
|
|
116
|
-
|
|
117
|
-
def increase_count():
|
|
118
|
-
set_clicks(clicks + 1)
|
|
119
|
-
|
|
120
|
-
def reset_count():
|
|
121
|
-
set_clicks(0)
|
|
122
|
-
|
|
123
|
-
with solara.Column() as main:
|
|
124
|
-
with solara.Row():
|
|
125
|
-
solara.Button(label=f"Clicked: {clicks}", on_click=increase_count)
|
|
126
|
-
solara.Button(label="Reset", on_click=reset_count)
|
|
127
|
-
solara.Text("I am a child of a VBox")
|
|
128
|
-
return main
|
|
129
|
-
|
|
130
|
-
Page = FancyClickButton
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
## Automatic containers
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
Instead of returning the main container, Solara also allows you to not have a return value (or return `None`).
|
|
139
|
-
If that is the case, Solara will look at what elements you created. If you created one, that element will be taken
|
|
140
|
-
as a return value instead. If you make more than one element, those elements will be automatically wrapped by
|
|
141
|
-
a [Column](/documentation/components/layout/column). The only benefit of returning an element, is that we can infer the correct return type,
|
|
142
|
-
which can be useful for testing purposes. Users should probably never return an element, but use the automatic
|
|
143
|
-
container feature.
|
|
144
|
-
|
|
145
|
-
```solara
|
|
146
|
-
import solara
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
@solara.component
|
|
150
|
-
def ClickButton():
|
|
151
|
-
clicks, set_clicks = solara.use_state(0)
|
|
152
|
-
|
|
153
|
-
def my_click_hander():
|
|
154
|
-
set_clicks(clicks + 1)
|
|
155
|
-
|
|
156
|
-
solara.Button(label=f"Clicked: {clicks}", on_click=my_click_hander)
|
|
157
|
-
solara.Button(label=f"Reset", on_click=lambda: set_clicks(0))
|
|
158
|
-
|
|
159
|
-
Page = ClickButton
|
|
160
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Solara
|
|
2
|
-
|
|
3
|
-
Solara combines [ipywidgets](./ipywidgets), [reacton](./reacton) and puts it into a opinionated framework to make web apps with a focus on data (data apps for short).
|
|
4
|
-
|
|
5
|
-
Solara consists of two main parts
|
|
6
|
-
|
|
7
|
-
## Solara-ui
|
|
8
|
-
|
|
9
|
-
A set of opinionated react components and hooks that allow you to build web apps and data apps faster.
|
|
10
|
-
|
|
11
|
-
## Solara-server
|
|
12
|
-
|
|
13
|
-
A web framework for deploying web apps or data apps in production. Opinionated about pages and routing.
|