The PyScript project develops a platform for executing Python scripts in a web browser

The project PyScript, which allows you to integrate Python handlers into web pages and create interactive web applications in Python. Applications are given access to the DOM and an interface for bidirectional interaction with JavaScript objects. The web application development logic is preserved, and the differences come down to the possibility of using the Python language instead of JavaScrpt. The PyScript sources are distributed under the Apache 2.0 license.

Unlike the Brython project , which compiles Python code to JavaScript, PyScript uses Pyodide , a browser-side port of CPython compiled to WebAssembly, to execute Python code. Using Pyodide allows you to achieve full compatibility with Python 3 and use all the features of the language and library, including for scientific computing, such as numpy, pandas and scikit-learn. From the PyScript side, a layer is provided for integrating Python code with JavaScript, inserting code into web pages, importing modules, organizing I / O, and solving other related tasks. The project provides a set of widgets (buttons, text blocks, etc.) for creating a web interface in Python.

The PyScript project develops a platform for executing Python scripts in a web browser

Spotify donates 100,000 euros in open source awards

Using PyScript comes down to connecting the pyscript.js style pyscript.css , after which it becomes possible to integrate Python code placed inside the <py-script> tag into the pages, or connect files through the <py-script src=… tag. >. The project also provides a <py-repl> tag with an implementation of an interactive code execution framework (REPL). The “<py-env>” tag is used to define paths to local modules.

      <py-script> print('Hello World!') </py-script>
        - numpy
        - matplotlib
        - paths:
          - /
      <py-script src="./"></py-script>

Be the first to comment

Leave a Reply

Your email address will not be published.