
PyScript framework has been launched to help developers run Python in HTML in the simplest way possible.
PyScript Framework
PyScript is a programming framework that is used to run Python inside HTML in the browser. PyScript was developed by Peter Wang, Philipp Rudiger, and Fabio Pliger. It was officially launched on April 30, 2022, at the Python US Conference (PyCon US 2022).
Pyscript uses py-script tag or src to execute python code on a web page. This solves the problem of having to use more than one framework, package, or extension to get your code to work.
It also comes with readily available UI components like containers, buttons, and text boxes.
The team from Anaconda cloud which developed PyScript says that in the future they will create support for rich UI and more tags.
How to use PyScript
To use PyScript for writing python code in HTML, you don’t need to install any application. Just add pyscript.css and pyscript.js code to your HTML <head> or download code from Github.
Once you have added the pyscript.css and physcript.js in your html head, then write your python code inside the opening and closing PyScript tags. That is <py-script>your</py-script> or include external python script using <py-script src=”/python_file.py”></py-script>.
NOTE: If you want to reduce payload, use pyscript.min.js
Learn more about PyScript.
PyScript website: pyscript.net
Leave a Reply