Options for Building Python Web Apps
By: Gordon Fleetwood – ODSC data science team contributor
One of the ways that R’s ecosystem outperforms Python’s with regard to Data Science is the existence of Shiny. It is the premier platform for data-driven web apps in the field. Shiny is already mature and is evolving steadily as seen at the recent inaugural iteration of the Shiny Developers Conference. One speaker at the event was Joe Cheng, CTO of RStudio, the company behind Shiny. He will also be speaking at ODSC East at the end of May. In the Python sphere, there is no Shiny equivalent. Instead, users have to leverage other frameworks and integrate aspect of data analysis into them.
The most preferred option is to use one of Python’s web frameworks. Django and Flask are the most popular options. The latter is generally preferred due to its lightweight nature, modularity, and ease of use. On the other hand, Django requires a lot of boilerplate material to construct even simple apps, and the underlying components are not as customizable as with Flask.
Using established web frameworks is a consequence of Python’s origins as a general purpose language rather than one built for data analysis. As Python has become an entrenched part of Data Science, there have been attempts to construct a Python equivalent to Shiny. One of these is Adam Hajari’s spyre, built on top of the Python web framework cherrypy. The influence of Shiny is obvious in spyre’s structure, where the use of input and outputs ids to control the flow of objects from the backend to the front end was replicated. Mr. Hajari’s work has gained enough attention that he has spoken about it at conferences, but the library hasn’t been adopted by the Python community.
As the situation stands, all Python users have at the moment are shadows of what Shiny is capable of. When or if such a platform finally arrives, it will be another monumental step for Python in its use for Data Science.