News for hackers. Stuff that matters.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by pjmlp on Tuesday September 17, 2024 @10:43AM (#41568093)
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 engineering effort.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by jtr1 on Tuesday September 17, 2024 @12:17PM (#41569267)
Frontend dev here. I think it’s important to remember that there’s not necessarily one use case to rule them all when it comes to the web. If this helps a smaller project that is Python-first get their work in front of a wider audience, is that a bad thing? I’m inclined to think it’s just fine to have lots of approaches available.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Sn3llius on Tuesday September 17, 2024 @11:02AM (#41568311)
Hey, Rio dev here. Love to see us on Hackernews <3

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-labs/rio: WebApps in pure Python. No JavaScript, HTML... by eigilsagafos on Tuesday September 17, 2024 @12:24PM (#41569363)
As developers/engineers we love to solve problems. Too many times though we mislabel "friction" as "problem" and then start trying to solve the friction based on our current skill set or viewpoint. So frontend devs feel friction working backend and vice versa leading to all sorts of efforts like this that mostly fail. Good luck though :)
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by animal_spirits on Tuesday September 17, 2024 @01:57PM (#41570643)
This kind of framework isn’t targeted towards frontend devs though. It is targeted towards backend devs who want to make frontends easier.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by testermelon on Tuesday September 17, 2024 @02:51PM (#41571238)
That's why they said "vice versa".
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by 8organicbits on Tuesday September 17, 2024 @11:08AM (#41568422)
It would be a lot easier if they didn't rename things. 'Text' becomes 'span' and 'justify' becomes 'text-align'. Unless there's more I'm missing, it looks like they've just added a layer of indirection.

    rio.Text(self.name, justify="left"),
Becomes:

   <span style="[...] text-align: left;">Dataset 1</span>
I'd prefer:

    rio.Span(self.name, text_align="left")
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by positus on Tuesday September 17, 2024 @11:38AM (#41568804)
Using the term "justify" is very common outside of web. It's been used for decades in print ("left justify / right justify / center justify"). This is indeed a web project though, so I hear what you're saying.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by simonw on Tuesday September 17, 2024 @11:46AM (#41568917)
The term "justify" is used in modern CSS too: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-con...

    justify-content: center;
    justify-content: start;
    justify-content: end;
    justify-content: flex-start;
    justify-content: flex-end;
    justify-content: left;
    justify-content: right;
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Sn3llius on Tuesday September 17, 2024 @11:12AM (#41568481)
We don't see ourselves as Python bindings for the web, but instead as a pythonic way to create apps. I understand that "span" has become a well known name amongst web developers, that's just not something most new developers understand.

Think of it like how Python has renamed a lot of things. What other languages call arrays, Python calls lists. HashTables are dicts, and so on. Python has faced a lot of resistance here from people that got used to the more technical names, but I think the popularity of the language speaks for itself. Easy to understand, meaningful names are a plus, not a downside :D

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by jonkoops on Tuesday September 17, 2024 @11:17AM (#41568548)
> that's just not something most new developers understand.

That is just false if you ask me. Eventually you reach the limits of the API defined by a framework and users will have to reach out to HTML and CSS. And now is there not only a level of indirection, but also all of the existing documentation from the Web Platform cannot be applied.

I think there is validity for having a Python based system (instead of JS) that runs on the client to render standard HTML and CSS, but this goes beyond that and will just become an immense scope creep.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by dumbo-octopus on Tuesday September 17, 2024 @11:50AM (#41568973)
What connection do you think span has to text? To me, span is just the grouping element that defaults to display: inline. This can be used for text, but it can be used for about a million other things too. To me this looks like a fast path to a lot of docs that say “We aren’t actually putting any text in this element, but for legacy reasons it’s called Text. Version N+1 will rename it to Inline”.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by bee_rider on Tuesday September 17, 2024 @12:29PM (#41569431)
Python lists aren’t arrays, right? They are the closest thing in Python to an array maybe, but they do a ton of stuff under the hood, like grow when needed.

Calling them arrays would be very confusing to everybody who expects a typical array: a pointer with some empty space after it.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Sn3llius on Tuesday September 17, 2024 @01:27PM (#41570244)
Most languages have arrays that grow automatically. I'd say C/C++ is the exception there.

When I said array, I specifically meant O(1) access, which is in contrast to linked lists, which the name "list" would seem to imply.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by pjmlp on Tuesday September 17, 2024 @01:40PM (#41570398)
C++ has them on the standard library, I would make a clear split with C in this regard.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Phrodo_00 on Tuesday September 17, 2024 @12:53PM (#41569764)
Yeah and no? Python Lists indeed don't make any sort of array-like guarantee, but they're implemented as a vector/autogrowing-array of python object references (but these objects are not guaranteed to be cache-local).

The implementation defines the underlying data structure as PyObject *ob_item

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Sn3llius on Tuesday September 17, 2024 @01:26PM (#41570223)
List access is O(1), which effectively makes them arrays :)
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Phrodo_00 on Tuesday September 17, 2024 @01:35PM (#41570344)
Maybe if you don't consider CPU architecture, but most would expect to be able to do loops over Arrays that don't incur in a lot of cache misses, and Python Lists don't do that, since they're actually arrays of pointers to heap memory.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by mixmastamyk on Tuesday September 17, 2024 @12:30PM (#41569451)
A list is not an array. Each item is a pointer to what could be any type. There’s an array module if that’s what is needed.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by magnio on Tuesday September 17, 2024 @11:46AM (#41568927)
Yeah, that's gonna be annoying when you want to read HTML & CSS documentation and translate it to Python. How do you differentiate text-align, justify-content, justify-items, and justify-self?
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by vanviegen on Wednesday September 18, 2024 @01:14AM (#41576032)
Their goal is for their target developers not to have to learn html and css. Text and justify make a lot more sense to those whose layouting experience is mostly based on MS Word then span and text_align do.

Also, let's not pretend that html/css is particularly well designed or easy too learn. It's the backwards compatible result of decades of experimentation, where the initial design did not even remotely consider building interactive apps with it.

Modern web app dev requires learning way to much (archaic) stuff, just to create something that ought to be simple. Rio at least seems to be trying hard to address that.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by rty32 on Tuesday September 17, 2024 @10:59AM (#41568270)
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-labs/rio: WebApps in pure Python. No JavaScript, HTML... by mattgreenrocks on Tuesday September 17, 2024 @10:53AM (#41568191)
Not sure I agree. What makes the presentation layer of HTML/JS/CSS so different from Win32 of yore, which had VB? VB enabled a LOT of bespoke monstrosities, but it let you do things quickly and easily. We need something like that for the web.

There will always be essential complexity in dealing with the client/server nature of web apps. But there's still a lot of incidental complexity that can be burned off.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by worewood on Tuesday September 17, 2024 @11:18AM (#41568561)
> What makes the presentation layer of HTML/JS/CSS so different from Win32 of yore, which had VB?

From my experience: besides both Win32 and VB being from the same entity (Microsoft), which helps a lot, what we had basically were VB bindings for the underlying Win32 library.

This Rio project seems more analogous to a library that tries to do an abstraction on top of Win32, like wxWidgets or Java's AWT. They work but the end results always seem a bit "off".

And unlike Win32, web technologies are moving targets and any assumptions one makes may be wrong some browser updates down the line... and there's where the nightmare comes

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by pjmlp on Tuesday September 17, 2024 @11:21AM (#41568593)
Because of the rendering features provided by HTML, CSS and JavaScript semantics.

That is why Flash became so loved by Web designers, allowing them to target a rendering surface, completely bypassing the browser.

Also why we are now having Flash's revenge with WebGL/WebGPU/WebAssembly.

However the "until you have to debug it" still applies, unless you ship the browser with the application, but that isn't something people usually do. /s

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by wiseowise on Tuesday September 17, 2024 @04:51PM (#41572597)
> We need something like that for the web.

It’s called HTML/CSS/JS.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by mattgreenrocks on Tuesday September 17, 2024 @06:31PM (#41573581)
They should be, but the default browser styling is terrible.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Sparkyte on Tuesday September 17, 2024 @11:25AM (#41568650)
At yes lets use a screwdriver to do something which a hammer was meant for and call it progress.

That is what I read when I read the title. People should think about what a language's purpose is before planning to interate a technological design around it. Python is very good for many things just not this...

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by skeledrew on Wednesday September 18, 2024 @02:14AM (#41576357)
What exactly makes Python (the language) not good for this? Keep in mind we now also have PyScript.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by dncornholio on Tuesday September 17, 2024 @10:52AM (#41568174)
It fails flat when you want to go beyond to scope of the framework. But for teaching programming or quick prototyping or some raspberry project, these are pretty great.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by j45 on Tuesday September 17, 2024 @11:35AM (#41568761)
Now, python having some experimentation like this is quite nice to see.

I agree with some of what you’re saying and it made me think of how common this is or not.

It appears this renders html using python syntax.

Just like any html avoidant libraries of JavaScript that need to be debugged.

React can have debugging too to output html.

Maybe less so but still the case for Rails for Ruby.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by zdragnar on Tuesday September 17, 2024 @11:28AM (#41568681)
Remember GWT? I sure do.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by pjmlp on Tuesday September 17, 2024 @11:44AM (#41568900)
Vaadin is still around.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by davidsgk on Tuesday September 17, 2024 @01:08PM (#41569970)
Going from GWT at my first internship to regular HTML/CSS/JavaScript at the next (before even TypeScript) was such a fresh experience.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by ashconnor on Tuesday September 17, 2024 @02:45PM (#41571175)
Apache Wicket
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Onawa on Tuesday September 17, 2024 @12:23PM (#41569347)
I would argue that it depends on your skill as a developer, the stacks that you're familiar with, etc. As an example I work with a lot of scientific developers who are familiar with python and R but don't know anything about the website needing to make a web application. They're also not trying to optimize for thousands of users or have the cleanest interface. Technologies like Dash, Bokeh, Stream lot, and Shiny for Python and R all help these types of people make a functional web application for a small set of users without having to go down the rabbit hole of web technologies.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by TrackerFF on Tuesday September 17, 2024 @12:29PM (#41569428)
Back when I started programming, building programs with GUI was a breeze. Whether it was using Delphi, VB and WinForms, later .NET, or whatever - it was so easy that even complete beginners could get the hang of it.

At least for me, there's some nostalgia involved. The longing of "simple" - at least for smaller apps / software. Being able to slap together some simple app in 15 minutes.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by afavour on Tuesday September 17, 2024 @12:54PM (#41569779)
IMO you either need to go all in or not at all. And by all in I mean your "web page" is nothing but a <canvas> tag and your non-web framework is handling basically everything. It's an unholy nightmare for many reasons but it would at least allow you to make a reliable self-contained system.

"We'll take your native constructs and jimmy them into some bastardized HTML" is almost always full of razor-sharp edge cases.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by Sn3llius on Tuesday September 17, 2024 @01:41PM (#41570429)
Agreed! And indeed we are still considering switching Rio to a Canvas + WebGL/WebGPU. The reason we've decided against it for now is accessibility, and weird edge cases such as Copy & Pasting.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by moritzwarhier on Tuesday September 17, 2024 @02:41PM (#41571129)
What about text rendering?

Apart from native a11y, hackability/"DX" and affordances like text selection, I feel that text rendering is a big moat of classic web technologies.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by bobbylarrybobby on Tuesday September 17, 2024 @01:48PM (#41570516)
How does a screen reader interact with one of these canvas pages?
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by afavour on Tuesday September 17, 2024 @03:32PM (#41571715)
That would be one of the entries in the "unholy nightmare" bullet list.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by moffkalast on Tuesday September 17, 2024 @01:36PM (#41570360)
Well that but with WebGPU just might work without turning your app into lagtown central, in a year or five when it's widely supported anyway.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by pjmlp on Tuesday September 17, 2024 @01:38PM (#41570388)
Welcome to what made Flash took off in first place.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by afavour on Tuesday September 17, 2024 @01:41PM (#41570428)
I'm old enough to remember making admins with Adobe Flex. I unironically kind of miss it.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by wiseowise on Tuesday September 17, 2024 @04:49PM (#41572578)
> And by all in I mean your "web page" is nothing but a <canvas> tag and your non-web framework is handling basically everything

What a huge step back for the web.

Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by explorigin on Tuesday September 17, 2024 @01:25PM (#41570217)
Streamlit seems to be doing ok.
Re:Rio-labs/rio: WebApps in pure Python. No JavaScript, HTML... by manojlds on Tuesday September 17, 2024 @02:21PM (#41570932)
With tailwind people aren't writing CSS anyway (technically)