Fast analytical web application with DashExpress
Build your next dashboard even faster with premade responsive UI and automatic callback-function. DashExpress is a wrapper over the Plotly Dash web framework, which allows you to simplify and speed up the creation of multi-page analytical applications based on data from pd.DataFrame.
pip install dash-express
Currently supported: Charts, KPI, Geographical Maps
The key features are:
- High Performance: Provided by built-in optimization methods of Dash callback functions.
- Fast to code: Using a pre-configured UI and automatically generated callback functions.
- Based on Pandas: A library familiar to all analysts.
- Used Mantine UI: Pretty UI by Mantine React Library.
- Include Dark Theme: Use a dark theme for all components (including graphs and maps) without any additional actions.
Minimal full-featured dashboard
The first step is to import the necessary libraries
import pandas as pd
import plotly.graph_objects as go
import dash_mantine_components as dmc
from dash_express import DashExpress, Page
Next, you need to initialize an instance of the Dash Express application.
app = DashExpress(
logo='DashExpress', # navbar logo, string or dict: {'dark':'path/to/darklogo.svg', 'light':...}
cache=True, # flask_caching.Cache instance, dict or True (default: True)
default_cache_timeout=3600, # flask_caching.Cache timeout in seconds (default: 3600)
app_shell=..., # Appshell class for customization UI your app (default: BaseAppShell())
# And standart Plotly Dash param
)
The Dash Express object implements a Dash application with a pre-configured interface and automatic callback generation for quickly creating interactive multi-page web analytics applications.
Page definition
Each application page is a separate object, an instance of the dash_express' class.Page. The page contains the source data for analysis, graph creation functions and a list of filters.
page = Page(
app=app, # DashExpress app
url_path='/', # page url
name='Owerview', # page name in navigation buttons
get_df=get_df, # function for getting pd.DataFrame
title='Owerview', # page title
)
Getting data
The 'get_df` function contains the logic of getting data:
get_df = lambda: pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv')
Dashboard layout
Next, you need to determine the layout of the dashboard. we recommend using dmc.Grid and dmc.SimpleGrid
page.layout = dmc.SimpleGrid(
page.add_graph(h='100%',render_func=bar_func)
)
The render_func parameter of the page.add_graph method is a graph generation function based on data from a DataFrame
# The logic of drawing a graph
def bar_func(df):
pv = pd.pivot_table(df, index='continent', values='lifeExp').reset_index()
fig = go.Figure([go.Bar(x=pv['continent'], y=pv['lifeExp'])])
return fig
The last action is to add filters, which is done by simply calling the page.add_filter method and specifying the filtering column.
page.add_autofilter('continent', multi=True)
page.add_autofilter('country', multi=True)
page.add_autofilter('lifeExp', multi=True)
App run
These actions are enough to create a fully functional dashboard, so you can run the application.
app.run()
Full code of the minimal application
import pandas as pd
import plotly.graph_objects as go
import dash_mantine_components as dmc
from dash_express import DashExpress, Page
# Incorporate data
get_df = lambda: pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv')
# Initialize the app
app = DashExpress(logo='DashExpress')
# Initialize the Page
page = Page(
app=app, # DashExpress app
url_path='/', # page url
name='Owerview', # page name in navigation buttons
get_df=get_df, # function for getting pd.DataFrame
title='Owerview', # page title
)
# The logic of drawing a graph
def bar_func(df):
pv = pd.pivot_table(df, index='continent', values='lifeExp').reset_index()
fig = go.Figure([go.Bar(x=pv['continent'], y=pv['lifeExp'])])
return fig
# Dashboard layout
page.layout = dmc.SimpleGrid(
page.add_graph(h='calc(100vh - 138px)',render_func=bar_func)
)
# By which columns to filter
page.add_autofilter('continent', multi=True)
page.add_autofilter('country', multi=True)
page.add_autofilter('lifeExp', multi=True)
app.run(debug=True)
Requirements
Python 3.7+
DashExpress stands on the shoulders of giants:
- Plotly Dash for the web parts.
- Pandas DataFrame for the data store & compute measure.
- Dash Mantine Components for the create pretty UI
- Dash Leaflet for the create maps
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for dash-express 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dash_express-1.2.0.tar.gz | 22.5 kB | Without provenance | Details for dash_express-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dash_express-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for dash_express-1.2.0-py3-none-any.whl |
Total release size: 45.4 kB
Release files / dash_express-1.2.0.tar.gz
| Download URL | dash_express-1.2.0.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f37fd0789b62e3526c5ca638d81181f8fe85ff37794ba30973670deb79c52f9
|
|
BLAKE2b-256 checksum How to use checksums |
b844f8d88329b291837a80b0439b14c2fc5be1e782229505b6a06b6a4fd821c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / dash_express-1.2.0-py3-none-any.whl
| Download URL | dash_express-1.2.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23fa905c21ffa7d812f3038f0771b0c158a770e26773f6a8a349dbd5f8c04c1a
|
|
BLAKE2b-256 checksum How to use checksums |
4709f2600b29cf22c9ab3ef69408a811744462a27c605d17f964412b36517c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for dash-express 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.