From 82e46e27bfbabf1b22a753958f347d1f09446f71 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 24 Jan 2024 16:25:27 -0500 Subject: [PATCH 1/6] Describe where packages are --- docs/_quarto.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/_quarto.yml b/docs/_quarto.yml index 3e1093ae7..6da6e7571 100644 --- a/docs/_quarto.yml +++ b/docs/_quarto.yml @@ -34,5 +34,9 @@ filters: interlinks: sources: + PIL: + url: https://pillow.readthedocs.io/en/stable/ + matplotlib: + url: https://matplotlib.org/stable/ python: url: https://docs.python.org/3/ From 8b75d20079ac47355c070361aca71ef8065e7037 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 24 Jan 2024 16:25:59 -0500 Subject: [PATCH 2/6] Add entries for download_link, render.code, render.download --- docs/_quartodoc.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/_quartodoc.yml b/docs/_quartodoc.yml index f33556b4e..c1b09a701 100644 --- a/docs/_quartodoc.yml +++ b/docs/_quartodoc.yml @@ -93,6 +93,7 @@ quartodoc: contents: - ui.input_file - ui.download_button + - ui.download_link - title: Custom UI desc: Lower-level UI functions for creating custom HTML/CSS/JS contents: @@ -164,7 +165,9 @@ quartodoc: - render.image - render.table - render.text + - render.code - render.ui + - render.download - render.data_frame - render.DataGrid - render.DataTable From e58f5848c8a0125ba383580db2236e86f83e3f04 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 24 Jan 2024 16:26:33 -0500 Subject: [PATCH 3/6] Add type entries for reactive.Context, htmltools.TagFunction, htmltools.Tagifiable, htmltools.MetadataNode --- docs/_quartodoc.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/_quartodoc.yml b/docs/_quartodoc.yml index c1b09a701..caa743f29 100644 --- a/docs/_quartodoc.yml +++ b/docs/_quartodoc.yml @@ -257,6 +257,7 @@ quartodoc: - ui.Sidebar - ui.CardItem - ui.AccordionPanel + - reactive.Context - name: ui.css.CssUnit dynamic: false - ui._input_slider.SliderValueArg @@ -279,6 +280,12 @@ quartodoc: dynamic: false - name: htmltools.TagList dynamic: false + - name: htmltools.TagFunction + dynamic: false + - name: htmltools.Tagifiable + dynamic: false + - name: htmltools.MetadataNode + dynamic: false - kind: page path: ExceptionTypes summary: From 73fa096d2b9418b61f8b0c9f75dfbfef1a29577a Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 24 Jan 2024 16:27:19 -0500 Subject: [PATCH 4/6] Make `Developer facing tools` contain more subsections, including htmltools methods --- docs/_quartodoc.yml | 63 +++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/docs/_quartodoc.yml b/docs/_quartodoc.yml index caa743f29..ce099dc30 100644 --- a/docs/_quartodoc.yml +++ b/docs/_quartodoc.yml @@ -171,22 +171,6 @@ quartodoc: - render.data_frame - render.DataGrid - render.DataTable - - kind: page - path: Renderer - flatten: true - summary: - name: "Create output renderers" - desc: "Package author methods for creating new output renderers." - contents: - - render.renderer.Renderer - - name: render.renderer.Jsonifiable - dynamic: false - - name: render.renderer.ValueFn - dynamic: false - - name: render.renderer.AsyncValueFn - dynamic: false - - name: render.renderer.RendererT - dynamic: false - title: Reactive programming desc: "" contents: @@ -233,12 +217,47 @@ quartodoc: - title: Developer facing tools desc: "" contents: - - session.get_current_session - - session.require_active_session - - session.session_context - - reactive.get_current_context - - name: input_handler.input_handlers - dynamic: true + - kind: page + path: Session + summary: + name: "Session" + desc: "" + flatten: true + contents: + - session.get_current_session + - session.require_active_session + - session.session_context + - reactive.get_current_context + - name: input_handler.input_handlers + dynamic: true + - kind: page + path: Renderer + flatten: true + summary: + name: "Create output renderers" + desc: "Package author methods for creating new output renderers." + contents: + - render.renderer.Renderer + - name: render.renderer.Jsonifiable + dynamic: false + - name: render.renderer.ValueFn + dynamic: false + - name: render.renderer.AsyncValueFn + dynamic: false + - name: render.renderer.RendererT + dynamic: false + - kind: page + path: Htmltools + flatten: true + package: null + summary: + name: "htmltools methods" + desc: "" + contents: + - name: htmltools.HTMLDependency + dynamic: false + - name: htmltools.css + dynamic: false - title: Types desc: "" contents: From bdc3436186704c5b0d4b55a2c642b49b13c39d1f Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 24 Jan 2024 16:28:02 -0500 Subject: [PATCH 5/6] Quartodoc lints rnd 1+2 --- shiny/_app.py | 2 +- shiny/_main.py | 2 +- shiny/_validation.py | 8 +++--- shiny/experimental/ui/_card.py | 2 +- shiny/experimental/ui/_deprecated.py | 10 ++++---- shiny/express/_output.py | 4 +-- shiny/express/_run.py | 2 +- shiny/express/ui/_cm_components.py | 10 ++++---- shiny/input_handler.py | 2 +- shiny/reactive/_core.py | 21 +++++++-------- shiny/reactive/_poll.py | 14 +++++----- shiny/reactive/_reactives.py | 32 ++++++++++++----------- shiny/render/_dataframe.py | 10 ++++---- shiny/render/_render.py | 38 ++++++++++++++-------------- shiny/render/renderer/_renderer.py | 6 ----- shiny/session/_utils.py | 8 +++--- shiny/types.py | 24 +++++++----------- shiny/ui/_accordion.py | 7 +++-- shiny/ui/_bootstrap.py | 6 ++--- shiny/ui/_card.py | 8 +++--- shiny/ui/_include_helpers.py | 36 +++++++++++++------------- shiny/ui/_input_check_radio.py | 36 +++++++++++++------------- shiny/ui/_input_update.py | 16 +++++++----- shiny/ui/_insert.py | 21 +++++++-------- shiny/ui/_markdown.py | 16 +++--------- shiny/ui/_modal.py | 35 ++++++++++++------------- shiny/ui/_notification.py | 9 ++++--- shiny/ui/_output.py | 20 +++++++-------- shiny/ui/_page.py | 4 +-- shiny/ui/_popover.py | 4 +-- shiny/ui/_progress.py | 9 ++++--- shiny/ui/_sidebar.py | 13 ++++++---- shiny/ui/_valuebox.py | 11 +++----- shiny/ui/dataframe/_dataframe.py | 2 +- shiny/ui/fill/_fill.py | 4 +-- 35 files changed, 224 insertions(+), 228 deletions(-) diff --git a/shiny/_app.py b/shiny/_app.py index e9a6882d2..5a1f33237 100644 --- a/shiny/_app.py +++ b/shiny/_app.py @@ -32,7 +32,7 @@ from ._utils import guess_mime_type, is_async_callable from .html_dependencies import jquery_deps, require_deps, shiny_deps from .http_staticfiles import FileResponse, StaticFiles -from .session import Inputs, Outputs, Session, session_context +from .session._session import Inputs, Outputs, Session, session_context T = TypeVar("T") diff --git a/shiny/_main.py b/shiny/_main.py index 5b915286e..56180606c 100644 --- a/shiny/_main.py +++ b/shiny/_main.py @@ -247,7 +247,7 @@ def run_app( Tip --- The ``shiny run`` command-line interface (which comes installed with Shiny) provides - the same functionality as :func:`~shiny.run_app`. + the same functionality as `shiny.run_app()`. Examples -------- diff --git a/shiny/_validation.py b/shiny/_validation.py index a51846d37..f9bc18369 100644 --- a/shiny/_validation.py +++ b/shiny/_validation.py @@ -27,8 +27,8 @@ def req(*args: T, cancel_output: bool | Literal["progress"] = False) -> T | None """ Throw a silent exception for falsy values. - This is a convenient shorthand for throwing :func:`~shiny.types.SilentException` / - :func:`~shiny.types.SilentCancelOutputException` if any of the arguments are falsy. + This is a convenient shorthand for throwing :class:`~shiny.types.SilentException` / + :class:`~shiny.types.SilentCancelOutputException` if any of the arguments are falsy. The term "falsy" generally indicates that a value is considered `False` when encountered in a logical context. We use the term a little loosely here; our usage @@ -42,8 +42,8 @@ def req(*args: T, cancel_output: bool | Literal["progress"] = False) -> T | None *args Any number of arguments to check. cancel_output - If ``True``, throw :func:`~shiny.types.SilentCancelOutputException` instead of - :func:`~shiny.types.SilentException`. + If ``True``, throw :class:`~shiny.types.SilentCancelOutputException` instead of + :class:`~shiny.types.SilentException`. Returns ------- diff --git a/shiny/experimental/ui/_card.py b/shiny/experimental/ui/_card.py index 3ecff0557..fdf64f385 100644 --- a/shiny/experimental/ui/_card.py +++ b/shiny/experimental/ui/_card.py @@ -131,7 +131,7 @@ def card_title( resolved :class:`~htmltools.Tag` object. container Method for the returned :class:`~htmltools.Tag` object. Defaults to - :func:`~shiny.ui.tags`.h5. + :func:`~shiny.ui.tags.h5`. **kwargs Additional HTML attributes for the returned :class:`~htmltools.Tag` object. diff --git a/shiny/experimental/ui/_deprecated.py b/shiny/experimental/ui/_deprecated.py index 6d324bb0e..e55754c04 100644 --- a/shiny/experimental/ui/_deprecated.py +++ b/shiny/experimental/ui/_deprecated.py @@ -595,7 +595,7 @@ def panel_main( # Deprecated 2023-09-12 CssUnit = MainCssUnit """ -Deprecated. Please use `shiny.ui.css_unit.CssUnit` instead. +Deprecated. Please use `shiny.ui.css.CssUnit` instead. """ @@ -612,12 +612,12 @@ def as_css_unit(value: CssUnit) -> str: # Deprecated 2023-09-12 def as_css_unit(value: None | CssUnit) -> None | str: """ - Deprecated. Please use :func:`~shiny.ui.css_unit.as_css_unit()` instead. + Deprecated. Please use :func:`~shiny.ui.css.as_css_unit()` instead. """ warn_deprecated( "`shiny.experimental.ui.as_css_unit()` is deprecated. " "This method will be removed in a future version, " - "please use `shiny.ui.css_unit.as_css_unit()` instead." + "please use `shiny.ui.css.as_css_unit()` instead." ) return main_as_css_unit(value) @@ -635,12 +635,12 @@ def as_css_padding(padding: None) -> None: # Deprecated 2023-09-12 def as_css_padding(padding: CssUnit | list[CssUnit] | None) -> str | None: """ - Deprecated. Please use :func:`~shiny.ui.css_unit.as_css_padding()` instead. + Deprecated. Please use :func:`~shiny.ui.css.as_css_padding()` instead. """ warn_deprecated( "`shiny.experimental.ui.as_css_padding()` is deprecated. " "This method will be removed in a future version, " - "please use `shiny.ui.css_unit.as_css_padding()` instead." + "please use `shiny.ui.css.as_css_padding()` instead." ) return main_as_css_padding(padding) diff --git a/shiny/express/_output.py b/shiny/express/_output.py index da2952e24..375c35a70 100644 --- a/shiny/express/_output.py +++ b/shiny/express/_output.py @@ -22,9 +22,9 @@ def output_args( """ Sets default UI arguments for a Shiny rendering function. - Each Shiny render function (like :func:`~shiny.render.plot`) can display itself when + Each Shiny render function (like :class:`~shiny.render.plot`) can display itself when declared within a Shiny inline-style application. In the case of - :func:`~shiny.render.plot`, the :func:`~shiny.ui.output_plot` function is called + :class:`~shiny.render.plot`, the :func:`~shiny.ui.output_plot` function is called implicitly to display the plot. Use the `@ui_kwargs` decorator to specify arguments to be passed to `output_plot` (or whatever the corresponding UI function is) when the render function displays itself. diff --git a/shiny/express/_run.py b/shiny/express/_run.py index 68fb8b035..860f2a67a 100644 --- a/shiny/express/_run.py +++ b/shiny/express/_run.py @@ -31,7 +31,7 @@ def wrap_express_app(file: Path) -> App: Returns ------- : - A `shiny.App` object. + A :class:`shiny.App` object. """ try: with session_context(cast(Session, MockSession())): diff --git a/shiny/express/ui/_cm_components.py b/shiny/express/ui/_cm_components.py index 0fe85fee1..5e686628f 100644 --- a/shiny/express/ui/_cm_components.py +++ b/shiny/express/ui/_cm_components.py @@ -147,7 +147,7 @@ def layout_sidebar( This function wraps :func:`~shiny.ui.layout_sidebar`. Create a sidebar layout component which can be dropped inside any Shiny UI page - method (e.g. :func:`~shiny.shiny.ui.page_fillable`) or :func:`~shiny.ui.card` + method (e.g. :func:`~shiny.ui.page_fillable`) or :func:`~shiny.ui.card` context. The first child needs to be of class :class:`~shiny.ui.Sidebar` object created by @@ -159,10 +159,10 @@ def layout_sidebar( ---------- fillable Whether or not the main content area should be wrapped in a fillable container. - See :func:`~shiny.ui.as_fillable_container` for details. + See :func:`~shiny.ui.fill.as_fillable_container` for details. fill Whether or not the sidebar layout should be wrapped in a fillable container. See - :func:`~shiny.ui.as_fill_item` for details. + :func:`~shiny.ui.fill.as_fill_item` for details. bg,fg A background or foreground color. border @@ -370,7 +370,7 @@ def layout_columns( See Also -------- - * :func:`~shiny.express.layout.layout_column_wrap` for laying out elements into a + * :func:`~shiny.express.ui.layout_column_wrap` for laying out elements into a uniform grid. Reference @@ -1250,7 +1250,7 @@ def panel_conditional( Tip --- A more powerful (but slower) way to conditionally show UI content is to use - :func:`~shiny.render.ui`. + :class:`~shiny.render.ui`. """ return RecallContextManager( ui.panel_conditional, diff --git a/shiny/input_handler.py b/shiny/input_handler.py index 7c2c1bf9a..0b27fb806 100644 --- a/shiny/input_handler.py +++ b/shiny/input_handler.py @@ -44,7 +44,7 @@ def _process_value(self, type: str, value: Any, name: str, session: Session) -> Add and/or remove input handlers of a given ``type``. Shiny uses these handlers to pre-process input values from the client (after being deserialized) before passing them -to the ``input`` argument of an :func:`~shiny.App`'s ``server`` function. +to the ``input`` argument of an :class:`~shiny.App`'s ``server`` function. The ``type`` is based on the ``getType()`` JavaScript method on the relevant Shiny input binding. See `this article `_ diff --git a/shiny/reactive/_core.py b/shiny/reactive/_core.py index 86fed00fc..d7f0219c8 100644 --- a/shiny/reactive/_core.py +++ b/shiny/reactive/_core.py @@ -161,7 +161,7 @@ def use_context(self, ctx: Context) -> typing.Generator[None, None, None]: self._current_context.reset(old) def current_context(self) -> Context: - """Return the current Context object""" + """Return the current `Context` object""" ctx = self._current_context.get() if ctx is None: raise RuntimeError("No current reactive context") @@ -224,7 +224,7 @@ def isolate() -> Generator[None, None, None]: See Also -------- - ~shiny.reactive.event + * :func:`~shiny.reactive.event` """ with _reactive_environment.isolate(): yield @@ -237,7 +237,7 @@ def get_current_context() -> Context: Returns ------- : - A :class:`~Context`. + A `~shiny.reactive.Context` class. Raises ------ @@ -282,7 +282,7 @@ def on_flushed( See Also -------- - flush + * :func:`~shiny.reactive.flush` """ return _reactive_environment.on_flushed(func, once) @@ -317,12 +317,13 @@ def invalidate_later( Note ---- - When called within a reactive function (i.e., :func:`~reactive.effect`, :func:`~reactive.calc`, - :func:`render.ui`, etc.), that reactive context is invalidated (and re-executes) - after the interval has passed. The re-execution will reset the invalidation flag, so - in a typical use case, the object will keep re-executing and waiting for the - specified interval. It's possible to stop this cycle by adding conditional logic - that prevents the ``invalidate_later`` from being run. + When called within a reactive function (i.e., :func:`~shiny.reactive.effect`, + :func:`~shiny.reactive.calc`, :class:`shiny.render.ui`, etc.), that reactive context + is invalidated (and re-executes) after the interval has passed. The re-execution + will reset the invalidation flag, so in a typical use case, the object will keep + re-executing and waiting for the specified interval. It's possible to stop this + cycle by adding conditional logic that prevents the ``invalidate_later`` from being + run. """ if isinstance(session, MISSING_TYPE): diff --git a/shiny/reactive/_poll.py b/shiny/reactive/_poll.py index 413125a8b..88907d171 100644 --- a/shiny/reactive/_poll.py +++ b/shiny/reactive/_poll.py @@ -10,7 +10,7 @@ from ..types import MISSING, MISSING_TYPE if TYPE_CHECKING: - from ..session import Session + from .. import Session __all__ = ("poll", "file_reader") @@ -50,7 +50,7 @@ def poll( object at the top level of app.py (outside of the server function). Both `poll_func` and the decorated (data reading) function can read reactive values - and :class:`~shiny.reactive.calc` objects. Any invalidations triggered by reactive + and :func:`~shiny.reactive.calc` objects. Any invalidations triggered by reactive dependencies will apply to the reactive polling object immediately (not waiting for the `interval_secs` delay to expire). @@ -73,7 +73,7 @@ def poll( The function that will be used to compare each `poll_func` return value with its immediate predecessor. priority - Reactive polling is implemented using an :class:`~shiny.reactive.effect` to call + Reactive polling is implemented using an :func:`~shiny.reactive.effect` to call `poll_func` on a timer; use the `priority` argument to control the order of this Effect's execution versus other Effects in your app. See :func:`~shiny.reactive.effect` for more details. @@ -89,7 +89,7 @@ def poll( A decorator that should be applied to a no-argument function that (expensively) reads whatever data is desired. (This function may be a regular function or a co-routine function.) The result of the decorator is a reactive - :class:`~shiny.reactive.calc` that always returns up-to-date data, and invalidates + :func:`~shiny.reactive.calc` that always returns up-to-date data, and invalidates callers when changes are detected via polling. See Also @@ -226,7 +226,7 @@ def file_reader( Note that `file_reader` works only on single files, not directories of files. Both the `filepath` function and the decorated (file reading) function can read - reactive values and :class:`~shiny.reactive.calc` objects. Any invalidations + reactive values and :func:`~shiny.reactive.calc` objects. Any invalidations triggered by reactive dependencies will apply to the reactive file reader object immediately (not waiting for the `interval_secs` delay to expire). @@ -247,7 +247,7 @@ def file_reader( Note: depending on what other tasks are executing, the actual wait time may far exceed this value. priority - Reactive polling is implemented using an :class:`~shiny.reactive.effect` to call + Reactive polling is implemented using an :func:`~shiny.reactive.effect` to call `poll_func` on a timer; use the `priority` argument to control the order of this Effect's execution versus other Effects in your app. See :func:`~shiny.reactive.effect` for more details. @@ -263,7 +263,7 @@ def file_reader( A decorator that should be applied to a no-argument function that (expensively) reads whatever data is desired. (This function may be a regular function or a co-routine function.) The result of the decorator is a reactive - :class:`~shiny.reactive.calc` that always returns up-to-date data, and invalidates + :func:`~shiny.reactive.calc` that always returns up-to-date data, and invalidates callers when changes are detected via polling. See Also diff --git a/shiny/reactive/_reactives.py b/shiny/reactive/_reactives.py index 8f3f49de7..10061a2e1 100644 --- a/shiny/reactive/_reactives.py +++ b/shiny/reactive/_reactives.py @@ -74,20 +74,22 @@ class Value(Generic[T]): Raises ------ - ~shiny.types.SilentException - If :func:`~Value.get` is called before a value is provided/set. + :class:`~shiny.types.SilentException` + If :func:`~shiny.reactive.Value.get` is called before a value is provided/set. Note ---- A reactive value may only be read from within a reactive function (e.g., :func:`~shiny.reactive.calc`, :func:`~shiny.reactive.effect`, - :func:`shiny.render.text`, etc.) and, when doing so, the function takes a reactive + :class:`shiny.render.text`, etc.) and, when doing so, the function takes a reactive dependency on the value (i.e., when the value changes, the calling reactive function will re-execute). See Also -------- - ~shiny.Inputs ~shiny.reactive.calc ~shiny.reactive.effect + * :class:`~shiny.Inputs` + * :func:`~shiny.reactive.calc` + * :func:`~shiny.reactive.effect` """ # These overloads are necessary so that the following hold: @@ -130,7 +132,7 @@ def get(self) -> T: Raises ------ - ~shiny.types.SilentException + :class:`~shiny.types.SilentException` If the value is not set. RuntimeError If called from outside a reactive function. @@ -428,11 +430,11 @@ def calc( See Also -------- - ~shiny.Inputs - ~shiny.reactive.Value - ~shiny.reactive.effect - ~shiny.reactive.invalidate_later - ~shiny.reactive.event + * :class:`~shiny.Inputs` + * :class:`~shiny.reactive.Value` + * :func:`~shiny.reactive.effect` + * :func:`~shiny.reactive.invalidate_later` + * :func:`~shiny.reactive.event` """ def create_calc(fn: CalcFunction[T] | CalcFunctionAsync[T]) -> Calc_[T]: @@ -725,11 +727,11 @@ def effect( See Also -------- - ~shiny.Inputs - ~shiny.reactive.Value - ~shiny.reactive.effect - ~shiny.reactive.invalidate_later - ~shiny.reactive.event + * :class:`~shiny.Inputs` + * :class:`~shiny.reactive.Value` + * :func:`~shiny.reactive.effect` + * :func:`~shiny.reactive.invalidate_later` + * :func:`~shiny.reactive.event` """ def create_effect(fn: EffectFunction | EffectFunctionAsync) -> Effect_: diff --git a/shiny/render/_dataframe.py b/shiny/render/_dataframe.py index 573075478..c7e84188d 100644 --- a/shiny/render/_dataframe.py +++ b/shiny/render/_dataframe.py @@ -24,7 +24,7 @@ def to_payload(self) -> Jsonifiable: @add_example(ex_dir="../api-examples/data_frame") class DataGrid(AbstractTabularData): """ - Holds the data and options for a ``shiny.render.data_frame`` output, for a + Holds the data and options for a :class:`~shiny.render.data_frame` output, for a spreadsheet-like view. Parameters @@ -65,7 +65,7 @@ class DataGrid(AbstractTabularData): See Also -------- :func:`~shiny.ui.output_data_frame` - :func:`~shiny.render.data_frame` + :class:`~shiny.render.data_frame` :class:`~shiny.render.DataTable` """ @@ -111,7 +111,7 @@ def to_payload(self) -> Jsonifiable: @no_example class DataTable(AbstractTabularData): """ - Holds the data and options for a ``shiny.render.data_frame`` output, for a + Holds the data and options for a :class:`~shiny.render.data_frame` output, for a spreadsheet-like view. Parameters @@ -152,7 +152,7 @@ class DataTable(AbstractTabularData): See Also -------- :func:`~shiny.ui.output_data_frame` - :func:`~shiny.render.data_frame` + :class:`~shiny.render.data_frame` :class:`~shiny.render.DataGrid` """ @@ -230,7 +230,7 @@ class data_frame(Renderer[DataFrameResult]): 1. A :class:`~shiny.render.DataGrid` or :class:`~shiny.render.DataTable` object, which can be used to customize the appearance and behavior of the data frame output. - 2. A pandas :class:`DataFrame` object. (Equivalent to + 2. A pandas `DataFrame` object. (Equivalent to `shiny.render.DataGrid(df)`.) 3. Any object that has a `.to_pandas()` method (e.g., a Polars data frame or Arrow table). (Equivalent to `shiny.render.DataGrid(df.to_pandas())`.) diff --git a/shiny/render/_render.py b/shiny/render/_render.py index 725aeb8ea..51dd9ec59 100644 --- a/shiny/render/_render.py +++ b/shiny/render/_render.py @@ -89,8 +89,8 @@ class text(Renderer[str]): See Also -------- - * ~shiny.render.code - * ~shiny.ui.output_text + * :class:`~shiny.render.code` + * :func:`~shiny.ui.output_text` """ def auto_output_ui( @@ -150,8 +150,8 @@ class code(Renderer[str]): See Also -------- - * ~shiny.render.code - * ~shiny.ui.output_code + * :class:`~shiny.render.code` + * :func:`~shiny.ui.output_code` """ def auto_output_ui( @@ -238,8 +238,8 @@ class plot(Renderer[object]): See Also -------- - * ~shiny.ui.output_plot - * ~shiny.render.image + * :func:`~shiny.ui.output_plot` + * :class:`~shiny.render.image` """ def auto_output_ui( @@ -409,9 +409,9 @@ class image(Renderer[ImgData]): See Also -------- - * ~shiny.ui.output_image - * ~shiny.types.ImgData - * ~shiny.render.plot + * :func:`~shiny.ui.output_image` + * :class:`~shiny.types.ImgData` + * :class:`~shiny.render.plot` """ def auto_output_ui(self, **kwargs: object): @@ -466,21 +466,21 @@ class table(Renderer[TableResult]): Reactively render a pandas ``DataFrame`` object (or similar) as a basic HTML table. - Consider using :func:`~shiny.render.data_frame` instead of this renderer, as + Consider using :class:`~shiny.render.data_frame` instead of this renderer, as it provides high performance virtual scrolling, built-in filtering and sorting, and a better default appearance. This renderer may still be helpful if you use pandas styling features that are not currently supported by - :func:`~shiny.render.data_frame`. + :class:`~shiny.render.data_frame`. Parameters ---------- index - Whether to print index (row) labels. (Ignored for pandas :class:`Styler` + Whether to print index (row) labels. (Ignored for pandas :class:`~pandas.io.formats.style.Styler` objects; call ``style.hide(axis="index")`` from user code instead.) classes CSS classes (space separated) to apply to the resulting table. By default, we use `table shiny-table w-auto` which is designed to look reasonable with - Bootstrap 5. (Ignored for pandas :class:`Styler` objects; call + Bootstrap 5. (Ignored for pandas :class:`~pandas.io.formats.style.Styler` objects; call ``style.set_table_attributes('class="dataframe table shiny-table w-auto"')`` from user code instead.) **kwargs @@ -492,8 +492,8 @@ class table(Renderer[TableResult]): : A decorator for a function that returns any of the following: - 1. A pandas :class:`DataFrame` object. - 2. A pandas :class:`Styler` object. + 1. A pandas :class:`~pandas.DataFrame` object. + 2. A pandas :class:`~pandas.io.formats.style.Styler` object. 3. Any object that has a `.to_pandas()` method (e.g., a Polars data frame or Arrow table). @@ -505,7 +505,7 @@ class table(Renderer[TableResult]): See Also -------- - * ~shiny.ui.output_table for the corresponding UI component to this render function. + * :func:`~shiny.ui.output_table` for the corresponding UI component to this render function. """ def auto_output_ui(self, **kwargs: TagAttrValue) -> Tag: @@ -575,9 +575,9 @@ class ui(Renderer[TagChild]): ------- : A decorator for a function that returns an object of type - :class:`~shiny.ui.TagChild`. + :class:`~htmltools.TagChild`. - Tip + Tips ---- The name of the decorated function (or ``@output(id=...)``) should match the ``id`` of a :func:`~shiny.ui.output_ui` container (see :func:`~shiny.ui.output_ui` for @@ -585,7 +585,7 @@ class ui(Renderer[TagChild]): See Also -------- - * ~shiny.ui.output_ui + * :func:`~shiny.ui.output_ui` """ def auto_output_ui(self) -> Tag: diff --git a/shiny/render/renderer/_renderer.py b/shiny/render/renderer/_renderer.py index 2e2972e66..5367ac299 100644 --- a/shiny/render/renderer/_renderer.py +++ b/shiny/render/renderer/_renderer.py @@ -230,12 +230,6 @@ def auto_output_ui( ) -> DefaultUIFnResultOrNone: """ Express mode method that automatically generates the output's UI. - - Parameters - ---------- - id - Output function name or ID (provided to `@output(id=)`). This value will - contain any module prefix. """ return None diff --git a/shiny/session/_utils.py b/shiny/session/_utils.py index dba7c3ce7..2d399cb2d 100644 --- a/shiny/session/_utils.py +++ b/shiny/session/_utils.py @@ -51,8 +51,8 @@ def get_current_session() -> Optional[Session]: called from within an active Shiny session. See Also - ------- - ~require_active_session + -------- + * :func:`~shiny.session.require_active_session` """ return _current_session.get() or _default_session @@ -104,8 +104,8 @@ def require_active_session(session: Optional[Session]) -> Session: If session is not active. See Also - ------- - ~get_current_session + -------- + * :func:`~shiny.session.get_current_session` """ if session is None: diff --git a/shiny/types.py b/shiny/types.py index 5df75ae05..e116e8454 100644 --- a/shiny/types.py +++ b/shiny/types.py @@ -35,17 +35,14 @@ class MISSING_TYPE: # {'name': 'mtcars.csv', 'size': 1303, 'type': 'text/csv', 'datapath: '/...../mtcars.csv'} # The incoming data doesn't include 'datapath'; that field is added by the # FileUploadOperation class. +@add_example(ex_dir="./api-examples/input_file") class FileInfo(TypedDict): """ Class for information about a file upload. See Also -------- - ~shiny.ui.input_file - - Example - ------- - See :func:`~shiny.ui.input_file`. + * :func:`~shiny.ui.input_file` """ name: str @@ -58,17 +55,14 @@ class FileInfo(TypedDict): """The path to the file on the server.""" +@add_example(ex_dir="./api-examples/output_image") class ImgData(TypedDict): """ - Return type for :func:`~shiny.render.image`. + Return type for :class:`~shiny.render.image`. See Also -------- - ~shiny.render.image - - Example - ------- - See :func:`~shiny.render.image`. + * :class:`~shiny.render.image` """ src: str @@ -107,7 +101,7 @@ class SilentException(Exception): Normally, when an exception occurs inside a reactive context, it's either: - Displayed to the user (as a big red error message) - - This happens when the exception is raised from an output context (e.g., :func:`shiny.render.ui`) + - This happens when the exception is raised from an output context (e.g., :class:`shiny.render.ui`) - Crashes the application - This happens when the exception is raised from an :func:`shiny.reactive.Effect` @@ -116,7 +110,7 @@ class SilentException(Exception): See Also -------- - ~SilentCancelOutputException + * :class:`~shiny.types.SilentCancelOutputException` """ pass @@ -127,12 +121,12 @@ class SilentCancelOutputException(Exception): """ Throw a silent exception and don't clear output - Similar to :class:`~SilentException`, but if thrown in an output context, + Similar to :class:`~shiny.types.SilentException`, but if thrown in an output context, existing output isn't cleared. See Also -------- - ~SilentException + * :class:`~shiny.types.SilentException` """ pass diff --git a/shiny/ui/_accordion.py b/shiny/ui/_accordion.py index fdfefef93..c2c3044bc 100644 --- a/shiny/ui/_accordion.py +++ b/shiny/ui/_accordion.py @@ -1,19 +1,22 @@ from __future__ import annotations import random -from typing import Literal, Optional, TypeVar +from typing import TYPE_CHECKING, Literal, Optional, TypeVar from htmltools import Tag, TagAttrs, TagAttrValue, TagChild, css, tags from .._docstring import add_example from .._namespaces import resolve_id_or_none from .._utils import drop_none -from ..session import Session, require_active_session +from ..session import require_active_session from ..types import MISSING, MISSING_TYPE from ._html_deps_shinyverse import components_dependency from ._tag import consolidate_attrs from .css._css_unit import CssUnit, as_css_unit +if TYPE_CHECKING: + from .. import Session + __all__ = ( "accordion", "accordion_panel", diff --git a/shiny/ui/_bootstrap.py b/shiny/ui/_bootstrap.py index dd6b38fdb..d29199468 100644 --- a/shiny/ui/_bootstrap.py +++ b/shiny/ui/_bootstrap.py @@ -184,12 +184,12 @@ def panel_conditional( Tip --- A more powerful (but slower) way to conditionally show UI content is to use - :func:`~shiny.render.ui`. + :class:`~shiny.render.ui`. See Also ------- - ~shiny.render.ui - ~shiny.ui.output_ui + * :class:`~shiny.render.ui` + * :func:`~shiny.ui.output_ui` """ ns_prefix = current_namespace() diff --git a/shiny/ui/_card.py b/shiny/ui/_card.py index c8357ead8..97dbd4c50 100644 --- a/shiny/ui/_card.py +++ b/shiny/ui/_card.py @@ -295,7 +295,7 @@ def card_body( height Any valid CSS unit (e.g., `height="200px"`). Doesn't apply when a card is made `full_screen` (in this case, consider setting a `height` in - :func:`~shiny.ui.card_body`). + `card_body()`). padding Padding to use for the body. This can be a numeric vector (which will be interpreted as pixels) or a character vector with valid CSS @@ -326,7 +326,7 @@ def card_body( (or multiple columns inside a card). * :func:`~shiny.ui.card` for creating a card component. * :func:`~shiny.ui.card_header` for creating a header within the card. - * :func:`~shiny.ui.card_title` for creating a title within the card body. + * :func:`~shiny.experimental.ui.card_title` for creating a title within the card body. * :func:`~shiny.ui.card_footer` for creating a footer within the card. """ if isinstance(max_height_full_screen, MISSING_TYPE): @@ -371,7 +371,7 @@ class CardItem: """ A wrapper around a :class:`~htmltools.Tag` object that represents the content of a card item (e.g., :func:`~shiny.ui.card_header` or - :func:`~shiny.card_footer`). + :func:`~shiny.ui.card_footer`). This class is used to allow for consecutive non-card items to be bundled into a single group within :func:`~shiny.ui.card`. @@ -381,7 +381,7 @@ class CardItem: item A :class:`~htmltools.Tag` object that represents the content of a card item (e.g., :func:`~shiny.ui.card_header` or - :func:`~shiny.card_footer`). + :func:`~shiny.ui.card_footer`). See Also -------- diff --git a/shiny/ui/_include_helpers.py b/shiny/ui/_include_helpers.py index 8ceebb12f..3c0c9409a 100644 --- a/shiny/ui/_include_helpers.py +++ b/shiny/ui/_include_helpers.py @@ -36,7 +36,7 @@ def include_js( method One of the following: - * ``"link"`` is the link to the CSS file via a :func:`~ui.tags.link` tag. This + * ``"link"`` is the link to the CSS file via a :func:`~shiny.ui.tags.link` tag. This method is generally preferable to ``"inline"`` since it allows the browser to cache the file. * ``"link_files"`` is the same as ``"link"``, but also allow for the CSS file to @@ -49,20 +49,20 @@ def include_js( should be somewhere like ``/app/css/custom.css`` (and all the other relevant accompanying 'safe' files should be located under ``/app/css/``). * ``"inline"`` is the inline the CSS file contents within a - :func:`~ui.tags.style` tag. + :func:`~shiny.ui.tags.style` tag. **kwargs - Attributes which are passed on to `~ui.tags.script`. + Attributes which are passed on to `~shiny.ui.tags.script`. Returns ------- : - A :func:`~ui.tags.script` tag. + A :func:`~shiny.ui.tags.script` tag. Note ---- - This places a :func:`~ui.tags.script` tag in the :func:`~ui.tags.body` of the - document. If you want to place the tag in the :func:`~ui.tags.head` of the + This places a :func:`~shiny.ui.tags.script` tag in the :func:`~shiny.ui.tags.body` of the + document. If you want to place the tag in the :func:`~shiny.ui.tags.head` of the document instead, you can wrap it in ``head_content`` (in this case, just make sure you're aware that the DOM probably won't be ready when the script is executed). @@ -81,8 +81,8 @@ def include_js( See Also -------- - ~ui.tags.script - ~include_css + * :func:`~shiny.ui.tags.script` + * :func:`~shiny.ui.include_css` """ file_path = check_path(path) @@ -111,7 +111,7 @@ def include_css( method One of the following: - * ``"link"`` is the link to the CSS file via a :func:`~ui.tags.link` tag. This + * ``"link"`` is the link to the CSS file via a :func:`~shiny.ui.tags.link` tag. This method is generally preferable to ``"inline"`` since it allows the browser to cache the file. * ``"link_files"`` is the same as ``"link"``, but also allow for the CSS file to @@ -124,22 +124,22 @@ def include_css( should be somewhere like ``/app/css/custom.css`` (and all the other relevant accompanying 'safe' files should be located under ``/app/css/``). * ``"inline"`` is the inline the CSS file contents within a - :func:`~ui.tags.style` tag. + :func:`~shiny.ui.tags.style` tag. Returns ------- : - If ``method="inline"``, returns a :func:`~ui.tags.style` tag; otherwise, returns a - :func:`~ui.tags.link` tag. + If ``method="inline"``, returns a :func:`~shiny.ui.tags.style` tag; otherwise, returns a + :func:`~shiny.ui.tags.link` tag. Note ---- - By default this places a :func:`~ui.tags.link` (or :func:`~ui.tags.style`) tag in - the :func:`~ui.tags.body` of the document, which isn't optimal for performance, and + By default this places a :func:`~shiny.ui.tags.link` (or :func:`~shiny.ui.tags.style`) tag in + the :func:`~shiny.ui.tags.body` of the document, which isn't optimal for performance, and may result in a Flash of Unstyled Content (FOUC). To instead place the CSS in the - :func:`~ui.tags.head` of the document, you can wrap it in ``head_content``: + :func:`~shiny.ui.tags.head` of the document, you can wrap it in ``head_content``: ```{python} #| eval: false @@ -159,9 +159,9 @@ def include_css( See Also -------- - ~ui.tags.style - ~ui.tags.link - ~include_js + * :func:`~shiny.ui.tags.style` + * :func:`~shiny.ui.tags.link` + * :func:`~shiny.ui.include_js` """ file_path = check_path(path) diff --git a/shiny/ui/_input_check_radio.py b/shiny/ui/_input_check_radio.py index 6c330f62e..ffaecc098 100644 --- a/shiny/ui/_input_check_radio.py +++ b/shiny/ui/_input_check_radio.py @@ -59,11 +59,11 @@ def input_checkbox( ::: See Also - ------- - ~shiny.ui.input_switch - ~shiny.ui.update_checkbox - ~shiny.ui.input_checkbox_group - ~shiny.ui.input_radio_buttons + -------- + * :func:`~shiny.ui.input_switch` + * :func:`~shiny.ui.update_checkbox` + * :func:`~shiny.ui.input_checkbox_group` + * :func:`~shiny.ui.input_radio_buttons` """ return div( @@ -117,11 +117,11 @@ def input_switch( ::: See Also - ------- - ~shiny.ui.input_checkbox - ~shiny.ui.update_switch - ~shiny.ui.input_checkbox_group - ~shiny.ui.input_radio_buttons + -------- + * :func:`~shiny.ui.input_checkbox` + * :func:`~shiny.ui.update_switch` + * :func:`~shiny.ui.input_checkbox_group` + * :func:`~shiny.ui.input_radio_buttons` """ return _bslib_input_checkbox( @@ -209,10 +209,10 @@ def input_checkbox_group( ::: See Also - ------- - ~shiny.ui.update_checkbox_group - ~shiny.ui.input_checkbox - ~shiny.ui.input_radio_buttons + -------- + * :func:`~shiny.ui.update_checkbox_group` + * :func:`~shiny.ui.input_checkbox` + * :func:`~shiny.ui.input_radio_buttons` """ resolved_id = resolve_id(id) @@ -279,10 +279,10 @@ def input_radio_buttons( ::: See Also - ------- - ~shiny.ui.update_radio_buttons - ~shiny.ui.input_checkbox_group - ~shiny.ui.input_checkbox + -------- + * :func:`~shiny.ui.update_radio_buttons` + * :func:`~shiny.ui.input_checkbox_group` + * :func:`~shiny.ui.input_checkbox` """ resolved_id = resolve_id(id) diff --git a/shiny/ui/_input_update.py b/shiny/ui/_input_update.py index 003b29703..5d116c501 100644 --- a/shiny/ui/_input_update.py +++ b/shiny/ui/_input_update.py @@ -21,7 +21,7 @@ import json import re from datetime import date -from typing import Literal, Mapping, Optional, cast, overload +from typing import TYPE_CHECKING, Literal, Mapping, Optional, cast, overload from htmltools import TagChild, TagList, tags from starlette.requests import Request @@ -32,7 +32,7 @@ from .._typing_extensions import NotRequired, TypedDict from .._utils import drop_none from ..input_handler import input_handlers -from ..session import Session, require_active_session, session_context +from ..session import require_active_session, session_context from ..types import ActionButtonValue from ._input_check_radio import ChoicesArg, _generate_options from ._input_date import _as_date_attr @@ -40,6 +40,10 @@ from ._input_slider import SliderStepArg, SliderValueArg, _as_numeric, _slider_type from ._utils import JSEval, _session_on_flush_send_msg, extract_js_keys +if TYPE_CHECKING: + from .. import Session + + _note = """ The input updater functions send a message to the client, telling it to change the settings of an input object. The messages are collected and sent after all the @@ -52,8 +56,8 @@ Any arguments with ``None`` values will be ignored; they will not result in any changes to the input object on the client. - For :func:`~update_radio_buttons`, :func:`~update_checkbox_group`, and - :func:`~update_select`, the set of choices can be cleared by using ``choices=[]``. + For :func:`~shiny.ui.update_radio_buttons`, :func:`~shiny.ui.update_checkbox_group`, and + :func:`~shiny.ui.update_select`, the set of choices can be cleared by using ``choices=[]``. Similarly, for these inputs, the selected item can be cleared by using `selected=[]`. """ @@ -92,7 +96,7 @@ def update_action_button( See Also ------- - :func:`~shiny.input_action_button` + * :func:`~shiny.input_action_button` """ session = require_active_session(session) @@ -523,7 +527,7 @@ def update_numeric( step Interval to use when stepping between min and max. session - The :class:`~shiny.Session` object passed to the server function of a :func:`~shiny.App`. + The :class:`~shiny.Session` object passed to the server function of a :class:`~shiny.App`. Note ---- diff --git a/shiny/ui/_insert.py b/shiny/ui/_insert.py index 13c4fbdd4..3397d2154 100644 --- a/shiny/ui/_insert.py +++ b/shiny/ui/_insert.py @@ -5,7 +5,8 @@ from htmltools import TagChild from .._docstring import add_example -from ..session import Session, require_active_session +from ..session import require_active_session +from ..session._session import Session @add_example() @@ -25,10 +26,10 @@ def insert_ui( ui The UI object you want to insert. This can be anything that you usually put inside your app's UI function. If you're inserting multiple elements in one - call, make sure to wrap them in either a :func:`~shiny.ui.TagList` or a + call, make sure to wrap them in either a :func:`~htmltools.TagList` or a :func:`~shiny.ui.tags.div` (the latter option has the advantage that you can give it an id to make it easier to reference or remove it later on). If you want - to insert raw HTML, use :func:`~shiny.ui.HTML`. + to insert raw HTML, use :class:`~shiny.ui.HTML`. selector A string that is accepted by jQuery's selector (i.e. the string ``s`` to be placed in a ``$(s)`` jQuery call) which determines the element(s) relative to @@ -54,17 +55,17 @@ def insert_ui( Note ---- This function allows you to dynamically add arbitrary UI into your app, whenever you - want, as many times as you want. Unlike :func:`~shiny.render.ui`, the UI generated + want, as many times as you want. Unlike :class:`~shiny.render.ui`, the UI generated with `insert_ui` is persistent: once it's created, it stays there until removed by - :func:`remove_ui`. Each new call to `insert_ui` creates more UI objects, in addition + :func:`~shiny.ui.remove_ui`. Each new call to `insert_ui` creates more UI objects, in addition to the ones already there (all independent from one another). To update a part of the UI (ex: an input object), you must use the appropriate render function or a customized reactive function. See Also -------- - ~shiny.ui.remove_ui - ~shiny.render.ui + * :func:`~shiny.ui.remove_ui` + * :class:`~shiny.render.ui` """ session = require_active_session(session) @@ -115,9 +116,9 @@ def remove_ui( :func:`~shiny.session.get_current_session`. See Also - ------- - ~shiny.ui.insert_ui - ~shiny.render.ui + -------- + * :func:`~shiny.ui.insert_ui` + * :class:`~shiny.render.ui` """ session = require_active_session(session) diff --git a/shiny/ui/_markdown.py b/shiny/ui/_markdown.py index e8e0cf40b..3693f129d 100644 --- a/shiny/ui/_markdown.py +++ b/shiny/ui/_markdown.py @@ -5,9 +5,8 @@ import warnings from typing import Callable, Literal, Optional -from htmltools import HTML - from .._docstring import add_example +from . import HTML @add_example() @@ -24,7 +23,7 @@ def markdown( render_func A function (with at least 1 argument) which accepts a string of markdown and returns a string of HTML. By default, a customized instance of the - :class:`MarkdownIt` class (which supports Github-flavored markdown) from the + `markdown_id.main.MarkdownIt` class (which supports Github-flavored markdown) from the ``markdown-it`` package is used. **kwargs Additional keyword arguments passed to the ``render_func``. @@ -32,16 +31,7 @@ def markdown( Returns ------- : - An :func:`ui.HTML` string of the rendered markdown. - - Note - ---- - Use :func:`ui.include_markdown` instead if you want to include local images (or - other files) in the markdown. - - See Also - -------- - :func:`ui.include_markdown` + An :class:`~shiny.ui.HTML` string of the rendered markdown. """ if render_func is None: diff --git a/shiny/ui/_modal.py b/shiny/ui/_modal.py index 8f2e934a3..8ea91a78d 100644 --- a/shiny/ui/_modal.py +++ b/shiny/ui/_modal.py @@ -12,14 +12,15 @@ from htmltools import HTML, Tag, TagAttrs, TagAttrValue, TagChild, div, tags from .._docstring import add_example -from ..session import Session, require_active_session +from ..session import require_active_session +from ..session._session import Session from ..types import MISSING, MISSING_TYPE @add_example(ex_dir="../api-examples/modal") def modal_button(label: TagChild, icon: TagChild = None, **kwargs: TagAttrValue) -> Tag: """ - Creates a button that will dismiss a :func:`modal`. :func:`~shiny.ui.modal_button` is usually + Creates a button that will dismiss a :func:`~shiny.ui.modal`. :func:`~shiny.ui.modal_button` is usually passed to the `footer` of a :func:`~shiny.ui.modal` to add a button to the footer that will close the :func:`~shiny.ui.modal`. @@ -38,10 +39,10 @@ def modal_button(label: TagChild, icon: TagChild = None, **kwargs: TagAttrValue) A UI element See Also - ------- - ~shiny.ui.modal - ~shiny.ui.modal_show - ~shiny.ui.modal_remove + -------- + * :func:`~shiny.ui.modal` + * :func:`~shiny.ui.modal_show` + * :func:`~shiny.ui.modal_remove` """ return tags.button( icon, @@ -99,10 +100,10 @@ def modal( A UI element See Also - ------- - ~shiny.ui.modal_show - ~shiny.ui.modal_remove - ~shiny.ui.modal_button + -------- + * :func:`~shiny.ui.modal_show` + * :func:`~shiny.ui.modal_remove` + * :func:`~shiny.ui.modal_button` """ title_div = None @@ -164,15 +165,15 @@ def modal_show(modal: Tag, session: Optional[Session] = None) -> None: Parameters ---------- modal - Typically a :func:`modal` instance. + Typically a :func:`~shiny.ui.modal` instance. session The :class:`~shiny.Session` instance to display the modal in. If not provided, the session is inferred via :func:`~shiny.session.get_current_session`. See Also - ------- - ~shiny.ui.modal_remove - ~shiny.ui.modal + -------- + * :func:`~shiny.ui.modal_remove` + * :func:`~shiny.ui.modal` """ session = require_active_session(session) msg = session._process_ui(modal) @@ -195,9 +196,9 @@ def modal_remove(session: Optional[Session] = None) -> None: provided, the session is inferred via :func:`~shiny.session.get_current_session`. See Also - ------- - ~shiny.ui.modal_show - ~shiny.ui.modal + -------- + * :func:`~shiny.ui.modal_show` + * :func:`~shiny.ui.modal` """ session = require_active_session(session) session._send_message_sync({"modal": {"type": "remove", "message": None}}) diff --git a/shiny/ui/_notification.py b/shiny/ui/_notification.py index 73cdc1efb..4f887948d 100644 --- a/shiny/ui/_notification.py +++ b/shiny/ui/_notification.py @@ -2,13 +2,16 @@ __all__ = ("notification_show", "notification_remove") -from typing import Any, Literal, Optional +from typing import TYPE_CHECKING, Any, Literal, Optional from htmltools import TagChild from .._docstring import add_example, no_example from .._utils import rand_hex -from ..session import Session, require_active_session +from ..session import require_active_session + +if TYPE_CHECKING: + from .. import Session @add_example() @@ -119,7 +122,7 @@ def notification_remove(id: str, *, session: Optional[Session] = None) -> str: Example ------- - See :func:`notification_show`. + See :func:`shiny.ui.notification_show`. """ session = require_active_session(session) session._send_message_sync({"notification": {"type": "remove", "message": id}}) diff --git a/shiny/ui/_output.py b/shiny/ui/_output.py index 683c0cd55..bd4119068 100644 --- a/shiny/ui/_output.py +++ b/shiny/ui/_output.py @@ -47,8 +47,8 @@ def output_plot( """ Create a output container for a static plot. - Place a :func:`~shiny.render.plot` result in the user interface. See - :func:`~shiny.render.plot` for more details on what types of plots are supported. + Place a :class:`~shiny.render.plot` result in the user interface. See + :class:`~shiny.render.plot` for more details on what types of plots are supported. Parameters ---------- @@ -101,7 +101,7 @@ def output_plot( See Also -------- - * :func:`~shiny.render.plot` + * :class:`~shiny.render.plot` * :func:`~shiny.ui.output_image` """ if isinstance(fill, MISSING_TYPE): @@ -187,7 +187,7 @@ def output_image( See Also -------- - * :func:`~shiny.render.image` + * :class:`~shiny.render.image` * :func:`~shiny.ui.output_plot` """ func = tags.span if inline else div @@ -262,7 +262,7 @@ def output_text( See Also -------- - * :func:`~shiny.render.text` + * :class:`~shiny.render.text` * :func:`~shiny.ui.output_text_verbatim` """ @@ -300,7 +300,7 @@ def output_code(id: str, placeholder: bool = True) -> Tag: See Also -------- - * :func:`~shiny.render.text` + * :class:`~shiny.render.text` * :func:`~shiny.ui.output_text` * :func:`~shiny.ui.output_text_verbatim` @@ -318,7 +318,7 @@ def output_text_verbatim(id: str, placeholder: bool = False) -> Tag: """ Create a output container for some text. - Place a :func:`~shiny.render.text` result in the user interface. + Place a :class:`~shiny.render.text` result in the user interface. Differs from :func:`~shiny.ui.output_text` in that it wraps the text in a fixed-width container with a gray-ish background color and border. @@ -338,7 +338,7 @@ def output_text_verbatim(id: str, placeholder: bool = False) -> Tag: See Also -------- - * :func:`~shiny.render.text` + * :class:`~shiny.render.text` * :func:`~shiny.ui.output_text` Example @@ -368,7 +368,7 @@ def output_table(id: str, **kwargs: TagAttrValue) -> Tag: See Also -------- - * :func:`~shiny.render.table` + * :class:`~shiny.render.table` """ return tags.div({"class": "shiny-html-output"}, id=resolve_id(id), **kwargs) @@ -409,7 +409,7 @@ def output_ui( See Also -------- - * :func:`~shiny.render.ui` + * :class:`~shiny.render.ui` * :func:`~shiny.ui.output_text` """ diff --git a/shiny/ui/_page.py b/shiny/ui/_page.py index 8993b2c92..913b938be 100644 --- a/shiny/ui/_page.py +++ b/shiny/ui/_page.py @@ -273,13 +273,13 @@ def page_fillable( *args UI elements. padding - Padding to use for the body. See :func:`~shiny.ui.css_unit.as_css_padding` + Padding to use for the body. See :func:`~shiny.ui.css.as_css_padding` for more details. fillable_mobile Whether or not the page should fill the viewport's height on mobile devices (i.e., narrow windows). gap - A CSS length unit passed through :func:`~shiny.ui.css_unit.as_css_unit` + A CSS length unit passed through :func:`~shiny.ui.css.as_css_unit` defining the `gap` (i.e., spacing) between elements provided to `*args`. title The browser window title (defaults to the host URL of the page). Can also be set diff --git a/shiny/ui/_popover.py b/shiny/ui/_popover.py index 93c476759..1d50bdcc1 100644 --- a/shiny/ui/_popover.py +++ b/shiny/ui/_popover.py @@ -33,13 +33,13 @@ def popover( trigger The UI element to serve as the popover trigger (typically a :func:`~shiny.ui.input_action_button` or similar). If `trigger` renders as - multiple HTML elements (e.g., it's a :func:`~shiny.ui.tags.TagList`), the last + multiple HTML elements (e.g., it's a :class:`~shiny.ui.TagList`), the last HTML element is used for the trigger. If the `trigger` should contain all of those elements, wrap the object in a :func:`~shiny.ui.tags.div` or :func:`~shiny.ui.tags.span`. *args UI elements for the popover's body. Character strings are - automatically escaped unless marked as :func:`~shiny.html`. + automatically escaped unless marked as :class:`~shiny.ui.HTML`. title A title (header) for the popover. id diff --git a/shiny/ui/_progress.py b/shiny/ui/_progress.py index 8bc2a9bdc..5f5ad764c 100644 --- a/shiny/ui/_progress.py +++ b/shiny/ui/_progress.py @@ -3,21 +3,24 @@ __all__ = ("Progress",) from types import TracebackType -from typing import Optional, Type +from typing import TYPE_CHECKING, Optional, Type from warnings import warn from .._docstring import add_example from .._utils import rand_hex -from ..session import Session, require_active_session +from ..session import require_active_session from ..session._session import UpdateProgressMessage +if TYPE_CHECKING: + from .. import Session + @add_example() class Progress: """ Initialize a progress bar. - :func:`~shiny.ui.Progress` creates a computation manager that can be used with `with` to + `Progress` creates a computation manager that can be used with `with` to run a block of code. Shiny will display a progress bar while the code runs, which you can update by calling the `set()` and `message()` methods of the computation manager at strategic points in the code block. diff --git a/shiny/ui/_sidebar.py b/shiny/ui/_sidebar.py index 242fc7695..fb2e0b8fe 100644 --- a/shiny/ui/_sidebar.py +++ b/shiny/ui/_sidebar.py @@ -2,7 +2,7 @@ import random import warnings -from typing import Literal, Optional, cast +from typing import TYPE_CHECKING, Literal, Optional, cast from htmltools import ( HTML, @@ -19,7 +19,7 @@ from .._deprecated import warn_deprecated from .._docstring import add_example, no_example from .._namespaces import resolve_id_or_none -from ..session import Session, require_active_session +from ..session import require_active_session from ._card import CardItem from ._html_deps_shinyverse import components_dependency from ._tag import consolidate_attrs, trinary @@ -27,6 +27,9 @@ from .css import CssUnit, as_css_padding, as_css_unit from .fill import as_fill_item, as_fillable_container +if TYPE_CHECKING: + from .. import Session + __all__ = ( "Sidebar", "sidebar", @@ -311,7 +314,7 @@ def layout_sidebar( Sidebar layout Create a sidebar layout component which can be dropped inside any Shiny UI page - method (e.g. :func:`~shiny.shiny.ui.page_fillable`) or + method (e.g. :func:`~shiny.ui.page_fillable`) or :func:`~shiny.ui.card` context. Parameters @@ -323,10 +326,10 @@ def layout_sidebar( :class:`~htmltools.Tag` object. fillable Whether or not the main content area should be wrapped in a fillable container. - See :func:`~shiny.ui.as_fillable_container` for details. + See :func:`~shiny.ui.fill.as_fillable_container` for details. fill Whether or not the sidebar layout should be wrapped in a fillable container. See - :func:`~shiny.ui.as_fill_item` for details. + :func:`~shiny.ui.fill.as_fill_item` for details. bg,fg A background or foreground color. border diff --git a/shiny/ui/_valuebox.py b/shiny/ui/_valuebox.py index 7f7bd470e..ef35ec55f 100644 --- a/shiny/ui/_valuebox.py +++ b/shiny/ui/_valuebox.py @@ -102,7 +102,7 @@ def showcase_left_center( """ Showcase left center - A :func:`~shiny.ui.showcase_left_center` is a :class:`~shiny.ui.ShowcaseLayout` with + A :func:`~shiny.ui.showcase_left_center` is a `ShowcaseLayout` with the following default properties: * `width` is `"30%"` @@ -136,7 +136,7 @@ def showcase_top_right( """ Showcase top right - A :func:`~shiny.ui.showcase_top_right` is a :class:`~shiny.ui.ShowcaseLayout` with + A :func:`~shiny.ui.showcase_top_right` is a `ShowcaseLayout` with the following default properties: * `width` is `"40%"` @@ -173,7 +173,7 @@ def showcase_bottom( """ Showcase bottom - A :func:`~shiny.ui.showcase_bottom` is a :class:`~shiny.ui.ShowcaseLayout` with + A :func:`~shiny.ui.showcase_bottom` is a `ShowcaseLayout` with the following default properties: * `width` is `"100%"` @@ -262,12 +262,11 @@ def value_box_theme( Returns ------- : - A :class:`~shiny.ui.ValueBoxTheme` + A `ValueBoxTheme` See Also -------- * :func:`~shiny.ui.value_box` - * :class:`~shiny.ui.ValueBoxTheme` """ # bg # If only `bg` is provided, @@ -382,8 +381,6 @@ def value_box( * :func:`~shiny.ui.showcase_bottom` * :func:`~shiny.ui.showcase_left_center` * :func:`~shiny.ui.showcase_top_right` - * :class:`~shiny.ui.ShowcaseLayout` - * :class:`~shiny.ui.ValueBoxTheme` * :func:`~shiny.ui.card` """ diff --git a/shiny/ui/dataframe/_dataframe.py b/shiny/ui/dataframe/_dataframe.py index 73d8a27af..e6c89d826 100644 --- a/shiny/ui/dataframe/_dataframe.py +++ b/shiny/ui/dataframe/_dataframe.py @@ -28,7 +28,7 @@ def output_data_frame(id: str) -> Tag: See Also -------- - :func:`~shiny.render.data_frame` + :class:`~shiny.render.data_frame` """ return as_fillable_container( as_fill_item( diff --git a/shiny/ui/fill/_fill.py b/shiny/ui/fill/_fill.py index 4b148b85a..d1c26ac99 100644 --- a/shiny/ui/fill/_fill.py +++ b/shiny/ui/fill/_fill.py @@ -124,7 +124,7 @@ def is_fillable_container( Filling layouts are built on the foundation of _fillable containers_ and _fill items_ (_fill carriers_ are both _fillable containers_ and _fill items_). This is - why most UI components (e.g., :func:`~shiny.ui.card`, :func:`~shiny.ui.card_body`, + why most UI components (e.g., :func:`~shiny.ui.card` and :func:`~shiny.ui.layout_sidebar`) possess both `fillable` and `fill` arguments (to control their fill behavior). However, sometimes it's useful to add, remove, and/or test fillable/fill properties on arbitrary :class:`~htmltools.Tag`, which these @@ -161,7 +161,7 @@ def is_fill_item(tag: object) -> bool: Filling layouts are built on the foundation of _fillable containers_ and _fill items_ (_fill carriers_ are both _fillable containers_ and _fill items_). This is - why most UI components (e.g., :func:`~shiny.ui.card`, :func:`~shiny.ui.card_body`, + why most UI components (e.g., :func:`~shiny.ui.card` and :func:`~shiny.ui.layout_sidebar`) possess both `fillable` and `fill` arguments (to control their fill behavior). However, sometimes it's useful to add, remove, and/or test fillable/fill properties on arbitrary :class:`~htmltools.Tag`, which these From ba7a0c0a503c696641d695ae02d6f0afe4e5542f Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 24 Jan 2024 17:00:40 -0500 Subject: [PATCH 6/6] Clean up `See Also` sections --- shiny/_app.py | 2 +- shiny/express/ui/_cm_components.py | 4 +- shiny/reactive/_poll.py | 4 +- shiny/render/_dataframe.py | 12 +- shiny/render/_render.py | 2 +- shiny/ui/_bootstrap.py | 20 +- shiny/ui/_input_action_button.py | 12 +- shiny/ui/_input_date.py | 12 +- shiny/ui/_input_file.py | 2 +- shiny/ui/_input_numeric.py | 4 +- shiny/ui/_input_password.py | 4 +- shiny/ui/_input_select.py | 16 +- shiny/ui/_input_slider.py | 6 +- shiny/ui/_input_task_button.py | 6 +- shiny/ui/_input_text.py | 6 +- shiny/ui/_input_update.py | 56 ++--- shiny/ui/_navs.py | 316 ++++++++++++++--------------- shiny/ui/_notification.py | 12 +- shiny/ui/_page.py | 26 +-- shiny/ui/dataframe/_dataframe.py | 2 +- 20 files changed, 264 insertions(+), 260 deletions(-) diff --git a/shiny/_app.py b/shiny/_app.py index 5a1f33237..90956fac6 100644 --- a/shiny/_app.py +++ b/shiny/_app.py @@ -319,7 +319,7 @@ async def stop(self) -> None: See Also -------- - ~shiny.Session.close + * :func:`~shiny.Session.close` """ # convert to list to avoid modifying the dict while iterating over it, which # throws an error diff --git a/shiny/express/ui/_cm_components.py b/shiny/express/ui/_cm_components.py index 5e686628f..579ab49bc 100644 --- a/shiny/express/ui/_cm_components.py +++ b/shiny/express/ui/_cm_components.py @@ -1286,8 +1286,8 @@ def panel_fixed( Arguments passed along to :func:`~shiny.ui.panel_absolute`. See Also - ------- - :func:`~shiny.ui.panel_absolute` + -------- + * :func:`~shiny.ui.panel_absolute` """ return RecallContextManager( ui.panel_fixed, diff --git a/shiny/reactive/_poll.py b/shiny/reactive/_poll.py index 88907d171..644739333 100644 --- a/shiny/reactive/_poll.py +++ b/shiny/reactive/_poll.py @@ -94,7 +94,7 @@ def poll( See Also -------- - ~shiny.reactive.file_reader + * :func:`~shiny.reactive.file_reader` """ with reactive.isolate(): @@ -268,7 +268,7 @@ def file_reader( See Also -------- - ~shiny.reactive.poll + * :func:`~shiny.reactive.poll` """ if isinstance(filepath, str): diff --git a/shiny/render/_dataframe.py b/shiny/render/_dataframe.py index c7e84188d..3a5d0343f 100644 --- a/shiny/render/_dataframe.py +++ b/shiny/render/_dataframe.py @@ -64,9 +64,9 @@ class DataGrid(AbstractTabularData): See Also -------- - :func:`~shiny.ui.output_data_frame` - :class:`~shiny.render.data_frame` - :class:`~shiny.render.DataTable` + * :func:`~shiny.ui.output_data_frame` + * :class:`~shiny.render.data_frame` + * :class:`~shiny.render.DataTable` """ def __init__( @@ -151,9 +151,9 @@ class DataTable(AbstractTabularData): See Also -------- - :func:`~shiny.ui.output_data_frame` - :class:`~shiny.render.data_frame` - :class:`~shiny.render.DataGrid` + * :func:`~shiny.ui.output_data_frame` + * :class:`~shiny.render.data_frame` + * :class:`~shiny.render.DataGrid` """ def __init__( diff --git a/shiny/render/_render.py b/shiny/render/_render.py index 51dd9ec59..067ce0369 100644 --- a/shiny/render/_render.py +++ b/shiny/render/_render.py @@ -623,7 +623,7 @@ class download(Renderer[str]): See Also -------- - * ~shiny.ui.download_button + * :func:`~shiny.ui.download_button` """ def auto_output_ui(self) -> Tag: diff --git a/shiny/ui/_bootstrap.py b/shiny/ui/_bootstrap.py index d29199468..35184f3b7 100644 --- a/shiny/ui/_bootstrap.py +++ b/shiny/ui/_bootstrap.py @@ -61,8 +61,8 @@ def row(*args: TagChild | TagAttrs, **kwargs: TagAttrValue) -> Tag: A UI element. See Also - ------- - :func:`~shiny.ui.column` + -------- + * :func:`~shiny.ui.column` """ return div({"class": "row"}, *args, **kwargs) @@ -93,8 +93,8 @@ def column( A UI element. See Also - ------- - :func:`~shiny.ui.row` + -------- + * :func:`~shiny.ui.row` """ if width < 1 or width > 12: @@ -130,9 +130,9 @@ def panel_well(*args: TagChild | TagAttrs, **kwargs: TagAttrValue) -> Tag: A UI element. See Also - ------- - :func:`~shiny.ui.panel_sidebar` - :func:`~shiny.ui.panel_main` + -------- + * :func:`~shiny.ui.panel_sidebar` + * :func:`~shiny.ui.panel_main` """ return div({"class": "well"}, *args, **kwargs) @@ -187,7 +187,7 @@ def panel_conditional( :class:`~shiny.render.ui`. See Also - ------- + -------- * :class:`~shiny.render.ui` * :func:`~shiny.ui.output_ui` """ @@ -266,8 +266,8 @@ def panel_fixed( A UI element. See Also - ------- - :func:`~shiny.ui.panel_absolute` + -------- + * :func:`~shiny.ui.panel_absolute` """ return panel_absolute( *args, diff --git a/shiny/ui/_input_action_button.py b/shiny/ui/_input_action_button.py index b29ca7d7b..806011a1d 100644 --- a/shiny/ui/_input_action_button.py +++ b/shiny/ui/_input_action_button.py @@ -46,9 +46,9 @@ def input_action_button( ::: See Also - ------- - ~shiny.ui.input_action_link - ~shiny.reactive.event + -------- + * :func:`~shiny.ui.input_action_link` + * :func:`~shiny.reactive.event` """ if "_add_ws" not in kwargs: @@ -100,9 +100,9 @@ def input_action_link( ::: See Also - ------- - ~shiny.ui.input_action_button - ~shiny.reactive.event + -------- + * :func:`~shiny.ui.input_action_button` + * :func:`~shiny.reactive.event` """ return tags.a( diff --git a/shiny/ui/_input_date.py b/shiny/ui/_input_date.py index 6e2f16664..eade4f74c 100644 --- a/shiny/ui/_input_date.py +++ b/shiny/ui/_input_date.py @@ -105,9 +105,9 @@ def input_date( ::: See Also - ------- - ~shiny.ui.update_date - ~shiny.ui.input_date_range + -------- + * :func:`~shiny.ui.update_date` + * :func:`~shiny.ui.input_date_range` """ resolved_id = resolve_id(id) @@ -224,9 +224,9 @@ def input_date_range( ::: See Also - ------- - ~shiny.ui.update_date_range - ~shiny.ui.input_date + -------- + * :func:`~shiny.ui.update_date_range` + * :func:`~shiny.ui.input_date` """ resolved_id = resolve_id(id) diff --git a/shiny/ui/_input_file.py b/shiny/ui/_input_file.py index b1e8caa86..143961c8a 100644 --- a/shiny/ui/_input_file.py +++ b/shiny/ui/_input_file.py @@ -76,7 +76,7 @@ def input_file( See Also -------- - ~shiny.ui.download_button + * :func:`~shiny.ui.download_button` """ if isinstance(accept, str): diff --git a/shiny/ui/_input_numeric.py b/shiny/ui/_input_numeric.py index bf2138f70..be280bd9d 100644 --- a/shiny/ui/_input_numeric.py +++ b/shiny/ui/_input_numeric.py @@ -52,8 +52,8 @@ def input_numeric( ::: See Also - ------- - ~shiny.ui.update_numeric + -------- + * :func:`~shiny.ui.update_numeric` """ resolved_id = resolve_id(id) diff --git a/shiny/ui/_input_password.py b/shiny/ui/_input_password.py index fbdd49eaf..cfb7a6035 100644 --- a/shiny/ui/_input_password.py +++ b/shiny/ui/_input_password.py @@ -46,8 +46,8 @@ def input_password( ::: See Also - ------- - ~shiny.ui.update_text + -------- + * :func:`~shiny.ui.update_text` """ resolved_id = resolve_id(id) return div( diff --git a/shiny/ui/_input_select.py b/shiny/ui/_input_select.py index ce9304ed7..ce11b810d 100644 --- a/shiny/ui/_input_select.py +++ b/shiny/ui/_input_select.py @@ -104,8 +104,10 @@ def input_selectize( ::: See Also - ------- - ~shiny.ui.input_select ~shiny.ui.input_radio_buttons ~shiny.ui.input_checkbox_group + -------- + * :func:`~shiny.ui.input_select` + * :func:`~shiny.ui.input_radio_buttons` + * :func:`~shiny.ui.input_checkbox_group` """ x = input_select( @@ -181,11 +183,11 @@ def input_select( ::: See Also - ------- - ~shiny.ui.input_selectize - ~shiny.ui.update_select - ~shiny.ui.input_radio_buttons - ~shiny.ui.input_checkbox_group + -------- + * :func:`~shiny.ui.input_selectize` + * :func:`~shiny.ui.update_select` + * :func:`~shiny.ui.input_radio_buttons` + * :func:`~shiny.ui.input_checkbox_group` """ if options is not None and selectize is False: raise Exception("Options can only be set when selectize is `True`.") diff --git a/shiny/ui/_input_slider.py b/shiny/ui/_input_slider.py index eeb37b389..ba5181921 100644 --- a/shiny/ui/_input_slider.py +++ b/shiny/ui/_input_slider.py @@ -47,7 +47,7 @@ class AnimationOptions(TypedDict): See Also -------- - ~shiny.ui.input_slider + * :func:`~shiny.ui.input_slider` """ interval: NotRequired[int] @@ -136,8 +136,8 @@ def input_slider( ::: See Also - ------- - ~shiny.ui.update_slider + -------- + * :func:`~shiny.ui.update_slider` """ # Thanks to generic typing, max, value, etc. should be of the same type diff --git a/shiny/ui/_input_task_button.py b/shiny/ui/_input_task_button.py index 5f9f41f48..692935a8e 100644 --- a/shiny/ui/_input_task_button.py +++ b/shiny/ui/_input_task_button.py @@ -113,8 +113,10 @@ def input_task_button( ::: See Also - ------- - ~shiny.ui.update_task_button ~shiny.ui.input_action_button ~shiny.reactive.event + -------- + * :func:`~shiny.ui.update_task_button` + * :func:`~shiny.ui.input_action_button` + * :func:`~shiny.reactive.event` """ if "_add_ws" not in kwargs: diff --git a/shiny/ui/_input_text.py b/shiny/ui/_input_text.py index 78da52bcd..6c1317d88 100644 --- a/shiny/ui/_input_text.py +++ b/shiny/ui/_input_text.py @@ -59,8 +59,8 @@ def input_text( ::: See Also - ------- - :func:`~shiny.ui.input_text_area` + -------- + * :func:`~shiny.ui.input_text_area` """ resolved_id = resolve_id(id) @@ -153,7 +153,7 @@ def input_text_area( See Also -------- - :func:`~shiny.ui.input_text` + * :func:`~shiny.ui.input_text` """ if resize and resize not in ["none", "both", "horizontal", "vertical"]: diff --git a/shiny/ui/_input_update.py b/shiny/ui/_input_update.py index 5d116c501..703db03c0 100644 --- a/shiny/ui/_input_update.py +++ b/shiny/ui/_input_update.py @@ -95,7 +95,7 @@ def update_action_button( {note} See Also - ------- + -------- * :func:`~shiny.input_action_button` """ @@ -204,8 +204,8 @@ def update_checkbox( {note} See Also - ------- - ~shiny.ui.input_checkbox + -------- + * :func:`~shiny.ui.input_checkbox` """ session = require_active_session(session) @@ -242,8 +242,8 @@ def update_switch( {note} See Also - ------- - ~shiny.ui.input_switch + -------- + * :func:`~shiny.ui.input_switch` """ session = require_active_session(session) @@ -288,8 +288,8 @@ def update_checkbox_group( {note} See Also - ------- - ~shiny.ui.input_checkbox_group + -------- + * :func:`~shiny.ui.input_checkbox_group` """ _update_choice_input( @@ -340,8 +340,8 @@ def update_radio_buttons( {note} See Also - ------- - ~shiny.ui.input_radio_buttons + -------- + * :func:`~shiny.ui.input_radio_buttons` """ _update_choice_input( @@ -423,8 +423,8 @@ def update_date( {note} See Also - ------- - ~shiny.ui.input_date + -------- + * :func:`~shiny.ui.input_date` """ session = require_active_session(session) @@ -479,8 +479,8 @@ def update_date_range( {note} See Also - ------- - ~shiny.ui.input_date_range + -------- + * :func:`~shiny.ui.input_date_range` """ session = require_active_session(session) @@ -534,8 +534,8 @@ def update_numeric( {note} See Also - ------- - ~shiny.ui.input_numeric + -------- + * :func:`~shiny.ui.input_numeric` """ session = require_active_session(session) @@ -588,9 +588,9 @@ def update_select( {note} See Also - ------- - ~shiny.ui.input_select - ~shiny.ui.update_selectize + -------- + * :func:`~shiny.ui.input_select` + * :func:`~shiny.ui.update_selectize` """ session = require_active_session(session) @@ -665,8 +665,8 @@ def update_selectize( {note} See Also - ------- - ~shiny.ui.input_selectize + -------- + * :func:`~shiny.ui.input_selectize` """ session = require_active_session(session) @@ -854,8 +854,8 @@ def update_slider( {note} See Also - ------- - ~shiny.ui.input_slider + -------- + * :func:`~shiny.ui.input_slider` """ session = require_active_session(session) @@ -926,8 +926,8 @@ def update_text( {note} See Also - ------- - ~shiny.ui.input_text + -------- + * :func:`~shiny.ui.input_text` """ session = require_active_session(session) @@ -968,10 +968,10 @@ def update_navs( {note} See Also - ------- - ~shiny.ui.navset_tab - ~shiny.ui.navset_pill - ~shiny.ui.page_navbar + -------- + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.page_navbar` """ session = require_active_session(session) diff --git a/shiny/ui/_navs.py b/shiny/ui/_navs.py index 5672d8bb9..a692e4aaa 100644 --- a/shiny/ui/_navs.py +++ b/shiny/ui/_navs.py @@ -124,18 +124,18 @@ def nav_panel( See Also -------- - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` """ if value is None: value = str(title) @@ -169,18 +169,18 @@ def nav_control(*args: TagChild) -> NavPanel: See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -196,18 +196,18 @@ def nav_spacer() -> NavPanel: See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:~shiny.ui.nav_panel + * :func:~shiny.ui.nav_menu + * :func:~shiny.ui.nav_control + * :func:~shiny.ui.navset_bar + * :func:~shiny.ui.navset_tab + * :func:~shiny.ui.navset_pill + * :func:~shiny.ui.navset_underline + * :func:~shiny.ui.navset_card_tab + * :func:~shiny.ui.navset_card_pill + * :func:~shiny.ui.navset_card_underline + * :func:~shiny.ui.navset_pill_list + * :func:~shiny.ui.navset_hidden Example ------- @@ -333,19 +333,19 @@ def nav_menu( A UI element representing both the navigation menu. See Also - ------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + -------- + * :func:~shiny.ui.nav_panel + * :func:~shiny.ui.nav_control + * :func:~shiny.ui.nav_spacer + * :func:~shiny.ui.navset_bar + * :func:~shiny.ui.navset_tab + * :func:~shiny.ui.navset_pill + * :func:~shiny.ui.navset_underline + * :func:~shiny.ui.navset_card_tab + * :func:~shiny.ui.navset_card_pill + * :func:~shiny.ui.navset_card_underline + * :func:~shiny.ui.navset_pill_list + * :func:~shiny.ui.navset_hidden Example ------- @@ -433,18 +433,18 @@ def navset_tab( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -489,18 +489,18 @@ def navset_pill( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -545,18 +545,18 @@ def navset_underline( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -600,18 +600,18 @@ def navset_hidden( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` """ return NavSet( @@ -716,18 +716,18 @@ def navset_card_tab( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -782,18 +782,18 @@ def navset_card_pill( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -848,18 +848,18 @@ def navset_card_underline( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -946,18 +946,18 @@ def navset_pill_list( See Also -------- - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_bar - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_bar` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_hidden` Example ------- @@ -1225,19 +1225,19 @@ def navset_bar( See Also -------- - * ~shiny.ui.page_navbar - * ~shiny.ui.nav_panel - * ~shiny.ui.nav_menu - * ~shiny.ui.nav_control - * ~shiny.ui.nav_spacer - * ~shiny.ui.navset_tab - * ~shiny.ui.navset_pill - * ~shiny.ui.navset_underline - * ~shiny.ui.navset_card_tab - * ~shiny.ui.navset_card_pill - * ~shiny.ui.navset_card_underline - * ~shiny.ui.navset_pill_list - * ~shiny.ui.navset_hidden + * :func:`~shiny.ui.page_navbar` + * :func:`~shiny.ui.nav_panel` + * :func:`~shiny.ui.nav_menu` + * :func:`~shiny.ui.nav_control` + * :func:`~shiny.ui.nav_spacer` + * :func:`~shiny.ui.navset_tab` + * :func:`~shiny.ui.navset_pill` + * :func:`~shiny.ui.navset_underline` + * :func:`~shiny.ui.navset_card_tab` + * :func:`~shiny.ui.navset_card_pill` + * :func:`~shiny.ui.navset_card_underline` + * :func:`~shiny.ui.navset_pill_list` + * :func:`~shiny.ui.navset_hidden` Example ------- diff --git a/shiny/ui/_notification.py b/shiny/ui/_notification.py index 4f887948d..033909397 100644 --- a/shiny/ui/_notification.py +++ b/shiny/ui/_notification.py @@ -64,9 +64,9 @@ def notification_show( The notification's ``id``. See Also - ------- - ~shiny.ui.notification_remove - ~shiny.ui.modal + -------- + * :func:`~shiny.ui.notification_remove` + * :func:`~shiny.ui.modal` """ session = require_active_session(session) @@ -116,9 +116,9 @@ def notification_remove(id: str, *, session: Optional[Session] = None) -> str: The notification's ``id``. See Also - ------- - ~shiny.ui.notification_show - ~shiny.ui.modal + -------- + * :func:`~shiny.ui.notification_show` + * :func:`~shiny.ui.modal` Example ------- diff --git a/shiny/ui/_page.py b/shiny/ui/_page.py index 913b938be..a9e4125d9 100644 --- a/shiny/ui/_page.py +++ b/shiny/ui/_page.py @@ -189,7 +189,7 @@ def page_navbar( A UI element. See Also - ------- + -------- * :func:`~shiny.ui.nav` * :func:`~shiny.ui.nav_menu` * :func:`~shiny.ui.navset_bar` @@ -295,7 +295,7 @@ def page_fillable( A UI element. See Also - ------- + -------- * :func:`~shiny.ui.page_fluid` * :func:`~shiny.ui.page_fixed` """ @@ -354,10 +354,10 @@ def page_fluid( A UI element. See Also - ------- - :func:`~shiny.ui.page_fixed` - :func:`~shiny.ui.page_bootstrap` - :func:`~shiny.ui.page_navbar` + -------- + * :func:`~shiny.ui.page_fixed` + * :func:`~shiny.ui.page_bootstrap` + * :func:`~shiny.ui.page_navbar` """ return page_bootstrap( @@ -395,10 +395,10 @@ def page_fixed( A UI element. See Also - ------- - :func:`~shiny.ui.page_fluid` - :func:`~shiny.ui.page_bootstrap` - :func:`~shiny.ui.page_navbar` + -------- + * :func:`~shiny.ui.page_fluid` + * :func:`~shiny.ui.page_bootstrap` + * :func:`~shiny.ui.page_navbar` """ return page_bootstrap( @@ -437,9 +437,9 @@ def page_bootstrap( A UI element. See Also - ------- - :func:`~shiny.ui.page_fluid` - :func:`~shiny.ui.page_navbar` + -------- + * :func:`~shiny.ui.page_fluid` + * :func:`~shiny.ui.page_navbar` """ head = tags.title(title) if title else None return tags.html( diff --git a/shiny/ui/dataframe/_dataframe.py b/shiny/ui/dataframe/_dataframe.py index e6c89d826..be3e929b5 100644 --- a/shiny/ui/dataframe/_dataframe.py +++ b/shiny/ui/dataframe/_dataframe.py @@ -28,7 +28,7 @@ def output_data_frame(id: str) -> Tag: See Also -------- - :class:`~shiny.render.data_frame` + * :class:`~shiny.render.data_frame` """ return as_fillable_container( as_fill_item(