One of the promises WebAssembly makes is to allow us to use any language we choose to develop for the web, though this remains a distant goal. The philosophy behind Brython, at least as far as Python 3 is concerned, is why wait?
Plenty of live code examples and a gallery of mini-applications demonstrate how it all works. It’s even possible to use Brython to write a native Android app in Python. Async functionality is available, although you have to use Brython’s
async module instead of Python’s
Most of Python’s common keywords and behaviors are supported, including
Note that the Jiphy project hasn’t been updated since mid-2020. Jiphy should be considered strictly experimental until work on it resumes.
$ special symbol used by jQuery works as-is in RapydScript, and arrays can support both the
.append (Python) methods. However, the project has not been updated since May 2021, so it should be considered experimental.
Like Brython, which uses some of the same underlying technology, PyScript allows Python to run directly in the browser. PyScript uses the Pyodide project, a Python runtime ported to WebAssembly, to make the browser a more hospitable environment for running Python as a web scripting language.
print() command can be used to write output directly into a web page, in much the same way one would print output to the console.
PyScript also provides ways to work with packages available on the PyPI package index, although not all of them may behave as intended. For instance, PyScript doesn’t yet work with the
fetch method to accomplish the same tasks.
One of Transcrypt’s biggest advantages is automatic access to the Document Object Model. If you try to access
document.getElementById in Python, for instance, the converted code will use the
Copyright © 2023 IDG Communications, Inc.