From 4c2b1b3581bb12bbb3e0193f317deb32db10db8d Mon Sep 17 00:00:00 2001 From: Gordon Shotwell Date: Fri, 20 Oct 2023 13:58:08 -0300 Subject: [PATCH] Fix submodule build issues --- README.md | 1 - api/.gitignore | 1 + api/index.qmd | 46 ++++++++++++++++++++++++++++++++++++++++++++++ py-shiny | 1 + 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 api/index.qmd create mode 160000 py-shiny diff --git a/README.md b/README.md index e4ecc523..2c18ee12 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ Serve the website and watch for changes to the .qmd files: make serve ``` - Running `make` by itself will print out the available `make` targets: ``` diff --git a/api/.gitignore b/api/.gitignore index b037c32d..8d34365c 100644 --- a/api/.gitignore +++ b/api/.gitignore @@ -1,2 +1,3 @@ *.qmd +!index.qmd _sidebar.yml diff --git a/api/index.qmd b/api/index.qmd new file mode 100644 index 00000000..7f60deb4 --- /dev/null +++ b/api/index.qmd @@ -0,0 +1,46 @@ +# API Reference Intro + +This website documents the public API of Shiny for Python. See the [Getting Started tutorial](/docs/get-started.qmd) for a more approachable introduction to the API. +The left-hand sidebar gives quick access to the full public API, and the table of contents below shows the same entries plus a brief summary for each. +Most of the reference pages include a live example app at the bottom, or at least mention another page with a relevant example. + +We've intentionally designed Shiny's API so that you can `from shiny import *` to get access to most of what you need for most apps without introducing an excessive amount of namespace pollution. +Namely, it gives you: + +* User interface (UI/HTML) helpers, available via the `ui` subpackage. + + * To avoid clashing with this `ui` namespace when you do `from shiny import *`, you'll want to name you UI object something else, like `app_ui`. + +* Reactive programming utilities, available via the `reactive` subpackage. +* Decorators for rendering `output`, available via the `render` subpackage. + + * 3rd party packages that want to implement their own rendering functions are encouraged to use a `@render_foo()` naming convention so users may import with `from mypkg import render_foo`. + +* A handful of other things you'll want for most apps (e.g., `App`, `Module`, etc). +* If you're using type checking, you'll also want to use the `Inputs`, `Outputs`, and `Session` Classes + to type the instances supplied to your server function, for example: + + +```{shinylive-python} +#| standalone: true +#| components: [editor, viewer] +#| layout: vertical +#| viewerHeight: 400 +## file: app.py +from shiny import * + +app_ui = ui.page_fluid( + ui.input_slider("n", "Value of n", min=1, max=10, value=5), + ui.output_text("n2") +) + +def server(input: Inputs, output: Outputs, session: Session) -> None: + @output + @render.text + def n2(): + return f"The value of n*2 is {input.n() * 2}" + +app = App(app_ui, server) +``` + +{{< include _api_index.qmd >}} diff --git a/py-shiny b/py-shiny new file mode 160000 index 00000000..f4694216 --- /dev/null +++ b/py-shiny @@ -0,0 +1 @@ +Subproject commit f4694216d433abc9a82016283594a5a57b822dcc