What now?

Smartphones and the mobile world have deeply affected the UI landscape for every platform. People want sleek and intuitive interfaces that evoke creativity, like what they’ve come to expect from Apple products, and to some extent Android. They don’t necessarily evaluate your application by its use of native widgets, in fact they now want things to look like what the web provides with CSS and HTML5.

Popular libraries and templating systems have evolved considerably over the years, effectively democratizing common metaphors for user interaction. Just look at Bootstrap and Foundation, or even Ionic and WordPress. These systems make it fairly easy to put together a good-looking website fairly quickly.

The web browsers themselves, as well as the JavaScript language, have also advanced to the point of providing speed and compatibility at a level that never existed before. Which in turn has led to single-page web applications that reconfigure themselves as if using native widgets instead of loading into separate individual webpages.

To top it all off, HTML5 and its SVG tag have ushered in advanced vector graphics support. Have you seen what d3js can do? Then there’s WebGL, another technology that now a number of game engines are targeting, allowing developers to produce performant 3D games within your browser.

Given all these advances, I find myself writing a bunch of JavaScript or HTML code in order to provide a front-end to my Python, and as much as I may like making pretty things, readability and maintainability suffer greatly with those languages.

At the same time, I seem to be repeating the same patterns in creating those interfaces, connecting them to my backend code and wiring up the eventing I need to have a functional web application. And of course, switching between languages and coding practices can really muck with your style (or prevent you from having a good one in the first place). So I ask:

Why not design a Python package for interacting with users based on all these technologies put together?

Would it be possible? I’m not talking about another web server like Django or Pyramid, in fact I think the very idea of Django and similar frameworks should go away. I find templates cumbersome, hard to read and non-pythonic.

I want to write Python code that spits out the HTML and JavaScript required for these interfaces and I still want to handle all the logic in Python. I don’t want to touch any other layers unless I need some specific tweaks to the widgets. I want to automatically use whatever relevant JS libraries I need like D3, DataTables, jQuery, etc. all from my Python code. I want it extensible such that new “widgets” are easily built on top of the base platform, and using them would be as simple as importing a module. I want it all with cross-browser support, and I want to be able to deliver it as a self-contained application.