Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! ✅Check out the new docs.

[Feedback] My Dash Wish List as a Python Developer

I’ve made a few Dash applications now and I’ve loved it a lot. Generally I’m happy to write my own frameworks to drive Dash to get my own very specific needs working, but there are a few general sore points as a Python developer that I wanted to give feedback on.

Please take this as what it is, just my viewpoints coming from a very Python heavy background, I hope that’s useful to you but if not please ignore. All of these I can and do workaround, but I really feel if they were fixed it would make for a better Dash.

  1. Type Checking OR Type Hinting

All 3 of these are accepted (i.e. won’t throw an exception):

html.Div(html.Div())
html.Div([html.Div(), html.Div()])
html.Div(html.Div(), html.Div())

I appreciate that you want to make people’s code easier and less verbose so for the case where children is a single element, though this is an inconsistent with the inputs and state argument in a callback, but this makes it very easy to write the third example which results in this:

Div(children=Div(None), id=Div(None))

Which at no point throws an exception, and because there is no type hinting either then PyCharm and MyPy don’t have a chance to point to this as possible problem.

  1. Multiple Callbacks with Output to the same Prop

Particularly with the new DataTable it’s really useful to have multiple Inputs both Output to a DataTable. The “Timestamp” solution to work out which Input triggered isn’t available for every possible Input and even when it is >2 Timestamps turns in to a spaghetti monster. I would be happy to handle the state carefully myself in code like this:

 @app.callback(output=Output(*foo_prop), inputs=[Input(*bar_prop)], state=[State(*baz_prop)]):
 def my_func1: pass

 @app.callback(output=Output(*foo_prop), inputs=[Input(*baz_prop)], state=[State(*bar_prop)]):
 def my_func2: pass
  1. Circular References

Firstly this doesn’t even throw a Python exception (last I checked, I know there’s an issue on this) which is annoying, but even if it did there are times when I would want to override it sometimes. I’m coming across situations where if propA is updated then I want propB to be updated, and if propB is updated I want propA to be updated, in this case I would put a check in to raise PreventUpdate when they don’t need updating.

  1. Clean-support for multi-page apps with callback checking kept

So I know this can be done by creating multiple Dash Apps and using the same Flask Server and using “url_base_pathname”, but this isn’t explained in the documentation and it just feels a little odd. Maybe this one isn’t that important, but it just doesn’t feel nearly as magical as the rest of Dash

  1. Stuff I know is getting fixed in the future but still deserve to be on this list:
    a. Removing None Callbacks on Page-Load
    b. Output to multiple Props

Both will make a big difference to both performance and creating a cleaner layout to my applications.

3 Likes