Frequently Asked Questions
- Why all the effort? What problem are you trying to solve here?
- Since all events get sent to the server and get handled in Python, how high is the latency?
- How does Lona perform compared with React, Vue or Angular?
- Why has Lona no live-reload feature like aiohttp-devtools?
One of our biggest internal projects at work is a web based accounting system. If there is a bug that is not a technical, but an accounting issue, i can't do anything about it (i have no clue about accounting). If the bug touches multiple layers of the software (backend and frontend) our application developers are sometimes busy for days. Thats slows down development and that's expensive.
With Lona, and the Lona widgets i created for the accounting system, i can give them a very simple, abstract and pythonic API for common tasks like "show a table and then update it", "show a progressbar with an abort button" or "show a popup with 3 buttons". The code is more readable for everyone involved, and the application developers can solve most of their problems on their own now.
Lona may have some performance disadvantages over React for example, but CPU-time is cheap these days, developer-time is expensive!
fscherf: Because all state has to go through network back an forth there is some latency. But you would have this kind of latency anyway, when you have to access server state, what most applications do at some point. In the kind of projects I work on, all interesting state is on the server, and it makes more sense to make decisions, like if a button is clickable or not, there.
I have no real latency measurements but this was never a problem. If your application has very sensitive timing constrains Lona will be the wrong tool. For "normal" interaction, the latency is not noticeable.
fscherf: Lona is not meant to compete with React, Vue or Angular or to be used by a startup to create the next Amazon or Netflix. Lona is meant for projects where previously the alternative was to have no web interface at all.
A coworker of mine created a small python script that generates qr-codes for a small label printer. He is from the hardware team, so there is no way he would bother to create a web interface using React or something else, but with Lona he had to add ~20 lines of extra Python code.
Web is a very powerful tool for visualization and interaction. Python is a powerful tool for an unlimited range of tasks. Lona tries to bridge this gap and is designed to be very accessible and good for rapid prototyping.
fscherf: Early versions of Lona had such a feature, but it got removed due bad user experience: Reloading your view helps when the view is fully self contained, but when it uses widgets or helper functions from another module, things become inconsistent.
To make that a reliable feature you would have to maintain a list of all loaded files and directories and track changes, file removes and addition of new files. And you would have to maintain this list between restarts, to not miss events, if files get changed fast after each other, like in a git rebase.
Also people use different editors that save files at different times and sometimes multiple times and/or periodically.
It's hard to get this right, therefore I focused on making the server fast to restart and easier to maintain.