From baa3dc41f3eaa89f9b6328dcdb3e1b7696df80d8 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Wed, 25 Jun 2025 11:35:58 +0200 Subject: [PATCH 01/10] Add extension --- vizro-core/hatch.toml | 3 ++- vizro-core/mkdocs.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vizro-core/hatch.toml b/vizro-core/hatch.toml index 0a18c75c2..0c889803a 100644 --- a/vizro-core/hatch.toml +++ b/vizro-core/hatch.toml @@ -101,7 +101,8 @@ dependencies = [ "mkdocs-git-revision-date-localized-plugin>=1.2.5", "mkdocstrings[python]", "linkchecker", - "mkdocs-pycafe" + "mkdocs-pycafe", + "griffe-pydantic" ] installer = "uv" template = "docs" # Can't be detached = true since griffe_extensions:DynamicallyInspect needs vizro to be importable. diff --git a/vizro-core/mkdocs.yml b/vizro-core/mkdocs.yml index 2a3c07a24..6f27d1223 100644 --- a/vizro-core/mkdocs.yml +++ b/vizro-core/mkdocs.yml @@ -153,6 +153,8 @@ plugins: - docs/griffe_extensions.py: paths: [vizro.figures.kpi_card, vizro.figures.kpi_card_reference] + - griffe-pydantic: + schema: true paths: [src] - git-revision-date-localized: enable_creation_date: false From 26183d233cb67a1625c6406f6879d189fc438549 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Mon, 30 Jun 2025 12:21:00 +0200 Subject: [PATCH 02/10] Fix dunder in package reference --- vizro-core/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vizro-core/mkdocs.yml b/vizro-core/mkdocs.yml index e728fefab..bb92299ad 100644 --- a/vizro-core/mkdocs.yml +++ b/vizro-core/mkdocs.yml @@ -153,7 +153,7 @@ plugins: - docs/griffe_extensions.py: paths: [vizro.figures.kpi_card, vizro.figures.kpi_card_reference] - - griffe-pydantic: + - griffe_pydantic: schema: true paths: [src] - git-revision-date-localized: From 8f7d2f26e4298afd684f231f1fb23cf9dcfb52f3 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Mon, 30 Jun 2025 13:43:08 +0200 Subject: [PATCH 03/10] TMP probably revert, just to try some things --- .../pages/API-reference/action-callables.md | 4 +- .../pages/API-reference/figure-callables.md | 4 +- .../pages/API-reference/kedro-integration.md | 4 +- vizro-core/docs/pages/API-reference/models.md | 11 +++- vizro-core/mkdocs.yml | 2 +- vizro-core/src/vizro/models/_dashboard.py | 66 ++++++++++++++----- vizro-core/src/vizro/models/_page.py | 15 +---- 7 files changed, 69 insertions(+), 37 deletions(-) diff --git a/vizro-core/docs/pages/API-reference/action-callables.md b/vizro-core/docs/pages/API-reference/action-callables.md index 208fae76a..0a06a2c69 100644 --- a/vizro-core/docs/pages/API-reference/action-callables.md +++ b/vizro-core/docs/pages/API-reference/action-callables.md @@ -3,11 +3,11 @@ API reference for all built-in action functions. -::: vizro.actions + diff --git a/vizro-core/docs/pages/API-reference/kedro-integration.md b/vizro-core/docs/pages/API-reference/kedro-integration.md index 320051ef0..baf64822a 100644 --- a/vizro-core/docs/pages/API-reference/kedro-integration.md +++ b/vizro-core/docs/pages/API-reference/kedro-integration.md @@ -3,8 +3,8 @@ API reference for all Kedro integration functions. The how-to guide on [Kedro Data Catalog integration](../user-guides/kedro-data-catalog.md) contains more information. -::: vizro.integrations.kedro + diff --git a/vizro-core/docs/pages/API-reference/models.md b/vizro-core/docs/pages/API-reference/models.md index 95b415824..a565ed94e 100644 --- a/vizro-core/docs/pages/API-reference/models.md +++ b/vizro-core/docs/pages/API-reference/models.md @@ -3,10 +3,19 @@ API reference for all [`pydantic`](https://docs.pydantic.dev/latest/) models used. +::: vizro.models._dashboard.ExampleModel + +::: vizro.models.Dashboard + options: + filters: ["!^_","!build","!model_post_init"] # Don't show underscore methods, build method, and model_post_init +::: vizro.models.Page + options: + filters: ["!^_","!build","!model_post_init"] # Don't show underscore methods, build method, and model_post_init + ::: vizro.models.types options: filters: ["!^_"] # Don't show dunder methods as well as single underscore ones diff --git a/vizro-core/mkdocs.yml b/vizro-core/mkdocs.yml index bb92299ad..768e5ec4c 100644 --- a/vizro-core/mkdocs.yml +++ b/vizro-core/mkdocs.yml @@ -154,7 +154,7 @@ plugins: paths: [vizro.figures.kpi_card, vizro.figures.kpi_card_reference] - griffe_pydantic: - schema: true + schema: false paths: [src] - git-revision-date-localized: enable_creation_date: false diff --git a/vizro-core/src/vizro/models/_dashboard.py b/vizro-core/src/vizro/models/_dashboard.py index 18c9acba7..e2fa13acc 100644 --- a/vizro-core/src/vizro/models/_dashboard.py +++ b/vizro-core/src/vizro/models/_dashboard.py @@ -4,7 +4,7 @@ import logging from functools import partial from pathlib import Path -from typing import TYPE_CHECKING, Annotated, Literal, Optional, cast +from typing import TYPE_CHECKING, Annotated, Any, Literal, Optional, cast import dash import dash_bootstrap_components as dbc @@ -22,7 +22,16 @@ html, ) from dash.development.base_component import Component -from pydantic import AfterValidator, BeforeValidator, Field, ValidationInfo +from pydantic import ( + AfterValidator, + BaseModel, + BeforeValidator, + ConfigDict, + Field, + ValidationInfo, + field_validator, + model_validator, +) from typing_extensions import TypedDict import vizro @@ -41,6 +50,45 @@ logger = logging.getLogger(__name__) +def random_add(v: str) -> str: + return v + "1" + + +class ExampleModel(BaseModel): + """An example model.""" + + model_config = ConfigDict(frozen=False) + + field_without_default: Annotated[str, AfterValidator(random_add)] + """Shows the *[Required]* marker in the signature.""" + + field_plain_with_validator: int = 100 + """Show standard field with type annotation.""" + + field_with_validator_and_alias: str = Field("FooBar", alias="BarFoo", validation_alias="BarFoo") + """Shows corresponding validator with link/anchor.""" + + field_with_constraints_and_description: int = Field( + default=5, ge=0, le=100, description="Shows constraints within doc string." + ) + + @field_validator("field_with_validator_and_alias", "field_without_default", mode="before") + @classmethod + def check_max_length_ten(cls, v) -> str: + """Show corresponding field with link/anchor.""" + if len(v) >= 10: + raise ValueError("No more than 10 characters allowed") + return v + + @model_validator(mode="before") + @classmethod + def lowercase_only(cls, data: dict[str, Any]) -> dict[str, Any]: + """Ensure that the field without a default is lowercase.""" + if isinstance(data.get("field_without_default"), str): + data["field_without_default"] = data["field_without_default"].lower() + return data + + def _all_hidden(components: list[Component]): """Returns True if all `components` are either None and/or have hidden=True and/or className contains `d-none`.""" return all( @@ -82,19 +130,7 @@ def set_navigation_pages(navigation: Optional[Navigation], info: ValidationInfo) class Dashboard(VizroBaseModel): - """Vizro Dashboard to be used within [`Vizro`][vizro._vizro.Vizro.build]. - - Args: - pages (list[Page]): See [`Page`][vizro.models.Page]. - theme (Literal["vizro_dark", "vizro_light"]): Layout theme to be applied across dashboard. - Defaults to `vizro_dark`. - navigation (Navigation): See [`Navigation`][vizro.models.Navigation]. Defaults to `None`. - title (str): Dashboard title to appear on every page on top left-side. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. This also sets the page's meta - tags. Defaults to `None`. - - """ + """Vizro Dashboard to be used within [`Vizro`][vizro._vizro.Vizro.build].""" pages: list[Page] theme: Literal["vizro_dark", "vizro_light"] = Field( diff --git a/vizro-core/src/vizro/models/_page.py b/vizro-core/src/vizro/models/_page.py index 27ea139ea..780b2fe1c 100644 --- a/vizro-core/src/vizro/models/_page.py +++ b/vizro-core/src/vizro/models/_page.py @@ -52,20 +52,7 @@ def clean_path(path: str, allowed_characters: str) -> str: class Page(VizroBaseModel): - """A page in [`Dashboard`][vizro.models.Dashboard] with its own URL path and place in the `Navigation`. - - Args: - components (list[ComponentType]): See [ComponentType][vizro.models.types.ComponentType]. At least one component - has to be provided. - title (str): Title of the `Page`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. This also sets the page's meta - tags. Defaults to `None`. - layout (Optional[LayoutType]): Layout to place components in. Defaults to `None`. - controls (list[ControlType]): See [ControlType][vizro.models.types.ControlType]. Defaults to `[]`. - path (str): Path to navigate to page. Defaults to `""`. - - """ + """A page in [`Dashboard`][vizro.models.Dashboard] with its own URL path and place in the `Navigation`.""" # TODO[mypy], see: https://github.com/pydantic/pydantic/issues/156 for components field components: conlist(Annotated[ComponentType, BeforeValidator(check_captured_callable_model)], min_length=1) # type: ignore[valid-type] From 2f73f0b46cae5cf04629526b20a868556fc31cd8 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Mon, 30 Jun 2025 14:46:44 +0200 Subject: [PATCH 04/10] Unwrap annotated --- vizro-core/mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/vizro-core/mkdocs.yml b/vizro-core/mkdocs.yml index 768e5ec4c..b79195f3b 100644 --- a/vizro-core/mkdocs.yml +++ b/vizro-core/mkdocs.yml @@ -143,6 +143,7 @@ plugins: merge_init_into_class: true docstring_section_style: list separate_signature: true + unwrap_annotated: true # filters: ["!^_"] show_root_heading: true docstring_options: From eea5b323df929f2d63874eccc5d633b3bb90e71e Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Fri, 25 Jul 2025 18:00:19 +0200 Subject: [PATCH 05/10] Working version without reusable validators --- vizro-core/docs/pages/API-reference/models.md | 11 ++------ vizro-core/mkdocs.yml | 7 ++++++ .../src/vizro/models/_action/_action.py | 13 ++-------- vizro-core/src/vizro/models/_base.py | 8 +----- .../src/vizro/models/_components/ag_grid.py | 19 ++------------ .../src/vizro/models/_components/button.py | 19 +------------- .../src/vizro/models/_components/card.py | 15 +---------- .../src/vizro/models/_components/container.py | 25 +------------------ .../src/vizro/models/_components/figure.py | 10 ++------ .../models/_components/form/checklist.py | 16 +----------- .../models/_components/form/date_picker.py | 16 ------------ .../vizro/models/_components/form/dropdown.py | 19 +------------- .../models/_components/form/radio_items.py | 17 +------------ .../models/_components/form/range_slider.py | 18 ------------- .../vizro/models/_components/form/slider.py | 17 ------------- .../src/vizro/models/_components/graph.py | 25 ++----------------- .../src/vizro/models/_components/table.py | 19 ++------------ .../src/vizro/models/_components/tabs.py | 11 +------- .../src/vizro/models/_components/text.py | 13 +--------- .../src/vizro/models/_controls/filter.py | 8 ------ .../src/vizro/models/_controls/parameter.py | 7 ------ vizro-core/src/vizro/models/_flex.py | 14 +---------- .../src/vizro/models/_navigation/accordion.py | 8 +----- .../src/vizro/models/_navigation/nav_bar.py | 9 +------ .../src/vizro/models/_navigation/nav_link.py | 9 +------ .../vizro/models/_navigation/navigation.py | 9 +------ vizro-core/src/vizro/models/_tooltip.py | 13 +--------- 27 files changed, 34 insertions(+), 341 deletions(-) diff --git a/vizro-core/docs/pages/API-reference/models.md b/vizro-core/docs/pages/API-reference/models.md index a565ed94e..c3521fcc7 100644 --- a/vizro-core/docs/pages/API-reference/models.md +++ b/vizro-core/docs/pages/API-reference/models.md @@ -3,19 +3,12 @@ API reference for all [`pydantic`](https://docs.pydantic.dev/latest/) models used. -::: vizro.models._dashboard.ExampleModel + + -::: vizro.models.Dashboard - options: - filters: ["!^_","!build","!model_post_init"] # Don't show underscore methods, build method, and model_post_init -::: vizro.models.Page - options: - filters: ["!^_","!build","!model_post_init"] # Don't show underscore methods, build method, and model_post_init - ::: vizro.models.types options: filters: ["!^_"] # Don't show dunder methods as well as single underscore ones diff --git a/vizro-core/mkdocs.yml b/vizro-core/mkdocs.yml index b79195f3b..c98d6a923 100644 --- a/vizro-core/mkdocs.yml +++ b/vizro-core/mkdocs.yml @@ -144,6 +144,10 @@ plugins: docstring_section_style: list separate_signature: true unwrap_annotated: true + show_symbol_type_heading: true + show_symbol_type_toc: true + signature_crossrefs: true + show_signature_annotations: true # filters: ["!^_"] show_root_heading: true docstring_options: @@ -157,6 +161,9 @@ plugins: - griffe_pydantic: schema: false paths: [src] + inventories: + - https://docs.python.org/3/objects.inv + - https://docs.pydantic.dev/latest/objects.inv - git-revision-date-localized: enable_creation_date: false diff --git a/vizro-core/src/vizro/models/_action/_action.py b/vizro-core/src/vizro/models/_action/_action.py index 4c67149a5..804191aa4 100644 --- a/vizro-core/src/vizro/models/_action/_action.py +++ b/vizro-core/src/vizro/models/_action/_action.py @@ -333,16 +333,7 @@ def callback_wrapper(external: Union[list[Any], dict[str, Any]], internal: dict[ class Action(_BaseAction): - """Action to be inserted into `actions` of relevant component. - - Args: - function (CapturedCallable): Action function. - inputs (list[str]): List of inputs provided to the action function. Each input can be specified as `` - or `.` or `.`. Defaults to `[]`. - outputs (Union[list[str], dict[str, str]]): List or dictionary of outputs modified by the action function. Each - output can be specified as `` or `.` or `.`. - Defaults to `[]`. - """ + """Action to be inserted into `actions` of relevant component.""" # TODO-AV2 D 5: when it's made public, add something like below to docstring: # This class is only relevant for user-defined actions using @capture("action"). Actions that are defined by @@ -405,7 +396,7 @@ def _legacy(self) -> bool: logger.debug("Action with id %s, function %s, has legacy=%s", self.id, self._action_name, legacy) return legacy - _validate_function = field_validator("function", mode="before")(validate_captured_callable) + # _validate_function = field_validator("function", mode="before")(validate_captured_callable) @property def _parameters(self) -> set[str]: diff --git a/vizro-core/src/vizro/models/_base.py b/vizro-core/src/vizro/models/_base.py index 4d63bb77a..81c027870 100644 --- a/vizro-core/src/vizro/models/_base.py +++ b/vizro-core/src/vizro/models/_base.py @@ -214,13 +214,7 @@ def set_id(id: ModelID) -> ModelID: class VizroBaseModel(BaseModel): - """All models that are registered to the model manager should inherit from this class. - - Args: - id (ModelID): ID to identify model. Must be unique throughout the whole dashboard. Defaults to `""`. - When no ID is chosen, ID will be automatically generated. - - """ + """All models that are registered to the model manager should inherit from this class.""" id: Annotated[ ModelID, diff --git a/vizro-core/src/vizro/models/_components/ag_grid.py b/vizro-core/src/vizro/models/_components/ag_grid.py index 6ea23512c..4636844f7 100644 --- a/vizro-core/src/vizro/models/_components/ag_grid.py +++ b/vizro-core/src/vizro/models/_components/ag_grid.py @@ -33,22 +33,7 @@ class AgGrid(VizroBaseModel): - """Wrapper for `dash-ag-grid.AgGrid` to visualize grids in dashboard. - - Args: - type (Literal["ag_grid"]): Defaults to `"ag_grid"`. - figure (CapturedCallable): Function that returns a Dash AgGrid. See [`vizro.tables`][vizro.tables]. - title (str): Title of the `AgGrid`. Defaults to `""`. - header (str): Markdown text positioned below the `AgGrid.title`. Follows the CommonMark specification. - Ideal for adding supplementary information such as subtitles, descriptions, or additional context. - Defaults to `""`. - footer (str): Markdown text positioned below the `AgGrid`. Follows the CommonMark specification. - Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - - """ + """Wrapper for `dash-ag-grid.AgGrid` to visualize grids in dashboard.""" type: Literal["ag_grid"] = "ag_grid" figure: Annotated[ @@ -89,7 +74,7 @@ class AgGrid(VizroBaseModel): ] _inner_component_id: str = PrivateAttr() - _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) + # _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) def model_post_init(self, context) -> None: super().model_post_init(context) diff --git a/vizro-core/src/vizro/models/_components/button.py b/vizro-core/src/vizro/models/_components/button.py index 7f2655fb4..05ccf8230 100644 --- a/vizro-core/src/vizro/models/_components/button.py +++ b/vizro-core/src/vizro/models/_components/button.py @@ -14,24 +14,7 @@ class Button(VizroBaseModel): - """Component provided to `Page` to trigger any defined `action` in `Page`. - - Args: - type (Literal["button"]): Defaults to `"button"`. - text (str): Text to be displayed on button. Defaults to `"Click me!"`. - href (str): URL (relative or absolute) to navigate to. Defaults to `""`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - variant (Literal["plain", "filled", "outlined"]): Predefined styles to choose from. Options are `plain`, - `filled` or `outlined`. Defaults to `filled`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the button text. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Button` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/button/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - - """ + """Component provided to `Page` to trigger any defined `action` in `Page`.""" type: Literal["button"] = "button" text: str = Field(default="Click me!", description="Text to be displayed on button.") diff --git a/vizro-core/src/vizro/models/_components/card.py b/vizro-core/src/vizro/models/_components/card.py index 529e93c97..ca5036abf 100644 --- a/vizro-core/src/vizro/models/_components/card.py +++ b/vizro-core/src/vizro/models/_components/card.py @@ -11,20 +11,7 @@ class Card(VizroBaseModel): - """Creates a card based on Markdown syntax. - - Args: - type (Literal["card"]): Defaults to `"card"`. - text (str): Markdown string to create card title/text that should adhere to the CommonMark Spec. - href (str): URL (relative or absolute) to navigate to. If not provided the Card serves as a text card - only. Defaults to `""`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Card` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/card/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - - """ + """Creates a card based on Markdown syntax.""" type: Literal["card"] = "card" text: str = Field( diff --git a/vizro-core/src/vizro/models/_components/container.py b/vizro-core/src/vizro/models/_components/container.py index 2b3977928..c51146c7e 100644 --- a/vizro-core/src/vizro/models/_components/container.py +++ b/vizro-core/src/vizro/models/_components/container.py @@ -23,30 +23,7 @@ def set_variant(variant: Optional[Literal["plain", "filled", "outlined"]], info: class Container(VizroBaseModel): - """Container to group together a set of components on a page. - - Args: - type (Literal["container"]): Defaults to `"container"`. - components (list[ComponentType]): See [ComponentType][vizro.models.types.ComponentType]. At least one component - has to be provided. - title (str): Title of the `Container`. Defaults to `""`. - layout (Optional[LayoutType]): Layout to place components in. Defaults to `None`. - collapsed (Optional[bool]): Boolean flag that determines whether the container is collapsed on initial load. - Set to `True` for a collapsed state, `False` for an expanded state. Defaults to `None`, meaning the - container is not collapsible. - variant (Optional[Literal["plain", "filled", "outlined"]]): Predefined styles to choose from. Options are - `plain`, `filled` or `outlined`. Defaults to `plain` (or `outlined` for collapsible container). - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - controls (list[ControlType]): See [ControlType][vizro.models.types.ControlType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Container` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/layout/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - - - """ + """Container to group together a set of components on a page.""" type: Literal["container"] = "container" # TODO[mypy], see: https://github.com/pydantic/pydantic/issues/156 for components field diff --git a/vizro-core/src/vizro/models/_components/figure.py b/vizro-core/src/vizro/models/_components/figure.py index d2c5991d4..29628b93f 100644 --- a/vizro-core/src/vizro/models/_components/figure.py +++ b/vizro-core/src/vizro/models/_components/figure.py @@ -12,13 +12,7 @@ class Figure(VizroBaseModel): - """Creates a figure-like object that can be displayed in the dashboard and is reactive to controls. - - Args: - type (Literal["figure"]): Defaults to `"figure"`. - figure (CapturedCallable): Function that returns a figure-like object. See [`vizro.figures`][vizro.figures]. - - """ + """Creates a figure-like object that can be displayed in the dashboard and is reactive to controls.""" type: Literal["figure"] = "figure" figure: Annotated[ @@ -31,7 +25,7 @@ class Figure(VizroBaseModel): ] # Component properties for actions and interactions - _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) + # _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) @property def _action_outputs(self) -> dict[str, _IdProperty]: diff --git a/vizro-core/src/vizro/models/_components/form/checklist.py b/vizro-core/src/vizro/models/_components/form/checklist.py index 60a8da728..7af95f632 100644 --- a/vizro-core/src/vizro/models/_components/form/checklist.py +++ b/vizro-core/src/vizro/models/_components/form/checklist.py @@ -19,20 +19,6 @@ class Checklist(VizroBaseModel): Can be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter]. - - Args: - type (Literal["checklist"]): Defaults to `"checklist"`. - options (OptionsType): See [`OptionsType`][vizro.models.types.OptionsType]. Defaults to `[]`. - value (Optional[MultiValueType]): See [`MultiValueType`][vizro.models.types.MultiValueType]. Defaults to `None`. - title (str): Title to be displayed. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Checklist` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/input/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. """ type: Literal["checklist"] = "checklist" @@ -76,7 +62,7 @@ class Checklist(VizroBaseModel): _in_container: bool = PrivateAttr(False) # Reused validators - _validate_options = model_validator(mode="before")(validate_options_dict) + # _validate_options = model_validator(mode="before")(validate_options_dict) @property def _action_outputs(self) -> dict[str, _IdProperty]: diff --git a/vizro-core/src/vizro/models/_components/form/date_picker.py b/vizro-core/src/vizro/models/_components/form/date_picker.py index 5d47e80bb..80fa6eeca 100644 --- a/vizro-core/src/vizro/models/_components/form/date_picker.py +++ b/vizro-core/src/vizro/models/_components/form/date_picker.py @@ -20,22 +20,6 @@ class DatePicker(VizroBaseModel): """Temporal single/range option selector `DatePicker`. Can be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter]. - - Args: - type (Literal["date_picker"]): Defaults to `"date_picker"`. - min (Optional[date]): Start date for date picker. Defaults to `None`. - max (Optional[date]): End date for date picker. Defaults to `None`. - value (Optional[Union[list[date], date]]): Default date/dates for date picker. Defaults to `None`. - title (str): Title to be displayed. Defaults to `""`. - range (bool): Boolean flag for displaying range picker. Defaults to `True`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dmc.DatePickerInput` and overwrite - any defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dmc documentation](https://www.dash-mantine-components.com/components/datepicker) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. """ type: Literal["date_picker"] = "date_picker" diff --git a/vizro-core/src/vizro/models/_components/form/dropdown.py b/vizro-core/src/vizro/models/_components/form/dropdown.py index 76458a0e9..0f36e63e4 100755 --- a/vizro-core/src/vizro/models/_components/form/dropdown.py +++ b/vizro-core/src/vizro/models/_components/form/dropdown.py @@ -60,23 +60,6 @@ class Dropdown(VizroBaseModel): Can be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter]. - - Args: - type (Literal["dropdown"]): Defaults to `"dropdown"`. - options (OptionsType): See [`OptionsType`][vizro.models.types.OptionsType]. Defaults to `[]`. - value (Optional[Union[SingleValueType, MultiValueType]]): See - [`SingleValueType`][vizro.models.types.SingleValueType] and - [`MultiValueType`][vizro.models.types.MultiValueType]. Defaults to `None`. - multi (bool): Whether to allow selection of multiple values. Defaults to `True`. - title (str): Title to be displayed. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Dropdown` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/dropdown) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. """ type: Literal["dropdown"] = "dropdown" @@ -129,7 +112,7 @@ class Dropdown(VizroBaseModel): _in_container: bool = PrivateAttr(False) # Reused validators - _validate_options = model_validator(mode="before")(validate_options_dict) + # _validate_options = model_validator(mode="before")(validate_options_dict) @property def _action_outputs(self) -> dict[str, _IdProperty]: diff --git a/vizro-core/src/vizro/models/_components/form/radio_items.py b/vizro-core/src/vizro/models/_components/form/radio_items.py index 79b1e56af..a720622b7 100644 --- a/vizro-core/src/vizro/models/_components/form/radio_items.py +++ b/vizro-core/src/vizro/models/_components/form/radio_items.py @@ -19,21 +19,6 @@ class RadioItems(VizroBaseModel): Can be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter]. - - Args: - type (Literal["radio_items"]): Defaults to `"radio_items"`. - options (OptionsType): See [`OptionsType`][vizro.models.types.OptionsType]. Defaults to `[]`. - value (Optional[SingleValueType]): See [`SingleValueType`][vizro.models.types.SingleValueType]. - Defaults to `None`. - title (str): Title to be displayed. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.RadioItems` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/input/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. """ type: Literal["radio_items"] = "radio_items" @@ -77,7 +62,7 @@ class RadioItems(VizroBaseModel): _in_container: bool = PrivateAttr(False) # Reused validators - _validate_options = model_validator(mode="before")(validate_options_dict) + # _validate_options = model_validator(mode="before")(validate_options_dict) @property def _action_outputs(self) -> dict[str, _IdProperty]: diff --git a/vizro-core/src/vizro/models/_components/form/range_slider.py b/vizro-core/src/vizro/models/_components/form/range_slider.py index 56a255a39..ffaf31119 100644 --- a/vizro-core/src/vizro/models/_components/form/range_slider.py +++ b/vizro-core/src/vizro/models/_components/form/range_slider.py @@ -24,24 +24,6 @@ class RangeSlider(VizroBaseModel): Can be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter]. - - Args: - type (Literal["range_slider"]): Defaults to `"range_slider"`. - min (Optional[float]): Start value for slider. Defaults to `None`. - max (Optional[float]): End value for slider. Defaults to `None`. - step (Optional[float]): Step-size for marks on slider. Defaults to `None`. - marks (Optional[dict[Union[float, int], str]]): Marks to be displayed on slider. Defaults to `{}`. - value (Optional[list[float]]): Default start and end value for slider. Must be 2 items. Defaults to `None`. - title (str): Title to be displayed. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.RangeSlider` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/rangeslider) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - """ type: Literal["range_slider"] = "range_slider" diff --git a/vizro-core/src/vizro/models/_components/form/slider.py b/vizro-core/src/vizro/models/_components/form/slider.py index eaa585ebb..249db953d 100644 --- a/vizro-core/src/vizro/models/_components/form/slider.py +++ b/vizro-core/src/vizro/models/_components/form/slider.py @@ -24,23 +24,6 @@ class Slider(VizroBaseModel): Can be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter]. - - Args: - type (Literal["range_slider"]): Defaults to `"range_slider"`. - min (Optional[float]): Start value for slider. Defaults to `None`. - max (Optional[float]): End value for slider. Defaults to `None`. - step (Optional[float]): Step-size for marks on slider. Defaults to `None`. - marks (Optional[dict[Union[float, int], str]]): Marks to be displayed on slider. Defaults to `{}`. - value (Optional[float]): Default value for slider. Defaults to `None`. - title (str): Title to be displayed. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Slider` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/slider) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. """ type: Literal["slider"] = "slider" diff --git a/vizro-core/src/vizro/models/_components/graph.py b/vizro-core/src/vizro/models/_components/graph.py index 982488d13..28ea6946b 100644 --- a/vizro-core/src/vizro/models/_components/graph.py +++ b/vizro-core/src/vizro/models/_components/graph.py @@ -32,28 +32,7 @@ class Graph(VizroBaseModel): - """Wrapper for `dcc.Graph` to visualize charts in dashboard. - - Args: - type (Literal["graph"]): Defaults to `"graph"`. - figure (CapturedCallable): Function that returns a graph. - See `CapturedCallable`][vizro.models.types.CapturedCallable]. - title (str): Title of the `Graph`. Defaults to `""`. - header (str): Markdown text positioned below the `Graph.title`. Follows the CommonMark specification. - Ideal for adding supplementary information such as subtitles, descriptions, or additional context. - Defaults to `""`. - footer (str): Markdown text positioned below the `Graph`. Follows the CommonMark specification. - Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Graph` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/graph#graph-properties) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - - """ + """Wrapper for `dcc.Graph` to visualize charts in dashboard.""" type: Literal["graph"] = "graph" figure: Annotated[ @@ -106,7 +85,7 @@ class Graph(VizroBaseModel): ] ] - _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) + # _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) @property def _action_outputs(self) -> dict[str, _IdProperty]: diff --git a/vizro-core/src/vizro/models/_components/table.py b/vizro-core/src/vizro/models/_components/table.py index 51e927461..6f16bd04e 100644 --- a/vizro-core/src/vizro/models/_components/table.py +++ b/vizro-core/src/vizro/models/_components/table.py @@ -22,22 +22,7 @@ class Table(VizroBaseModel): - """Wrapper for `dash_table.DataTable` to visualize tables in dashboard. - - Args: - type (Literal["table"]): Defaults to `"table"`. - figure (CapturedCallable): Function that returns a Dash DataTable. See [`vizro.tables`][vizro.tables]. - title (str): Title of the `Table`. Defaults to `""`. - header (str): Markdown text positioned below the `Table.title`. Follows the CommonMark specification. - Ideal for adding supplementary information such as subtitles, descriptions, or additional context. - Defaults to `""`. - footer (str): Markdown text positioned below the `Table`. Follows the CommonMark specification. - Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`. - - """ + """Wrapper for `dash_table.DataTable` to visualize tables in dashboard.""" type: Literal["table"] = "table" figure: Annotated[ @@ -80,7 +65,7 @@ class Table(VizroBaseModel): _inner_component_id: str = PrivateAttr() # Component properties for actions and interactions - _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) + # _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) def model_post_init(self, context) -> None: super().model_post_init(context) diff --git a/vizro-core/src/vizro/models/_components/tabs.py b/vizro-core/src/vizro/models/_components/tabs.py index ce54f00c8..8891e5e7a 100644 --- a/vizro-core/src/vizro/models/_components/tabs.py +++ b/vizro-core/src/vizro/models/_components/tabs.py @@ -22,16 +22,7 @@ def validate_tab_has_title(tab: Container) -> Container: class Tabs(VizroBaseModel): - """Tabs to group together a set of containers on a page. - - Args: - type (Literal["tabs"]): Defaults to `"tabs"`. - tabs (list[Container]): See [`Container`][vizro.models.Container]. - title (str): Title displayed above Tabs. Defaults to `""`. - description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title. - Hovering over the icon shows a tooltip with the provided description. Defaults to `None`. - - """ + """Tabs to group together a set of containers on a page.""" type: Literal["tabs"] = "tabs" # TODO[mypy], see: https://github.com/pydantic/pydantic/issues/156 for tabs field diff --git a/vizro-core/src/vizro/models/_components/text.py b/vizro-core/src/vizro/models/_components/text.py index 9765046a8..d266e0310 100644 --- a/vizro-core/src/vizro/models/_components/text.py +++ b/vizro-core/src/vizro/models/_components/text.py @@ -10,18 +10,7 @@ class Text(VizroBaseModel): - """Creates a text component based on Markdown syntax. - - Args: - type (Literal["text"]): Defaults to `"text"`. - text (str): Markdown string to create text that should adhere to the CommonMark Spec. - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Markdown` and overwrite any - defaults chosen by the Vizro team. This may have unexpected behavior. - Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/markdown/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - - """ + """Creates a text component based on Markdown syntax.""" type: Literal["text"] = "text" text: str = Field( diff --git a/vizro-core/src/vizro/models/_controls/filter.py b/vizro-core/src/vizro/models/_controls/filter.py index 8d94d6639..4940feee3 100644 --- a/vizro-core/src/vizro/models/_controls/filter.py +++ b/vizro-core/src/vizro/models/_controls/filter.py @@ -72,14 +72,6 @@ class Filter(VizroBaseModel): Examples: >>> print(repr(Filter(column="species"))) - - Args: - type (Literal["filter"]): Defaults to `"filter"`. - column (str): Column of `DataFrame` to filter. - targets (list[ModelID]): Target component to be affected by filter. If none are given then target all components - on the page that use `column`. Defaults to `[]`. - selector (Optional[SelectorType]): See [SelectorType][vizro.models.types.SelectorType]. Defaults to `None`. - """ type: Literal["filter"] = "filter" diff --git a/vizro-core/src/vizro/models/_controls/parameter.py b/vizro-core/src/vizro/models/_controls/parameter.py index 9c5ce17c3..8126d400d 100644 --- a/vizro-core/src/vizro/models/_controls/parameter.py +++ b/vizro-core/src/vizro/models/_controls/parameter.py @@ -52,13 +52,6 @@ class Parameter(VizroBaseModel): Examples: >>> Parameter(targets=["scatter.x"], selector=Slider(min=0, max=1, default=0.8, title="Bubble opacity")) - - Args: - type (Literal["parameter"]): Defaults to `"parameter"`. - targets (list[str]): Targets in the form of `.`. - selector (SelectorType): See [SelectorType][vizro.models.types.SelectorType]. Converts selector value - `"NONE"` into `None` to allow optional parameters. - """ type: Literal["parameter"] = "parameter" diff --git a/vizro-core/src/vizro/models/_flex.py b/vizro-core/src/vizro/models/_flex.py index fc9e41313..ae9f5cd70 100644 --- a/vizro-core/src/vizro/models/_flex.py +++ b/vizro-core/src/vizro/models/_flex.py @@ -10,19 +10,7 @@ class Flex(VizroBaseModel): - """Flex Container to place chart/components on the [`Page`][vizro.models.Page]. - - Args: - type (Literal["flex"]): Defaults to `"flex"`. - direction (Literal["row", "column"]): Sets the direction of the flex items inside the container. Options are - `row` or `column`. Defaults to `column`. - gap (str): Specifies the gap between rows and columns. Allowed units: 'px', 'rem', 'em', or '%'. - Defaults to `24px`. - wrap (bool): Determines whether flex items are forced onto a single line or can wrap onto multiple lines. - If `False`, all items will be on one line. If `True`, items will wrap onto multiple lines. - Defaults to `False`. - - """ + """Flex Container to place chart/components on the [`Page`][vizro.models.Page].""" type: Literal["flex"] = "flex" direction: Literal["row", "column"] = Field( diff --git a/vizro-core/src/vizro/models/_navigation/accordion.py b/vizro-core/src/vizro/models/_navigation/accordion.py index 2b3d6794d..ab6a99421 100644 --- a/vizro-core/src/vizro/models/_navigation/accordion.py +++ b/vizro-core/src/vizro/models/_navigation/accordion.py @@ -21,13 +21,7 @@ def coerce_pages_type(pages): class Accordion(VizroBaseModel): - """Accordion to be used as nav_selector in [`Navigation`][vizro.models.Navigation]. - - Args: - type (Literal["accordion"]): Defaults to `"accordion"`. - pages (dict[str, list[ModelID]]): Mapping from name of a pages group to a list of page IDs. Defaults to `{}`. - - """ + """Accordion to be used as nav_selector in [`Navigation`][vizro.models.Navigation].""" type: Literal["accordion"] = "accordion" pages: Annotated[ diff --git a/vizro-core/src/vizro/models/_navigation/nav_bar.py b/vizro-core/src/vizro/models/_navigation/nav_bar.py index 300b88ec8..95be2c94a 100644 --- a/vizro-core/src/vizro/models/_navigation/nav_bar.py +++ b/vizro-core/src/vizro/models/_navigation/nav_bar.py @@ -21,14 +21,7 @@ def coerce_pages_type(pages: Union[list[str], dict[str, list[str]]]) -> dict[str class NavBar(VizroBaseModel): - """Navigation bar to be used as a nav_selector for `Navigation`. - - Args: - type (Literal["nav_bar"]): Defaults to `"nav_bar"`. - pages (dict[str, list[ModelID]]): Mapping from name of a pages group to a list of page IDs. Defaults to `{}`. - items (list[NavLink]): See [`NavLink`][vizro.models.NavLink]. Defaults to `[]`. - - """ + """Navigation bar to be used as a nav_selector for `Navigation`.""" type: Literal["nav_bar"] = "nav_bar" pages: Annotated[ diff --git a/vizro-core/src/vizro/models/_navigation/nav_link.py b/vizro-core/src/vizro/models/_navigation/nav_link.py index 96610a2e1..b56767d36 100644 --- a/vizro-core/src/vizro/models/_navigation/nav_link.py +++ b/vizro-core/src/vizro/models/_navigation/nav_link.py @@ -16,14 +16,7 @@ class NavLink(VizroBaseModel): - """Icon that serves as a navigation link to be used in navigation bar of Dashboard. - - Args: - pages (NavPagesType): See [`NavPagesType`][vizro.models.types.NavPagesType]. Defaults to `[]`. - label (str): Text description of the icon for use in tooltip. - icon (str): Icon name from [Google Material icons library](https://fonts.google.com/icons). Defaults to `""`. - - """ + """Icon that serves as a navigation link to be used in navigation bar of Dashboard.""" pages: Annotated[NavPagesType, AfterValidator(_validate_pages), Field(default=[])] label: str = Field(description="Text description of the icon for use in tooltip.") diff --git a/vizro-core/src/vizro/models/_navigation/navigation.py b/vizro-core/src/vizro/models/_navigation/navigation.py index e2266e3e8..5d39e3b10 100644 --- a/vizro-core/src/vizro/models/_navigation/navigation.py +++ b/vizro-core/src/vizro/models/_navigation/navigation.py @@ -14,14 +14,7 @@ class Navigation(VizroBaseModel): - """Navigation in [`Dashboard`][vizro.models.Dashboard] to structure [`Pages`][vizro.models.Page]. - - Args: - pages (NavPagesType): See [`NavPagesType`][vizro.models.types.NavPagesType]. Defaults to `[]`. - nav_selector (Optional[NavSelectorType]): See [`NavSelectorType`][vizro.models.types.NavSelectorType]. - Defaults to `None`. - - """ + """Navigation in [`Dashboard`][vizro.models.Dashboard] to structure [`Pages`][vizro.models.Page].""" pages: Annotated[NavPagesType, AfterValidator(_validate_pages), Field(default=[])] nav_selector: Optional[NavSelectorType] = None diff --git a/vizro-core/src/vizro/models/_tooltip.py b/vizro-core/src/vizro/models/_tooltip.py index db0842cc9..76fd606ed 100644 --- a/vizro-core/src/vizro/models/_tooltip.py +++ b/vizro-core/src/vizro/models/_tooltip.py @@ -22,18 +22,7 @@ def coerce_str_to_tooltip(text: Any) -> Any: class Tooltip(VizroBaseModel): - """A tooltip that displays text when hovering over an icon. - - Args: - text (str): Markdown string for text shown when hovering over the icon. Should adhere to the CommonMark Spec. - icon (str): Icon name from [Google Material icons library](https://fonts.google.com/icons). - extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Tooltip` and overwrite any - chosen by the Vizro team. This may have unexpected behavior. Visit the - [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/tooltip/) - to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the - underlying component may change in the future. Defaults to `{}`. - - """ + """A tooltip that displays text when hovering over an icon.""" text: str = Field( description="Markdown string for text shown when hovering over the icon. Should adhere to the CommonMark Spec." From 8ee81af3449b4958ddc3d4d7e866cef340e8e958 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Fri, 25 Jul 2025 20:08:31 +0200 Subject: [PATCH 06/10] Potential fix for reused field validator --- vizro-core/hatch.toml | 2 +- vizro-core/src/vizro/models/_components/graph.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vizro-core/hatch.toml b/vizro-core/hatch.toml index c3661de25..002591d0a 100644 --- a/vizro-core/hatch.toml +++ b/vizro-core/hatch.toml @@ -104,7 +104,7 @@ dependencies = [ "mkdocstrings[python]", "linkchecker", "mkdocs-pycafe", - "griffe-pydantic" + "griffe-pydantic", "PyGithub", "playwright" ] diff --git a/vizro-core/src/vizro/models/_components/graph.py b/vizro-core/src/vizro/models/_components/graph.py index 6e4438931..03b7a1cac 100644 --- a/vizro-core/src/vizro/models/_components/graph.py +++ b/vizro-core/src/vizro/models/_components/graph.py @@ -7,7 +7,7 @@ from dash import ClientsideFunction, Input, Output, State, clientside_callback, dcc, html, set_props from dash.exceptions import MissingCallbackContextException from plotly import graph_objects as go -from pydantic import AfterValidator, BeforeValidator, Field, field_validator +from pydantic import AfterValidator, BeforeValidator, Field, ValidationInfo, field_validator from pydantic.functional_serializers import PlainSerializer from pydantic.json_schema import SkipJsonSchema @@ -86,7 +86,10 @@ class Graph(VizroBaseModel): ] ] - # _validate_figure = field_validator("figure", mode="before")(validate_captured_callable) + @field_validator("figure", mode="before") + @classmethod + def _validate_figure(cls, v: Any, info: ValidationInfo): + return validate_captured_callable(cls, v, info) @property def _action_outputs(self) -> dict[str, _IdProperty]: From 946af070b69cc6260c99bdff0d1ab8b207cfd4de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:09:52 +0000 Subject: [PATCH 07/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- vizro-core/mkdocs.yml | 4 ++-- vizro-core/src/vizro/models/_action/_action.py | 3 +-- vizro-core/src/vizro/models/_components/ag_grid.py | 3 +-- vizro-core/src/vizro/models/_components/figure.py | 4 ++-- vizro-core/src/vizro/models/_components/form/checklist.py | 3 +-- vizro-core/src/vizro/models/_components/form/dropdown.py | 3 +-- vizro-core/src/vizro/models/_components/form/radio_items.py | 3 +-- vizro-core/src/vizro/models/_components/table.py | 4 ++-- 8 files changed, 11 insertions(+), 16 deletions(-) diff --git a/vizro-core/mkdocs.yml b/vizro-core/mkdocs.yml index 6bbf43f77..5b58ff41a 100644 --- a/vizro-core/mkdocs.yml +++ b/vizro-core/mkdocs.yml @@ -161,8 +161,8 @@ plugins: schema: false paths: [src] inventories: - - https://docs.python.org/3/objects.inv - - https://docs.pydantic.dev/latest/objects.inv + - https://docs.python.org/3/objects.inv + - https://docs.pydantic.dev/latest/objects.inv - git-revision-date-localized: enable_creation_date: false diff --git a/vizro-core/src/vizro/models/_action/_action.py b/vizro-core/src/vizro/models/_action/_action.py index 804191aa4..6d3a96800 100644 --- a/vizro-core/src/vizro/models/_action/_action.py +++ b/vizro-core/src/vizro/models/_action/_action.py @@ -9,7 +9,7 @@ from dash import Input, Output, State, callback, html from dash.development.base_component import Component -from pydantic import Field, TypeAdapter, field_validator +from pydantic import Field, TypeAdapter from pydantic.json_schema import SkipJsonSchema from typing_extensions import TypedDict @@ -21,7 +21,6 @@ ControlType, _IdOrIdProperty, _IdProperty, - validate_captured_callable, ) logger = logging.getLogger(__name__) diff --git a/vizro-core/src/vizro/models/_components/ag_grid.py b/vizro-core/src/vizro/models/_components/ag_grid.py index 565e96449..ccd647c38 100644 --- a/vizro-core/src/vizro/models/_components/ag_grid.py +++ b/vizro-core/src/vizro/models/_components/ag_grid.py @@ -4,7 +4,7 @@ import dash_ag_grid as dag import pandas as pd from dash import ClientsideFunction, Input, Output, State, clientside_callback, dcc, html -from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr, field_validator +from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr from pydantic.functional_serializers import PlainSerializer from pydantic.json_schema import SkipJsonSchema @@ -21,7 +21,6 @@ ActionType, CapturedCallable, _IdProperty, - validate_captured_callable, ) logger = logging.getLogger(__name__) diff --git a/vizro-core/src/vizro/models/_components/figure.py b/vizro-core/src/vizro/models/_components/figure.py index 29628b93f..573659007 100644 --- a/vizro-core/src/vizro/models/_components/figure.py +++ b/vizro-core/src/vizro/models/_components/figure.py @@ -1,14 +1,14 @@ from typing import Annotated, Literal from dash import dcc, html -from pydantic import AfterValidator, Field, field_validator +from pydantic import AfterValidator, Field from pydantic.json_schema import SkipJsonSchema from vizro.managers import data_manager from vizro.models import VizroBaseModel from vizro.models._components._components_utils import _process_callable_data_frame from vizro.models._models_utils import _log_call -from vizro.models.types import CapturedCallable, _IdProperty, validate_captured_callable +from vizro.models.types import CapturedCallable, _IdProperty class Figure(VizroBaseModel): diff --git a/vizro-core/src/vizro/models/_components/form/checklist.py b/vizro-core/src/vizro/models/_components/form/checklist.py index d266aadfe..17245a65f 100644 --- a/vizro-core/src/vizro/models/_components/form/checklist.py +++ b/vizro-core/src/vizro/models/_components/form/checklist.py @@ -2,7 +2,7 @@ import dash_bootstrap_components as dbc from dash import ClientsideFunction, Input, Output, State, clientside_callback, html -from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr, model_validator +from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr from pydantic.functional_serializers import PlainSerializer from pydantic.json_schema import SkipJsonSchema @@ -10,7 +10,6 @@ from vizro.models._action._actions_chain import _action_validator_factory from vizro.models._components.form._form_utils import ( get_dict_options_and_default, - validate_options_dict, validate_value, ) from vizro.models._models_utils import _log_call, warn_description_without_title diff --git a/vizro-core/src/vizro/models/_components/form/dropdown.py b/vizro-core/src/vizro/models/_components/form/dropdown.py index f41d55cf3..a90ed68e7 100755 --- a/vizro-core/src/vizro/models/_components/form/dropdown.py +++ b/vizro-core/src/vizro/models/_components/form/dropdown.py @@ -4,7 +4,7 @@ import dash_bootstrap_components as dbc from dash import ClientsideFunction, Input, Output, State, clientside_callback, dcc, html -from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr, StrictBool, ValidationInfo, model_validator +from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr, StrictBool, ValidationInfo from pydantic.functional_serializers import PlainSerializer from pydantic.json_schema import SkipJsonSchema @@ -12,7 +12,6 @@ from vizro.models._action._actions_chain import _action_validator_factory from vizro.models._components.form._form_utils import ( get_dict_options_and_default, - validate_options_dict, validate_value, ) from vizro.models._models_utils import _log_call diff --git a/vizro-core/src/vizro/models/_components/form/radio_items.py b/vizro-core/src/vizro/models/_components/form/radio_items.py index d8360e209..4042b7d11 100644 --- a/vizro-core/src/vizro/models/_components/form/radio_items.py +++ b/vizro-core/src/vizro/models/_components/form/radio_items.py @@ -2,7 +2,7 @@ import dash_bootstrap_components as dbc from dash import html -from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr, model_validator +from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr from pydantic.functional_serializers import PlainSerializer from pydantic.json_schema import SkipJsonSchema @@ -10,7 +10,6 @@ from vizro.models._action._actions_chain import _action_validator_factory from vizro.models._components.form._form_utils import ( get_dict_options_and_default, - validate_options_dict, validate_value, ) from vizro.models._models_utils import _log_call diff --git a/vizro-core/src/vizro/models/_components/table.py b/vizro-core/src/vizro/models/_components/table.py index 8f104bfb1..7655dd72e 100644 --- a/vizro-core/src/vizro/models/_components/table.py +++ b/vizro-core/src/vizro/models/_components/table.py @@ -3,7 +3,7 @@ import pandas as pd from dash import State, dcc, html -from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr, field_validator +from pydantic import AfterValidator, BeforeValidator, Field, PrivateAttr from pydantic.functional_serializers import PlainSerializer from pydantic.json_schema import SkipJsonSchema @@ -16,7 +16,7 @@ from vizro.models._components._components_utils import _process_callable_data_frame from vizro.models._models_utils import _log_call, warn_description_without_title from vizro.models._tooltip import coerce_str_to_tooltip -from vizro.models.types import ActionType, CapturedCallable, _IdProperty, validate_captured_callable +from vizro.models.types import ActionType, CapturedCallable, _IdProperty logger = logging.getLogger(__name__) From f78ac55bb59d0c2ce19d7fe16591696844ca4e3b Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Fri, 25 Jul 2025 22:18:15 +0200 Subject: [PATCH 08/10] Simplfy example --- vizro-core/docs/pages/API-reference/models.md | 2 +- vizro-core/src/vizro/models/_dashboard.py | 76 +------------------ 2 files changed, 4 insertions(+), 74 deletions(-) diff --git a/vizro-core/docs/pages/API-reference/models.md b/vizro-core/docs/pages/API-reference/models.md index c3521fcc7..4719d4e05 100644 --- a/vizro-core/docs/pages/API-reference/models.md +++ b/vizro-core/docs/pages/API-reference/models.md @@ -3,7 +3,7 @@ API reference for all [`pydantic`](https://docs.pydantic.dev/latest/) models used. - +::: vizro.models._dashboard.ExampleModel ::: vizro.models diff --git a/vizro-core/src/vizro/models/_dashboard.py b/vizro-core/src/vizro/models/_dashboard.py index 3cc743203..cb01c1b68 100644 --- a/vizro-core/src/vizro/models/_dashboard.py +++ b/vizro-core/src/vizro/models/_dashboard.py @@ -50,82 +50,12 @@ logger = logging.getLogger(__name__) -def random_add(v: str) -> str: - return v + "1" - - class ExampleModel(BaseModel): """An example model.""" - model_config = ConfigDict(frozen=False) - - field_without_default: Annotated[str, AfterValidator(random_add)] - """Shows the *[Required]* marker in the signature.""" - - field_plain_with_validator: int = 100 - """Show standard field with type annotation.""" - - field_with_validator_and_alias: str = Field("FooBar", alias="BarFoo", validation_alias="BarFoo") - """Shows corresponding validator with link/anchor.""" - - field_with_constraints_and_description: int = Field( - default=5, ge=0, le=100, description="Shows constraints within doc string." - ) - - @field_validator("field_with_validator_and_alias", "field_without_default", mode="before") - @classmethod - def check_max_length_ten(cls, v) -> str: - """Show corresponding field with link/anchor.""" - if len(v) >= 10: - raise ValueError("No more than 10 characters allowed") - return v - - @model_validator(mode="before") - @classmethod - def lowercase_only(cls, data: dict[str, Any]) -> dict[str, Any]: - """Ensure that the field without a default is lowercase.""" - if isinstance(data.get("field_without_default"), str): - data["field_without_default"] = data["field_without_default"].lower() - return data - - -def random_add(v: str) -> str: - return v + "1" - - -class ExampleModel(BaseModel): - """An example model.""" - - model_config = ConfigDict(frozen=False) - - field_without_default: Annotated[str, AfterValidator(random_add)] - """Shows the *[Required]* marker in the signature.""" - - field_plain_with_validator: int = 100 - """Show standard field with type annotation.""" - - field_with_validator_and_alias: str = Field("FooBar", alias="BarFoo", validation_alias="BarFoo") - """Shows corresponding validator with link/anchor.""" - - field_with_constraints_and_description: int = Field( - default=5, ge=0, le=100, description="Shows constraints within doc string." - ) - - @field_validator("field_with_validator_and_alias", "field_without_default", mode="before") - @classmethod - def check_max_length_ten(cls, v) -> str: - """Show corresponding field with link/anchor.""" - if len(v) >= 10: - raise ValueError("No more than 10 characters allowed") - return v - - @model_validator(mode="before") - @classmethod - def lowercase_only(cls, data: dict[str, Any]) -> dict[str, Any]: - """Ensure that the field without a default is lowercase.""" - if isinstance(data.get("field_without_default"), str): - data["field_without_default"] = data["field_without_default"].lower() - return data + field_with_constraints_and_description: Annotated[ + int, Field(default=5, ge=0, le=100, description="Shows constraints within doc string.") + ] def _all_hidden(components: Union[Component, list[Component]]): From 7673a241dc311caac0b127f131249a6d3ae0fea9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 20:18:47 +0000 Subject: [PATCH 09/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- vizro-core/src/vizro/models/_dashboard.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vizro-core/src/vizro/models/_dashboard.py b/vizro-core/src/vizro/models/_dashboard.py index cb01c1b68..7776ac12b 100644 --- a/vizro-core/src/vizro/models/_dashboard.py +++ b/vizro-core/src/vizro/models/_dashboard.py @@ -4,7 +4,7 @@ import logging from functools import partial from pathlib import Path -from typing import TYPE_CHECKING, Annotated, Any, Literal, Optional, Union, cast +from typing import TYPE_CHECKING, Annotated, Literal, Optional, Union, cast import dash import dash_bootstrap_components as dbc @@ -26,11 +26,8 @@ AfterValidator, BaseModel, BeforeValidator, - ConfigDict, Field, ValidationInfo, - field_validator, - model_validator, ) from typing_extensions import TypedDict From 46c49daff87da31af38a2ffa8dc774399aab4df9 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Fri, 25 Jul 2025 22:23:31 +0200 Subject: [PATCH 10/10] Update schema --- vizro-core/schemas/0.1.44.dev0.json | 52 ++++++++++++++--------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/vizro-core/schemas/0.1.44.dev0.json b/vizro-core/schemas/0.1.44.dev0.json index 8e3a85ce9..eabcd6398 100644 --- a/vizro-core/schemas/0.1.44.dev0.json +++ b/vizro-core/schemas/0.1.44.dev0.json @@ -2,7 +2,7 @@ "$defs": { "Accordion": { "additionalProperties": false, - "description": "Accordion to be used as nav_selector in [`Navigation`][vizro.models.Navigation].\n\nArgs:\n type (Literal[\"accordion\"]): Defaults to `\"accordion\"`.\n pages (dict[str, list[ModelID]]): Mapping from name of a pages group to a list of page IDs. Defaults to `{}`.", + "description": "Accordion to be used as nav_selector in [`Navigation`][vizro.models.Navigation].", "properties": { "id": { "default": "", @@ -34,7 +34,7 @@ }, "Action": { "additionalProperties": false, - "description": "Action to be inserted into `actions` of relevant component.\n\nArgs:\n function (CapturedCallable): Action function.\n inputs (list[str]): List of inputs provided to the action function. Each input can be specified as ``\n or `.` or `.`. Defaults to `[]`.\n outputs (Union[list[str], dict[str, str]]): List or dictionary of outputs modified by the action function. Each\n output can be specified as `` or `.` or `.`.\n Defaults to `[]`.", + "description": "Action to be inserted into `actions` of relevant component.", "properties": { "id": { "default": "", @@ -118,7 +118,7 @@ }, "AgGrid": { "additionalProperties": false, - "description": "Wrapper for `dash-ag-grid.AgGrid` to visualize grids in dashboard.\n\nArgs:\n type (Literal[\"ag_grid\"]): Defaults to `\"ag_grid\"`.\n figure (CapturedCallable): Function that returns a Dash AgGrid. See [`vizro.tables`][vizro.tables].\n title (str): Title of the `AgGrid`. Defaults to `\"\"`.\n header (str): Markdown text positioned below the `AgGrid.title`. Follows the CommonMark specification.\n Ideal for adding supplementary information such as subtitles, descriptions, or additional context.\n Defaults to `\"\"`.\n footer (str): Markdown text positioned below the `AgGrid`. Follows the CommonMark specification.\n Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.", + "description": "Wrapper for `dash-ag-grid.AgGrid` to visualize grids in dashboard.", "properties": { "id": { "default": "", @@ -187,7 +187,7 @@ }, "Button": { "additionalProperties": false, - "description": "Component provided to `Page` to trigger any defined `action` in `Page`.\n\nArgs:\n type (Literal[\"button\"]): Defaults to `\"button\"`.\n text (str): Text to be displayed on button. Needs to have at least 1 character. Defaults to `\"Click me!\"`.\n href (str): URL (relative or absolute) to navigate to. Defaults to `\"\"`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n variant (Literal[\"plain\", \"filled\", \"outlined\"]): Predefined styles to choose from. Options are `plain`,\n `filled` or `outlined`. Defaults to `filled`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the button text.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Button` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/button/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Component provided to `Page` to trigger any defined `action` in `Page`.", "properties": { "id": { "default": "", @@ -258,7 +258,7 @@ }, "Card": { "additionalProperties": false, - "description": "Creates a card based on Markdown syntax.\n\nArgs:\n type (Literal[\"card\"]): Defaults to `\"card\"`.\n text (str): Markdown string to create card title/text that should adhere to the CommonMark Spec.\n href (str): URL (relative or absolute) to navigate to. If not provided the Card serves as a text card\n only. Defaults to `\"\"`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Card` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/card/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Creates a card based on Markdown syntax.", "properties": { "id": { "default": "", @@ -290,7 +290,7 @@ }, "Checklist": { "additionalProperties": false, - "description": "Categorical multi-option selector `Checklist`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].\n\nArgs:\n type (Literal[\"checklist\"]): Defaults to `\"checklist\"`.\n options (OptionsType): See [`OptionsType`][vizro.models.types.OptionsType]. Defaults to `[]`.\n value (Optional[MultiValueType]): See [`MultiValueType`][vizro.models.types.MultiValueType]. Defaults to `None`.\n title (str): Title to be displayed. Defaults to `\"\"`.\n show_select_all (Optional[bool]): Whether to display the 'Select All' option that allows users to select or\n deselect all available options with a single click. Defaults to `True`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Checklist` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/input/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Categorical multi-option selector `Checklist`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].", "properties": { "id": { "default": "", @@ -424,7 +424,7 @@ }, "Container": { "additionalProperties": false, - "description": "Container to group together a set of components on a page.\n\nArgs:\n type (Literal[\"container\"]): Defaults to `\"container\"`.\n components (list[ComponentType]): See [ComponentType][vizro.models.types.ComponentType]. At least one component\n has to be provided.\n title (str): Title of the `Container`. Defaults to `\"\"`.\n layout (Optional[LayoutType]): Layout to place components in. Defaults to `None`.\n collapsed (Optional[bool]): Boolean flag that determines whether the container is collapsed on initial load.\n Set to `True` for a collapsed state, `False` for an expanded state. Defaults to `None`, meaning the\n container is not collapsible.\n variant (Optional[Literal[\"plain\", \"filled\", \"outlined\"]]): Predefined styles to choose from. Options are\n `plain`, `filled` or `outlined`. Defaults to `plain` (or `outlined` for collapsible container).\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n controls (list[ControlType]): See [ControlType][vizro.models.types.ControlType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Container` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/layout/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Container to group together a set of components on a page.", "properties": { "id": { "default": "", @@ -587,7 +587,7 @@ }, "DatePicker": { "additionalProperties": false, - "description": "Temporal single/range option selector `DatePicker`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter].\n\nArgs:\n type (Literal[\"date_picker\"]): Defaults to `\"date_picker\"`.\n min (Optional[date]): Start date for date picker. Defaults to `None`.\n max (Optional[date]): End date for date picker. Defaults to `None`.\n value (Optional[Union[list[date], date]]): Default date/dates for date picker. Defaults to `None`.\n title (str): Title to be displayed. Defaults to `\"\"`.\n range (bool): Boolean flag for displaying range picker. Defaults to `True`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dmc.DatePickerInput` and overwrite\n any defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dmc documentation](https://www.dash-mantine-components.com/components/datepicker)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Temporal single/range option selector `DatePicker`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or [`Parameter`][vizro.models.Parameter].", "properties": { "id": { "default": "", @@ -699,7 +699,7 @@ }, "Dropdown": { "additionalProperties": false, - "description": "Categorical single/multi-option selector `Dropdown`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].\n\nArgs:\n type (Literal[\"dropdown\"]): Defaults to `\"dropdown\"`.\n options (OptionsType): See [`OptionsType`][vizro.models.types.OptionsType]. Defaults to `[]`.\n value (Optional[Union[SingleValueType, MultiValueType]]): See\n [`SingleValueType`][vizro.models.types.SingleValueType] and\n [`MultiValueType`][vizro.models.types.MultiValueType]. Defaults to `None`.\n multi (bool): Whether to allow selection of multiple values. Defaults to `True`.\n title (str): Title to be displayed. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Dropdown` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/dropdown)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Categorical single/multi-option selector `Dropdown`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].", "properties": { "id": { "default": "", @@ -846,7 +846,7 @@ }, "Figure": { "additionalProperties": false, - "description": "Creates a figure-like object that can be displayed in the dashboard and is reactive to controls.\n\nArgs:\n type (Literal[\"figure\"]): Defaults to `\"figure\"`.\n figure (CapturedCallable): Function that returns a figure-like object. See [`vizro.figures`][vizro.figures].", + "description": "Creates a figure-like object that can be displayed in the dashboard and is reactive to controls.", "properties": { "id": { "default": "", @@ -866,7 +866,7 @@ }, "Filter": { "additionalProperties": false, - "description": "Filter the data supplied to `targets` on the [`Page`][vizro.models.Page].\n\nExamples:\n >>> print(repr(Filter(column=\"species\")))\n\nArgs:\n type (Literal[\"filter\"]): Defaults to `\"filter\"`.\n column (str): Column of `DataFrame` to filter.\n targets (list[ModelID]): Target component to be affected by filter. If none are given then target all components\n on the page that use `column`. Defaults to `[]`.\n selector (Optional[SelectorType]): See [SelectorType][vizro.models.types.SelectorType]. Defaults to `None`.\n show_in_url (bool): Whether the filter should be included in the URL query string. Defaults to `False`.\n Useful for bookmarking or sharing dashboards with specific filter values pre-set.", + "description": "Filter the data supplied to `targets` on the [`Page`][vizro.models.Page].\n\nExamples:\n >>> print(repr(Filter(column=\"species\")))", "properties": { "id": { "default": "", @@ -950,7 +950,7 @@ }, "Flex": { "additionalProperties": false, - "description": "Flex Container to place chart/components on the [`Page`][vizro.models.Page].\n\nArgs:\n type (Literal[\"flex\"]): Defaults to `\"flex\"`.\n direction (Literal[\"row\", \"column\"]): Sets the direction of the flex items inside the container. Options are\n `row` or `column`. Defaults to `column`.\n gap (str): Specifies the gap between rows and columns. Allowed units: 'px', 'rem', 'em', or '%'.\n Defaults to `24px`.\n wrap (bool): Determines whether flex items are forced onto a single line or can wrap onto multiple lines.\n If `False`, all items will be on one line. If `True`, items will wrap onto multiple lines.\n Defaults to `False`.", + "description": "Flex Container to place chart/components on the [`Page`][vizro.models.Page].", "properties": { "id": { "default": "", @@ -990,7 +990,7 @@ }, "Graph": { "additionalProperties": false, - "description": "Wrapper for `dcc.Graph` to visualize charts in dashboard.\n\nArgs:\n type (Literal[\"graph\"]): Defaults to `\"graph\"`.\n figure (CapturedCallable): Function that returns a graph. Either use\n [`vizro.plotly.express`](../user-guides/graph.md) or see\n [`CapturedCallable`][vizro.models.types.CapturedCallable].\n title (str): Title of the `Graph`. Defaults to `\"\"`.\n header (str): Markdown text positioned below the `Graph.title`. Follows the CommonMark specification.\n Ideal for adding supplementary information such as subtitles, descriptions, or additional context.\n Defaults to `\"\"`.\n footer (str): Markdown text positioned below the `Graph`. Follows the CommonMark specification.\n Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Graph` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/graph#graph-properties)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Wrapper for `dcc.Graph` to visualize charts in dashboard.", "properties": { "id": { "default": "", @@ -1180,7 +1180,7 @@ }, "NavBar": { "additionalProperties": false, - "description": "Navigation bar to be used as a nav_selector for `Navigation`.\n\nArgs:\n type (Literal[\"nav_bar\"]): Defaults to `\"nav_bar\"`.\n pages (dict[str, list[ModelID]]): Mapping from name of a pages group to a list of page IDs. Defaults to `{}`.\n items (list[NavLink]): See [`NavLink`][vizro.models.NavLink]. Defaults to `[]`.", + "description": "Navigation bar to be used as a nav_selector for `Navigation`.", "properties": { "id": { "default": "", @@ -1220,7 +1220,7 @@ }, "NavLink": { "additionalProperties": false, - "description": "Icon that serves as a navigation link to be used in navigation bar of Dashboard.\n\nArgs:\n pages (NavPagesType): See [`NavPagesType`][vizro.models.types.NavPagesType]. Defaults to `[]`.\n label (str): Text description of the icon for use in tooltip.\n icon (str): Icon name from [Google Material icons library](https://fonts.google.com/icons). Defaults to `\"\"`.", + "description": "Icon that serves as a navigation link to be used in navigation bar of Dashboard.", "properties": { "id": { "default": "", @@ -1267,7 +1267,7 @@ }, "Navigation": { "additionalProperties": false, - "description": "Navigation in [`Dashboard`][vizro.models.Dashboard] to structure [`Pages`][vizro.models.Page].\n\nArgs:\n pages (NavPagesType): See [`NavPagesType`][vizro.models.types.NavPagesType]. Defaults to `[]`.\n nav_selector (Optional[NavSelectorType]): See [`NavSelectorType`][vizro.models.types.NavSelectorType].\n Defaults to `None`.", + "description": "Navigation in [`Dashboard`][vizro.models.Dashboard] to structure [`Pages`][vizro.models.Page].", "properties": { "id": { "default": "", @@ -1359,7 +1359,7 @@ }, "Page": { "additionalProperties": false, - "description": "A page in [`Dashboard`][vizro.models.Dashboard] with its own URL path and place in the `Navigation`.\n\nArgs:\n components (list[ComponentType]): See [ComponentType][vizro.models.types.ComponentType]. At least one component\n has to be provided.\n title (str): Title of the `Page`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. This also sets the page's meta\n tags. Defaults to `None`.\n layout (Optional[LayoutType]): Layout to place components in. Defaults to `None`.\n controls (list[ControlType]): See [ControlType][vizro.models.types.ControlType]. Defaults to `[]`.\n path (str): Path to navigate to page. Defaults to `\"\"`.", + "description": "A page in [`Dashboard`][vizro.models.Dashboard] with its own URL path and place in the `Navigation`.", "properties": { "id": { "default": "", @@ -1502,7 +1502,7 @@ }, "Parameter": { "additionalProperties": false, - "description": "Alter the arguments supplied to any `targets` on the [`Page`][vizro.models.Page].\n\nExamples:\n >>> Parameter(targets=[\"scatter.x\"], selector=Slider(min=0, max=1, default=0.8, title=\"Bubble opacity\"))\n\nArgs:\n type (Literal[\"parameter\"]): Defaults to `\"parameter\"`.\n targets (list[str]): Targets in the form of `.`.\n selector (SelectorType): See [SelectorType][vizro.models.types.SelectorType]. Converts selector value\n `\"NONE\"` into `None` to allow optional parameters.\n show_in_url (bool): Whether the parameter should be included in the URL query string. Defaults to `False`.\n Useful for bookmarking or sharing dashboards with specific parameter values pre-set.", + "description": "Alter the arguments supplied to any `targets` on the [`Page`][vizro.models.Page].\n\nExamples:\n >>> Parameter(targets=[\"scatter.x\"], selector=Slider(min=0, max=1, default=0.8, title=\"Bubble opacity\"))", "properties": { "id": { "default": "", @@ -1572,7 +1572,7 @@ }, "RadioItems": { "additionalProperties": false, - "description": "Categorical single-option selector `RadioItems`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].\n\nArgs:\n type (Literal[\"radio_items\"]): Defaults to `\"radio_items\"`.\n options (OptionsType): See [`OptionsType`][vizro.models.types.OptionsType]. Defaults to `[]`.\n value (Optional[SingleValueType]): See [`SingleValueType`][vizro.models.types.SingleValueType].\n Defaults to `None`.\n title (str): Title to be displayed. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.RadioItems` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/input/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Categorical single-option selector `RadioItems`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].", "properties": { "id": { "default": "", @@ -1688,7 +1688,7 @@ }, "RangeSlider": { "additionalProperties": false, - "description": "Numeric multi-option selector `RangeSlider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].\n\nArgs:\n type (Literal[\"range_slider\"]): Defaults to `\"range_slider\"`.\n min (Optional[float]): Start value for slider. Defaults to `None`.\n max (Optional[float]): End value for slider. Defaults to `None`.\n step (Optional[float]): Step-size for marks on slider. Defaults to `None`.\n marks (Optional[dict[Union[float, int], str]]): Marks to be displayed on slider. Defaults to `{}`.\n value (Optional[list[float]]): Default start and end value for slider. Must be 2 items. Defaults to `None`.\n title (str): Title to be displayed. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.RangeSlider` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/rangeslider)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Numeric multi-option selector `RangeSlider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].", "properties": { "id": { "default": "", @@ -1817,7 +1817,7 @@ }, "Slider": { "additionalProperties": false, - "description": "Numeric single-option selector `Slider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].\n\nArgs:\n type (Literal[\"range_slider\"]): Defaults to `\"range_slider\"`.\n min (Optional[float]): Start value for slider. Defaults to `None`.\n max (Optional[float]): End value for slider. Defaults to `None`.\n step (Optional[float]): Step-size for marks on slider. Defaults to `None`.\n marks (Optional[dict[Union[float, int], str]]): Marks to be displayed on slider. Defaults to `{}`.\n value (Optional[float]): Default value for slider. Defaults to `None`.\n title (str): Title to be displayed. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Slider` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/slider)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Numeric single-option selector `Slider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter].", "properties": { "id": { "default": "", @@ -1942,7 +1942,7 @@ }, "Table": { "additionalProperties": false, - "description": "Wrapper for `dash_table.DataTable` to visualize tables in dashboard.\n\nArgs:\n type (Literal[\"table\"]): Defaults to `\"table\"`.\n figure (CapturedCallable): Function that returns a Dash DataTable. See [`vizro.tables`][vizro.tables].\n title (str): Title of the `Table`. Defaults to `\"\"`.\n header (str): Markdown text positioned below the `Table.title`. Follows the CommonMark specification.\n Ideal for adding supplementary information such as subtitles, descriptions, or additional context.\n Defaults to `\"\"`.\n footer (str): Markdown text positioned below the `Table`. Follows the CommonMark specification.\n Ideal for providing further details such as sources, disclaimers, or additional notes. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.\n actions (list[ActionType]): See [`ActionType`][vizro.models.types.ActionType]. Defaults to `[]`.", + "description": "Wrapper for `dash_table.DataTable` to visualize tables in dashboard.", "properties": { "id": { "default": "", @@ -2011,7 +2011,7 @@ }, "Tabs": { "additionalProperties": false, - "description": "Tabs to group together a set of containers on a page.\n\nArgs:\n type (Literal[\"tabs\"]): Defaults to `\"tabs\"`.\n tabs (list[Container]): See [`Container`][vizro.models.Container].\n title (str): Title displayed above Tabs. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. Defaults to `None`.", + "description": "Tabs to group together a set of containers on a page.", "properties": { "id": { "default": "", @@ -2058,7 +2058,7 @@ }, "Text": { "additionalProperties": false, - "description": "Creates a text component based on Markdown syntax.\n\nArgs:\n type (Literal[\"text\"]): Defaults to `\"text\"`.\n text (str): Markdown string to create text that should adhere to the CommonMark Spec.\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dcc.Markdown` and overwrite any\n defaults chosen by the Vizro team. This may have unexpected behavior.\n Visit the [dcc documentation](https://dash.plotly.com/dash-core-components/markdown/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "Creates a text component based on Markdown syntax.", "properties": { "id": { "default": "", @@ -2084,7 +2084,7 @@ }, "Tooltip": { "additionalProperties": false, - "description": "A tooltip that displays text when hovering over an icon.\n\nArgs:\n text (str): Markdown string for text shown when hovering over the icon. Should adhere to the CommonMark Spec.\n icon (str): Icon name from [Google Material icons library](https://fonts.google.com/icons).\n extra (Optional[dict[str, Any]]): Extra keyword arguments that are passed to `dbc.Tooltip` and overwrite any\n chosen by the Vizro team. This may have unexpected behavior. Visit the\n [dbc documentation](https://dash-bootstrap-components.opensource.faculty.ai/docs/components/tooltip/)\n to see all available arguments. [Not part of the official Vizro schema](../explanation/schema.md) and the\n underlying component may change in the future. Defaults to `{}`.", + "description": "A tooltip that displays text when hovering over an icon.", "properties": { "id": { "default": "", @@ -2189,7 +2189,7 @@ } }, "additionalProperties": false, - "description": "Vizro Dashboard to be used within [`Vizro`][vizro._vizro.Vizro.build].\n\nArgs:\n pages (list[Page]): See [`Page`][vizro.models.Page].\n theme (Literal[\"vizro_dark\", \"vizro_light\"]): Layout theme to be applied across dashboard.\n Defaults to `vizro_dark`.\n navigation (Navigation): See [`Navigation`][vizro.models.Navigation]. Defaults to `None`.\n title (str): Dashboard title to appear on every page on top left-side. Defaults to `\"\"`.\n description (Optional[Tooltip]): Optional markdown string that adds an icon next to the title.\n Hovering over the icon shows a tooltip with the provided description. This also sets the page's meta\n tags. Defaults to `None`.", + "description": "Vizro Dashboard to be used within [`Vizro`][vizro._vizro.Vizro.build].", "properties": { "id": { "default": "",