Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Server side Blazor-like framework in Python?

1,512 views
Skip to first unread message

hchr...@online.no

unread,
Dec 15, 2019, 7:09:03 AM12/15/19
to
I've been doing a lot of development with server side Blazor on .NET recently, and I think it's a very interesting UI model (https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.1). What would it take to make something similar in Python? I guess a lot of relevant Python packages already exist.

SSB works by having a component/DOM model running on the server. The client web page sends events and receives DOM diffs over a SignalR/websocket comnection.

Chris Angelico

unread,
Dec 15, 2019, 7:15:13 AM12/15/19
to
On Sun, Dec 15, 2019 at 11:11 PM <hchr...@online.no> wrote:
>
> I've been doing a lot of development with server side Blazor on .NET recently, and I think it's a very interesting UI model (https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.1). What would it take to make something similar in Python? I guess a lot of relevant Python packages already exist.
>
> SSB works by having a component/DOM model running on the server. The client web page sends events and receives DOM diffs over a SignalR/websocket comnection.
>

I *much* prefer to have the front end in charge of the UI, and the
back end work as an API. Just send and receive JSON with useful
information in it, and let the front end figure out how it wants to
display that.

But hey, if you want to ship a DOM diff down the wire, go ahead. Just
don't ask me to use your tool. :)

ChrisA

hchr...@online.no

unread,
Dec 15, 2019, 7:57:11 AM12/15/19
to
There are several advantages with the server side approach.

* You can have everything in one codebase. No need to set up a separate build for client-side. (In particular, no npm ...) You can do everything in C#/Python.
* No need for a REST API.
* No need to duplicate your DTOs and whatever in another project in another language for the client app.
* Client code is very lightweight. Download is in no time, and the client code demands very little of the client.
* The development process is fast, easy and robust.

The main drawback is network lag. Server load looks to be a minor issue. Tests have shown that SSB performs quite well on a server with moderate specs. For LOB apps, there are few or no important drawbacks.

Blazor has gained a lot of attention in short time. For me it's the obvious choice for LOB web apps on .NET, possibly also for public apps. I just wish I could have something similar in Python as well.

Test Bot

unread,
Dec 15, 2019, 10:26:21 AM12/15/19
to
+1

Though the implementation might be good from an exercise perspective. But
there is a general philosophy in Software Engineering namely

Separation of Concern.

Python as a language is not concerned about the "Front-End" side of things
since it is not meant for that. Though i am a very devote Python
programmer, i would still prefer to limit Python to backend tasks and have
the Front End implemented in React.

On Sun, Dec 15, 2019 at 5:47 PM Chris Angelico <ros...@gmail.com> wrote:

> On Sun, Dec 15, 2019 at 11:11 PM <hchr...@online.no> wrote:
> >
> I *much* prefer to have the front end in charge of the UI, and the
> back end work as an API. Just send and receive JSON with useful
> information in it, and let the front end figure out how it wants to
> display that.
>
> But hey, if you want to ship a DOM diff down the wire, go ahead. Just
> don't ask me to use your tool. :)
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>

hchr...@online.no

unread,
Dec 15, 2019, 1:26:49 PM12/15/19
to
Separation of concerns is not a question about language, but how your code is organised. Python is a general-purpose language and isn't restricted to certain programming domains. The restrictions are purely practical, such as performance and the availability of the runtime on various platforms.

There are many Python frameworks that could qualify as front end tools, including various attempts at running Python on the JS runtime in browsers. The pyodide project which runs Python and native code on webassembly in the browser, frameworks for desktop applications and even command line interfaces are all front end.

hchr...@online.no

unread,
Dec 15, 2019, 1:46:51 PM12/15/19
to
Not to mention Flask and Django, both popular tools for making front ends, but the question wasn't about which personal opinions people have about this or that. I was wondering how one could make something similar to server side Blazor in Python. In particular, whether there are libraries that could be helpful. You would at least need some server side websocket code for managing connections and state, and preferably some templating system that could be translated to DOM elements mixed with data and event bindings the way the component model would need them. The component model itself should be possible to port from the Blazor source code.
0 new messages