Easy-to-use data visualization framework
Project description
Dashy
A small framework built on top of Plotly Dash and Dash Bootstrap Components intended to make it easy and quick to build dashboards without having to think about all the small details.
How To Use | Key Features | Future | Credits | License
Install
pip install dash-dashy
Key Features
Simpler callbacks
Dash callbacks usually looks like
@app.callback(
Output('container', 'children'),
Input('btn-1', 'n_clicks'),
Input('btn-2', 'n_clicks'),
Input('btn-3', 'n_clicks'),
State('dropdown', 'value'))
def some_callback_func(...):
...
In order to make callbacks less verbose Dashy apps has its own callback decorator using only list and tuples as arguments. The example above reduces to
@app.cb(
inputs=[('btn-1', 'n_clicks'), ('btn-2', 'n_clicks'), ('btn-3', 'n_clicks')],
outputs=('container', 'children'),
states=('dropdown', 'value'))
def some_callback_func(...):
...
Dashy also assume an implicit order of the decorator arguments which is, inputs -> outputs -> states. This is handy for simple callbacks like
# callback taking buttons clicks as input and outputs 'children' to 'container'
@app.cb(('btn-1', 'n_clicks'), ('container', 'children'))
def some_callback_func(...):
...
Dashy callbacks also does not require an explicit output.
# do something when the button is clicked
@app.cb(('btn-1', 'n_clicks'))
def some_callback_func(...):
...
High level function components
All components in Dashy are functions, import what you need or everything
# import individual components
from dashy.components import navbar, button, graph, dropdown
# or
import dashy.components as dc
Layout
Dashy utilizes bootstrap's grid system and tries to handle as much of the layout as possible while still making the dashboards look good. Import the container
row
and col
components and build your layout.
from dashy.components import container, row, col
layout = container([
row([
# your components
]),
col([
# more components
])
])
Complete app example
Building an app with a navbar, tabs and a callback to switch tabs becomes
from dashy import create_app
from dashy.components import navbar, tabs, div
app = create_app(__name__, layout=[
navbar('My App', dark=True),
tabs(id='tabs', labels=['Tab1', 'Tab2', 'Tab3'], content_id='tab-content')
])
@app.cb(('tabs', 'active_tab'), ('tab-content', 'children'))
def switch_tabs(tab_id: str):
return div(f'Hello from {tab_id}')
if __name__ == "__main__":
app.launch()
Future
- Integrate all components with bootstrap themes
- Dashboard templates
Credits
This software uses the following awesome open source packages:
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dash_dashy-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70d7be0650c5a68dccd90b7e4b324b56be2d6e40aadeb4e45769063a059cbb6a |
|
MD5 | 953d25ac9be93737466b31fa063a7f1a |
|
BLAKE2b-256 | b4e3aa8e10729a2c86d24b031c78910b2975f5d7dddd314027c40a657c52fb8f |