News for hackers. Stuff that matters.
Re:Introducing PyScript (summary of PyCon keynote) by abidlabs on Wednesday June 22, 2022 @10:27PM (#31844508)
An alternative, which doesn't require insane loading times, is to use any of the many great Python libraries that allow you to write web apps in Python, which get converted to JS web apps.

For example, I'm one of developers of Gradio [0], which lets you write your web app in Python, which gets rendered using Svelte-based components:

[0] https://www.gradio.dev

Re:Introducing PyScript (summary of PyCon keynote) by dragonwriter on Wednesday June 22, 2022 @11:27PM (#31844880)
> An alternative, which doesn't require insane loading times, is to use any of the many great Python libraries that allow you to write web apps in Python

Sure, there are lots of things that do that.

They don't let you build apps using the Python scientific stack that live entirely in the browser, because they tend to be transpilers plus implementations of a subset of the stdlib plus some browser-specific libraries, whereas PyScript bundles WASM-compiled versions of important Python ecosystem libraries.

They have different strengths.

Re:Introducing PyScript (summary of PyCon keynote) by juanci_to on Wednesday June 22, 2022 @10:31PM (#31844540)
That's interesting. I played with Svelte a couple of times and I like it.

But since it's kind of niche among the rest of JS frameworks, I'm wondering, what made you chose it over the alternatives?

Re:Introducing PyScript (summary of PyCon keynote) by abidlabs on Wednesday June 22, 2022 @10:41PM (#31844592)
We migrated from React to Svelte because of two reasons: (1) speed: Svelte does a lot of work during the compile-time, which led to much faster and more responsive web apps (2) developer learning curve: as we expanded our team, we found that front-end engineers found Svelte much more intuitive and faster to learn
Re:Introducing PyScript (summary of PyCon keynote) by rahimnathwani on Wednesday June 22, 2022 @10:43PM (#31844607)
The trade off is flexibility, right? I mean, with something like gradio, can you add e.g. an event listener to a specific DOM element?
Re:Introducing PyScript (summary of PyCon keynote) by abidlabs on Thursday June 23, 2022 @01:48AM (#31845579)
You can, if that that specific DOM element is a Gradio component (e.g. a button, image, textbox, etc). Here's a very simple example: https://github.com/gradio-app/gradio/blob/main/demo/blocks_h...