From 8816e3675799d9c7449d465f208463f49b393f03 Mon Sep 17 00:00:00 2001 From: Iisakki Rotko Date: Fri, 5 Apr 2024 16:03:19 +0200 Subject: [PATCH] docs: move reference from getting_started to advanced --- solara/cache.py | 4 ++-- solara/components/file_download.py | 2 +- solara/lab/components/confirmation_dialog.py | 2 +- solara/lab/components/tabs.py | 4 ++-- solara/website/pages/__init__.py | 18 +++++++++--------- .../content/15-reference}/00-overview.md | 0 .../content/15-reference}/40-static_files.md | 0 .../content/15-reference}/41-asset-files.md | 2 +- .../15-reference}/60-static-site-generation.md | 0 .../content/15-reference}/70-search.md | 2 +- .../content/15-reference}/80-reloading.md | 0 .../15-reference}/90-notebook-support.md | 0 .../content/15-reference}/95-caching.md | 0 .../20-understanding/50-solara-server.md | 2 +- .../documentation/examples/basics/__init__.py | 7 +++++++ .../getting_started/content/01-introduction.md | 4 ++-- .../content/04-tutorials/20-web-app.md | 2 +- .../content/04-tutorials/40-streamlit.md | 2 +- tests/unit/autorouting_test.py | 2 +- 19 files changed, 30 insertions(+), 23 deletions(-) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/00-overview.md (100%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/40-static_files.md (100%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/41-asset-files.md (92%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/60-static-site-generation.md (100%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/70-search.md (76%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/80-reloading.md (100%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/90-notebook-support.md (100%) rename solara/website/pages/documentation/{getting_started/content/06-reference => advanced/content/15-reference}/95-caching.md (100%) diff --git a/solara/cache.py b/solara/cache.py index 604accce2..10933eb1f 100644 --- a/solara/cache.py +++ b/solara/cache.py @@ -218,7 +218,7 @@ def mean(df, column): memory content. The storage can be any object that implements the MutableMapping interface, for instance a dict or - a cachetools.LRUCache. Or a new instance of `solara.cache.Memory`, see [caching](/documentation/getting_started/reference/caching) + a cachetools.LRUCache. Or a new instance of `solara.cache.Memory`, see [caching](/documentation/advanced/reference/caching) for cache storage options. The return value of the decorator behaves like the original function, but also has a few attributes: @@ -230,7 +230,7 @@ def mean(df, column): If the value is already cached, the function will not be executed in a thread. - See also the [reference on caching](/documentation/getting_started/reference/caching) for more caching details. + See also the [reference on caching](/documentation/advanced/reference/caching) for more caching details. """ diff --git a/solara/components/file_download.py b/solara/components/file_download.py index 054b0eb3e..eaf673e3d 100644 --- a/solara/components/file_download.py +++ b/solara/components/file_download.py @@ -145,7 +145,7 @@ def get_data(): Note that the data will be kept in memory when downloading. If the file is large (>10 MB), and when using [Solara server](/documentation/advanced/understanding/solara-server), we recommend using the - [static files directory](/documentation/getting_started/reference/static-files) instead. + [static files directory](/documentation/advanced/reference/static-files) instead. """ request_download, set_request_download = solara.use_state(False) diff --git a/solara/lab/components/confirmation_dialog.py b/solara/lab/components/confirmation_dialog.py index 78dc73ead..8f1338753 100644 --- a/solara/lab/components/confirmation_dialog.py +++ b/solara/lab/components/confirmation_dialog.py @@ -58,7 +58,7 @@ def ConfirmationDialog( ): """A dialog used to confirm a user action. - (*Note: [This component is experimental and its API may change in the future](/documentation/getting_started/lab).*) + (*Note: [This component is experimental and its API may change in the future](/documentation/getting_started/what-is-lab).*) By default, has a title, a text explaining the decision to be made, and two buttons "OK" and "Cancel". diff --git a/solara/lab/components/tabs.py b/solara/lab/components/tabs.py index 75135a1bb..2393c57c2 100644 --- a/solara/lab/components/tabs.py +++ b/solara/lab/components/tabs.py @@ -17,7 +17,7 @@ def Tab( ): """An item in a Tabs component. - (*Note: [This component is experimental and its API may change in the future](/documentation/getting_started/lab).*) + (*Note: [This component is experimental and its API may change in the future](/documentation/getting_started/what-is-lab).*) Should be a direct child of a [Tabs](/documentation/components/lab/tabs). @@ -62,7 +62,7 @@ def Tabs( ): """A tabbed container showing one tab at a time. - (*Note: [This component is experimental and its API may change in the future](/documentation/getting_started/lab).*) + (*Note: [This component is experimental and its API may change in the future](/documentation/getting_started/what-is-lab).*) Note that if Tabs are used as a child of the [AppBar](/documentation/components/layout/app_bar) component, the tabs will be placed under the app bar. See our [authorization app](/apps/authorization) for an example. diff --git a/solara/website/pages/__init__.py b/solara/website/pages/__init__.py index 8d0960ae1..4e2082787 100644 --- a/solara/website/pages/__init__.py +++ b/solara/website/pages/__init__.py @@ -36,14 +36,14 @@ "/docs/howto/debugging": "/documentation/advanced/howto/debugging", "/docs/howto/embed": "/documentation/advanced/howto/embed", "/docs/howto/ipywidget-libraries": "/documentation/advanced/howto/ipywidget-libraries", - "/docs/reference": "/documentation/getting_started/reference", - "/docs/reference/static-files": "/documentation/getting_started/reference/static-files", - "/docs/reference/asset-files": "/documentation/getting_started/reference/asset-files", - "/docs/reference/static-site-generation": "/documentation/getting_started/reference/static-site-generation", - "/docs/reference/search": "/documentation/getting_started/reference/search", - "/docs/reference/reloading": "/documentation/getting_started/reference/reloading", - "/docs/reference/notebook-support": "/documentation/getting_started/reference/notebook-support", - "/docs/reference/caching": "/documentation/getting_started/reference/caching", + "/docs/reference": "/documentation/advanced/reference", + "/docs/reference/static-files": "/documentation/advanced/reference/static-files", + "/docs/reference/asset-files": "/documentation/advanced/reference/asset-files", + "/docs/reference/static-site-generation": "/documentation/advanced/reference/static-site-generation", + "/docs/reference/search": "/documentation/advanced/reference/search", + "/docs/reference/reloading": "/documentation/advanced/reference/reloading", + "/docs/reference/notebook-support": "/documentation/advanced/reference/notebook-support", + "/docs/reference/caching": "/documentation/advanced/reference/caching", "/docs/understanding": "/documentation/advanced/understanding", "/docs/understanding/ipywidgets": "/documentation/advanced/understanding/ipywidgets", "/docs/understanding/ipyvuetify": "/documentation/advanced/understanding/ipyvuetify", @@ -66,7 +66,7 @@ "/docs/changelog": "/changelog", "/docs/contact": "/contact", "/docs/faq": "/documentation/faq", - "/docs/lab": "/documentation/getting_started/lab", + "/docs/lab": "/documentation/getting_started/what-is-lab", "/api": "/documentation/api", "/api/altair": "/documentation/components/viz/altair", "/api/app_bar": "/documentation/components/layout/app_bar", diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/00-overview.md b/solara/website/pages/documentation/advanced/content/15-reference/00-overview.md similarity index 100% rename from solara/website/pages/documentation/getting_started/content/06-reference/00-overview.md rename to solara/website/pages/documentation/advanced/content/15-reference/00-overview.md diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/40-static_files.md b/solara/website/pages/documentation/advanced/content/15-reference/40-static_files.md similarity index 100% rename from solara/website/pages/documentation/getting_started/content/06-reference/40-static_files.md rename to solara/website/pages/documentation/advanced/content/15-reference/40-static_files.md diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/41-asset-files.md b/solara/website/pages/documentation/advanced/content/15-reference/41-asset-files.md similarity index 92% rename from solara/website/pages/documentation/getting_started/content/06-reference/41-asset-files.md rename to solara/website/pages/documentation/advanced/content/15-reference/41-asset-files.md index 924e3ee25..ddd6ecced 100644 --- a/solara/website/pages/documentation/getting_started/content/06-reference/41-asset-files.md +++ b/solara/website/pages/documentation/advanced/content/15-reference/41-asset-files.md @@ -33,4 +33,4 @@ All assets files are served under `/static/assets/`, but how the asset Putting the `assets` directory 1 level higher than the `pages` directory avoids name collision with pages. -Although the `assets` directory can be used for serving arbitrary files, we recommend using the [static files](/documentation/getting_started/reference/static-files) directory instead, to avoid name collisions. +Although the `assets` directory can be used for serving arbitrary files, we recommend using the [static files](/documentation/advanced/reference/static-files) directory instead, to avoid name collisions. diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/60-static-site-generation.md b/solara/website/pages/documentation/advanced/content/15-reference/60-static-site-generation.md similarity index 100% rename from solara/website/pages/documentation/getting_started/content/06-reference/60-static-site-generation.md rename to solara/website/pages/documentation/advanced/content/15-reference/60-static-site-generation.md diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/70-search.md b/solara/website/pages/documentation/advanced/content/15-reference/70-search.md similarity index 76% rename from solara/website/pages/documentation/getting_started/content/06-reference/70-search.md rename to solara/website/pages/documentation/advanced/content/15-reference/70-search.md index 275327e88..d00e54409 100644 --- a/solara/website/pages/documentation/getting_started/content/06-reference/70-search.md +++ b/solara/website/pages/documentation/advanced/content/15-reference/70-search.md @@ -4,7 +4,7 @@ description: If you are using static site generation (SSG) in your Solara applic --- # Search -Solara can provide search, if [SSG](/documentation/getting_started/reference/static-site-generation) is enabled. This allows you to add a search box to you website, which performs a full-text search to provide quick access to pages. The solara website itself uses the +Solara can provide search, if [SSG](/documentation/advanced/reference/static-site-generation) is enabled. This allows you to add a search box to you website, which performs a full-text search to provide quick access to pages. The solara website itself uses the search feature as well in the toolbar. ## Using Solara's Search feature. diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/80-reloading.md b/solara/website/pages/documentation/advanced/content/15-reference/80-reloading.md similarity index 100% rename from solara/website/pages/documentation/getting_started/content/06-reference/80-reloading.md rename to solara/website/pages/documentation/advanced/content/15-reference/80-reloading.md diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/90-notebook-support.md b/solara/website/pages/documentation/advanced/content/15-reference/90-notebook-support.md similarity index 100% rename from solara/website/pages/documentation/getting_started/content/06-reference/90-notebook-support.md rename to solara/website/pages/documentation/advanced/content/15-reference/90-notebook-support.md diff --git a/solara/website/pages/documentation/getting_started/content/06-reference/95-caching.md b/solara/website/pages/documentation/advanced/content/15-reference/95-caching.md similarity index 100% rename from solara/website/pages/documentation/getting_started/content/06-reference/95-caching.md rename to solara/website/pages/documentation/advanced/content/15-reference/95-caching.md diff --git a/solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md b/solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md index c0f31d259..f2fb8ce9d 100644 --- a/solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md +++ b/solara/website/pages/documentation/advanced/content/20-understanding/50-solara-server.md @@ -72,7 +72,7 @@ The JSON format may be subject to change. By default, solara runs in development mode. This means, it will: - * Automatically [reload your project files](/documentation/getting_started/reference/reloading) by watching files on the filesystemn + * Automatically [reload your project files](/documentation/advanced/reference/reloading) by watching files on the filesystemn * Load debug version of the CSS files and JavaScript files for improved error messages (which leads to larger asset files). To disabled all of these option, pass the `--production` flag, or set the environment variable `SOLARA_MODE=production`. diff --git a/solara/website/pages/documentation/examples/basics/__init__.py b/solara/website/pages/documentation/examples/basics/__init__.py index 00a85276e..3faad5242 100644 --- a/solara/website/pages/documentation/examples/basics/__init__.py +++ b/solara/website/pages/documentation/examples/basics/__init__.py @@ -1,3 +1,10 @@ """Demonstrates very basic usage of Solara.""" +import solara + redirect = None + + +@solara.component +def Page(): + return solara.Markdown("Should not see me") diff --git a/solara/website/pages/documentation/getting_started/content/01-introduction.md b/solara/website/pages/documentation/getting_started/content/01-introduction.md index c5f47e262..132a190b6 100644 --- a/solara/website/pages/documentation/getting_started/content/01-introduction.md +++ b/solara/website/pages/documentation/getting_started/content/01-introduction.md @@ -83,7 +83,7 @@ Solara is actually two things. ### Solara server [Solara server](/documentation/advanced/understanding/solara-server) renders ipywidgets in the browser in a very efficient manner and takes care of many other things -such as [routing](/documentation/advanced/understanding/routing) and [Static Site Generation](/documentation/getting_started/reference/static-site-generation). +such as [routing](/documentation/advanced/understanding/routing) and [Static Site Generation](/documentation/advanced/reference/static-site-generation). ### Solara UI @@ -110,7 +110,7 @@ We recommend going through the documentation linearly following the arrows on th If you want to know more about specific parts, you can go through the [How-to section](/documentation/advanced/howto) to learn more. Feel free to skip chapters, and go back to topics when you need to. -If you want to know what components or hooks are available, or want to know more about a specific component, check out the [Documentation](/documentation) which includes live code examples. Other reference documentation can be found at the [reference section](/documentation/getting_started/reference) +If you want to know what components or hooks are available, or want to know more about a specific component, check out the [Documentation](/documentation) which includes live code examples. Other reference documentation can be found at the [reference section](/documentation/advanced/reference) If you feel like you miss some basic understanding and want to give a bit deeper into the what and why feel free to explore the [Understanding section](/documentation/advanced/understanding). diff --git a/solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md b/solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md index 1e84cfc59..d3c3f2f4b 100644 --- a/solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md +++ b/solara/website/pages/documentation/getting_started/content/04-tutorials/20-web-app.md @@ -73,7 +73,7 @@ Lets modify the script a little bit, possibly in this way: ``` If we save the script, Solara will automatically reload your script and update -your browser (we call this feature [hot reloading](/documentation/getting_started/reference/reloading)). +your browser (we call this feature [hot reloading](/documentation/advanced/reference/reloading)). Note that Solara will remember your state (e.g., the number of buttons clicked) when the app reloads. diff --git a/solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md b/solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md index 1f4bf7826..dae55219b 100644 --- a/solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md +++ b/solara/website/pages/documentation/getting_started/content/04-tutorials/40-streamlit.md @@ -74,7 +74,7 @@ If you are using [Solara server](/documentation/advanced/understanding/solara-se ### Execution model As the introduction says, Solara does not re-execute your whole script after user interactions. -The main script is executed only once. With Solara you can use your main script to read large dataframes, or do some pre-calculations without the need for [caching](/documentation/getting_started/reference/caching). +The main script is executed only once. With Solara you can use your main script to read large dataframes, or do some pre-calculations without the need for [caching](/documentation/advanced/reference/caching). When a user navigates to a Solara server, the `Page` component (basically a function) will get executed. The `Page` component will call (lazily) new components like [solara.Markdown](/documentation/components/output/markdown) to build up the page. If state changes due to user input, Solara will trigger a cascade of re-excecutions of components which inputs or state changed, but never your whole script, nor every component. diff --git a/tests/unit/autorouting_test.py b/tests/unit/autorouting_test.py index 61a3c2512..bb80b4648 100644 --- a/tests/unit/autorouting_test.py +++ b/tests/unit/autorouting_test.py @@ -105,7 +105,7 @@ def test_routes_examples_api_button(): def test_routes_examples_getting_started(): routes = solara.autorouting.generate_routes(solara.website.pages.documentation.getting_started) - assert len(routes) == 9 + assert len(routes) == 8 assert routes[0].path == "/" assert routes[0].label == "Quickstart"