OLV Basiliek Zwolle

Main Menu

  • Home
  • Browser list
  • Browser software
  • Browser types
  • Browser news

OLV Basiliek Zwolle

Header Banner

OLV Basiliek Zwolle

  • Home
  • Browser list
  • Browser software
  • Browser types
  • Browser news
Browser list
Home›Browser list›PyScript brings Python to the browser, easier than ever

PyScript brings Python to the browser, easier than ever

By Ronnie A. Huntsman
May 2, 2022
0
0

Anaconda, creator of the Python distribution for scientific computing, announced at PyCon US 2022 the PyScript project – an in-browser, single-inclusive way to run Python scripts in HTML pages as easily as JavaScript itself.

Traditionally, Python could only interact with JavaScript or a web page by running as an application server returning HTML and JavaScript. PyScript has no server component; everything runs directly in the browser.

Using PyScript, useful components from the Python and JavaScript worlds can be deployed side by side. In one example, the NYC taxi data demo, PyScript uses Pandas to analyze the data and then generates an interactive 3D view of the data using JavaScript’s WebGL.

pyscript IDG

A PyScript demo (real-time rendering of NYC taxi activity) that uses Pandas for numeric calculations and JavaScript visualization libraries to provide an interactive view of data.

PyScript uses a full port of the CPython runtime to WebAssembly to execute Python code inline. You place your Python code inside tags, and you can place its output in a

. A tag inserts a REPL block that lets you enter and run code, and a the tag works 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 that ship with Anaconda—NumPy, Pandas, Scikit-learn, and many others. Demos from the PyScript repository show different ways of doing this.

Although PyScript is still in its infancy, it already offers the ability for Python and JavaScript to interact, for Python to reference the DOM, for example, or for JavaScript objects to address Python objects. PyScript also allows in-browser equivalents for many behaviors needed in a Python distribution, such as listing package requirements for a script.

Earlier projects in this vein, like Pyodide (which PyScript uses as the basis for its own work), lacked PyScript’s seamless integration between JavaScript and Python, and its broad package access. PyScript has access to all the packages available through PyPI, with the commonly used Pandas and NumPy already available.

However, third-party packages work best if they are pure Python. PyScript does not yet have a mechanism to automatically create platform binaries for packages, although this is theoretically possible. Another hurdle is the time and bandwidth needed to download and configure all the necessary components for a given PyScript-enabled web page. The main Python runtime is about 3.4 MB of WebAssembly, although it is cached after the first load.

The goal of Anaconda for PyScript, as described in a community forum post, is to make it a 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.

Copyright © 2022 IDG Communications, Inc.

Categories

  • Browser list
  • Browser news
  • Browser software
  • Browser types

Recent Posts

  • Secret Mode: Huawei Browser vs. Samsung Internet
  • Beagle Button: Could this browser extension help you save money?
  • 7 must-see space websites that will change your perception of the cosmos
  • Browser Games Market Size Research Reports and Industry Analysis | Alien Hominid, Bejeweled, Meat Boy – Indian Defense News
  • Attackers can use “Scroll to Text Fragment” web browser feature to steal data – research

Archives

  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • Privacy Policy
  • Terms and Conditions