Live data from Hacker News

React, but in Python

github.com

51–60 of 179 posts

Re: React, but in Python

#51

If you're interested in this sort of thing, but want to code in Java, try Flavour: https://flavour.sourceforge.io/ Flavour is a fast, batteries-included, type-safe framework for making modern SPA web apps in Java (and other JVM languages). * Great Lighthouse scores? Check! * Real SPAs without sluggish network round trips? Check! * Modern path-based routing? Check! * Components (built-in and user-defined)? Check! * Ef…

None of these links seem to work? This site can’t be reachedCheck if there is a typo in frequal.com. DNS_PROBE_FINISHED_NXDOMAIN

Not sure if your parent commenter fixed, but FYI all links worked for me.

Re: React, but in Python

#52
post #23

Earlier quoted context omitted.

I haven't used htmx but it looks nothing like pyreact. htmx is about adding attributes to html, so again, you are still writing html.

Htmx is not only about adding attributes to HTML :) check how responses to requests are expected to contain full or partial HTML instead of, say, json.

yeah I get that, but the html that is returned from the server doesn't have to be generated with things like html.div(html.p('hello this is a p tag inside a div'))

you could still have your html in a template file and parse and return the contents of that.

Re: React, but in Python

#53

Does anyone have a list of full-stack Python frameworks for building interactive web apps? I feel like a new one comes out each week, and it would be nice to see them together to compare.

https://github.com/sfermigier/awesome-python-web-frameworks#...

(Not complete. Pull requests welcome.)

Re: React, but in Python

#54
post #51

Earlier quoted context omitted.

None of these links seem to work? This site can’t be reachedCheck if there is a typo in frequal.com. DNS_PROBE_FINISHED_NXDOMAIN

Not sure if your parent commenter fixed, but FYI all links worked for me.

Thanks hu3! No changes since posting, all links tested then and now, 100% working from here.

Re: React, but in Python

#55

Long ago, before jsx and react, before hack, Facebook had a fork of php called xhp, which allowed xml data within php. I'm not suggesting anybody should maintain a fork of python with xml support but a pre-processor could parse xython and generate standard python with trees of html.xx() calls. https://en.wikipedia.org/wiki/XHP

xhp was honestly pretty nice - it was something watching the rapid codemods transform the language.

There was also ComponentKit, which was used heavily in fbobjc: https://github.com/facebook/componentkit

Re: React, but in Python

#56
post #50

If you're interested in using React-style frontend programming in Python but want an experience / API closer to that of React, I recommend checkout out Reacton [1]. Similarly to this library, it gives you a `@component` decorator that allows you to create components out of functions. But it also: 1. Includes all existing React hooks (use_state, use_memo, etc) -- so you don't have to learn new patterns. I believe this…

Thanks for the shout out.

The follow up of that is Solara: "NextJS, but in Python" :)

https://github.com/widgetti/solara/

Re: React, but in Python

#57
post #39

I'm lost. React builds interactive UIs (web, mobile). After each interaction, the virtual DOM is programmatically recreated and reconciled to the actual DOM. But reactpy is running on a backend sever??? Is each interaction resulting in a server call? Can someone explain what is going on? EDIT: Ah, okay, thanks. Every re-render is a network call. If people complained about web UI performance before..... :)

In reality, an important and large class of apps will hit the backend on roughly every click anyway, and having full control over in-browser interactivity is kind of overkill for those apps. Business apps with tables, charts, and forms, for example. You click the nav to load a new page, you scroll down or click a button to load more data, you fill a form and click submit, all those things hit the server. For those ty…

What about conditional form elements, modal dialogs with static text, or collapsible menus?

I understand the benefits, then again if interacting with these elements requires calling the backend then the cost is quite high.

Re: React, but in Python

#58
post #44

Earlier quoted context omitted.

yes, from reading the docs, there's a websocket. Making a 'server call' on each interaction is also what web apps used to do before SPAs were a thing. And in many cases it's what SPAs do as well. Of course, it depends what counts as an 'interaction', but that's been the case since JavaScript existed.

> Making a 'server call' on each interaction is also what web apps used to do before SPAs were a thing. One of the reasons behind the popularity around webapps was that they would no longer need to make 'a server call' on each interaction. > And in many cases it's what SPAs do as well. I feel you're grossly misrepresenting what SPAs do. SPAs do calls to send and receive data, not to fetch server-side rendered content…

> One of the reasons behind the popularity around webapps was that they would no longer need to make 'a server call' on each interaction.

Ironically, many modern SPAs are significantly slower than the traditional apps they replaced. Try using Twitter's webapp on a non-premium phone, for example.

Sometimes it's regrettable that the webdev truck has no rear-view mirror.

Re: React, but in Python

#59

Long ago, before jsx and react, before hack, Facebook had a fork of php called xhp, which allowed xml data within php. I'm not suggesting anybody should maintain a fork of python with xml support but a pre-processor could parse xython and generate standard python with trees of html.xx() calls. https://en.wikipedia.org/wiki/XHP

And long before transpiling became cool, FB had https://en.m.wikipedia.org/wiki/HipHop_for_PHP

Re: React, but in Python

#60
post #39

I'm lost. React builds interactive UIs (web, mobile). After each interaction, the virtual DOM is programmatically recreated and reconciled to the actual DOM. But reactpy is running on a backend sever??? Is each interaction resulting in a server call? Can someone explain what is going on? EDIT: Ah, okay, thanks. Every re-render is a network call. If people complained about web UI performance before..... :)

In reality, an important and large class of apps will hit the backend on roughly every click anyway, and having full control over in-browser interactivity is kind of overkill for those apps. Business apps with tables, charts, and forms, for example. You click the nav to load a new page, you scroll down or click a button to load more data, you fill a form and click submit, all those things hit the server. For those ty…

For a certain class of things, this could work.

You'd have to conscious of this.

It's defiantly not a "write a usual React app, but in Python"...every dropdown, menu, modal, etc interaction interaction is a backend call.

Post reply on HN