Live data from Hacker News

Rio: Web apps in pure Python

github.com

81–90 of 205 posts

Re: Rio: Web apps in pure Python

#81

I'm excited to see more projects like Rio exploring the full-stack python web dev space. There are definitely categories of users for which the approach makes sense. --- For me personally -- and I'm guessing for a bunch of other HNers -- writing full-stack web apps strictly in python is a non-goal. I've settled on a comfortable (for me) stack for smaller projects that need python on the backend that combines: 1. Lite…

Where’s a good place to learn about the web components aspect? I’ve tried a few times (and the shoelace docs) but it doesn’t stick.

I may be the wrong person to answer, alas. I nearly entirely avoid the machinery of web components.

With the stack above, I typically write small classes that derive from HTMLElement and implement a couple key callbacks (usually, connectedCallback and disconnectedCallback). In those, I typically (a) initialize state by reading attributes from the DOM and (b) configure event handlers. Pretty simple.

That's... about it. I'm templating elsewhere, so I avoid using web component templates. And the less I think about the shadow DOM, the better.

For this, the MDN documentation on custom components is enough.

Re: Rio: Web apps in pure Python

#82

Earlier quoted context omitted.

I think my answer: I have no idea what multi-line lambdas are, probably explains why I find Reflex (or Rio/Streamlit, etc) amazing, haha For a person with zero front-end knowledge, it's a game changer.

In JavaScript you can do this: const f = (x, y) => { const z = x + y; const w = z * 2; return z - w + x; }; In Python, you cannot do this: f = ( lambda x, y: z = x + y; w = z * 2; return z - w + x; ) Instead, you need to pull it out into a def: def f(x, y): z = x + y; w = z * 2; return z - w + x; Sometimes, this is no big deal. But other times, it's damn annoying; the language forces you to lay out your code in a les…

Ah I see! Thanks for elaborating! :)

Re: Rio: Web apps in pure Python

#83
It's a bit sad that most of the comments here are negative. Most of them seem to be some variation of, "Nobody needs a tool like this, all you have to do is simply dedicate yourself to multiple years of writing corporate CRUD apps in both vanilla soul-crushing Javascript and web frameworks. You know, like I did."

So, I am the target audience of this. I have a LOT of experience writing tools and automation and that is where most of my Python knowledge comes from. I am not an expert Python programmer, but I am competent.

But sometimes, I have an idea for writing a web application that would greatly improve my day-to-day life in some way. I know exactly what I want it to do, I know exactly what I want it to look like. I have already designed the API in my head, and could probably write the bulk of the Flask code in under an hour. Maybe a couple of hours if you want tests. But what I DON'T have is the time to learn is the vagaries of HTML+CSS layout and internalize the Great Lessons of the last 20 years of JS development history.

I have consciously stayed away from (non-trivial) web development because the tooling and patterns change almost daily. But the old stuff is not replaced, it is simply bolted on top of. And you have to know the WHOLE stack in order to troubleshoot most any part of it. Waking up one morning and saying, "I know a fair amount about computers, I want to write a web application," is just about as fanciful as saying, "I know a fair amount about airplanes, I want to design a jet engine."

Rio devs, thank you for releasing this as open source. I look forward to checking it out. Even if it doesn't pan out for me, I appreciate that you took a crack at it.

Re: Rio: Web apps in pure Python

#84
post #83

It's a bit sad that most of the comments here are negative. Most of them seem to be some variation of, "Nobody needs a tool like this, all you have to do is simply dedicate yourself to multiple years of writing corporate CRUD apps in both vanilla soul-crushing Javascript and web frameworks. You know, like I did." So, I am the target audience of this. I have a LOT of experience writing tools and automation and that is…

Ok that's great. I guess I'm just skeptical you won't have to either A. Settle for premade layouts B. Learn some CSS like specification of custom styles. And that is where you get sucked into the rabbit hole

Re: Rio: Web apps in pure Python

#85
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…

Remember GWT? I sure do.

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: Web apps in pure Python

#87

I'm excited to see more projects like Rio exploring the full-stack python web dev space. There are definitely categories of users for which the approach makes sense. --- For me personally -- and I'm guessing for a bunch of other HNers -- writing full-stack web apps strictly in python is a non-goal. I've settled on a comfortable (for me) stack for smaller projects that need python on the backend that combines: 1. Lite…

> If I need a database, I'll grab SQLAlchemy. I wish there were a mature lightweight solution here; maybe Tortoise ORM will get there soon?

[Peewee ORM](https://docs.peewee-orm.com/)

Re: Rio: Web apps in pure Python

#89

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.

Flask + HTMX + AlpineJS always seem like so much more work than just writing JavaScript.
Post reply on HN