Highlight

Combining Vaadin, ZeroRPC, and Electron for scientific UIs for Python codes

An example of a code being run from the provided User Interface (UI). The program loads a model from a file (either on the user’s desktop or from the web server) in the top left, parses it to find the variables in mid-left, then the user launches the job and gets back the results in the bottom left. In the top right is a list of output files for viewing or downloading.
An example of a code being run from the provided User Interface (UI). The program loads a model from a file (either on the user’s desktop or from the web server) in the top left, parses it to find the variables in mid-left, then the user launches the job and gets back the results in the bottom left. In the top right is a list of output files for viewing or downloading.

Achievement

CCreated a User Interface (UI), both web and desktop, for Python codes using Vaadin and Electron.

Significance and Impact

TThis work provides a template for the creation of UIs for scientific codes which can both be deployed to a server for accessibility over the web or downloaded as a desktop application.

Research Details

·         Established communication between a Java frontend server and Python backend server so Vaadin can execute Python commands.

·         Packaged both the Vaadin and ZeroRPC components into an Electron app to be run on desktops.

Overview

DDue to its simplicity, Python is a commonly used language for the development of scientific codes by domain scientists without a computer science background. As the need for mature User Interfaces (UIs) for these codes arises, a common problem faced by research software engineers is to create UI in a language better suited for web development than Python. This work has created a UI framework for use with a particular fusion code which can be easily reused for other Python codes. The UI itself is written in Vaadin, a Java framework that creates web UIs by creating a Javascript website. A ZeroRPC Python server is used for the backend. ZeroRPC is a framework for creating a server that allows inter-process communication to run Python functions. The code which is to be exposed to the UI is then wrapped in one of the ZeroRPC server’s functions, thus defining the communications protocol between the frontend and backend. Both halves can then be deployed so that the user can access the interface and run their jobs over the web via a browser. The second step is to provide a desktop version for offline use. This is achieved with Electron, a program that wraps server programs together with a simple web browser and launches them all together. The end product is an executable that launches the server along with a window displaying the contents of the page it is serving, making it function identically to a standard stand alone application. In our case, the electron app launches both Vaadin and ZeroRPC servers, then displays the web page created by Vaadin. This allows both web and desktop development to overlap almost entirely, as well as providing the user with an identical experience whether they are using the web or desktop versions.

Last Updated: January 15, 2021 - 11:22 am