PyScript Logo

PyScript is an open source platform for Python in the browser.

Step 1: Add these two lines to the <head> of your HTML document:

<link rel="stylesheet" href="https://pyscript.net/releases/2026.1.1/core.css" />
<script type="module" src="https://pyscript.net/releases/2026.1.1/core.js"></script>

Step 2: Start PyScript with a <script> tag in the <body> of your HTML document:

<script type="py" config="./conf.json" src="./main.py"></script>

Step 3: Write Python and explore the pyscript namespace:

from pyscript import when, display


@when("click", "#my-button")
def handler():
    display("Button clicked!")

That's just the start of it!

What's next?

I'm a beginner...
Welcome! PyScript is designed to be friendly for beginner coders. Start with our beginning PyScript guide to create your first apps. Graduate to the user guide to grow your understanding.
I'm already technical...
The beginner docs describe a simple coding environment. Consult the user guide for comprehensive learning resources. The example applications demonstrate many of the features of PyScript. The API docs and FAQ contain the technical details.
I want support...

Join the conversation on our discord server, for realtime chat with core maintainers and fellow users of PyScript. Check out our YouTube channel, full of community calls and show-and-tells.

I want to contribute...

Welcome, friend! PyScript is an open source project, we expect participants to act in the spirit of our code of conduct and we have many ways in which you can contribute. Our developer guide explains how to set up a working development environment for PyScript.