Dash app structure

Hi,

My postgraduate thesis involves building a large-scale sales dahsboard using Dash. I have loved working with Dash and Plotly! I am concerned that as my app grows the structure of the system will become more and more important. The app consists of about 10 different pages and around 3000 lines of code at the moment. Are there any large, open-source Dash projects you can point me to so I can get an idea of how a large-scale dash application with multiple files should be structured? I looked at the sample projects on github, but these are all built in a single app.py file.

Thanks!

1 Like

For 10 pages it should be ok the approach described here

There might be better examples on github, but one extreme case is the Dash documentation itself:

2 Likes

Thanks for your quick response. I have checked this out, but was wondering if there would ever be Python classes or object orientation involved in building the dashboard?

Interesting point… Why would you want/need it?

I am more just wondering than actually needing it. A portion of our mark is based on quality of code and was wondering what the best practice would be.

I can see the appeal to OOP for code quality purposes and some time ago I found this library that explores it, but I never actually implemented anything with it (my previous company wasn’t that interested in CQ…).

Dash has also a documentation/submodule with respect to testing. I am still trying to figure out how to go beyond the basics in Multi-Page Applications, but it is something that can help identify errors and it is relatively simple to set up in CI pipelines (at least GH Actions and Gitlab CI). I supplement it with unit tests for callbacks, although they are a slippery slope, as it is hard to cover in isolation the different structures that Inputs and Outputs assume during the app lifecycle.

2 Likes