PyScript unveiled at PyCon US 2022
Tags: python, programming, news
Published: 2022-05-06 22:24:45

*This post is from Grokking Python, a free newsletter available on Substack from Educative, the world’s best learning platform for software developers. It’s where we’ll share our team’s best Python-related info and resources—stuff we think could really enhance your understanding.*

Hey Grokking Python readers!

Peter Wang, CEO of Anaconda, gave an exciting keynote speech at PyCon US 2022. He revealed PyScript, an ambitious project designed to make Python as accessible and portable as HTML or JavaScript. PyScript is currently in alpha, but the future looks bright for data scientists and developers who want to build websites in Python.

<blockquote class="twitter-tweet"><p lang="en" dir="ltr"><a href="https://twitter.com/hashtag/PyConUS2022?src=hash&amp;ref_src=twsrc%5Etfw">#PyConUS2022</a> <a href="https://twitter.com/pwang?ref_src=twsrc%5Etfw">@pwang</a> Keynote: Announcing Py-script!!!<br>It&#39;s Python! inside HTML!!! 🤯 <a href="https://t.co/paDsibNQtt">pic.twitter.com/paDsibNQtt</a></p>&mdash; Mariatta 🤦 (@mariatta) <a href="https://twitter.com/mariatta/status/1520432987359399936?ref_src=twsrc%5Etfw">April 30, 2022</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

## What is PyScript?

PyScript is a Pythonic alternative to Scratch, JSFiddle, and other programming frameworks. It's a 100% client-side JavaScript web framework for creating interactive Python apps directly in the browser.

### PyScript 

* Can interleave Python in HTML (like PHP)
* Full access to the Python Standard Library
* Can fully access the web page (DOM)
* Can call and be called by JavaScript libraries
* Is truly serverless
* Enables 'import d3'
* Requires ZERO installation
* Is performant (includes utilizing GPU)

During a live coding demonstration, Wang impressed the crowd by embedding an interactive Python data visualization of NYC taxicabs in an HTML file in mere minutes.

## Who is PyScript for?

If you've worked with Python, you may already know that trying to make desktop native applications with Python is frustrating, and making mobile native apps with Python is nearly impossible. This hurdle makes it difficult for Python developers to share their work with a broader audience. 

Wang described the Python interpreter as having an under-the-hood engine "like a Honda Civic with mounting bolts for a warp drive." While just about anyone can learn Python syntax quickly, there is a steep learning curve to familiarizing yourself with the rich ecosystem of libraries and frameworks that make Python great.
 
PyScript flattens that learning curve dramatically. 
Now, frontend web developers, Python developers, and data scientists will all be able to share models, dashboards, data visualizations, and more without learning additional infrastructure technology. 
How to learn Python in 5 easy steps (for beginners) is a great article to read on Educative if you'd like to brush up on those Python skills.

## How does PyScript work?

PyScript isn't a variation of the Python language. Instead, it combines multiple open source technologies to allow users to add logic and create sophisticated applications in the web browser. 
PyScript works by compiling CPython to WebAssembly (WASM) and Emscripten via [Pyodide](https://pyodide.org/en/stable/). WASM is a low-level assembly-like language released in 2017 that provided a way for developers to run code written in languages like C++ or Rust on the web at near-native speeds. 


![PyScript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ayrmhb8145sieb6ijt5.jpg)

## Try PyScript

You can try PyScript by checking out their [website](https://pyscript.net) or by visiting [GitHub](https://github.com/pyscript)! If you'd like to build a simple web app with PyScript, there’s a [quick guide](https://github.com/pyscript/pyscript/blob/main/GETTING-STARTED.md) to get started.

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Given the interest in PyScript and some of the common questions that are coming up, I figured I&#39;d share some of my slides which may answer some questions.<br><br>Also I highly recommend checking out our engineering blog post on it: <a href="https://t.co/I8i3BeTNJA">https://t.co/I8i3BeTNJA</a> <a href="https://t.co/JBtBfIQwso">pic.twitter.com/JBtBfIQwso</a></p>&mdash; Peter Wang (@pwang) <a href="https://twitter.com/pwang/status/1521137668003880961?ref_src=twsrc%5Etfw">May 2, 2022</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

## PyScript Demos

You can take a look at some of the demos that were presented at PyCon down below.

### Basic examples

* [Hello World!](https://pyscript.net/examples/hello_world.html)

* [Simple clock](https://pyscript.net/examples/simple_clock.html)

* [To-do list](https://pyscript.net/examples/todo.html)

### MIME Rendering

 * [Matplotlib](https://pyscript.net/examples/matplotlib.html)

* [Altair](https://pyscript.net/examples/altair.html)

* [Folium](https://pyscript.net/examples/folium.html)

### JavaScript Interaction

* [Simple d3 data visualization](https://pyscript.net/examples/d3.html)

* [Webgl Icosahedron](https://pyscript.net/examples/webgl/raycaster/index.html)

### Visualizations

* [NYC Taxicab Demo](https://pyscript.net/examples/panel_deckgl.html)

* [Fahrenheit to Celsius conversion](https://pyscript.net/examples/toga/freedom.html)

* [Fractals with NumPy and canvas](https://pyscript.net/examples/numpy_canvas_fractals.html)

## PyCon US 2023

If you're a passionate Pythonista and would like to stay in the loop about future Python events, stick around. We're all lifelong learners here at Educative, and we want everyone to have access to great learning experiences. 

The following PyCon US will be held in **Salt Lake City, Utah, from April 19th to April 27th, 2023**. We'll keep you posted when registration opens up, and we hope to see you there! 

*Happy learning!*
 
### Start a discussion
Will you be attending the next PyCon? Was this post helpful? Let us know in the comments below!