What is pyscript
pyscript was developed by a team from Anaconda, including Peter Wang, Fabio Pliger, and Philipp Rudiger, and as Peter mentioned in his talk, PyScript is "a system for interleaving Python with HTML (e.g. PHP). ." This means you can write and run Python code in HTML, call Javascript libraries in PyScript, and do all your web development in Python.
Most obviously, with PyScript, we can now write Python (and possibly other languages) in HTML and build web applications.PyScript makes the power of Python available to more front-end developers and creators.
contexts
Pyscript project itself is very small, KB level, referenced Pyodide project is relatively large, because it contains a variety of libraries wasm file, the default reference to the file on the cdn, the file on the cdn and the extranet, access will be interrupted resulting in the unavailability of the need to use the local Pyodide file used to use the
move
- Download the file for Pyodide, I downloaded version 0.21.2 from my side at:/pyodide/pyodide/releases Select the 177MB file pyodide-build-0.21..bz2 for version 0.21.2 and extract the file into the project, placing it in the same directory as the configuration file below.
- Add py-config configuration, either through HTML Append in, or through the tag directly write in, pay attention to indentation, if the indentation is not correct, it may be reported in the console YAML Exception error, pay attention to src directory should be consistent with the above decompression directory
<py-config> - autoclose_loader: true - runtimes: - src: "./pyodide/" name: pyodide-0.21.2 lang: python </py-config>
- At this point, you can see through the console that you are using the local pyodide-related files
To this article on the use of local Pyodide Pyscript configuration steps to this article, more related to the use of local Pyodide Pyscript configuration content please search for my previous articles or continue to browse the following related articles I hope you will support me in the future more!