Python web framework JustPy – interactive websites without JavaScript

Share
  • February 14, 2020

The very first public release of the high-level Python web framework JustPy has been published to GitHub. JustPy is object-oriented, component-based, and does not distinguish between front-end and back-end programming.

As the framework’s developer Eliezer Mintz describes, “All programming is done on the back-end allowing a simpler, more productive, and more Pythonic web development experience.” He further hopes that “JustPy will enable teaching web development in introductory Python courses by reducing the complexity of web development.”

SEE ALSO: CodinGame 2020 developer survey says Python is the most loved programming language

So, let’s see how to use JustPy and how it integrates with other Python tools.

First steps with JustPy

JustPy requires Python 3.6 or higher, and it is recommended to run the tutorial programs in a virtual environment so as not to affect the system-wide Python interpreter.

The documentation shows how to install JustPy and its dependencies, after creating a directory and creating and activating the virtual environment jp:

$ mkdir jptutorial
$ cd jptutorial
$ python3 -m venv jp
$ source jp/bin/activate
(jp) $ pip install justpy

On Windows, use jpScriptsactivate instead of source jp/bin/activate to active the virtual environment.

Then, in the jptutorial directory, you can create the file test.py (another file name may be chosen instead) that contains the following code:

import justpy as jp

def hello_world():
    wp = jp.WebPage()
    jp.Hello(a=wp)
    return wp

jp.justpy(hello_world)

Now, run the program by entering the command $ python3 test.py and go to http://127.0.0.1:8000 or http://localhost:8000/ in your browser – and you should see “Hello!”. When you click on it multiple times, the number of clicks should be displayed.

Support for Matplotlib, pandas and more

In JustPy, visualizations with the Python library Matplotlib and the JavaScript charting library Highcharts are supported. Additionally, JustPy has a pandas extension on board for creating interactive charts and grids.

SEE ALSO: New ML tool HiPlot offers interactive high-dimensional data visualization

For more details, see the official website, the GitHub repo, or follow JustPy on Twitter.

The post Python web framework JustPy – interactive websites without JavaScript appeared first on JAXenter.

Source : JAXenter