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 software
Home›Browser software›Programming languages: Want to run Python code in a browser? Soon you may be able to

Programming languages: Want to run Python code in a browser? Soon you may be able to

By Ronnie A. Huntsman
May 12, 2022
0
0

Python may be the most popular programming language in the world, but unlike other JavaScript precursors, you cannot run Python code in the browser.

At PyCon 2022, its community’s annual conference of “Pythonistas” — and the first in-person meeting for Python contributors since 2019 due to the pandemic — developers revisited the idea of ​​running Python code in the browser. .

In the browser, Python did not support compiling to the WebAssembly (Wasm) runtime, a widely supported IC3 web application standard that compiles code written in Rust, C, C++, and Go into a binary format , which allows web applications to do more. as a desktop app outside of the browser.

But at PyCon 2022, CPython developer Christian Heimes and fellow contributor Ethan Smith detailed how they enabled the main branch of CPython to compile to WebAssembly. CPython, short for Core Python, is the reference implementation from which other Python distributions are derived.

SEE: Rocky Linux developer lands $26 million in funding for company’s open source push

CPython now cross-compiles to Wasm using Emscripten, a toolchain that compiles projects written in C or C++ to Node.js or Wasm runtimes.

The Python Software Foundation highlighted the work in a blog post: “Python can be run on many platforms: Linux, Windows, Apple Macs, PCs, and even Android devices. But it’s a fact. well known that, if you want code to run in a browser, Python just isn’t good – you’ll just have to turn to JavaScript,” he notes. “Now, however, that may be about to change.”

While the Foundation notes that cross-compilation with WebAssembly is still “highly experimental” due to missing modules in the Python standard library, nevertheless, PyCon 2022 demonstrated the community’s growing interest in making Python a better language for the Navigator.

Some members of the Python community have wondered if Python has been pushed too far into data science, which could compromise its usefulness as a general-purpose programming language. Other than the browser, Python’s other weak point is that running on mobile devices, or indeed any application – even on a desktop – requires a graphical user interface.

But even in the field of data science, there is a desire to make Python more browser-friendly. Peter Wang, co-founder and CEO of Anaconda, the creator of the popular Anaconda Python distribution for data science, previously told ZDNet that it is “incredibly inconvenient to use Python to build and distribute applications with ‘real graphical user interfaces’.

Wang’s company showed off a new tool they’ve been working on to bring Python for data science to the browser.

Wang announced PyScript at PyCon 2022, describing it as “a system for interweaving Python into HTML (like PHP)”. It allows developers to write and run Python code in HTML and call JavaScript libraries in PyScript. This system makes it possible to write a website entirely in Python.

PyScript is built on top of Pyodide, a port of CPython, or a Python distribution for the browser and Node.js which is based on WebAssembly and Emscripten.

Pyodide is an interesting development for Python. It was part of the now-discontinued Mozilla Iodide project created in 2018 by Michael Droettboom. As of 2021, Pyiodide lives on as an independent open source project. It is aimed at data science users, allowing statistical and visual modeling work to be done in-browser using key Python data science libraries such as Numpy, Pandas, and Matplotlib.

“Pyodide allows Python packages to be installed and run in the browser with micropip. Any pure Python package with a wheel available on PyPI is supported,” says the Pyodide project. Essentially, it compiles Python code and scientific libraries to WebAssembly using Emscripten.

TO SEE: Software development is changing again. These are the skills sought by companies

The Pyodide project released version 0.20 a month ago. It has been updated to Python 3.10, the latest major Python release, and brings speed improvements in Firefox and Chrome.

The Python Software Foundation noted, “PyScript is currently built on top of Pyodide, a third-party project bringing Python to the browser, on which work began before Heimes began work on the main branch of CPython. With changes Heimes made to Python 3.11, this effort will only become easier.”

At PyCon 2021, Python creator Guido van Rossum acknowledged that Python was great for back-end web development, but conceded the front-end to JavaScript. Why extend Python into areas well served by other languages ​​when Python can focus its strengths on data science?

“I don’t mind that so many different languages ​​must have different purposes. I mean, nobody asks Rust when you can write Rust in the browser; at least that wouldn’t seem like a kind of useful target for either Rust.Python should focus on application areas where it’s good and for the web which is the backend and for processing scientific data,” van Rossum said at the time.

Categories

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

Recent Posts

  • Best Browser-Based Image Editors of May 2022
  • DuckDuckGo Privacy Browser app does not block Microsoft trackers
  • Best Maps and Navigation Extension for Chrome Browser of 2022 May
  • Best Sports Extension for Chrome Browser of May 2022
  • DuckDuckGo’s supposedly private browser caught allowing ad tracking

Archives

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