Hi everyone,
I decided to take some of the design ideas from my explainerdashboard package and put them in their own library. The result is dash_oop_components.
The goal is to make it easier to write clean, modular, configurable dash code, by wrapping your dash code in object-oriented wrapper classes. (hence the name dash_oop_components
).
It includes:
-
DashFigureFactory
: a wrapper for your data/plotting functionality. -
DashComponent
: a self-contained, modular, configurable unit that combines a dash layout with dash callbacks.- Makes use of a
DashFigureFactory
for plots or other data output -
DashComponents
are composable, meaning that you can nest them into new composite components.
- Makes use of a
-
DashApp
: Build a dashboard out ofDashComponent
and run it.
All three wrappers:
- Automatically store all params to attributes and to a ._stored_params dict
- Allow you to store its’ config to a
.yaml
file, including import details, and can then
be fully reloaded from a config file.
This allows you to:
- Seperate the data/plotting logic from the dashboard interactions logic, by putting all the plotting functionality inside a
DashFigureFactory
and all the dashboard layout and callback logic intoDashComponents
. - Build self-contained, configurable, re-usable
DashComponents
- Compose dashboards that consists of multiple
DashComponents
that each may consists of multiple nestedDashComponents
, etc. - Store all the configuration needed to rebuild and run a particular dashboard to a single configuration
.yaml
file - Parametrize your dashboard so that you (or others) can make change to the dashboard without having to edit the code.
The goal has been to invisibly automate as much of the boilerplate as possible, so hopefully it will be a delight to use! Please check it out!
Install:
pip install dash_oop_components
Github:
https://github.com/oegedijk/dash_oop_components.
Example:
An example dashboard can be found at github.com/oegedijk/dash_oop_demo and has been deployed to https://dash-oop-demo.herokuapp.com/