PyScript and Pyodide Recipes
This site contains a number of code snippets and guideines for accomplishing specific tasks with PyScript and Pyodide.
What are Pyodide and PyScript?
Pyodide is a distribution of Python for Web Browsers and NodeJS. It takes the CPython interpreter, compiles it to Web Assembly (using Emscripten), adds some additional useful JavaScript APIs and Python APIs, and makes it all available via a CDN. Additionally, the Pyodide project provides over 100 packages with their C/Rust/Fortran extensions pre-compiled to run on WebAssembly; these are made available through an additional built-in tool called Micropip.
PyScript is an HTML-focused framework for utilizing WebAssembly-based Python runtimes in the browser. It adds additonal Python and HTML API's to ease integration of Python with web development. Currently, Pyodide interpreter is the only supported interpreter, though support for Micropython is in works.
What is a recipe?
A recipe is short snippet of code intended to do one simple thing. It is different from an example, which might be a fully-realized page accomplishing some holistic task; and a tutorial, which gives an in-depth explanation of the full usage of a specific piece of functionality or API.
Some recipes are followed by tutorials explaning how they work.