Skip to main content

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.

GitHub Workflow Status PyPI PyPI - Python Version GitHub

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dash-dashy-0.0.2.tar.gz (16.5 kB view hashes)

Uploaded Source

Built Distribution

dash_dashy-0.0.2-py3-none-any.whl (20.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page