Do any open source Python wrappers exist for dash?

I notice that with Dash it’s quite easily to create apps where the number of lines and code required to build something grows pretty heavily and bloats the file up.

One solution I thought of this was creating a python wrapper for any dash component (such as a div or table or chart_ and turning it into a class by itself which inherits from the dash core component. e.g. turning dcc.div into

class Div(dcc.div):

with the styles preset but able to be overridden, and then importing into the like:

from ../../.. import Div

Does anyone have any thoughts on this idea? Has it been done before and can anybody point me to the code?

(n.b not sure if wrapper is the best way to refer to this but couldn’t think of another term…)

I’ve done this quite often,but I don’t think it’s a matter of finding wrappers. It’s more a set of best practices. One of the trickiest things I’ve found is if you want to expose dependencies within your class to be used in a callback, especially if you need access to more than one component in your class. The new pattern matching callbacks make this a little easier, but you can not in python write your own “component” and have it behave exactly like a regular dash component.

Look into Dash Core Components | Dash for Python Documentation | Plotly, Dash HTML Components | Dash for Python Documentation | Plotly, and lastly the even more awesome All native Python, all support heavy customization of Dash ecosystem. Each have examples and reference implementations to get you started.