# DashLab
[](https://asaboor-gh.github.io/litepad/notebooks/index.html?path=dashlab.ipynb)
[](https://mybinder.org/v2/gh/asaboor-gh/dashlab/HEAD?urlpath=%2Fdoc%2Ftree%2Fdemo.ipynb)
[](https://badge.fury.io/py/dashlab)
[](https://pepy.tech/project/dashlab)
An enhanced dashboarding library based on ipywidgets' interaction functionality that lets you observe any trait of widgets, observe multiple functions and build beautiful dashboards which can be turned into full screen.

## Installation
You can install dashlab using pip:
```bash
pip install dashlab
```
Or if you prefer to install from source, clone the repository and in its top folder, run:
```bash
pip install -e .
```
## Interactive Playground
**✨ Try it in your browser ✨**
| Jupyter Lab | Notebook | Binder |
|----|---|--- |
| [](https://asaboor-gh.github.io/litepad/lab/index.html?path=dashlab.ipynb) | [](https://asaboor-gh.github.io/litepad/notebooks/index.html?path=dashlab.ipynb) | [](https://mybinder.org/v2/gh/asaboor-gh/dashlab/HEAD?urlpath=%2Fdoc%2Ftree%2Fdemo.ipynb) |
## Features
- **DashboardBase**: Create interactive dashboard applications with minimal code by extending the `dashlab.DashboardBase` class and defining methods with the `@callback` decorator.
- **Dashboard**: A ready-to-use dashboard class that allows quick setup of interactive dashboards without subclassing and supports callbacks after initialization.
- **Custom Widgets**:
- Included custom built widgets for enhanced interaction.
- Pass any DOMWidget as a parameter to `interact/interactive` functions unlike default `ipywidgets.interactive` behavior.
- Observe any trait of the widget by `'widget_name.trait_name'` where `'widget_name'` is assigned to a `widget`/`fixed(widget)` in control parameters, OR `'.trait_name'` if `trait_name` exists on instance of interactive.
- Tuple pattern (widget, 'trait') for trait observation where widget is accessible via params and trait value goes to callback.
This is useful to have widget and trait in a single parameter, such as `x = (fig, 'selected')` for plotly FigureWidget. Other traits of same widget can be observed by separate parameters with `y = 'x.trait'` pattern.
- You can use '.fullscreen' to detect fullscreen change and do actions based on that.
- Use `.params` to acess widgets built with given parameters.
- Use `var` to observe any python variable which is not a widget and trigger callbacks when `var.value` changes.
- Add `ipywidgets.Button` to hold callbacks which use it as paramter for a click
- **Plotly Integration**: Modified plotly support with additional traits like `selected` and `clicked`
- **Markdown support**:
- Convert markdown to HTML widget using `dashlab.markdown` function.
- `hstack` and `vstack` functions support markdown strings to automatically convert to HTML and place in stack.
- **JupyTimer**: A non-blocking widget timer for Jupyter Notebooks without threading/asyncio.
- **Event Callbacks**: Easy widget event handling with the `@callback` decorator inside the subclass of `DashboardBase` or multiple functions in `interact/interactive` functions.
- **Full Screen Mode**: Transform your dashboards into full-screen applications by added button.
## Usage Example
```python
import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as ipw
import pandas as pd
import plotly.graph_objects as go
import dashlab as dl
dash = dl.Dashboard(
fig = dl.patched_plotly(go.FigureWidget()),
html = dl.markdown('**Select Box/Lesso on figure traces**'),
A = (1,10), omega = (0,20), phi = (0,10),
sdata = 'fig.selected', cdata = 'fig.clicked', fs = '.isfullscreen',
)
@dash.callback('out-click', throttle = 200) # limit click rate by 200 ms
def on_click(cdata,html):
display(pd.DataFrame(cdata or {}))
@dash.callback('out-select')
def on_select(sdata, html):
plt.scatter(sdata.get('xs',[]),sdata.get('ys',[]))
plt.show()
@dash.callback('out-fs')
def detect_fs(fig, fs):
print("isfullscreen = ",fs)
fig.layout.autosize = False # double trigger
fig.layout.autosize = True
@dash.callback
def plot(fig:go.FigureWidget, A, omega,phi): # adding type hint allows auto-completion inside function
fig.data = []
x = np.linspace(0,10,100)
fig.add_trace(go.Scatter(x=x, y=A*np.sin(omega*x + phi), mode='lines+markers'))
dash.set_css({
'.left-sidebar':{'background':'whitesmoke'},
':fullscreen': {'height': '100vh'}}
)
dash.set_layout(
left_sidebar=['A','omega','phi','html', 'out-select','out-main'],
center=['fig','out-click'],
pane_widths=[3,7,0],
)
dash
```

## Comprehensive Examples
- Check out the [demo.ipynb](demo.ipynb) which demonstates subclassing `DashboardBase`, using custom widgets, and observing multiple functions through the `@callback` decorator.
- See [Bandstructure Visualizer](https://github.com/asaboor-gh/ipyvasp/blob/d181ba9a1789368c5d8bc1460be849c34dcbe341/ipyvasp/widgets.py#L642) and [KPath Builder](https://github.com/asaboor-gh/ipyvasp/blob/d181ba9a1789368c5d8bc1460be849c34dcbe341/ipyvasp/widgets.py#L935) as comprehensive dashboards.
Raw data
{
"_id": null,
"home_page": null,
"name": "dashlab",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Dashboard, Data Visualization, Python, Analytics",
"author": null,
"author_email": "Abdul Saboor <asaboor.my@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/ff/19/9d8a8aa29aba2e81b19b02374941aaaf0c5695734c140854b7e71b2f3548/dashlab-0.2.0.tar.gz",
"platform": null,
"description": "# DashLab\r\n\r\n[](https://asaboor-gh.github.io/litepad/notebooks/index.html?path=dashlab.ipynb)\r\n[](https://mybinder.org/v2/gh/asaboor-gh/dashlab/HEAD?urlpath=%2Fdoc%2Ftree%2Fdemo.ipynb)\r\n[](https://badge.fury.io/py/dashlab)\r\n[](https://pepy.tech/project/dashlab)\r\n\r\nAn enhanced dashboarding library based on ipywidgets' interaction functionality that lets you observe any trait of widgets, observe multiple functions and build beautiful dashboards which can be turned into full screen.\r\n\r\n\r\n\r\n## Installation\r\n\r\nYou can install dashlab using pip:\r\n\r\n```bash\r\npip install dashlab\r\n```\r\n\r\nOr if you prefer to install from source, clone the repository and in its top folder, run:\r\n\r\n```bash\r\npip install -e .\r\n```\r\n\r\n## Interactive Playground\r\n**\u2728 Try it in your browser \u2728**\r\n| Jupyter Lab | Notebook | Binder |\r\n|----|---|--- |\r\n| [](https://asaboor-gh.github.io/litepad/lab/index.html?path=dashlab.ipynb) | [](https://asaboor-gh.github.io/litepad/notebooks/index.html?path=dashlab.ipynb) | [](https://mybinder.org/v2/gh/asaboor-gh/dashlab/HEAD?urlpath=%2Fdoc%2Ftree%2Fdemo.ipynb) |\r\n\r\n## Features\r\n\r\n- **DashboardBase**: Create interactive dashboard applications with minimal code by extending the `dashlab.DashboardBase` class and defining methods with the `@callback` decorator.\r\n- **Dashboard**: A ready-to-use dashboard class that allows quick setup of interactive dashboards without subclassing and supports callbacks after initialization.\r\n- **Custom Widgets**: \r\n - Included custom built widgets for enhanced interaction. \r\n - Pass any DOMWidget as a parameter to `interact/interactive` functions unlike default `ipywidgets.interactive` behavior.\r\n - Observe any trait of the widget by `'widget_name.trait_name'` where `'widget_name'` is assigned to a `widget`/`fixed(widget)` in control parameters, OR `'.trait_name'` if `trait_name` exists on instance of interactive.\r\n - Tuple pattern (widget, 'trait') for trait observation where widget is accessible via params and trait value goes to callback.\r\n This is useful to have widget and trait in a single parameter, such as `x = (fig, 'selected')` for plotly FigureWidget. Other traits of same widget can be observed by separate parameters with `y = 'x.trait'` pattern.\r\n - You can use '.fullscreen' to detect fullscreen change and do actions based on that.\r\n - Use `.params` to acess widgets built with given parameters.\r\n - Use `var` to observe any python variable which is not a widget and trigger callbacks when `var.value` changes.\r\n - Add `ipywidgets.Button` to hold callbacks which use it as paramter for a click\r\n- **Plotly Integration**: Modified plotly support with additional traits like `selected` and `clicked`\r\n- **Markdown support**: \r\n - Convert markdown to HTML widget using `dashlab.markdown` function.\r\n - `hstack` and `vstack` functions support markdown strings to automatically convert to HTML and place in stack.\r\n- **JupyTimer**: A non-blocking widget timer for Jupyter Notebooks without threading/asyncio.\r\n- **Event Callbacks**: Easy widget event handling with the `@callback` decorator inside the subclass of `DashboardBase` or multiple functions in `interact/interactive` functions.\r\n- **Full Screen Mode**: Transform your dashboards into full-screen applications by added button.\r\n\r\n## Usage Example\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport ipywidgets as ipw\r\nimport pandas as pd\r\nimport plotly.graph_objects as go\r\nimport dashlab as dl\r\n\r\ndash = dl.Dashboard(\r\n fig = dl.patched_plotly(go.FigureWidget()), \r\n html = dl.markdown('**Select Box/Lesso on figure traces**'),\r\n A = (1,10), omega = (0,20), phi = (0,10),\r\n sdata = 'fig.selected', cdata = 'fig.clicked', fs = '.isfullscreen',\r\n)\r\n@dash.callback('out-click', throttle = 200) # limit click rate by 200 ms\r\ndef on_click(cdata,html):\r\n display(pd.DataFrame(cdata or {}))\r\n\r\n@dash.callback('out-select')\r\ndef on_select(sdata, html):\r\n plt.scatter(sdata.get('xs',[]),sdata.get('ys',[]))\r\n plt.show()\r\n\r\n@dash.callback('out-fs')\r\ndef detect_fs(fig, fs):\r\n print(\"isfullscreen = \",fs)\r\n fig.layout.autosize = False # double trigger\r\n fig.layout.autosize = True\r\n\r\n@dash.callback\r\ndef plot(fig:go.FigureWidget, A, omega,phi): # adding type hint allows auto-completion inside function\r\n fig.data = []\r\n x = np.linspace(0,10,100)\r\n fig.add_trace(go.Scatter(x=x, y=A*np.sin(omega*x + phi), mode='lines+markers'))\r\n\r\ndash.set_css({\r\n '.left-sidebar':{'background':'whitesmoke'},\r\n ':fullscreen': {'height': '100vh'}}\r\n)\r\ndash.set_layout(\r\n left_sidebar=['A','omega','phi','html', 'out-select','out-main'], \r\n center=['fig','out-click'], \r\n pane_widths=[3,7,0],\r\n)\r\n\r\ndash\r\n```\r\n\r\n\r\n## Comprehensive Examples\r\n- Check out the [demo.ipynb](demo.ipynb) which demonstates subclassing `DashboardBase`, using custom widgets, and observing multiple functions through the `@callback` decorator.\r\n- See [Bandstructure Visualizer](https://github.com/asaboor-gh/ipyvasp/blob/d181ba9a1789368c5d8bc1460be849c34dcbe341/ipyvasp/widgets.py#L642) and [KPath Builder](https://github.com/asaboor-gh/ipyvasp/blob/d181ba9a1789368c5d8bc1460be849c34dcbe341/ipyvasp/widgets.py#L935) as comprehensive dashboards.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for dashboard and data visualization tools.",
"version": "0.2.0",
"project_urls": {
"Bug-Tracker": "https://github.com/asaboor-gh/dashlab/issues",
"Homepage": "https://github.com/asaboor-gh/dashlab"
},
"split_keywords": [
"dashboard",
" data visualization",
" python",
" analytics"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8adca151069de4eee56317381a9b9fbde086ec89606b51ab530aedada9849bf7",
"md5": "aa10cc0c6c1e01d84aaa587464fc52ef",
"sha256": "a84f80745c7d8ca8a42c5862a8a364ea6fc28cb5da89581242efb150027edf0d"
},
"downloads": -1,
"filename": "dashlab-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa10cc0c6c1e01d84aaa587464fc52ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 45929,
"upload_time": "2025-09-08T17:48:11",
"upload_time_iso_8601": "2025-09-08T17:48:11.338494Z",
"url": "https://files.pythonhosted.org/packages/8a/dc/a151069de4eee56317381a9b9fbde086ec89606b51ab530aedada9849bf7/dashlab-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ff199d8a8aa29aba2e81b19b02374941aaaf0c5695734c140854b7e71b2f3548",
"md5": "317c59cc03d10dc531946a8e55c409d1",
"sha256": "c868d65028fef1caeedb3f97930a6fc5bc85358779abf849291503b4f6c0375e"
},
"downloads": -1,
"filename": "dashlab-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "317c59cc03d10dc531946a8e55c409d1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 43926,
"upload_time": "2025-09-08T17:48:12",
"upload_time_iso_8601": "2025-09-08T17:48:12.794590Z",
"url": "https://files.pythonhosted.org/packages/ff/19/9d8a8aa29aba2e81b19b02374941aaaf0c5695734c140854b7e71b2f3548/dashlab-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 17:48:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "asaboor-gh",
"github_project": "dashlab",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "numpy",
"specs": []
},
{
"name": "pandas",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "anywidget",
"specs": []
},
{
"name": "markdown",
"specs": []
}
],
"lcname": "dashlab"
}