It is no exaggeration to regard this as the most fundamental idea in programming:
The evaluator, which determines the meaning of expressions in a
programming language, is just another program.
To appreciate this point is to change our images of ourselves as programmers. We come to see ourselves as designers of languages, rather than only users of languages designed by others.
-- Structure and Interpretation of Computer Programs, Chapter 4.
By developing web apps entirely in Python, Python serves as a metalanguage generating the target languages of CSS/HTML/JS.
If you think about it, we already use tools like lxml to generate XML. So similarly, we are seeking other tools for HTML/JS/CSS.
This greatly simplifies and abstracts web application development. Prior to the web, graphical applications were largely developed in just a single language. Text applications are still this way. Web application has gone through some phases, that I have discussed elsewhere:
- server side includes
- CGI scripts
- Java applets
- client-server partial page reloaded apps developed with a back-end and front-end
Even though stage 4 is where we are, stage 3 was a more unified approach to GUI development, very similar to the way X-windows and C/TCL/Smalltalk were used to develop GUI apps prior to the web.
The problem we have exists because the web was never really meant for applications: it was designed to make information browsable for anyone. Applications were something you downloaded and installed on your personal machine. But before we knew it, people were adding more and more functionality to websites by sticking in a little JQuery here or some PHP there. And before we knew it, the line between website and web application became blurry.
While data storage technologies have changed fairly slowly, the best way to develop in Javascript and even CSS changes quite a bit as you can see.
The need for robust software development was left behind in a frenzy of creating a soup of technologies. But some people saw the pitfall and started working on alternative solutions. In Java, we saw zk and Vaadin. In Scala, we saw mind-blowing live coding in ScalaJS and in Smalltalk we saw Seaside.
But most impressively we saw UrWeb - a metalanguage inspired by ML that generated typesafe back-end and front-end code, thereby preventing all the things that adhoc-tossed-salad modern web development suffers from:
- code-injection attacks
- invalid HTML
- Dead intra-application links
- mismatches between HTML forms, and the fields expected by their handlers
- client-side code that makes incorrect assumptions about the AJAX-style services that the remote web server provides
- invalid SQL queries
- improper marshaling or unmarshalling in communication with SQL databases or between browsers and web servers
- security
- ease of development
- learn one language instead of 3 or more rapidly changing languages
We call it "NOJS" web development because as Qooxdoo has shown, with Javascript, you can generate and manipulate CSS and HTML. So JS is the roots and everything else grows from there.
There are 3 main types of offerings in the Python space for allowing yourself to develop in Python but deliver modern dynamic full-featured web applications:
- Transpilers - these products are primarily concerned with literal translation of Python to JSS/CSS/HTML/Web assembly.
- Application suites - these products are designed to abstract away most or all of the concerns of deploying an industrial strength app.
- Builders are somewhere in between transpilers and application suites. In most cases a builder (or transpiler) is used with a conventional terminal-server webapp framework like Flask or Django. But there can be considerable pain in integrating builder output into a full-suite web application as users of Dash have unfortunately found out.
http://transcrypt.org/ is a Javascript generator that opts for integration with Javascript libraries instead of Python libraries. The book React to Python demonstrates how to use Transcrypt as the basis for full-blown applications.
https://github.com/atsepkov/RapydScript
https://github.com/kovidgoyal/rapydscript-ng
https://pyodide.org/en/stable/
Python with the scientific stack, compiled to WebAssembly.
Pyodide may be used in any context where you want to run Python inside a web browser.
Pyodide brings the Python 3.9 runtime to the browser via WebAssembly, along with the Python scientific stack including NumPy, Pandas, Matplotlib, SciPy, and scikit-learn. Over 75 packages are currently available. In addition it’s possible to install pure Python wheels from PyPi.
Pyodide provides transparent conversion of objects between Javascript and Python. When used inside a browser, Python has full access to the Web APIs.
https://pyodide.org/en/stable/project/about.html#communication
https://github.com/wasmerio/wasmer-python - A complete and mature WebAssembly runtime for Python.
http://anvil.works is an abstraction over all web development provided in a cloud web-based environment. It is a freemium product.
https://www.dashborg.net/ is unique. You could call it a more sane approach to the nightmare that Angular is. It allows one to create full applications but using a "live" version of HTML that dynamically self-populates using either Go or Python back-ends.
It is interesting, but it works backwards from the way I think: I would rather have a computer program generate HTML/JS/CSS rather than have my turing-complete language limited by HTML.
So I would say it would not interest me much in the same way that Angular does not - the less powerful language is orchestrating the use of a more powerful language.
Other past tools in this vein are OpenLaszlo.
Justpy has a callback based approach to input events.
Nagare was the first framework to eliminate HTML and programmatically create simple JS interactions.
It was inspired by the Seaside framework for smalltalk.
It is based on component-based OO instead of inheritance.
It is not designed to leverage all the power in Javascript to create reactive, highly interactive apps.
That being said, if your desire is object-oriented HTML production interfaced to an object-relational store on the back (SQLAlchemy), it is very Zen for this purpose.
https://www.reahl.org/ is an object-oriented widget approach to eliminating the need to focus on JS/HTML.
https://dash.plotly.com/ is built on top of flask and with some effort you can build complete web applications based on Flask.
The default authentication is based on either bare bones Basic Auth or Dash Enterprise.
Dash has a large following and is a product of Plotly, a commercial company that offers an enterprise version of Dash.
https://link.medium.com/GtsQEdqt7eb
https://github.com/fscherf/lona supports usage of Django models and the Django auth system.
To account for big HTML trees written in python, Lona supports widgets to encapsulate smaller trees an their functionalities. That makes components reusable.
Lona has an async approach which allows one to write whole views in one function and one context. The author feels it leads to much cleaner code.
According to the author Lona is based on aiohttp and uses asyncio internally. The Lona API is completely synchronous to make development easier. In contrast, with asyncio its possible to block the core event loop of the entire service without even noticing it. therefore Lona defines an API that feels like asyncio but can be integrated with blocking code seamlessly.
https://www.reddit.com/r/Python/comments/p109o0/lona_a_web_framework_for_responsive_web_apps_in/
Epyk is compatible with
most common Web Python Frameworks (i.e., Flask and Django). By default, the server
package embeds a Flask app as it is easier to install and ready to use.
It has good documentation and a nice gallery of working programs.
https://pywebio.readthedocs.io/en/latest/ is a builder with documented integration for Tornado, Flask, Django and aiohttp. It can also execute standalone. It is surprisingly procedural, yet offers decent support for nested rendering using functions instead of objects and methods.
Tokyo Olympics country's performance ranking
https://h2oai.github.io/wave/ is good at building realtime streaming dashboards. It has support for OpenID and Basic Auth but has no examples or express concern for integration with Flask or Django, even though they feel it probably should work.
I installed Wave and played around with the tour. I had problems getting some of the examples to work on Windows. Even so, I find Wave to be very succinct and very powerful.
It is modular and dynamic. By modular, I mean, that building a website is as simple as populating Python data structures with objects. By dynamic, I mean I was impressed by the ability to edit a live website directly from the Python REPL. Just think: a live site could have updates from cron jobs.
I was a bit put-off by having to learn two different ways to use Wave: one for scripts and one for apps. To make things simple for myself, I would just always write apps. Also, the tutorial would do well to have 2 directories - one for scripts and one for apps instead of putting all Python examples in an apps directory.
I also did not like the way to model was initialized in the rendering method. I started a discussion about that.
https://github.com/codelv/enaml-web
https://github.com/dewball345/ryact
https://github.com/idom-team/idom is a work in progress.
https://streamlit.io/ is very powerful, but adding features that you expect in a full-blown web app is hard and hackish
https://www.reddit.com/r/Python/comments/lnu1r9/i_made_a_covid19_immunityvaccination_tracker_and/
https://github.com/dddomodossola/remi offers a class-based approach to user interface generation. It operates using an internal webserver and has limited support for traditional authentication and authorization.
It primarily is good at building user interfaces for personal use.
https://www.anpylar.com/ has seen no updates since 2018.
Muntjac is an implementation of Vaadin for Python. Vaadin is an enterprise level Java web app framework with a large array of modern clean javascript widgets.
While Vaadin abstracted away Javascript through Java, Muntjac did the same for Python in an impressive way.
http://pyjs.org/ used to be called PyJamas but that name has been reserved for something altogether different now.
https://github.com/timothycrosley/WebBot is
a collection of
several tools that enables building Python web applications
the same way native ones are built.
As a result, the WebBot framework encourages reuse,
concise code, rapid development, and happy developers.
https://github.com/timothycrosley/jiphy is a nearly-defunct transpiler.
https://github.com/timothycrosley/thedom is for generating HTML and JS
https://github.com/BrainStormYourWayIn/sierra
Perry https://www.reddit.com/r/Python/comments/roaz0i/fancy_way_of_writing_websites_perry_library/
https://github.com/Knio/dominate
http://naga.re (JS processing limited to clicks)
https://pypi.org/project/simple-html/
https://analyticsindiamag.com/streamlit-vs-plotlydash-comparison-with-python-examples/