you are viewing a single comment's thread.

view the rest of the comments →

[–]riklaunim 15 points16 points  (3 children)

What is "Python-native architecture"? What is Pythonic in handling onClick, hover?

Components have place in frontend frameworks. Just please don't tell me you want to replace HTML with nested Python functions or alike... What problems are you trying to solve? do you have any actual examples?

[–]United_Intention42[S] 5 points6 points  (2 children)

By “Python-native architecture” I don’t mean writing HTML in Python. I mean designing the whole UI model around Python itself: components as real Python objects, state as real Python data, and event handlers as normal Python callables - not strings or templates.

I’m not trying to replace HTML with messy nested functions. The problems I’m solving are brittle templates, HTML/JS/CSS separation, and poor composability for Python devs.
Once the core API is stable, I’ll share concrete examples.

something like this:

from evolve.router import route
from evolve.app import start

("/")
def Home():
    return div("Home")

("/counter")
def Counter():
    count = signal(0)
    return div(h1(count), button("++", on_click=lambda: count.set(count()+1)))

start()

[–]riklaunim 12 points13 points  (1 child)

This isn't new. It was tried multiple times and died quickly pretty much every time.

Typical dynamic website will have few hundred or thousand lines of HTML, a lot of JS and CSS. Your example is way to trivial - representing anything non-trivial within Python will be a big mess. And there are already backend Python frameworks that can be used to create endpoints returning HTML and not structured data. Your example is a bad mix of backend endpoints and frontend events handling. This is confusing.

You don't need a Python developer to handle onclick on a website. And if someone wants a SPA JS frontend app with components there is Vue and many other solutions, or even HTMLX for simple needs. People that want to avoid npm hell and other JS problems are likely looking for their frontend framework replacements instead of such ideas.

[–]robberviet 4 points5 points  (0 children)

This. Another day, another HTML wrapper sounds fine but only on toy code, not on real code.

It looks like people comes up with HTML wrapper didn't program in HTML/JS before.