packages = ["numpy", "matplotlib"]

Hello, World!

(You may need to wait a few seconds for PyScript to load for results to appear. Tested on Firefox and Chrome.)

After including the following in your HTML file:

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

You can now run Python in the browser, and display results directly on the page. For example:

<py-script>
print("Hello, world!")
</py-script>
from pyscript import display display("Hello, world!") import numpy as np import matplotlib.pyplot as plt from pyscript import display # Data generation x = np.linspace(0, 1, 100) y = x ** 2 # Plotting fig, ax = plt.subplots() ax.plot(x, y) ax.set_title("y = x²") ax.set_xlabel("x") ax.set_ylabel("y") # Explicit display call is required display(fig)

Check out the PyScript documentation for more details and examples.