solara 1.30.1__py2.py3-none-any.whl → 1.32.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.
Files changed (438) hide show
  1. {solara-1.30.1.dist-info → solara-1.32.0.dist-info}/METADATA +12 -42
  2. solara-1.32.0.dist-info/RECORD +5 -0
  3. {solara-1.30.1.dist-info → solara-1.32.0.dist-info}/WHEEL +1 -1
  4. {solara/template/portal → solara-1.32.0.dist-info/licenses}/LICENSE +1 -1
  5. solara/__init__.py +0 -123
  6. solara/__main__.py +0 -734
  7. solara/alias.py +0 -6
  8. solara/autorouting.py +0 -545
  9. solara/cache.py +0 -294
  10. solara/checks.html +0 -71
  11. solara/checks.py +0 -224
  12. solara/comm.py +0 -28
  13. solara/components/__init__.py +0 -59
  14. solara/components/alert.py +0 -155
  15. solara/components/applayout.py +0 -393
  16. solara/components/button.py +0 -85
  17. solara/components/card.py +0 -87
  18. solara/components/checkbox.py +0 -50
  19. solara/components/code_highlight_css.py +0 -11
  20. solara/components/code_highlight_css.vue +0 -63
  21. solara/components/columns.py +0 -159
  22. solara/components/component_vue.py +0 -110
  23. solara/components/cross_filter.py +0 -335
  24. solara/components/dataframe.py +0 -546
  25. solara/components/datatable.py +0 -221
  26. solara/components/datatable.vue +0 -175
  27. solara/components/details.py +0 -21
  28. solara/components/download.vue +0 -35
  29. solara/components/echarts.py +0 -75
  30. solara/components/echarts.vue +0 -128
  31. solara/components/figure_altair.py +0 -39
  32. solara/components/file_browser.py +0 -182
  33. solara/components/file_download.py +0 -199
  34. solara/components/file_drop.py +0 -139
  35. solara/components/file_drop.vue +0 -83
  36. solara/components/file_list_widget.vue +0 -78
  37. solara/components/head.py +0 -27
  38. solara/components/head_tag.py +0 -49
  39. solara/components/head_tag.vue +0 -60
  40. solara/components/image.py +0 -173
  41. solara/components/input.py +0 -440
  42. solara/components/link.py +0 -55
  43. solara/components/markdown.py +0 -371
  44. solara/components/markdown_editor.py +0 -25
  45. solara/components/markdown_editor.vue +0 -362
  46. solara/components/matplotlib.py +0 -74
  47. solara/components/meta.py +0 -47
  48. solara/components/misc.py +0 -333
  49. solara/components/pivot_table.py +0 -258
  50. solara/components/pivot_table.vue +0 -158
  51. solara/components/progress.py +0 -47
  52. solara/components/select.py +0 -186
  53. solara/components/select.vue +0 -27
  54. solara/components/slider.py +0 -442
  55. solara/components/slider_date.vue +0 -56
  56. solara/components/spinner-solara.vue +0 -105
  57. solara/components/spinner.py +0 -30
  58. solara/components/sql_code.py +0 -33
  59. solara/components/sql_code.vue +0 -128
  60. solara/components/style.py +0 -105
  61. solara/components/switch.py +0 -68
  62. solara/components/tab_navigation.py +0 -37
  63. solara/components/title.py +0 -90
  64. solara/components/title.vue +0 -38
  65. solara/components/togglebuttons.py +0 -202
  66. solara/components/tooltip.py +0 -61
  67. solara/datatypes.py +0 -143
  68. solara/express.py +0 -241
  69. solara/hooks/__init__.py +0 -4
  70. solara/hooks/dataframe.py +0 -99
  71. solara/hooks/misc.py +0 -263
  72. solara/hooks/use_reactive.py +0 -129
  73. solara/hooks/use_thread.py +0 -129
  74. solara/kitchensink.py +0 -8
  75. solara/lab/__init__.py +0 -34
  76. solara/lab/components/__init__.py +0 -6
  77. solara/lab/components/chat.py +0 -203
  78. solara/lab/components/confirmation_dialog.py +0 -165
  79. solara/lab/components/cross_filter.py +0 -7
  80. solara/lab/components/input_date.py +0 -298
  81. solara/lab/components/menu.py +0 -181
  82. solara/lab/components/menu.vue +0 -38
  83. solara/lab/components/tabs.py +0 -274
  84. solara/lab/components/theming.py +0 -98
  85. solara/lab/components/theming.vue +0 -72
  86. solara/lab/hooks/__init__.py +0 -0
  87. solara/lab/hooks/dataframe.py +0 -12
  88. solara/lab/toestand.py +0 -3
  89. solara/lab/utils/__init__.py +0 -2
  90. solara/lab/utils/cookies.py +0 -5
  91. solara/lab/utils/dataframe.py +0 -115
  92. solara/lab/utils/headers.py +0 -5
  93. solara/layout.py +0 -44
  94. solara/minisettings.py +0 -133
  95. solara/py.typed +0 -0
  96. solara/reactive.py +0 -93
  97. solara/routing.py +0 -268
  98. solara/scope/__init__.py +0 -88
  99. solara/scope/types.py +0 -55
  100. solara/server/__init__.py +0 -0
  101. solara/server/app.py +0 -490
  102. solara/server/assets/custom.css +0 -1
  103. solara/server/assets/custom.js +0 -1
  104. solara/server/assets/favicon.png +0 -0
  105. solara/server/assets/favicon.svg +0 -5
  106. solara/server/assets/style.css +0 -1665
  107. solara/server/assets/theme-dark.css +0 -437
  108. solara/server/assets/theme-light.css +0 -420
  109. solara/server/assets/theme.js +0 -3
  110. solara/server/cdn_helper.py +0 -77
  111. solara/server/esm.py +0 -69
  112. solara/server/fastapi.py +0 -5
  113. solara/server/flask.py +0 -286
  114. solara/server/jupyter/__init__.py +0 -2
  115. solara/server/jupyter/cdn_handler.py +0 -28
  116. solara/server/jupyter/server_extension.py +0 -29
  117. solara/server/jupytertools.py +0 -46
  118. solara/server/kernel.py +0 -319
  119. solara/server/kernel_context.py +0 -396
  120. solara/server/patch.py +0 -552
  121. solara/server/reload.py +0 -242
  122. solara/server/server.py +0 -437
  123. solara/server/settings.py +0 -212
  124. solara/server/shell.py +0 -240
  125. solara/server/starlette.py +0 -597
  126. solara/server/static/ansi.js +0 -270
  127. solara/server/static/highlight-dark.css +0 -82
  128. solara/server/static/highlight.css +0 -43
  129. solara/server/static/main-vuetify.js +0 -260
  130. solara/server/static/main.js +0 -163
  131. solara/server/static/solara_bootstrap.py +0 -129
  132. solara/server/static/sun.svg +0 -23
  133. solara/server/static/webworker.js +0 -42
  134. solara/server/telemetry.py +0 -212
  135. solara/server/templates/index.html.j2 +0 -1
  136. solara/server/templates/loader-plain.css +0 -11
  137. solara/server/templates/loader-plain.html +0 -20
  138. solara/server/templates/loader-solara.css +0 -111
  139. solara/server/templates/loader-solara.html +0 -40
  140. solara/server/templates/plain.html +0 -82
  141. solara/server/templates/solara.html.j2 +0 -446
  142. solara/server/threaded.py +0 -75
  143. solara/server/utils.py +0 -30
  144. solara/server/websocket.py +0 -44
  145. solara/settings.py +0 -56
  146. solara/tasks.py +0 -847
  147. solara/template/button.py +0 -16
  148. solara/template/markdown.py +0 -42
  149. solara/template/portal/.flake8 +0 -6
  150. solara/template/portal/.pre-commit-config.yaml +0 -28
  151. solara/template/portal/Procfile +0 -7
  152. solara/template/portal/mypy.ini +0 -3
  153. solara/template/portal/pyproject.toml +0 -26
  154. solara/template/portal/solara_portal/__init__.py +0 -3
  155. solara/template/portal/solara_portal/components/__init__.py +0 -2
  156. solara/template/portal/solara_portal/components/article.py +0 -28
  157. solara/template/portal/solara_portal/components/data.py +0 -28
  158. solara/template/portal/solara_portal/components/header.py +0 -6
  159. solara/template/portal/solara_portal/components/layout.py +0 -6
  160. solara/template/portal/solara_portal/content/articles/equis-in-vidi.md +0 -85
  161. solara/template/portal/solara_portal/content/articles/substiterat-vati.md +0 -70
  162. solara/template/portal/solara_portal/data.py +0 -60
  163. solara/template/portal/solara_portal/pages/__init__.py +0 -67
  164. solara/template/portal/solara_portal/pages/article/__init__.py +0 -26
  165. solara/template/portal/solara_portal/pages/tabular.py +0 -29
  166. solara/template/portal/solara_portal/pages/viz/__init__.py +0 -69
  167. solara/template/portal/solara_portal/pages/viz/overview.py +0 -14
  168. solara/test/__init__.py +0 -0
  169. solara/test/pytest_plugin.py +0 -698
  170. solara/toestand.py +0 -772
  171. solara/util.py +0 -308
  172. solara/website/__init__.py +0 -0
  173. solara/website/assets/custom.css +0 -462
  174. solara/website/assets/images/logo-small.png +0 -0
  175. solara/website/assets/images/logo.svg +0 -17
  176. solara/website/assets/images/logo_white.svg +0 -50
  177. solara/website/assets/theme.js +0 -8
  178. solara/website/components/__init__.py +0 -5
  179. solara/website/components/algolia.vue +0 -24
  180. solara/website/components/algolia_api.vue +0 -157
  181. solara/website/components/docs.py +0 -118
  182. solara/website/components/header.py +0 -72
  183. solara/website/components/hero.py +0 -15
  184. solara/website/components/mailchimp.py +0 -12
  185. solara/website/components/mailchimp.vue +0 -47
  186. solara/website/components/markdown.py +0 -30
  187. solara/website/components/notebook.py +0 -172
  188. solara/website/pages/__init__.py +0 -575
  189. solara/website/pages/apps/__init__.py +0 -16
  190. solara/website/pages/apps/authorization/__init__.py +0 -118
  191. solara/website/pages/apps/authorization/admin.py +0 -12
  192. solara/website/pages/apps/authorization/users.py +0 -12
  193. solara/website/pages/apps/jupyter-dashboard-1.py +0 -116
  194. solara/website/pages/apps/layout-demo.py +0 -40
  195. solara/website/pages/apps/multipage/__init__.py +0 -38
  196. solara/website/pages/apps/multipage/page1.py +0 -26
  197. solara/website/pages/apps/multipage/page2.py +0 -34
  198. solara/website/pages/apps/scatter.py +0 -136
  199. solara/website/pages/apps/scrolling.py +0 -63
  200. solara/website/pages/apps/tutorial-streamlit.py +0 -18
  201. solara/website/pages/changelog/__init__.py +0 -8
  202. solara/website/pages/changelog/changelog.md +0 -195
  203. solara/website/pages/contact/__init__.py +0 -8
  204. solara/website/pages/contact/contact.md +0 -17
  205. solara/website/pages/doc_use_download.py +0 -85
  206. solara/website/pages/documentation/__init__.py +0 -184
  207. solara/website/pages/documentation/advanced/__init__.py +0 -9
  208. solara/website/pages/documentation/advanced/content/00-overview.md +0 -1
  209. solara/website/pages/documentation/advanced/content/10-howto/00-overview.md +0 -6
  210. solara/website/pages/documentation/advanced/content/10-howto/10-multipage.md +0 -196
  211. solara/website/pages/documentation/advanced/content/10-howto/20-layout.md +0 -125
  212. solara/website/pages/documentation/advanced/content/10-howto/30-testing.md +0 -154
  213. solara/website/pages/documentation/advanced/content/10-howto/31-debugging.md +0 -69
  214. solara/website/pages/documentation/advanced/content/10-howto/40-embed.md +0 -49
  215. solara/website/pages/documentation/advanced/content/10-howto/50-ipywidget_libraries.md +0 -124
  216. solara/website/pages/documentation/advanced/content/20-understanding/00-introduction.md +0 -10
  217. solara/website/pages/documentation/advanced/content/20-understanding/05-ipywidgets.md +0 -35
  218. solara/website/pages/documentation/advanced/content/20-understanding/06-ipyvuetify.md +0 -42
  219. solara/website/pages/documentation/advanced/content/20-understanding/10-reacton.md +0 -28
  220. solara/website/pages/documentation/advanced/content/20-understanding/12-reacton-basics.md +0 -108
  221. solara/website/pages/documentation/advanced/content/20-understanding/15-anatomy.md +0 -23
  222. solara/website/pages/documentation/advanced/content/20-understanding/17-rules-of-hooks.md +0 -7
  223. solara/website/pages/documentation/advanced/content/20-understanding/18-containers.md +0 -166
  224. solara/website/pages/documentation/advanced/content/20-understanding/20-solara.md +0 -18
  225. solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md +0 -240
  226. solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md +0 -86
  227. solara/website/pages/documentation/advanced/content/20-understanding/60-voila.md +0 -12
  228. solara/website/pages/documentation/advanced/content/30-enterprise/00-overview.md +0 -1
  229. solara/website/pages/documentation/advanced/content/30-enterprise/10-oauth.md +0 -171
  230. solara/website/pages/documentation/advanced/content/40-development/00-overview.md +0 -0
  231. solara/website/pages/documentation/advanced/content/40-development/01-contribute.md +0 -45
  232. solara/website/pages/documentation/advanced/content/40-development/10-setup.md +0 -76
  233. solara/website/pages/documentation/api/__init__.py +0 -19
  234. solara/website/pages/documentation/api/cross_filter/__init__.py +0 -9
  235. solara/website/pages/documentation/api/cross_filter/cross_filter_dataframe.py +0 -23
  236. solara/website/pages/documentation/api/cross_filter/cross_filter_report.py +0 -22
  237. solara/website/pages/documentation/api/cross_filter/cross_filter_select.py +0 -22
  238. solara/website/pages/documentation/api/cross_filter/cross_filter_slider.py +0 -22
  239. solara/website/pages/documentation/api/hooks/__init__.py +0 -9
  240. solara/website/pages/documentation/api/hooks/use_cross_filter.py +0 -25
  241. solara/website/pages/documentation/api/hooks/use_dark_effective.py +0 -13
  242. solara/website/pages/documentation/api/hooks/use_effect.md +0 -43
  243. solara/website/pages/documentation/api/hooks/use_effect.py +0 -9
  244. solara/website/pages/documentation/api/hooks/use_exception.py +0 -33
  245. solara/website/pages/documentation/api/hooks/use_memo.md +0 -16
  246. solara/website/pages/documentation/api/hooks/use_memo.py +0 -9
  247. solara/website/pages/documentation/api/hooks/use_previous.py +0 -32
  248. solara/website/pages/documentation/api/hooks/use_reactive.py +0 -15
  249. solara/website/pages/documentation/api/hooks/use_state.py +0 -11
  250. solara/website/pages/documentation/api/hooks/use_state_or_update.py +0 -68
  251. solara/website/pages/documentation/api/hooks/use_thread.md +0 -58
  252. solara/website/pages/documentation/api/hooks/use_thread.py +0 -44
  253. solara/website/pages/documentation/api/hooks/use_trait_observe.py +0 -13
  254. solara/website/pages/documentation/api/routing/__init__.py +0 -9
  255. solara/website/pages/documentation/api/routing/generate_routes.py +0 -11
  256. solara/website/pages/documentation/api/routing/generate_routes_directory.py +0 -11
  257. solara/website/pages/documentation/api/routing/resolve_path.py +0 -36
  258. solara/website/pages/documentation/api/routing/route.py +0 -32
  259. solara/website/pages/documentation/api/routing/use_route.py +0 -80
  260. solara/website/pages/documentation/api/routing/use_router.py +0 -15
  261. solara/website/pages/documentation/api/utilities/__init__.py +0 -9
  262. solara/website/pages/documentation/api/utilities/component_vue.py +0 -11
  263. solara/website/pages/documentation/api/utilities/computed.py +0 -16
  264. solara/website/pages/documentation/api/utilities/display.py +0 -15
  265. solara/website/pages/documentation/api/utilities/get_kernel_id.py +0 -16
  266. solara/website/pages/documentation/api/utilities/get_session_id.py +0 -16
  267. solara/website/pages/documentation/api/utilities/memoize.py +0 -36
  268. solara/website/pages/documentation/api/utilities/on_kernel_start.py +0 -27
  269. solara/website/pages/documentation/api/utilities/reactive.py +0 -15
  270. solara/website/pages/documentation/api/utilities/widget.py +0 -104
  271. solara/website/pages/documentation/components/__init__.py +0 -12
  272. solara/website/pages/documentation/components/advanced/__init__.py +0 -9
  273. solara/website/pages/documentation/components/advanced/link.py +0 -28
  274. solara/website/pages/documentation/components/advanced/meta.py +0 -21
  275. solara/website/pages/documentation/components/advanced/style.py +0 -44
  276. solara/website/pages/documentation/components/common.py +0 -9
  277. solara/website/pages/documentation/components/data/__init__.py +0 -9
  278. solara/website/pages/documentation/components/data/dataframe.py +0 -44
  279. solara/website/pages/documentation/components/data/pivot_table.py +0 -81
  280. solara/website/pages/documentation/components/enterprise/__init__.py +0 -9
  281. solara/website/pages/documentation/components/enterprise/avatar.py +0 -19
  282. solara/website/pages/documentation/components/enterprise/avatar_menu.py +0 -20
  283. solara/website/pages/documentation/components/input/__init__.py +0 -9
  284. solara/website/pages/documentation/components/input/button.py +0 -22
  285. solara/website/pages/documentation/components/input/checkbox.py +0 -12
  286. solara/website/pages/documentation/components/input/file_browser.py +0 -33
  287. solara/website/pages/documentation/components/input/file_drop.py +0 -75
  288. solara/website/pages/documentation/components/input/input.py +0 -18
  289. solara/website/pages/documentation/components/input/select.py +0 -21
  290. solara/website/pages/documentation/components/input/slider.py +0 -28
  291. solara/website/pages/documentation/components/input/switch.py +0 -12
  292. solara/website/pages/documentation/components/input/togglebuttons.py +0 -20
  293. solara/website/pages/documentation/components/lab/__init__.py +0 -9
  294. solara/website/pages/documentation/components/lab/chat.py +0 -108
  295. solara/website/pages/documentation/components/lab/confirmation_dialog.py +0 -55
  296. solara/website/pages/documentation/components/lab/cookies_headers.py +0 -48
  297. solara/website/pages/documentation/components/lab/input_date.py +0 -19
  298. solara/website/pages/documentation/components/lab/menu.py +0 -21
  299. solara/website/pages/documentation/components/lab/tab.py +0 -24
  300. solara/website/pages/documentation/components/lab/tabs.py +0 -44
  301. solara/website/pages/documentation/components/lab/task.py +0 -12
  302. solara/website/pages/documentation/components/lab/theming.py +0 -72
  303. solara/website/pages/documentation/components/lab/use_task.py +0 -12
  304. solara/website/pages/documentation/components/layout/__init__.py +0 -9
  305. solara/website/pages/documentation/components/layout/app_bar.py +0 -15
  306. solara/website/pages/documentation/components/layout/app_bar_title.py +0 -15
  307. solara/website/pages/documentation/components/layout/app_layout.py +0 -23
  308. solara/website/pages/documentation/components/layout/card.py +0 -14
  309. solara/website/pages/documentation/components/layout/card_actions.py +0 -15
  310. solara/website/pages/documentation/components/layout/column.py +0 -29
  311. solara/website/pages/documentation/components/layout/columns.py +0 -26
  312. solara/website/pages/documentation/components/layout/columns_responsive.py +0 -67
  313. solara/website/pages/documentation/components/layout/griddraggable.py +0 -61
  314. solara/website/pages/documentation/components/layout/gridfixed.py +0 -21
  315. solara/website/pages/documentation/components/layout/hbox.py +0 -17
  316. solara/website/pages/documentation/components/layout/row.py +0 -29
  317. solara/website/pages/documentation/components/layout/sidebar.py +0 -23
  318. solara/website/pages/documentation/components/layout/vbox.py +0 -19
  319. solara/website/pages/documentation/components/output/__init__.py +0 -9
  320. solara/website/pages/documentation/components/output/file_download.py +0 -12
  321. solara/website/pages/documentation/components/output/html.py +0 -22
  322. solara/website/pages/documentation/components/output/image.py +0 -12
  323. solara/website/pages/documentation/components/output/markdown.py +0 -59
  324. solara/website/pages/documentation/components/output/markdown_editor.py +0 -53
  325. solara/website/pages/documentation/components/output/sql_code.py +0 -84
  326. solara/website/pages/documentation/components/output/tooltip.py +0 -12
  327. solara/website/pages/documentation/components/page/__init__.py +0 -9
  328. solara/website/pages/documentation/components/page/head.py +0 -19
  329. solara/website/pages/documentation/components/page/title.py +0 -28
  330. solara/website/pages/documentation/components/status/__init__.py +0 -9
  331. solara/website/pages/documentation/components/status/error.py +0 -40
  332. solara/website/pages/documentation/components/status/info.py +0 -40
  333. solara/website/pages/documentation/components/status/progress.py +0 -10
  334. solara/website/pages/documentation/components/status/spinner.py +0 -10
  335. solara/website/pages/documentation/components/status/success.py +0 -40
  336. solara/website/pages/documentation/components/status/warning.py +0 -47
  337. solara/website/pages/documentation/components/viz/__init__.py +0 -9
  338. solara/website/pages/documentation/components/viz/altair.py +0 -44
  339. solara/website/pages/documentation/components/viz/echarts.py +0 -78
  340. solara/website/pages/documentation/components/viz/matplotlib.py +0 -32
  341. solara/website/pages/documentation/components/viz/plotly.py +0 -63
  342. solara/website/pages/documentation/components/viz/plotly_express.py +0 -41
  343. solara/website/pages/documentation/examples/__init__.py +0 -52
  344. solara/website/pages/documentation/examples/ai/__init__.py +0 -10
  345. solara/website/pages/documentation/examples/ai/chatbot.py +0 -96
  346. solara/website/pages/documentation/examples/ai/tokenizer.py +0 -106
  347. solara/website/pages/documentation/examples/basics/__init__.py +0 -2
  348. solara/website/pages/documentation/examples/basics/sine.py +0 -28
  349. solara/website/pages/documentation/examples/fullscreen/__init__.py +0 -9
  350. solara/website/pages/documentation/examples/fullscreen/authorization.py +0 -3
  351. solara/website/pages/documentation/examples/fullscreen/layout_demo.py +0 -3
  352. solara/website/pages/documentation/examples/fullscreen/multipage.py +0 -3
  353. solara/website/pages/documentation/examples/fullscreen/scatter.py +0 -3
  354. solara/website/pages/documentation/examples/fullscreen/scrolling.py +0 -3
  355. solara/website/pages/documentation/examples/fullscreen/tutorial_streamlit.py +0 -3
  356. solara/website/pages/documentation/examples/general/__init__.py +0 -9
  357. solara/website/pages/documentation/examples/general/custom_storage.py +0 -69
  358. solara/website/pages/documentation/examples/general/deploy_model.py +0 -114
  359. solara/website/pages/documentation/examples/general/live_update.py +0 -38
  360. solara/website/pages/documentation/examples/general/login_oauth.py +0 -76
  361. solara/website/pages/documentation/examples/general/mycard.vue +0 -58
  362. solara/website/pages/documentation/examples/general/pokemon_search.py +0 -51
  363. solara/website/pages/documentation/examples/general/vue_component.py +0 -50
  364. solara/website/pages/documentation/examples/ipycanvas.py +0 -49
  365. solara/website/pages/documentation/examples/libraries/__init__.py +0 -9
  366. solara/website/pages/documentation/examples/libraries/altair.py +0 -63
  367. solara/website/pages/documentation/examples/libraries/bqplot.py +0 -39
  368. solara/website/pages/documentation/examples/libraries/ipyleaflet.py +0 -32
  369. solara/website/pages/documentation/examples/libraries/ipyleaflet_advanced.py +0 -65
  370. solara/website/pages/documentation/examples/utilities/__init__.py +0 -9
  371. solara/website/pages/documentation/examples/utilities/calculator.py +0 -157
  372. solara/website/pages/documentation/examples/utilities/countdown_timer.py +0 -64
  373. solara/website/pages/documentation/examples/utilities/todo.py +0 -195
  374. solara/website/pages/documentation/examples/visualization/__init__.py +0 -6
  375. solara/website/pages/documentation/examples/visualization/annotator.py +0 -68
  376. solara/website/pages/documentation/examples/visualization/linked_views.py +0 -84
  377. solara/website/pages/documentation/examples/visualization/plotly.py +0 -43
  378. solara/website/pages/documentation/faq/__init__.py +0 -12
  379. solara/website/pages/documentation/faq/content/99-faq.md +0 -76
  380. solara/website/pages/documentation/getting_started/__init__.py +0 -9
  381. solara/website/pages/documentation/getting_started/content/00-quickstart.md +0 -89
  382. solara/website/pages/documentation/getting_started/content/01-introduction.md +0 -125
  383. solara/website/pages/documentation/getting_started/content/02-installing.md +0 -85
  384. solara/website/pages/documentation/getting_started/content/04-tutorials/00-overview.md +0 -14
  385. solara/website/pages/documentation/getting_started/content/04-tutorials/10_data_science.py +0 -13
  386. solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md +0 -89
  387. solara/website/pages/documentation/getting_started/content/04-tutorials/30-ipywidgets.md +0 -124
  388. solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md +0 -146
  389. solara/website/pages/documentation/getting_started/content/04-tutorials/50-dash.md +0 -144
  390. solara/website/pages/documentation/getting_started/content/04-tutorials/60-jupyter-dashboard-part1.py +0 -64
  391. solara/website/pages/documentation/getting_started/content/04-tutorials/SF_crime_sample.csv.gz +0 -0
  392. solara/website/pages/documentation/getting_started/content/04-tutorials/_data_science.ipynb +0 -445
  393. solara/website/pages/documentation/getting_started/content/04-tutorials/_jupyter_dashboard_1.ipynb +0 -1000
  394. solara/website/pages/documentation/getting_started/content/05-fundamentals/00-overview.md +0 -11
  395. solara/website/pages/documentation/getting_started/content/05-fundamentals/10-components.md +0 -223
  396. solara/website/pages/documentation/getting_started/content/05-fundamentals/50-state-management.md +0 -88
  397. solara/website/pages/documentation/getting_started/content/06-reference/00-overview.md +0 -3
  398. solara/website/pages/documentation/getting_started/content/06-reference/40-static_files.md +0 -31
  399. solara/website/pages/documentation/getting_started/content/06-reference/41-asset-files.md +0 -36
  400. solara/website/pages/documentation/getting_started/content/06-reference/60-static-site-generation.md +0 -59
  401. solara/website/pages/documentation/getting_started/content/06-reference/70-search.md +0 -34
  402. solara/website/pages/documentation/getting_started/content/06-reference/80-reloading.md +0 -34
  403. solara/website/pages/documentation/getting_started/content/06-reference/90-notebook-support.md +0 -7
  404. solara/website/pages/documentation/getting_started/content/06-reference/95-caching.md +0 -148
  405. solara/website/pages/documentation/getting_started/content/07-deploying/00-overview.md +0 -7
  406. solara/website/pages/documentation/getting_started/content/07-deploying/10-self-hosted.md +0 -273
  407. solara/website/pages/documentation/getting_started/content/07-deploying/20-cloud-hosted.md +0 -80
  408. solara/website/pages/documentation/getting_started/content/80-what-is-lab.md +0 -7
  409. solara/website/pages/documentation/getting_started/content/90-troubleshoot.md +0 -26
  410. solara/website/pages/docutils.py +0 -38
  411. solara/website/pages/showcase/__init__.py +0 -105
  412. solara/website/pages/showcase/domino_code_assist.py +0 -60
  413. solara/website/pages/showcase/planeto_tessa.py +0 -19
  414. solara/website/pages/showcase/solara_dev.py +0 -54
  415. solara/website/pages/showcase/solarathon_2023_team_2.py +0 -22
  416. solara/website/pages/showcase/solarathon_2023_team_4.py +0 -22
  417. solara/website/pages/showcase/solarathon_2023_team_5.py +0 -23
  418. solara/website/pages/showcase/solarathon_2023_team_6.py +0 -34
  419. solara/website/pages/showcase/wanderlust.py +0 -27
  420. solara/website/public/beach.jpeg +0 -0
  421. solara/website/public/logo.svg +0 -6
  422. solara/website/public/social/discord.svg +0 -1
  423. solara/website/public/social/github.svg +0 -1
  424. solara/website/public/social/twitter.svg +0 -3
  425. solara/website/public/success.html +0 -25
  426. solara/website/templates/index.html.j2 +0 -117
  427. solara/website/utils.py +0 -51
  428. solara/widgets/__init__.py +0 -1
  429. solara/widgets/vue/gridlayout.vue +0 -110
  430. solara/widgets/vue/html.vue +0 -4
  431. solara/widgets/vue/navigator.vue +0 -104
  432. solara/widgets/vue/vegalite.vue +0 -115
  433. solara/widgets/widgets.py +0 -65
  434. solara-1.30.1.data/data/etc/jupyter/jupyter_notebook_config.d/solara.json +0 -7
  435. solara-1.30.1.data/data/etc/jupyter/jupyter_server_config.d/solara.json +0 -7
  436. solara-1.30.1.dist-info/RECORD +0 -437
  437. solara-1.30.1.dist-info/entry_points.txt +0 -5
  438. /solara-1.30.1.dist-info/licenses/LICENSE → /LICENSE +0 -0
@@ -1,124 +0,0 @@
1
- ---
2
- title: Using various ipywidgets libraries within a Solara application
3
- description: Solara can work with virtually any ipywidget library, and enables powerful interactivity with libraries like ipyleaflet, ipydatagrid, and bqplot.
4
- ---
5
- # How can I use ipywidget library X?
6
-
7
- 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).
8
-
9
- 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:
10
-
11
- ```python
12
- import ipywidgets
13
- button_element = ipywidgets.Button.element(description="Click me")
14
- ```
15
-
16
- ## Example with ipyleaflet
17
-
18
- For instance, if we want to use ipyleaflet using the classical ipywidget API, we can do:
19
-
20
- ```python
21
- import ipyleaflet
22
-
23
- map = ipyleaflet.Map(center=(52, 10), zoom=8)
24
-
25
- marker = Marker(location=(52.1, 10.1), draggable=True)
26
- m.add_layer(marker)
27
- ```
28
-
29
- 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.
30
-
31
- 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
32
- 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.
33
-
34
- Putting this together.
35
- ```solara
36
- import ipyleaflet
37
- import solara
38
-
39
- url = ipyleaflet.basemaps.OpenStreetMap.Mapnik["url"]
40
-
41
- @solara.component
42
- def Page():
43
- marker = ipyleaflet.Marker.element(location=(52.1, 10.1), draggable=True)
44
- map = ipyleaflet.Map.element(
45
- center=(52, 10),
46
- zoom=8,
47
- layers=[
48
- ipyleaflet.TileLayer.element(url=url),
49
- marker,
50
- ],
51
- )
52
- ```
53
-
54
- 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.
55
- In practice, this does not happen often, and your code in general will be shorter and more readable.
56
-
57
- 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.
58
-
59
- See also [the basic ipyleaflet example](/examples/libraries/ipyleaflet) and [the advanced ipyleaflet example](/examples/libraries/ipyleaflet_advanced).
60
-
61
- ## Example with ipywidgets
62
-
63
- Most widgets in (classic) ipywidgets can be used without problems in Solara. Two widgets stand out that are difficult to use.
64
-
65
- ### Image
66
-
67
- 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
68
- makes this easier.
69
-
70
- ### Video
71
-
72
- The `Video` widget does not have a corresponding component in solara (yet), but we can manually fill in the `value`. For example:
73
-
74
- ```solara
75
- import solara
76
- import ipywidgets
77
-
78
- url = 'https://user-images.githubusercontent.com/1765949/240697327-25b296bd-72c6-4412-948b-2d37e8196260.mp4'
79
-
80
-
81
- @solara.component
82
- def Page():
83
- ipywidgets.Video.element(value=url.encode('utf8'),
84
- format='url',
85
- width=500
86
- )
87
-
88
- ```
89
-
90
- ## Wrapper libraries
91
-
92
- 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.
93
-
94
- The following libraries are fully wrapped:
95
-
96
- * `ipywidgets` wrapper: `reacton.ipywidgets`
97
- * `ipyvuetify` wrapper: `reacton.ipyvuetify`
98
- * `bqplot` wrapper: `reacton.bqplot`
99
- * `ipycanvas` wrapper: `reacton.ipycanvas`
100
-
101
- This allows us to do instead:
102
- ```python
103
- import reacton.ipywidgets as w
104
- button_element = w.Button(description="Click me)
105
- ```
106
-
107
- And enjoy auto complete and type checking.
108
-
109
- ## Create your own wrapper
110
-
111
- The best example would be to take a look at the source code for now:
112
-
113
- * [ipywidgets](https://github.com/widgetti/reacton/blob/master/reacton/ipywidgets.py)
114
- * [bqplot](https://github.com/widgetti/reacton/blob/master/reacton/bqplot.py)
115
- * [ipyvuetify](https://github.com/widgetti/reacton/blob/master/reacton/ipyvuetify.py)
116
-
117
- The code is generated by executing:
118
-
119
- $ python -m reacton.ipywidgets
120
-
121
-
122
- ## Limitation
123
-
124
- 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,10 +0,0 @@
1
- ---
2
- title: Understanding Solara's functionality
3
- description: Solara builds on existing technologies. If you are new to Solara or some of the underlying technologies, you may feel lost at times.
4
- These 'understanding' guides are meant to help you understand topics at a deeper level and how they connect to Solara.
5
- ---
6
-
7
- # Introduction
8
-
9
- Solara builds on existing technologies. If you are new to Solara or some of the underlying technologies, you may feel lost at times.
10
- These 'understanding' guides are meant to help you understand topics at a deeper level and how they connect to Solara.
@@ -1,35 +0,0 @@
1
- ---
2
- title: Understanding how ipywidgets work together with Solara
3
- description: Solara's primarily standalone app approach differs from the ipywidgets one. This article dives deeper into the different approaches and adapting to using
4
- ipywidgets within Solara.
5
- ---
6
- # IPywidgets
7
-
8
- * [Documentation](https://ipywidgets.readthedocs.io/en/stable/)
9
- * [GitHub](https://github.com/jupyter-widgets/ipywidgets)
10
-
11
- 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.
12
-
13
- With ipywidgets you get access to the browser without writing a single line of JavaScript or CSS.
14
-
15
-
16
- ## Solara and ipywidgets
17
-
18
- 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.
19
-
20
- ## Where do ipywidgets work?
21
-
22
- 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
23
- on many places (From Jupyter Notebook, Jupyter Lab, Google Colab to even VS Code).
24
-
25
- ## Which ipywidget libraries exist?
26
-
27
- There is a list [of ipywidget libraries](https://github.com/jupyter/jupyter/wiki/Jupyter-Widgets#custom-jupyter-widgets), but that are probably
28
- many more.
29
-
30
-
31
- ## Do all ipywidget libraries work with Solara server?
32
-
33
- 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)
34
-
35
- If you write a Reacton-based Solara application, check out [the reacton page](./reacton).
@@ -1,42 +0,0 @@
1
- ---
2
- title: Using ipyvuetify widgets with Solara
3
- description: Ipyvuetify is an ipywidgets based library that wraps the Vuetify javascript framework for use with python widgets. Learn how to use these to build apps with Solara.
4
- ---
5
- # ipyvuetify
6
-
7
- * [Documentation](https://ipyvuetify.readthedocs.io/)
8
- * [GitHub](https://github.com/widgetti/ipyvuetify)
9
-
10
-
11
- ipyvuetify is an [ipywidget based](./ipywidgets) library, that wraps the [Vuetify component library](https://v2.vuetifyjs.com/) to give beautiful
12
- material design based widgets.
13
-
14
- ![ipyvuetify screencast demo](https://user-images.githubusercontent.com/46192475/79730684-78954880-82f1-11ea-855b-43a2b619ca04.gif)
15
-
16
- ## Reacton and ipyvuetify
17
-
18
- We consider ipyvuetify one of the most essential ipywidget libraries, and that is the reason why [Reacton](/documentation/advanced/understanding/reacton) ships with
19
- generated ipyvuetify components to make your app type safe.
20
-
21
- ```solara
22
-
23
- import solara
24
- # rv is the reacton-ipyvuetify wrapper for Reacton/Solara
25
- import reacton.ipyvuetify as rv
26
-
27
-
28
- @solara.component
29
- def Page():
30
- clicks, set_clicks = solara.use_state(0)
31
- def my_click_handler(*ignore_args):
32
- # trigger a new render with a new value for clicks
33
- set_clicks(clicks+1)
34
- button = rv.Btn(children=[f"Clicked {clicks} times"])
35
- rv.use_event(button, 'click', my_click_handler)
36
- return button
37
- ```
38
-
39
-
40
- ## Solara and ipyvuetify
41
-
42
- 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,28 +0,0 @@
1
- ---
2
- title: Understanding how Solara builds on Reacton
3
- description: Solara adapts the React way of using components declaratively to build UIs and brings it to Python.
4
- ---
5
- # Reacton
6
-
7
- * [Documentation](https://reacton.solara.dev/)
8
- * [GitHub](https://github.com/widgetti/reacton/)
9
-
10
- Reacton is a React-like layer around ipywidgets.
11
-
12
- 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.
13
-
14
- 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.
15
-
16
-
17
- ## Solara or Reacton?
18
-
19
- We consider Solara a superset of Reacton, and that's why the full namespace of the `reacton` package is imported into the `solara` package.
20
- Therefore, you can write `solara.use_state` or `reacton.use_state`, they are the same function.
21
-
22
- The reason for this is simplicity for newcomers, who don't care about the difference between `solara` and `reacton`.
23
- But in practice, it also saves having to import both `solara` and `reacton`.
24
- Also, when writing Solara based apps, one does not think about Reacton anymore, it is all Solara.
25
-
26
- ## How do I use Reacton or Solara with ipywidget library X
27
-
28
- [The reacton documentation has a page on this](https://reacton.solara.dev/en/latest/libraries/)
@@ -1,108 +0,0 @@
1
- ---
2
- title: Understanding the basics of Reacton
3
- description: Using your favorite component, we try to understand better how it works to improve your understanding of Reacton and, thus, how to use Solara.
4
- ---
5
- # Reacton basic understanding
6
-
7
-
8
- 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.
9
-
10
-
11
- ```solara
12
- import solara
13
-
14
-
15
- @solara.component
16
- def ClickButton():
17
- clicks, set_clicks = solara.use_state(0)
18
-
19
- def my_click_hander():
20
- set_clicks(clicks + 1)
21
-
22
- return solara.Button(label=f"Clicked: {clicks}", on_click=my_click_hander)
23
-
24
- Page = ClickButton
25
- ```
26
-
27
- This example does a few things:
28
-
29
- * Add state (`clicks`) to the component.
30
- * 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`.
31
- * Pass the callback function to the child component (`Button`).
32
- * Set the `label` value on each render.
33
-
34
- Now if a user clicks the button:
35
-
36
- * The `my_click_hander` callback will be called by Solara/Reacton.
37
- * 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.
38
- * Solara/Reacton got asked to change the of `clicks`, and will execute your render function (the body of the `ClickButton` component) once.
39
- * 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"`.
40
-
41
- 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).
42
-
43
- ## Graphically
44
-
45
- Is the above text a bit dry? Maybe the annotated code will make it easier to understand for you.
46
-
47
- ![basics](https://dxhl76zpt6fap.cloudfront.net/public/docs/reacton-basics.webp)
48
-
49
-
50
- ## Going deeper
51
-
52
-
53
- Still not satisfied? Let's go through all the steps in more detail in this sequence diagram:
54
-
55
- ```mermaid
56
- sequenceDiagram
57
- actor You
58
- participant Frontend as Frontend
59
- participant ipywidgets as IPyWidgets
60
- participant react as Reacton
61
- participant component as ButtonClick
62
- participant app as Solara
63
-
64
- app->>component: el=ButtonClick()
65
- app->>react: render(el)
66
-
67
- activate react
68
- react->>component: render()
69
- component->>react: use_state(0)<br>(returns 0)
70
-
71
- react->>react: reconsolidate()
72
- react->>ipywidgets: create Button<br>description="Clicked: 0"
73
- deactivate react
74
- ipywidgets--)Frontend: create Button view
75
-
76
- You->>Frontend: clicks button
77
-
78
- Frontend--)ipywidgets: Button clicked
79
- ipywidgets->>component: on_click
80
- activate component
81
- component->>react: set_clicks(1)
82
- activate react
83
- deactivate component
84
- react->>+component: render()
85
- component->>-react: use_state(0)<br> (now returns 1)
86
- react->>react: reconsolidate()
87
- react->>ipywidgets: update Button<br>description="Clicked 1"
88
- deactivate react
89
- ipywidgets--)Frontend: update Button<br>description="Clicked 1"
90
- ```
91
-
92
- In words
93
-
94
- 1. Solara create `el = ButtonClick()` from your component.
95
- 1. The `display(el)` triggers the call to Reacton.
96
- 1. The render call enters the render phase, which will call the function body (which we call render function) of the `ButtonClick` component.
97
- 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).
98
- 1. The ButtonClick render function returns a Button element (not a widget!) with `description="Clicked: 0 times"`.
99
- 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.
100
- 1. Asynchronously via the Jupyter protocol, a widget model and view are created and displayed to the user in the browser.
101
- 1. The user clicks on the button.
102
- 1. The `on_click` handler gets triggered on the Python side, inside of the `ButtonClick` component (called `my_click_handler`).
103
- 1. `my_click_handler` handler calls `set_clicks(1)` which triggers a re-render.
104
- 1. The render call enters the render phase, which calls the render function of `ButtonClick` for the second time.
105
- 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.
106
- 1. The ButtonClick render function returns a new Button element (not a widget!) with the description `"Clicked: 1 times"`.
107
- 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"`.
108
- 1. Asynchronously via the Jupyter protocol, the widet model and view are being updated in the browser.
@@ -1,23 +0,0 @@
1
- ---
2
- title: The anatomy of Solara's functionality
3
- description: Dive deep into how Solara uses the technologies it builds on.
4
- ---
5
- # Anatomy
6
-
7
- For communication, it is useful to speak the same language and use the same idiom.
8
- As a reference, we provide this "anatomy" image of our favorite `ClickButton` component with a layout that we consider best practice.
9
-
10
- ![anatomy](https://dxhl76zpt6fap.cloudfront.net/public/docs/anatomy.webp)
11
-
12
- ## Explanations
13
-
14
- * Import `solara` and you also get the `reacton` namespace with it (saves typing, and finding/remembering which hooks is in which packages)
15
- * Add a `@solara.component` decorator to turn your function into a component.
16
- * Start with `use_state` hooks and other hooks. This avoids issues with [conditional hooks](/documentation/advanced/understanding/rules-of-hooks) or hooks in loops.
17
- * Data/state flows down (to children)
18
- * Information (events, data) flows up from children via events and callbacks (`on_<some_event_name>=my_callback`).
19
- * 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!
20
- * The body of your component (the function you wrote) is called the render function.
21
- * In between the hooks as defining all your elements, you put your custom code, like checking variables, defining callbacks, and other logic.
22
- * 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).
23
- * 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,7 +0,0 @@
1
- ---
2
- title: The rules of hooks in Solara
3
- description: Learn the rules that govern the usage of hooks in your Solara application.
4
- ----
5
- # Rules of hooks
6
-
7
- For now, we refer to the [ReactJS documentation](https://reactjs.org/docs/hooks-rules.html).
@@ -1,166 +0,0 @@
1
- ---
2
- title: Using Solara with containers to build complex UIs
3
- description: Solara allows for using python with statements to populate your UIs in a structured manner. This makes it easy to compose different components to build cohesive
4
- wholes.
5
- ---
6
-
7
- # Laying out components with containers
8
-
9
- ## Introduction
10
- Some components, such as our favorite `ClickButton` only add logic on top of an existing component:
11
-
12
- ```solara
13
- import solara
14
-
15
-
16
- @solara.component
17
- def ClickButton():
18
- clicks, set_clicks = solara.use_state(0)
19
-
20
- def my_click_hander():
21
- set_clicks(clicks + 1)
22
-
23
- # We return a single component
24
- return solara.Button(label=f"Clicked: {clicks}", on_click=my_click_hander)
25
-
26
- Page = ClickButton
27
- ```
28
-
29
-
30
- ## Containers with children
31
- However, more sophisticated components will add multiple components together into a container component, let's take a look at an example.
32
-
33
- ```solara
34
- import solara
35
-
36
-
37
- @solara.component
38
- def FancyClickButton():
39
- clicks, set_clicks = solara.use_state(0)
40
-
41
- def increase_count():
42
- set_clicks(clicks + 1)
43
-
44
- def reset_count():
45
- set_clicks(0)
46
-
47
- button_increase = solara.Button(label=f"Clicked: {clicks}", on_click=increase_count)
48
- button_reset = solara.Button(label="Reset", on_click=reset_count)
49
-
50
- return solara.Row(children=[button_increase,
51
- button_reset,
52
- ])
53
-
54
-
55
- Page = FancyClickButton
56
-
57
- ```
58
-
59
-
60
- Here we use an [HBox](/documentation/components/layout/hbox) to lay out two child components horizontally.
61
-
62
-
63
- ## Cleaner way to add children to containers
64
-
65
- 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).
66
-
67
- ```solara
68
- import solara
69
-
70
-
71
- @solara.component
72
- def FancyClickButton():
73
- clicks, set_clicks = solara.use_state(0)
74
-
75
- def increase_count():
76
- set_clicks(clicks + 1)
77
-
78
- def reset_count():
79
- set_clicks(0)
80
-
81
- with solara.Row() as main:
82
- solara.Button(label=f"Clicked: {clicks}", on_click=increase_count)
83
- solara.Button(label="Reset", on_click=reset_count)
84
- return main
85
-
86
- Page = FancyClickButton
87
-
88
- ```
89
-
90
- 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.
91
-
92
- ### About Context managers
93
-
94
- Context managers are a Python language feature, there are two ways to use them:
95
-
96
- ```python
97
-
98
- with some_anonymous_context_manager():
99
- print("some code")
100
-
101
- with some_named_context_manager() as this_is_my_name:
102
- print("some other code")
103
- ```
104
-
105
- 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).
106
-
107
- 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.
108
-
109
-
110
- ### Nested layout
111
-
112
- Adding children using context managers work at any level, you can nest Rows and Columns [or any other containers](/api#components).
113
-
114
-
115
- ```solara
116
- import solara
117
-
118
-
119
- @solara.component
120
- def FancyClickButton():
121
- clicks, set_clicks = solara.use_state(0)
122
-
123
- def increase_count():
124
- set_clicks(clicks + 1)
125
-
126
- def reset_count():
127
- set_clicks(0)
128
-
129
- with solara.Column() as main:
130
- with solara.Row():
131
- solara.Button(label=f"Clicked: {clicks}", on_click=increase_count)
132
- solara.Button(label="Reset", on_click=reset_count)
133
- solara.Text("I am a child of a VBox")
134
- return main
135
-
136
- Page = FancyClickButton
137
-
138
- ```
139
-
140
-
141
- ## Automatic containers
142
-
143
-
144
- Instead of returning the main container, Solara also allows you to not have a return value (or return `None`).
145
- If that is the case, Solara will look at what elements you created. If you created one, that element will be taken
146
- as a return value instead. If you make more than one element, those elements will be automatically wrapped by
147
- a [Column](/documentation/components/layout/column). The only benefit of returning an element, is that we can infer the correct return type,
148
- which can be useful for testing purposes. Users should probably never return an element, but use the automatic
149
- container feature.
150
-
151
- ```solara
152
- import solara
153
-
154
-
155
- @solara.component
156
- def ClickButton():
157
- clicks, set_clicks = solara.use_state(0)
158
-
159
- def my_click_hander():
160
- set_clicks(clicks + 1)
161
-
162
- solara.Button(label=f"Clicked: {clicks}", on_click=my_click_hander)
163
- solara.Button(label=f"Reset", on_click=lambda: set_clicks(0))
164
-
165
- Page = ClickButton
166
- ```
@@ -1,18 +0,0 @@
1
- ---
2
- title: Understanding different parts of Solara
3
- description: Solara is made of two main components, the bulk of the Solara package with UI elements that can be used together with Jupyter, and Solara server, which
4
- allows for these UI elements to be used in standalone apps and dashboards
5
- ---
6
- # Solara
7
-
8
- 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).
9
-
10
- Solara consists of two main parts
11
-
12
- ## Solara-ui
13
-
14
- A set of opinionated react components and hooks that allow you to build web apps and data apps faster.
15
-
16
- ## Solara-server
17
-
18
- A web framework for deploying web apps or data apps in production. Opinionated about pages and routing.