Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lingyielia committed Oct 24, 2023
2 parents 76cbb8c + f391d06 commit 22bbbeb
Show file tree
Hide file tree
Showing 32 changed files with 450 additions and 262 deletions.
Binary file modified .github/images/tech_logos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Vizro is a toolkit for creating modular data visualization applications
</p>

<p align="center">
<img src="https://raw.githubusercontent.com/mckinsey/vizro/main/.github/images/tech_logos.png" width="270"/>
<img src="https://raw.githubusercontent.com/mckinsey/vizro/main/.github/images/tech_logos.png" width="300"/>
</p>

## What is Vizro?
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ target-version = ["py38"]

[tool.codespell]
builtin = "clear,rare,en-GB_to_en-US"
ignore-words-list = "grey"
ignore-words-list = "grey,ned"

[tool.mypy]
# strict checks : strict = true
Expand Down
2 changes: 1 addition & 1 deletion tools/check_branch_name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

BRANCH_LOCAL=$(git symbolic-ref --short HEAD)
BRANCH_CI=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
REGEX="^(main|(release|feat|bug|docs|qa|dev|demo|ci|tidy)\/[^/]+(/[^/]+)*)$"
REGEX="^(main|(release|feat|bug|docs|qa|dev|demo|ci|tidy|dependabot)\/[^/]+(/[^/]+)*)$"

if ! [[ $BRANCH_LOCAL =~ $REGEX ]] && [[ $BRANCH_CI =~ $REGEX ]]; then
echo "Branch name is invalid - please rename your branch following this regex syntax: $REGEX"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Removed
- A bullet item for the Removed category.
-->
<!--
### Added
- A bullet item for the Added category.
-->
<!--
### Changed
- A bullet item for the Changed category.
-->
<!--
### Deprecated
- A bullet item for the Deprecated category.
-->

### Fixed

- Enable turning off `marks` when `step` is defined in `Slider` and `RangeSlider` ([#115](https://github.com/mckinsey/vizro/pull/115))

<!--
### Security
- A bullet item for the Security category.
-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

### Removed

- Remove warning message if not all registered pages are used in `Navigation` ([#117](https://github.com/mckinsey/vizro/pull/117))

<!--
### Added
- A bullet item for the Added category.
-->

### Changed

- Autopopulate `navigation.pages` with registered pages during `Dashboard` validation if `navigation.pages = None` ([#117](https://github.com/mckinsey/vizro/pull/117))

<!--
### Deprecated
- A bullet item for the Deprecated category.
-->
<!--
### Fixed
- A bullet item for the Fixed category.
-->
<!--
### Security
- A bullet item for the Security category.
-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Removed
- A bullet item for the Removed category.
-->
<!--
### Added
- A bullet item for the Added category.
-->
<!--
### Changed
- A bullet item for the Changed category.
-->
<!--
### Deprecated
- A bullet item for the Deprecated category.
-->
<!--
### Fixed
- A bullet item for the Fixed category.
-->

### Security

- Bump @babel/traverse from 7.22.20 to 7.23.2 ([#118](https://github.com/mckinsey/vizro/pull/118))
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Removed
- A bullet item for the Removed category.
-->
<!--
### Added
- A bullet item for the Added category.
-->

### Changed

- Update warning for duplicated IDs in `data_manager` and `model_manager` to now recommend `Vizro._reset()` as a potential fix when working in a Jupyter notebook ([#120](https://github.com/mckinsey/vizro/pull/120))

<!--
### Deprecated
- A bullet item for the Deprecated category.
-->
<!--
### Fixed
- A bullet item for the Fixed category.
<!--
### Security
- A bullet item for the Security category.
-->
1 change: 1 addition & 0 deletions vizro-core/docs/pages/development/authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

## Previous team members and code contributors

[Ned Letcher](https://github.com/ned2),
Natalia Kurakina,
[Leon Nallamuthu](https://github.com/leonnallamuthu),
[axa99](https://github.com/axa99),
Expand Down
46 changes: 23 additions & 23 deletions vizro-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions vizro-core/schemas/0.1.5.dev0.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
},
"RangeSlider": {
"title": "RangeSlider",
"description": "Numeric multi-selector `RangeSlider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter]. Based on the underlying\n[`dcc.RangeSlider`](https://dash.plotly.com/dash-core-components/rangeslider).\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[float, str]]): Marks to be displayed on slider. Defaults to `None`.\n value (Optional[List[float]]): Default start and end value for slider. Must be 2 items. Defaults to `None`.\n title (Optional[str]): Title to be displayed. Defaults to `None`.\n actions (List[Action]): See [`Action`][vizro.models.Action]. Defaults to `[]`.",
"description": "Numeric multi-selector `RangeSlider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter]. Based on the underlying\n[`dcc.RangeSlider`](https://dash.plotly.com/dash-core-components/rangeslider).\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[float, 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 (Optional[str]): Title to be displayed. Defaults to `None`.\n actions (List[Action]): See [`Action`][vizro.models.Action]. Defaults to `[]`.",
"type": "object",
"properties": {
"id": {
Expand Down Expand Up @@ -533,6 +533,7 @@
"marks": {
"title": "Marks",
"description": "Marks to be displayed on slider.",
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
Expand Down Expand Up @@ -566,7 +567,7 @@
},
"Slider": {
"title": "Slider",
"description": "Numeric single-selector `Slider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter]. Based on the underlying\n[`dcc.Slider`](https://dash.plotly.com/dash-core-components/slider).\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[float, str]]): Marks to be displayed on slider. Defaults to `None`.\n value (Optional[float]): Default value for slider. Defaults to `None`.\n title (Optional[str]): Title to be displayed. Defaults to `None`.\n actions (List[Action]): See [`Action`][vizro.models.Action]. Defaults to `[]`.",
"description": "Numeric single-selector `Slider`.\n\nCan be provided to [`Filter`][vizro.models.Filter] or\n[`Parameter`][vizro.models.Parameter]. Based on the underlying\n[`dcc.Slider`](https://dash.plotly.com/dash-core-components/slider).\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[float, str]]): Marks to be displayed on slider. Defaults to `{}`.\n value (Optional[float]): Default value for slider. Defaults to `None`.\n title (Optional[str]): Title to be displayed. Defaults to `None`.\n actions (List[Action]): See [`Action`][vizro.models.Action]. Defaults to `[]`.",
"type": "object",
"properties": {
"id": {
Expand Down Expand Up @@ -598,6 +599,7 @@
"marks": {
"title": "Marks",
"description": "Marks to be displayed on slider.",
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
Expand Down Expand Up @@ -859,7 +861,7 @@
},
"Navigation": {
"title": "Navigation",
"description": "Navigation in [`Dashboard`][vizro.models.Dashboard] to structure [`Pages`][vizro.models.Page].\n\nArgs:\n pages (Optional[NavigationPagesType]): See [NavigationPagesType][vizro.models.types.NavigationPagesType].\n Defaults to `None`.",
"description": "Navigation in [`Dashboard`][vizro.models.Dashboard] to structure [`Pages`][vizro.models.Page].\n\nArgs:\n pages (Optional[NavigationPagesType]): See [`NavigationPagesType`][vizro.models.types.NavigationPagesType].\n Defaults to `None`.",
"type": "object",
"properties": {
"id": {
Expand Down
16 changes: 14 additions & 2 deletions vizro-core/src/vizro/_vizro.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from pathlib import Path
from typing import Dict, List, Tuple

import dash
import flask
from dash import Dash

from vizro._constants import STATIC_URL_PREFIX
from vizro.managers import data_manager, model_manager
Expand All @@ -23,7 +23,7 @@ class Vizro:
def __init__(self):
"""Initializes Dash."""
_js, _css = _append_styles(self._lib_assets_folder, STATIC_URL_PREFIX)
self.dash = Dash(
self.dash = dash.Dash(
use_pages=True,
pages_folder="",
external_scripts=_js,
Expand Down Expand Up @@ -78,6 +78,18 @@ def _pre_build():
if hasattr(model, "pre_build"):
model.pre_build()

@staticmethod
def _reset():
"""Private method that clears all state in the vizro app."""
data_manager._clear()
model_manager._clear()
dash._callback.GLOBAL_CALLBACK_LIST = []
dash._callback.GLOBAL_CALLBACK_MAP = {}
dash._callback.GLOBAL_INLINE_SCRIPTS = []
dash.page_registry.clear()
dash._pages.CONFIG.clear()
dash._pages.CONFIG.__dict__.clear()


def _append_styles(walk_dir: str, url_prefix: str) -> Tuple[List[Dict[str, str]], List[str]]:
"""Append vizro css and js resources."""
Expand Down
4 changes: 2 additions & 2 deletions vizro-core/src/vizro/managers/_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _add_component(self, component_id: ComponentID, dataset_name: DatasetName):
f"Component with id={component_id} already exists and is mapped to dataset "
f"{self.__component_to_original[component_id]}. Components must uniquely map to a dataset across the "
f"whole dashboard. If you are working from a Jupyter Notebook, please either restart the kernel, or "
f"use 'from vizro.managers import data_manager; data_manager._reset()`."
f"use 'from vizro import Vizro; Vizro._reset()`."
)
self.__component_to_original[component_id] = dataset_name

Expand Down Expand Up @@ -98,7 +98,7 @@ def _has_registered_data(self, component_id: ComponentID) -> bool:
except KeyError:
return False

def _reset(self):
def _clear(self):
self.__init__() # type: ignore[misc]


Expand Down
Loading

0 comments on commit 22bbbeb

Please sign in to comment.