Announcing Dash for Julia

plotly
plotly
Oct 15, 2020 · 5 min read

📌 Want to learn how to use Dash for Julia to build high-performance dashboards? Check out our recorded webinar!

Today, we’re excited to officially welcome Dash for Julia. By adding Julia to Dash’s Python and R back ends, the Jupyter trinity is complete again.

“Dash is a productive Python framework for building web applications,” so starts Plotly’s Dash documentation. That is indeed how Dash began, allowing data scientists to build rich, beautiful, exploratory portals to their data using only Python. But, describing Dash as a Python framework misses a key feature of its design: the Python side (the back end/server) of Dash was built to be lightweight and stateless. The great majority of the code, complexity, and control resides in JavaScript in the browser (the front end/client) and the two sides communicate via a relatively simple JSON interface.

The power provided by this architecture was apparent even before we expanded beyond Python support: leveraging the performance of React; making the huge React component ecosystem, indeed most JavaScript packages, accessible without direct JavaScript coding; simplifying complex application logic into clear functional dependencies between the essential inputs and outputs; scaling and parallelizing across multiple back-end processes.

Another huge advantage of this architecture is the way it allows multiple back-end languages to coexist on an equal footing. Dash’s sister technology, Jupyter notebooks, adopted that name in 2014 as a visionary statement that Julia, Python, and R (Ju-Pyt-R) all belong as first-class members of the data science world. Dash was designed with the same philosophy, that the effort we put into the powerful Dash renderer and the wide array of Plotly-built and community-built Dash components should benefit not just Python users, but anyone with data to explore and share regardless of the language they prefer. To that end, in 2019 we introduced our second Dash back end, Dash for R. Bringing Dash to a whole new community, Dash for R proved that the idea of interchangeable back ends for the same component ecosystem was more than a dream. We’ve seen Python and R users helping each other learn the common patterns and techniques of Dash, and working together to improve the JavaScript components, benefitting users of both languages.

Today, we’re excited to officially welcome the third Dash back end, Dash for Julia. The Jupyter trinity is complete again!

From the beginning, Dash for Julia has been a community effort. Barely a year ago, Alexandr Romanenko was interested in Dash but preferred working in Julia. Recognizing the flexible architecture, he started building his own Julia back end as the package, Dashboards.jl. At Plotly, we had been discussing a Julia version of Dash for some time, so we were intrigued to hear about this project in the spring and were impressed at how far Alexandr had come in just a few months. Together with some of the world’s leading Julia experts at Julia Computing, Plotly partnered with Alexandr to turn Dashboards.jl into Dash.jl, the official Plotly-supported Julia version of Dash.

Julia users are at the forefront of high-performance computing, from basic research to financial modeling, from pharmaceuticals to energy to aerospace. Julia’s combination of clear and expressive syntax and its relentless focus on performance and scalability make it an ideal platform for our era of exponential growth in data volume. We’re thrilled to be able to offer the same flexible, interactive Dash experience that Python and R users know and love to this new community. If you’re a Julia user looking to take your data exploration to the next level, head on over to our docs, install Dash, and start creating!

pkg> add Dash DashCoreComponents DashHTMLComponents DashTable

Let’s make a Dash for Julia app!

In less than a day, he learned the basics of Dash and created the minimum viable dashboard. Perhaps more importantly, the reactive structure of Dash combined with Julia’s efficient and expressive syntax allowed for easy continued iteration and improvement. The final product is hosted as a highly limited (free tier) Heroku app. It has been running without intervention for the past five months, automatically downloading the new data on-demand and seamlessly handling the ever-growing dataset (now approaching a million rows).

In the open-source repo, you can see how the combination of Julia’s powerful syntaxes and data handling libraries interface with Dash’s reactive structure. We first download the data and join it against the 2019 US Census estimates, storing the resulting DataFrame as df:

df = download_add_preprocess("data/pop2019.csv")

We can then use the very simple template-like pseudo-HTML syntax to define the structure and elements of our dashboard. For example, a key feature of the dashboard is dynamically populating the available counties for a given state. We can reproduce that small section of the website with the table:

Finally, a callback connects the options of the county’s dropdown to the currently selected state name, and we start the app locally:

The complete application is of course more complicated than those 12 lines of code, but the basics are all the same: define a structure with interactive elements and then connect those elements together, linked by arbitrary Julia code. Some key Julia syntaxes like array comprehensions, named tuples, and terse anonymous functions make the developers’ experience smoother. All told, the final product looks something like this:

Take the sample Dash for Julia app for a spin or make your own app! Dash component authors can also easily add a single flag in the build command to include Julia support. Join the Dash Community of over 2M users and share what you make in our Show & Tell!

What about using Dash for Julia in your everyday workflow?

Learn more:

Plotly

Plotly’s Dash puts AI & ML in the hands of business users

Plotly

Plotly is a data visualization company that makes it easy to build, test, and deploy beautiful interactive web apps, charts and graphs—in any programming language.

plotly

Written by

plotly

The leading front-end for ML & data science models in Python, R, and Julia.

Plotly

Plotly is a data visualization company that makes it easy to build, test, and deploy beautiful interactive web apps, charts and graphs—in any programming language.