top | item 35140025

(no title)

vikinghckr | 3 years ago

I'm not exaggerating but this might just be the highest impact library I've seen. As a backend developer who has lots of great project ideas but bail at the thought of having to use JavaScript and HTML, this library is a godsend!

My only question is why it took so long for someone to implement it? And where are the equivalent libraries for Go, Rust and Java?

discuss

order

alanbernstein|3 years ago

Well, I haven't looked into this one deeply yet, so I'm not sure what the differences are exactly. But there are many existing, broadly similar, projects. I see this as a solution to "I want to make an interactive website, and I don't want to touch the JS ecosystem at all and/or I really prefer python-specific libraries". This is my position exactly, so I sort of keep track of what's available. From that perspective, this is in the same space as: web2py, pyjs, streamlit, brython, pyodide, pywebio, gleam. I'm sure there are others.

cutler|3 years ago

This is a futile pursuit simply because you are creating a layer of abstraction over JS using another dynamic language so there's no real gain other than syntactic sugar.

shrimpx|3 years ago

Bokeh, Dash, Gradio, Pglet, Idom, Anvil

ativzzz|3 years ago

So ruby has a JS transpiler - opal - https://opalrb.com/

I tried using it a little bit but the reality is if you need JS to make your app more interactable it's really worth it to just learn some JS. As soon as you need something complex the extra layer of abstraction just gets in the way and becomes more of a headache, and if you don't need anything complex then you don't need a fancy JS solution in the first place.

JS only becomes complex when you are trying to create an enterprise version of your app along with a build platform. You can always just sprinkle in <script> tags in your HTML for simple one liners without getting into the weeds.

DoesntMatter22|3 years ago

You are assuming people use Opal because they don't want to learn JS. In reality it's that JS is a very messy language compared to ruby.

You can be a lot more productive if you avoid JS entirely.

jrumbut|3 years ago

JS is complicated because the browser environment is complicated.

If it's going to be rendered by and live in a web browser it will either be complicated or limited in some way (like low code/no code tools).

nu11ptr|3 years ago

> And where are the equivalent libraries for Go, Rust and Java?

Not aware of anything yet for Go/Rust, but Java and Python have had libs like this for a while now (to the point that Pyjamas hasn't been updated in a decade):

* GWT (Java)

* Pyjamas (Python)

* Vaadin (Java)

Those are general purpose. After that you have the sci/data-oriented python frameworks like dash, streamlit, etc.

RonnieOwnsLexus|3 years ago

actually, as per the docs the framework is converting python code to Javascript. So you would need to JS skills to debug.

Most of the problems in web front have been solved in JS (think CSS styles, state management) re-writting it in python would be pain, especially when everything compiles to js

picklelo|3 years ago

Our goal is for the user to never have to see JS. We try to catch most errors in Python during compile time. We're also not trying to reinvent things like CSS styles, just make them accessible in Python.

aatd86|3 years ago

State management hasn't really been solved.

Hence the whole debate about signals vs no signals last week. :)

riceart|3 years ago

> My only question is why it took so long for someone to implement it?

Uhhhh. Because it didn’t. Google GWT was huge on the hype cycle about 15 years ago.

You know this has been done before over a decade ago, multiple times in Java and Python.

Not saying the space can’t be improved upon but I fail to see how it’s any more revolutionary now.

jeremycarter|3 years ago

I have seen a .NET project that did something similar to this, it was called Bridge. That was 8 years ago no sure if it's still available.

troymc|3 years ago

These days, in the .NET ecosystem, there is Blazor. You write your whole web app in HTML, CSS and C# (frontend and backend). There are several different deployment models; Wikipedia gives a good summary:

https://en.wikipedia.org/wiki/Blazor

zx14|3 years ago

Serious question, why not Typescript? Are you not aware of it or do you have other reasons?

psnehanshu|3 years ago

You may not realise this, but TS is just JS + Types.

killerstorm|3 years ago

Hmm? In 90s and 2000s most web frameworks did not rely on JS at all, they were completely server-side. I.e. the server renders a page. User clicks a button, browser collects data from a form and sends request to the server. The server updates its state and renders a new page. There are some downsides to that approach, but it can be pretty good if you just need to get some information and/or let user browse a data collection.

Compile-to-JS approach started to appear in mid 2000s.

abraxas|3 years ago

Java does have Vaadin but it's a mostly proprietary software. But it is very good and largely under appreciated.

agroot12|3 years ago

Maybe I am an optimist, but I'd say Vaadin is mostly Open Source (Apache License). You can build complete web applications with the open source version. Only some advanced components (e.g. an Excel-like grid, a WYSIWYG editor, Highcharts components) are proprietary and require a subscription for development, while the builds can be freely distributed.

naraga|3 years ago

.NET has Blazor, seen something similar in Rust. I believe there are tons of similar libs

dragonwriter|3 years ago

> My only question is why it took so long for someone to implement it?

This is by far the first front-end python implementation/framework. Skulpt, Brython, Anvil, PyFyre, PyScript, PyWebIO, and the list goes on…

hdhrufjdi|3 years ago

Nope, but something better, e.g. Leptos for Rust which enables you to write Rust code and RsX (JsX equivalent) that runs on the server until all WASM is loaded to run it in the browser

apetuskey|3 years ago

Thank you really appreciate that!