Hello, World!
Let's start with the simplest possible: Hello, World!
Including PyScript
Let's start with the HTML. To use PuePy, we include PyScript from its CDN:
  <link rel="stylesheet" href="https://pyscript.net/releases/2025.2.2/core.css">
  <script type="module" src="https://pyscript.net/releases/2025.2.2/core.js"></script>
Then, we include our PyScript config file and also execute our hello_world.py file:
PyScript configuration
PyScript Configuration
The official PyScript documentation has more information on PyScript configuration.
The PyScript configuration must, at minimum, tell PyScript to use PuePy (usually as a package) and include Morphdom, which is a dependency of PuePy.
The Python Code
Let's take a look at our Python code which actually renders Hello, World.
First, we import Application, Page, and t from puepy:
To use PuePy, you must always create an Application instance, even if the application only has one page:
Next, we define a Page and use the t singleton to compose our DOM in the populate() method. Don't worry too much about the details for now; just know that this is how we define pages and components in PuePy:
Finally, we tell PuePy where to mount the application. This is where the application will be rendered in the DOM. The #app element was already defined in our HTML file.
And with that, the page is added to the application, and the application is mounted in the element with id app.
Watching for Errors
Use your browser's development console to watch for any errors.