#import "@local/template-web:0.0.1": *
#import "/lib.typ": webpage

#show: webpage.with(
  path: "/pycript.html",
  title: "TeTyTe",
  description: "Demonstrate how to use pyscript to run python in the browser",
  tags: ("test", "html/css", "typst", "python"),
  date: datetime(year: 1942, month: 4, day: 1),
  page-label: <pyscript-page>,
  preview-image: image(
    "/assets/platypus.png",
    alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
  ),
  header: [
    = Showcase Pyscript
    Show how to run Python in the browser
  ],
  // Pyscript:
  pyscript-data-list: (
    "remote-2026.3.1": pyscript-data(
      "https://pyscript.net/releases/2026.3.1/core.js",
      additionnal-head-tags: {
        html.elem("script", attrs: (src: "/mini-coi.js")) // TODO: use <mini-coi> somehow? probably not supported in 0.15
        html.elem("link", attrs: (rel: "stylesheet", href: "https://pyscript.net/releases/2026.3.1/core.css"))
      },
    )
  ),
  pyscript-version: "remote-2026.3.1",
)

```python-run
n = ""
while not n.isnumeric():
  n = input("enter a valid number: ")

for i in range(1, int(n) + 1):
  if i % 3 == 0 and i % 5 == 0:
    print("plopliplop")
  elif i % 3 == 0:
    print("plop")
  elif i % 5 == 0:
    print("plip")
  else:
    print(i)
```
```python-run
# /// script
# # requires-python = ">=3.11" # not supported yet
# dependencies = [
#   "rich",
# ]
#
# [tool.pyscript]
# repl = true
# [tool.pyscript.files]
# "https://peps.python.org/api/peps.json" = "./peps.json"
# ///

import json
from rich.pretty import pprint

with open("./peps.json") as fd:
    data = json.load(fd)
pprint([(k, v["title"]) for k, v in data.items()][:10])
# >>> print(data["723"]["title"])
# Inline script metadata
```

```python-run
# /// script
# # requires-python = ">=3.11" # not supported yet
# dependencies = [
#   "rich",
# ]
#
# [tool.pyscript]
# repl = true
# hide-meta = true
# [tool.pyscript.files]
# "https://peps.python.org/api/peps.json" = "./peps.json"
# ///
# setting tool.pyscript.hide-meta to true will hide the `/// script` section
import json
from rich.pretty import pprint

with open("./peps.json") as fd:
    data = json.load(fd)
pprint([(k, v["title"]) for k, v in data.items()][:10])
# >>> print(data["723"]["title"])
# Inline script metadata
```

```python-run
# /// script
# dependencies = [
#   "pygame-ce",
#   "./python-packages/isn_s_cube-0.1.0-py3-none-any.whl"
# ]
# [tool.pyscript]
# pygame = true
# ///
from isn_s_cube import wasm
await wasm()
```
