PyScript uses a full port of the CPython runtime to WebAssembly to run in-line Python code. You place your Python code inside
<py-script> tags, and you can place its output in a selected
<py-repl> tag inserts a REPL block that allows you to input and execute code, and a
<py-env> tag functions like the requirements.txt file in a repository to list needed packages.
The PyScript runtime also enables many common Python packages such as the scientific libraries bundled with Anaconda—NumPy, Pandas, Scikit-learn, and many more. Demos in the PyScript repository show various ways to do this.
However, third-party packages work best if they’re pure Python. PyScript has no mechanism yet for automatically building platform binaries for packages, although this is theoretically possible. Another obstacle is the time and bandwidth needed to download and set up all of the components needed for a given PyScript-enabled web page. The core Python runtime is about 3.4MB of WebAssembly, although it’s cached after the first load.
Anaconda’s goal for PyScript, as described in a community message board post, is to make it one possible solution to the long-standing problem of packaging and deploying Python applications. It has long been difficult to take a Python script, especially one with many dependencies, and bundle it up for someone else to use as-is without the Python runtime.