What is the difference between Brython and PyScript?

258 views
Skip to first unread message

dgront

unread,
May 13, 2023, 5:09:44 PM5/13/23
to bry...@googlegroups.com
Dear all,

I've just came across PyScript:

Apparently it used pyodide under the hood. How does this technology compares to Brython? As far as I understand, it does not allow to go outside the
<py-script>
element that PyScript provides. In other words: what happens inside <py-script> must stay inside <py-script>; DOM manipulation is not possible. Am I right?

Best,
Dominik

Edward Elliott

unread,
May 14, 2023, 6:36:16 AM5/14/23
to bry...@googlegroups.com
Hi Dominik, interesting tool.  I think it came up in the mailing list last year.  Not a deep discussion, still very alpha stage.

The pyscript home page says this:
  • Python with JavaScript: Bi-directional communication between Python and Javascript objects and namespaces
If I remember, pyscript doesn't have a DOM interface because pyodide is implemented in Web Assembly, which lacks direct DOM access.  But you can manipulate the DOM via interaction with Javascript code running outside WASM.  It's a pain but seems to be the only option.



--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAKKq%3DUQ2NLMxAVO_QXGoEy33kRivOjbRh4gLT%3DfCBdUBfqwVjA%40mail.gmail.com.

Victor Norman

unread,
May 15, 2023, 9:40:21 AM5/15/23
to brython
No, pyscript can do DOM manipulation now.

Goffi

unread,
May 17, 2023, 8:03:32 AM5/17/23
to bry...@googlegroups.com
Hi Dominik,

I haven't tried myself, and PyScript is definitely interesting. But as far as I
know, either you use the full Python implementation and the blob to download
is huge, or you use the Micropython version which is really small, but then
you loose the full and recent versions Python compatibility.

Brython on the other hand target full Python compatibility, and the size of
the files to download can be reasonable.

In my personal use case (where I want to use some modules both in backend and
frontend), Brython seems the only choice. It's a good one in any case, I'm
really happy with it :)

Regards,
Goffi


Reply all
Reply to author
Forward
0 new messages