Skip to main content

Generate boilerplate code for plotly Dash apps

Project description

create-dash-app


PyPI version License Build status

create-dash-app is a utility for creating a boilerplate Dash applications.

Why?

I made this primarily because I wanted an easy way to initialize a Dash application that logically separates code.

If you're new to Dash, the docs lead you down a design path of single file apps. This may be fine for their simple examples, but in the real world your application will quickly grow untenable as you build out more complex views.

I personally have run into this issue at least 2 times, and because I find refactoring to be a tedious chore, I decided to build a tool to address it. I even added some other features because I'm just such a nice guy.

Installing

Installation is simple with pip or your preferred package manager.

python -m pip install create-dash-app

To test the installation

python -m create_dash_app -h

Running

Running is also simple and can be done in one of two ways:

To use the executable:

create-dash-app

To run via python:

python -m create_dash_app

Structure

The main point of this package is to lay out your new app in a helpful structure, so let's take a moment to review this snazzy structure.

dash_app
├── __init__.py
├── app.py
├── assets
│   ├── dash.min.css
│   └── dbc.min.css
├── callbacks
│   ├── __init__.py
│   └── index.py
├── components
│   ├── __init__.py
│   └── index.py
├── server.py
└── wsgi.py

This layout should intuitively make sense if you are familiar with Dash, but if you are a newbie or you can't read my mind here is a file/folder level breakdown.

Root Level Files

app.py

Your entrypoint to the Flask development server:

python dash_app/app.py

Typically, you won't have to touch this file.


server.py

Dash app configuration and cache configuration live here.


wsgi.py

A clean entrypoint if you run dash via a wsgi server (which you should be doing). For example:

gunicorn dash_app.wsgi -b :8050

Assets

This folder contains any static assets (CSS, images, JavaScript, etc.) you want to host. Read this page for more information on the assets folder.

Callbacks

All of your callback definitions should live here. callbacks.index is imported by app.py to prevent any circular dependency issues with the Dash object. It also means that if you create additional callback files, you only have to import them in callbacks.index and they will flow through to your app.

Components

All of your components definitions should live here, with components.index.Layout acting as the highest level Div. Similar to the callback directory, if you create additional component files you only need to make their components children of Layout.

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

create-dash-app-0.1.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

create_dash_app-0.1.2-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file create-dash-app-0.1.2.tar.gz.

File metadata

  • Download URL: create-dash-app-0.1.2.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for create-dash-app-0.1.2.tar.gz
Algorithm Hash digest
SHA256 85306dd822bfb5acac6966abeeb80e924e896ab32b3ee0ad0b300b31ec6f92cb
MD5 d8689f77d3cef203a729720b679b8e16
BLAKE2b-256 745af274e7153a215d8be938cf9f47a5a046700b555b0a676b636c335bc27b9f

See more details on using hashes here.

File details

Details for the file create_dash_app-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: create_dash_app-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for create_dash_app-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ea59fb1d71ca9d6804a8a8be15b42c388c30363fb28dbdf7008d9b4c07e5a07a
MD5 f426fca794825b2c219f709977b4837e
BLAKE2b-256 b343ad0ac01ac594fc3acf4f82193cd1f449fa7cf82158767ecf98fef49347cb

See more details on using hashes here.

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