Live data from Hacker News

Rio: Web apps in pure Python

github.com

21–30 of 205 posts

Re: Rio: Web apps in pure Python

#21
post #5

Curious to know what you're using under the hood for the python! I've download the repo and a quick search with "pyodide" didn't return anything.

Is python actually executed in the browser or is there a cpython process running on the backend?

No, it needs a server to run. This can be a python process or nginx or anything that FastAPI supports, since this seems to be build on top of FastAPI

Re: Rio: Web apps in pure Python

#23
post #12

This kind "you don't need JavaScript, HTML and CSS" approach always fails flat. We already went down this route several times since the first dotcom wave and all the frameworks that tried to target the browser as if we don't need to know "JavaScript, HTML and CSS". Until we need to debug the application, or why it isn't rendering as it should. It is also why I am not a big fan of Blazor, even though I admire its engi…

I find these projects very interesting as ideas but never ever suitable for any serious purpose. Not even for my personal website or blog. As soon as you approach the boundary of what the project provides, you are completely on your own. Also, unlike "established" projects, they may stop being maintained at any point. That's the reality.

Re: Rio: Web apps in pure Python

#24
These frameworks are cute, and I understand the desire to avoid the modern SPA JavaScript build systems, but it always seems like so much more work than just writing HTML.

I swear, HTML/CSS + Flask + HTMX gets you so far these days. Then, you can throw in some AlpineJS for any inter-element interaction you need and build a responsive SPA without almost any JavaScript.

Re: Rio: Web apps in pure Python

#25
Another rather unconventional way to do this, though it can be powerful, is to combine GraalPython, JavaFX and jpro.one:

https://www.jpro.one

The primary advantage is that the built in set of components is pretty powerful (e.g. a real table view), everything runs server side, the Python can be JIT compiled, and from the user's POV it still feels like a web app (e.g. zoom is respected). You can "shell out" to Javascript if needed, you can use Java libraries. The JPro website is itself a JavaFX app running as a web app. Also there's a visual UI builder that's decent (and free).

Primary downside beyond just the obscurity of the stack (same problem as for Rio), is just that JPro is a commercial solution. But then you get commercial support and bug fixes in case you need something special or hit an obscure rendering case.

Re: Rio: Web apps in pure Python

#26
post #12

This kind "you don't need JavaScript, HTML and CSS" approach always fails flat. We already went down this route several times since the first dotcom wave and all the frameworks that tried to target the browser as if we don't need to know "JavaScript, HTML and CSS". Until we need to debug the application, or why it isn't rendering as it should. It is also why I am not a big fan of Blazor, even though I admire its engi…

Hey, Rio dev here. Love to see us on Hackernews Rio comes with its own set of debug tools, so I don't see debugging as a problem. Our components even explain their entire layouting flow, so I'd argue debugging Rio layout is much easer than CSS :P

For example, here's an excerpt of what the built-in dev-tools have to say about a button in one of my apps:

> The component was allocated a width of 104.0 by its parent MyRoot. Due to align_x being set, the Button only takes up the minimum amount of space necessary and is centered in the available space.

Re: Rio: Web apps in pure Python

#27

These frameworks are cute, and I understand the desire to avoid the modern SPA JavaScript build systems, but it always seems like so much more work than just writing HTML. I swear, HTML/CSS + Flask + HTMX gets you so far these days. Then, you can throw in some AlpineJS for any inter-element interaction you need and build a responsive SPA without almost any JavaScript.

Rio Dev here. I can see where you're coming from. Seeing an experience web-dev work can be mindblowingly fast. But there's two sides to each story - there's tons of developers that are experts in their own fields but that aren't familiar with web technologies. That's where frameworks like Rio, streamlit, reflex, etc. come in.

We've been getting a lot of reactions from people being surprised how quickly they can create Rio apps after just a few hours, when previously creating UIs was always a major roadblock for them. Seeing these reactions has been extremely rewarding.

Re: Rio: Web apps in pure Python

#29
Nice, I guess a more established framework for writing webapps in Python is Streamlit, which is pretty good - minimal syntax can create quite an advanced, "reactive", GUI. It's very quick to throw together functional / relatively complex stuff with. But it's also very opinionated, so all Streamlit apps tend to have a similar look. Also it's more aimed at ML demos, for a few, non-persistent users, rather than for large apps with persistant users, etc. Wonder how this compares.

Re: Rio: Web apps in pure Python

#30
post #22
post #4

Is it the run_in_window() method cross platform? Can you talk a bit more about the implementation?

afaict it uses https://github.com/r0x0r/pywebview under the hood (so yes, cross-platform)

Nailed it! We use pywebview. (Rio Dev here.)

Local apps run inside of a webview. Think of it like electron but for Python. Even though this _should_ be cross platform, we've unfortunately found a lot of subtle issues with pywebview. That's why we're still considering this to be experimental.

In my experience webview works great on Windows, but struggles on Linux. For examples Videos don't play reliably when using the GTK backend.

We're looking into other ways to run a browser - my favorite would be to just find one already installed and just start it without UI - but that's some way off.

Post reply on HN