PyScript vs Brython — What’s the Difference?

Kenton de Jong
5 min readJul 20, 2022

In the past few months PyScript has been the talk of the programmer town. PyScript allows developers to run Python in the browser — something primarily done via JavaScript. With the advent of Web Assembly, however, more and more programming languages are coming to the web.

But the concept of PyScript isn’t new. Brython is a similar library that runs Python in the browser, and it came out nearly 10 years ago.

But what’s the difference? Well, surprisingly, there’s a quite a few.

Getting Started with PyScript

To get started with PyScript, you’ll want to go to https://pyscript.net/, click on “Install”, and then have it laugh at you for trying install something.

Don’t make fun of me, PyScript. I’m learning.

Then you’ll get the scripts to add to your site:

<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>

Although typically you’d put CSS code in the header and JS code in the footer, you can put all this in the header thanks to the defer on the script tag.

--

--

Kenton de Jong

I am a web developer turned travel blogger that is forced to code to eat.