Article 6QB19 A First Look at PyScript: Python in the Web Browser

A First Look at PyScript: Python in the Web Browser

by
hubie
from SoylentNews on (#6QB19)

upstart writes:

A First Look at PyScript: Python in the Web Browser - Real Python:

PyScript is a brand-new framework that caused a lot of excitement when Peter Wang, the CEO and co-founder of Anaconda, Inc., revealed it during his keynote speech at PyCon US 2022. Although this project is just an experiment in an early phase of development, people on social media seem to have already fallen in love with it. This tutorial will get you up to speed with PyScript, while the official documentation is still in the making.

[...] One of the goals of PyScript is to make the Web a friendly place for anyone wanting to learn to code, including kids. The framework achieves that goal by not requiring any installation or configuration process beyond your existing text editor and a browser. A side effect is that PyScript simplifies sharing your work with others.

[...] In other words, PyScript allows you to use Python, with or without JavaScript, to build interactive websites that don't necessarily have to communicate with a server. The main benefit here is that you can leverage your existing knowledge of Python to enter the world of front-end development, lowering the entry barrier and making it more accessible. But there are many other benefits of using PyScript that you'll learn about later.

On a slightly more technical level, PyScript is a single-page application (SPA) written in TypeScript using the Svelte framework, styled with Tailwind CSS, and bundled with rollup.js. According to one of the comments in an early Git commit, the project was based on a template mentioned in a blog post by Sascha Aeppli, which combines those tools.

PyScript wouldn't be possible without building on top of a recent version of Pyodide-a CPython interpreter compiled with emscripten to WebAssembly, enabling Python to run in the browser. PyScript provides a thin abstraction layer over Pyodide by encapsulating the required boilerplate code, which you'd otherwise have to type yourself using JavaScript.

See also:
Pyscript.net
GitHub: pyscript/pyscript:
Try PyScript: https://pyscript.com
Examples: https://tinyurl.com/pyscript-examples
Community: https://discord.gg/HxvBtukrg2

Original Submission

Read more of this story at SoylentNews.

External Content
Source RSS or Atom Feed
Feed Location https://soylentnews.org/index.rss
Feed Title SoylentNews
Feed Link https://soylentnews.org/
Feed Copyright Copyright 2014, SoylentNews
Reply 0 comments